X-Git-Url: http://cloudbase.mooo.com/gitweb/avrcpm.git/blobdiff_plain/a7b795ca288038b9b99c6afe5d15cf2ddd4dac3f..d8fa6a36ffba80be398c90641b3e7e7a79d56d43:/avr/dsk_ram.asm diff --git a/avr/dsk_ram.asm b/avr/dsk_ram.asm index 2edda4f..5c8c876 100644 --- a/avr/dsk_ram.asm +++ b/avr/dsk_ram.asm @@ -1,6 +1,6 @@ -; Various functions for the Interaction with the CPM Filesystem +; RAM disk driver ; -; Copyright (C) 2010 Frank Zoll +; Copyright (C) 2010 Leo C. ; ; This file is part of avrcpm. ; @@ -20,11 +20,158 @@ ; $Id$ ; -#ifndef RAMDSK_SUPPORT - #define RAMDSK_SUPPORT 0 +#ifndef RAMDISKCNT + #define RAMDISKCNT 0 #endif -#if RAMDSK_SUPPORT +#if RAMDISKCNT + +#if DRAM_8BIT + +; -------------- RAM disk (8-bit DRAM) -------------- + + .dseg +rdskbuf: + .byte 32 + + .cseg +; ---------------------------------------------- + +rdsk_adr: + ldi zl,0 + lds zh,seeksec + lds temp2,seektrk + lsr zh + ror zl ;Col 0..7 + + mov temp,temp2 + andi temp,0x0f + swap temp + or zh,temp ;Row 0..7 + + ldi yl,~((1< 12 * 128 = 1536 = 77µs + out PORTC,_255 ;1 +; sei + out PORTB,_255 ;1 + + ldi yl,low (rdskbuf) + ldi yh,high(rdskbuf) + ldi temp2,32 +rdsk_rdstl: + ld temp,y+ ;2 + mem_write_d x ;14 (?) + adiw x,1 ;2 --> 18 * 128 = 2304 = 115µs + dec temp2 + brne rdsk_rdstl + pop yl + pop yh + dec temp3 + brne rdsk_rdlo + ret + + +rdsk_write: + lds xl,dmaadr + lds xh,dmaadr+1 + rcall rdsk_adr + ldi temp3,4 + push yh + push yl +rdsk_wrlo: + ldi yl,low (rdskbuf) + ldi yh,high(rdskbuf) + ldi temp2,32 +rdsk_wrldl: + mem_read_s x + st y+,temp + adiw x,1 + dec temp2 + brne rdsk_wrldl + + pop yl + pop yh + push yh + push yl + ldi temp2,32 +; cli + out PORTB,yh + out PORTD,zh + out PORTC,_RAS0 + out PORTB,yl ;1 + ldi yl,low (rdskbuf) + ldi yh,high(rdskbuf) +rdsk_wrli: + out PORTD,zl + out PORTC,_CAS0 + ld temp,y+ + out PORTD,temp + out PORTC,_WE + out PORTC,_RAS0 + inc zl + dec temp2 + brne rdsk_wrli + + out PORTC,_255 +; sei + out PORTB,_255 + dec temp3 + brne rdsk_wrlo + pop yl + pop yh + ret + +#else /* 4-bit DRAM */ + ;-------------------------------------- Defines for RAMDISK Structures @@ -65,11 +212,12 @@ rdsk_adr: or xh,temp ;Row 0..7 ldiw z,rdskbuf - ldi temp3,128 + ldi temp3,128 DRAM_SETADDR xh, ~0,(1< 1 + printstring " " mov temp,xh rcall printhex printstring " " @@ -202,7 +350,11 @@ rdsk_add_partition: ret -#else + +#endif /* DRAM_8BIT */ + + +#else /* no ram disk */ rdsk_read: ret @@ -211,4 +363,5 @@ rdsk_write: rdsk_add_partition: ret -#endif +#endif /* RAMDISKCNT */ +