3 ; Copyright (C) 2010 Leo C.
5 ; This file is part of avrcpm.
7 ; avrcpm is free software: you can redistribute it and/or modify it
8 ; under the terms of the GNU General Public License as published by
9 ; the Free Software Foundation, either version 3 of the License, or
10 ; (at your option) any later version.
12 ; avrcpm is distributed in the hope that it will be useful,
13 ; but WITHOUT ANY WARRANTY; without even the implied warranty of
14 ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 ; GNU General Public License for more details.
17 ; You should have received a copy of the GNU General Public License
18 ; along with avrcpm. If not, see <http://www.gnu.org/licenses/>.
31 ; -------------- RAM disk (8-bit DRAM) --------------
38 ; ----------------------------------------------
52 ldi yl,~((1<<RAM_A10)|(1<<RAM_A9)|(1<<RAM_A8)) ;Col 8..10
71 ;----------------------------------------------
80 out PORTB,yh ; Row 8..10
81 out PORTD,zh ; Row 0..7
83 out PORTB,yl ;1 Col 8..10
91 out PORTD,zl ;1 Col 0..7
97 dram_wait DRAM_WAITSTATES ;
102 brne rdsk_rdli ;2 --> 12 * 128 = 1536 = 77µs
112 mem_write_d x ;14 (?)
113 adiw x,1 ;2 --> 18 * 128 = 2304 = 115µs
173 #else /* 4-bit DRAM */
176 ;-------------------------------------- Defines for RAMDISK Structures
178 ;----------------------------------------------- Start of Data Segment
182 rdskbuf: .byte 128 ; Buffer for RAM-Disk interaktions
184 ; ---------------------------------------------- Start of Code Segment
187 ; ====================================================================
188 ; Function: Calculate an sets the adress of Sector within the RAMDISK
189 ; ====================================================================
191 ; --------------------------------------------------------------------
193 ; Variables : [r] seeksec Sector to read
194 ; [r] seektrk Track to read
195 ; [w] temp3 Number of Bytes per Sector (128)
196 ; --------------------------------------------------------------------
198 ; ====================================================================
216 DRAM_SETADDR xh, ~0,(1<<ram_ras), ~0,(1<<ram_a8)|(1<<ram_oe)
230 ; ====================================================================
231 ; Function: Does a read opperation on a RAMDISK
232 ; ====================================================================
234 ; --------------------------------------------------------------------
236 ; Variables : [r] seeksec Sector to read
237 ; [r] seektrk Track to read
238 ; [r] flags RW operation Flags
239 ; [w] erflag Error Status of the operation
240 ; --------------------------------------------------------------------
242 ; ====================================================================
249 printstring "rd-adr: "
254 DRAM_SETADDR xl, ~(1<<ram_ras),0, ~((1<<ram_oe)), (1<<ram_a8)
258 dram_wait DRAM_WAITSTATES ;
265 dram_wait DRAM_WAITSTATES ;
266 in temp2,P_DQ-2 ; PIN
289 ; ====================================================================
290 ; Function: Does a write opperation on a RAMDISK
291 ; ====================================================================
293 ; --------------------------------------------------------------------
295 ; Variables : [r] seeksec Sector to read
296 ; [r] seektrk Track to read
297 ; [r] flags RW operation Flags
298 ; [w] erflag Error Status of the operation
299 ; --------------------------------------------------------------------
301 ; ====================================================================
306 printstring "wr-adr: "
319 ldi temp2,RAM_DQ_MASK | (1<<ram_w) | (1<<ram_cas)
325 andi temp,RAM_DQ_MASK & ~(1<<ram_w)
326 ori temp,(1<<ram_cas)
328 DRAM_SETADDR xl, ~(1<<ram_ras),0, ~((1<<ram_a8)),(1<<ram_oe)
333 andi temp2,RAM_DQ_MASK & ~(1<<ram_w)
334 ori temp2,(1<<ram_cas)
343 ldi temp,~RAM_DQ_MASK | (1<<ram_w) | (1<<ram_cas)
354 #endif /* DRAM_8BIT */
357 #else /* no ram disk */
366 #endif /* RAMDISKCNT */