X-Git-Url: http://cloudbase.mooo.com/gitweb/avrcpm.git/blobdiff_plain/24fb3c9d88450abc11093647829582c544ec08a2..411b34bd372992e583428ab5edea4d758b518e95:/z80.asm diff --git a/z80.asm b/z80.asm index 32b902f..efb91df 100755 --- a/z80.asm +++ b/z80.asm @@ -16,7 +16,7 @@ ; You should have received a copy of the GNU General Public License ; along with this program. If not, see . -.nolist +;.nolist #if defined atmega8 .include "m8def.inc" #elif defined atmega168 @@ -84,10 +84,14 @@ .equ ram_a5 = 5 .equ ram_a6 = 6 .equ ram_a7 = 7 -.equ P_OE = PORTD -.equ RAM_AH_MASK = 0xE0 ; ram_a[7..5] -.equ PD_OUTPUT_MASK = 0xFE +.equ P_OE = PORTD +.equ P_AH = PORTD +.equ P_A8 = PORTD +.equ P_MMC_CS = PORTD + ; ram_a[7..5] +.equ RAM_AH_MASK = (1< 0xFF + ;the first answer must be 0x01 (Idle-Mode) cpi temp,0 - breq mmcInitOcrLoopDone + breq mmcInitOcrLoopDone ;second answer is 0x00 (Idle-Mode leave) CMD1 is OK - sbi PORTD,mmc_cs - rcall mmcByteNoSend + sbi P_MMC_CS,mmc_cs ;disable /CS + +; rcall mmcByteNoSend ;unnecessary + + ldi temp,10 + rcall delay_ms pop temp2 dec temp2 cpi temp2,0 - brne mmcInitOcrLoop + brne mmcInitOcrLoop ;repeat - ldi temp,4 + ldi temp2,4 rjmp mmcWaitErr mmcInitOcrLoopDone: pop temp2 - sbi PORTD,mmc_cs + sbi P_MMC_CS,mmc_cs ;disable /CS rcall mmcByteNoSend ldi temp,0 @@ -1087,7 +1103,7 @@ mmcReadSect: ldi temp,0x50 out SPCR,temp - cbi PORTD,mmc_cs + cbi P_MMC_CS,mmc_cs rcall mmcByteNoSend ldi temp,0x51 ;cmd (read sector) rcall mmcByte @@ -1130,7 +1146,7 @@ mmcreadloop: rcall mmcByteNoSend rcall mmcByteNoSend - sbi PORTD,mmc_cs + sbi P_MMC_CS,mmc_cs rcall mmcByteNoSend ldi temp,0 @@ -1144,7 +1160,7 @@ mmcWriteSect: ldi temp,0x50 out SPCR,temp - cbi PORTD,mmc_cs + cbi P_MMC_CS,mmc_cs rcall mmcByteNoSend ldi temp,0x58 ;cmd (write sector) @@ -1197,7 +1213,7 @@ mmcwaitwritten: cpi temp,0xff brne mmcwaitwritten - sbi PORTD,mmc_cs + sbi P_MMC_CS,mmc_cs rcall mmcByteNoSend ldi temp,0 @@ -1426,46 +1442,10 @@ dram_write: ; ***************************** New DRAM routines **************************** -; Defines how the dram nibbles are arganized. -; RAMORG == 0 : A7 == 0: low nibble, A7 == 1: high nibble (Original Sprite_tm design) -; RAMORG == 1 : A8 == 0: low nibble, A8 == 1: high nibble (faster) -; -#define RAMORG 1 - -#if RAMORG == 0 -;Sends the address in zh:zl to the ram -dram_setaddr: - push temp - in temp,PORTB - andi temp,~RAM_AL_MASK - sbrc zl,0 - ori temp,(1<