diff --git a/.gitignore b/.gitignore index 5baf441..f450422 100644 --- a/.gitignore +++ b/.gitignore @@ -37,4 +37,8 @@ /CPLD/*.err /CPLD/xlnx_auto_0_xdb /CPLD/xst/work -/Updater/NEW +/driver/DRIVER.BIN +/driver/DRIVER.LST +/driver/SDMAPPER.ROM +/updater/SDMUPD.COM +/updater/SDMUPD.LST diff --git a/_build.cmd b/_build.cmd index 5d09ec8..9d102be 100644 --- a/_build.cmd +++ b/_build.cmd @@ -1,15 +1,15 @@ @echo off echo Building Driver -docker run --rm -it -v %cd%/driver:/src fbelavenuto/8bitcompilers sjasmplus --lst=driver.lst driver.asm +docker run --rm -it -v %cd%/driver:/src fbelavenuto/8bitcompilers N80 DRIVER.ASM DRIVER.BIN --listing-file DRIVER.LST IF ERRORLEVEL 1 GOTO error -echo Building Updater -docker run --rm -it -v %cd%/updater:/src fbelavenuto/8bitcompilers sjasmplus --lst=sdmupd.lst sdmupd.asm +echo Building ROM +docker run --rm -it -v %cd%:/src fbelavenuto/8bitcompilers mknexrom Nextor/Nextor-2.1.0-beta2.base.dat driver/SDMAPPER.ROM /d:driver/DRIVER.BIN /m:Nextor/Mapper.ASCII16.bin IF ERRORLEVEL 1 GOTO error -echo Building ROM -docker run --rm -it -v %cd%:/src fbelavenuto/8bitcompilers mknexrom Nextor/Nextor-2.1.0-beta2.base.dat driver/SDMAPPER.ROM /d:driver/driver.bin /m:Nextor/Mapper.ASCII16.bin +echo Building Updater +docker run --rm -it -v %cd%/updater:/src fbelavenuto/8bitcompilers N80 SDMUPD.ASM SDMUPD.COM --listing-file SDMUPD.LST IF ERRORLEVEL 1 GOTO error goto ok diff --git a/_build.sh b/_build.sh index ed45fb2..a038642 100755 --- a/_build.sh +++ b/_build.sh @@ -2,10 +2,10 @@ set -e echo Building Driver -docker run --rm -it -v $PWD/driver:/src fbelavenuto/8bitcompilers sjasmplus --lst=driver.lst driver.asm - -echo Building Updater -docker run --rm -it -v $PWD/updater:/src fbelavenuto/8bitcompilers sjasmplus --lst=sdmupd.lst sdmupd.asm +docker run --rm -it -v $PWD/driver:/src fbelavenuto/8bitcompilers N80 DRIVER.ASM DRIVER.BIN --listing-file DRIVER.LST echo Building ROM docker run --rm -it -v $PWD:/src fbelavenuto/8bitcompilers mknexrom Nextor/Nextor-2.1.0-beta2.base.dat driver/SDMAPPER.ROM /d:driver/driver.bin /m:Nextor/Mapper.ASCII16.bin + +echo Building Updater +docker run --rm -it -v $PWD/updater:/src fbelavenuto/8bitcompilers N80 SDMUPD.ASM SDMUPD.COM --listing-file SDMUPD.LST diff --git a/driver/SDMAPPER.ROM b/driver/SDMAPPER.ROM deleted file mode 100644 index 330db03..0000000 Binary files a/driver/SDMAPPER.ROM and /dev/null differ diff --git a/driver/SDMAPPER_patch_ciel2+.ROM b/driver/SDMAPPER_patch_ciel2+.ROM deleted file mode 100644 index 5f5cfed..0000000 Binary files a/driver/SDMAPPER_patch_ciel2+.ROM and /dev/null differ diff --git a/driver/driver.asm b/driver/driver.asm index b28db5a..6f1a508 100644 --- a/driver/driver.asm +++ b/driver/driver.asm @@ -1,3 +1,7 @@ + .CPU Z80 + TITLE Nextor driver for SD Mapper/Megaram v1.0.7 + .relab + ; Projeto MSX SD Mapper ; Copyright (c) 2014 Fabio Belavenuto @@ -29,10 +33,6 @@ ; 6001h : Mode configuration register (write only) ; b0 : 0=ROM mode, SPI interface disabled, 1=SPI interface enabled - - - output "driver.bin" - ;----------------------------------------------------------------------------- ; ; Driver configuration constants @@ -56,79 +56,77 @@ DEBUG equ 0 ;Set to 1 for debugging, 0 to normal operation VER_MAIN equ 1 VER_SEC equ 0 -VER_REV equ 6 +VER_REV equ 7 ;----------------------------------------------------------------------------- ; SPI addresses. Check the Technical info above for the bit contents -CHAVEIASPI = $6001 ; Mode config register -PORTCFG = $4800 ; Interface status and card select register -PORTSPI = $4000 ; SPI data port +CHAVEIASPI equ #6001 ; Mode config register +PORTCFG equ #4800 ; Interface status and card select register +PORTSPI equ #4000 ; SPI data port ; Comandos SPI: -CMD0 = 0 | $40 -CMD1 = 1 | $40 -CMD8 = 8 | $40 -CMD9 = 9 | $40 -CMD10 = 10 | $40 -CMD12 = 12 | $40 -CMD16 = 16 | $40 -CMD17 = 17 | $40 -CMD18 = 18 | $40 -CMD24 = 24 | $40 -CMD25 = 25 | $40 -CMD55 = 55 | $40 -CMD58 = 58 | $40 -ACMD23 = 23 | $40 -ACMD41 = 41 | $40 - -; Work area variables - STRUCT WRKAREA -BCSD ds 16 ; Card Specific Data -BCID1 ds 16 ; Card-ID of card1 -BCID2 ds 16 ; Card-ID of card2 -NUMSD db ; Currently selected card: 1 or 2 -CARDFLAGS db ; Flags that indicate card-change or card error -NUMBLOCKS db ; Number of blocks in multi-block operations -BLOCKS1 ds 3 ; 3 bytes. Size of card1, in blocks. -BLOCKS2 ds 3 ; 3 bytes. Size of card2, in blocks. -TEMP db ; Temporary data -TRLDIR ds 8 ; R800 data transfer helper - ENDS - +CMD0 equ 0 OR #40 +CMD1 equ 1 OR #40 +CMD8 equ 8 OR #40 +CMD9 equ 9 OR #40 +CMD10 equ 10 OR #40 +CMD12 equ 12 OR #40 +CMD16 equ 16 OR #40 +CMD17 equ 17 OR #40 +CMD18 equ 18 OR #40 +CMD24 equ 24 OR #40 +CMD25 equ 25 OR #40 +CMD55 equ 55 OR #40 +CMD58 equ 58 OR #40 +ACMD23 equ 23 OR #40 +ACMD41 equ 41 OR #40 + +; Work area variables +BCSD equ 0 ; Card Specific Data +BCID1 equ BCSD+16 ; Card-ID of card1 +BCID2 equ BCID1+16 ; Card-ID of card2 +NUMSD equ BCID2+16 ; Currently selected card: 1 or 2 +CARDFLAGS equ NUMSD+1 ; Flags that indicate card-change or card error +NUMBLOCKS equ CARDFLAGS+1 ; Number of blocks in multi-block operations +BLOCKS1 equ NUMBLOCKS+1 ; 3 bytes. Size of card1, in blocks. +BLOCKS2 equ BLOCKS1+3 ; 3 bytes. Size of card2, in blocks. +TEMP equ BLOCKS2+3 ; Temporary data +TRLDIR equ TEMP+1 ; R800 data transfer helper +WORKAREA_LEN equ TRLDIR+8 ;----------------------------------------------------------------------------- ; ; Standard BIOS and work area entries -INITXT = $006C ; Inicializa SCREEN0 -CHSNS = $009C ; Sense keyboard buffer for character -CHGET = $009F ; Get character from keyboard buffer -CHPUT = $00A2 ; A=char -CLS = $00C3 ; Chamar com A=0 -ERAFNK = $00CC ; Erase function key display -SNSMAT = $0141 ; Read row of keyboard matrix -KILBUF = $0156 ; Clear keyboard buffer -EXTROM = $015F +INITXT equ #006C ; Inicializa SCREEN0 +CHSNS equ #009C ; Sense keyboard buffer for character +CHGET equ #009F ; Get character from keyboard buffer +CHPUT equ #00A2 ; A=char +CLS equ #00C3 ; Chamar com A=0 +ERAFNK equ #00CC ; Erase function key display +SNSMAT equ #0141 ; Read row of keyboard matrix +KILBUF equ #0156 ; Clear keyboard buffer +EXTROM equ #015F ; subROM functions -SDFSCR = $0185 -REDCLK = $01F5 +SDFSCR equ #0185 +REDCLK equ #01F5 ; System variables -MSXVER = $002D -LINL40 = $F3AE ; Width -LINLEN = $F3B0 -INTFLG = $FC9B -SCRMOD = $FCAF +MSXVER equ #002D +LINL40 equ #F3AE ; Width +LINLEN equ #F3B0 +INTFLG equ #FC9B +SCRMOD equ #FCAF ;----------------------------------------------------------------------------- - org $4000 + org #4000 - ds 256, $FF ; 256 dummy bytes + ds 256, #FF ; 256 dummy bytes DRV_START: @@ -326,7 +324,7 @@ DRV_TIMI: ; Skips the interface r/w registers - ds $4800-$, $FF + ds #4800-$, #FF ;----------------------------------------------------------------------------- @@ -364,12 +362,12 @@ DRV_INIT: or a ; Is this the 1st call? jr nz,.call2 ; 1st call: - ld hl,WRKAREA.TRLDIR ; size of work area are needed for Z80 + ld hl,TRLDIR ; size of work area are needed for Z80 ld a,(MSXVER) cp 3 ; MSX Turbo-R? ccf ret nc ; No, return with Cy off - ld hl,WRKAREA ; size of work area are needed for TR + ld hl, WORKAREA_LEN ; size of work area are needed for TR or a ; Clear Cy ret @@ -386,7 +384,7 @@ DRV_INIT: .sdhcinit: ; FBLabs SDHC Interface initialization xor a ; zera flags do cartao - ld (iy+WRKAREA.CARDFLAGS), a + ld (iy+CARDFLAGS), a ld a, 1 ; detectar cartao 1 call .detecta @@ -404,17 +402,17 @@ DRV_INIT: jp printString .detecta: - ld (iy+WRKAREA.NUMSD), a ; processo de deteccao dos cartoes + ld (iy+NUMSD), a ; processo de deteccao dos cartoes ld de, strCartao call printString - ld a, (iy+WRKAREA.NUMSD) + ld a, (iy+NUMSD) add '0' call CHPUT ld a, ':' call CHPUT ld a, ' ' call CHPUT - ld c, (iy+WRKAREA.NUMSD) + ld c, (iy+NUMSD) ld a, (PORTCFG) ; testar se cartao esta inserido and c ; C contem 1 se cartao 1, 2 se cartao 2 jr z,.naoVazio @@ -459,11 +457,11 @@ SDMAPPERINIT: ; This block is exclusive for the SD-Mapper ld de, strMr_mp_desativada call modoSPI ld a, (PORTCFG) ; testar se mapper/megaram esta ativa - and $10 + and #10 jr z,.print ; desativada, pula ld de, strMapper ld a, (PORTCFG) ; ativa, testar se eh mapper ou megaram - and $20 + and #20 jp nz,printString ld de, strMegaram ; Megaram ativa .print: @@ -562,7 +560,8 @@ DRV_DIRECT4: DEV_RW: push af - cp a, 3 ; somente 2 dispositivos + cp a + cp 3 ; somente 2 dispositivos jr nc,.saicomerroidl dec c ; somente 1 logical unit jr nz,.saicomerroidl @@ -581,7 +580,7 @@ DEV_RW: ld b, 0 ret .ok: - ld (iy+WRKAREA.NUMBLOCKS), b ; save the number of blocks to transfer + ld (iy+NUMBLOCKS), b ; save the number of blocks to transfer exx call calculaCIDoffset ; ix=CID offset ld a,(ix+15) ; verificar se eh SDV1 ou SDV2 @@ -612,7 +611,7 @@ leitura: call modoROM jr nc,.ok call marcaErroCartao ; ocorreu erro na leitura, marcar erro - ld a,(iy+WRKAREA.NUMBLOCKS) ; Get the number of requested blocks + ld a,(iy+NUMBLOCKS) ; Get the number of requested blocks sub ixh ; subtract the number of remaining blocks ld b,a ; b=number of blocks read ; ld a, ENRDY ; Not ready @@ -623,7 +622,7 @@ leitura: escrita: ; Test if the card is write protected - ld c,(iy+WRKAREA.NUMSD) ; cartao atual (1 ou 2) + ld c,(iy+NUMSD) ; cartao atual (1 ou 2) sla c ; desloca para apontar para bits 2 ou 3 para cartoes 1 ou 2 respectivamente sla c call modoSPI @@ -656,7 +655,7 @@ escrita: call modoROM jr nc,.ok2 call marcaErroCartao ; ocorreu erro, marcar nas flags - ld a,(iy+WRKAREA.NUMBLOCKS) ; Get the number of requested blocks + ld a,(iy+NUMBLOCKS) ; Get the number of requested blocks sub ixh ; subtract the number of remaining blocks ld b,a ; b=number of blocks written ld a,EWRERR ; Write error @@ -703,7 +702,8 @@ escrita: DEV_INFO: inc b - cp a,3 ; somente 2 dispositivos + cp a + cp 3 ; somente 2 dispositivos jr nc,.saicomerro push hl call testaCartao ; verificar se cartao esta OK @@ -833,14 +833,15 @@ DEV_INFO: ; DEV_STATUS itself. Please read the Driver Developer Guide for more info. DEV_STATUS: - cp a,3 ; 2 dispositivos somente + cp a + cp 3 ; 2 dispositivos somente jr nc,.saicomerro dec b ; 1 logical unit somente jr nz,.saicomerro push af call pegaWorkArea ; HL=IY=Work area pointer pop af - ld (iy+WRKAREA.NUMSD),a ; salva numero do device atual (1 ou 2) + ld (iy+NUMSD),a ; salva numero do device atual (1 ou 2) ld c,a ; c=device number call modoSPI ld a, (PORTCFG) ; testar se cartao esta inserido @@ -903,7 +904,8 @@ DEV_STATUS: ; For other types of device, these fields must be zero. LUN_INFO: - cp a, 3 ; somente 2 dispositivo + cp a + cp 3 ; somente 2 dispositivo jr nc,.saicomerro dec b ; somente 1 logical unit jr nz,.saicomerro @@ -993,24 +995,24 @@ testaCartao: push af call pegaWorkArea ; HL=IY=Work area pointer pop af - ld (iy+WRKAREA.NUMSD), a ; salva numero do device atual (1 ou 2) + ld (iy+NUMSD), a ; salva numero do device atual (1 ou 2) ld c, a call modoSPI ld a, (PORTCFG) ; testar se cartao esta inserido call modoROM and c ; C contem 1 se cartao 1, 2 se cartao 2 jr nz,.saicomerro - ld a, (iy+WRKAREA.NUMSD) ; conseguimos detectar, tira erro nas flags + ld a, (iy+NUMSD) ; conseguimos detectar, tira erro nas flags cpl ; inverte bits para fazer o AND ld c, a - ld a, (iy+WRKAREA.CARDFLAGS) + ld a, (iy+CARDFLAGS) and c ; limpa bit - ld (iy+WRKAREA.CARDFLAGS), a + ld (iy+CARDFLAGS), a ret .saicomerro: - ld a, (iy+WRKAREA.CARDFLAGS) ; marca bit de erro nas flags + ld a, (iy+CARDFLAGS) ; marca bit de erro nas flags or c - ld (iy+WRKAREA.CARDFLAGS), a + ld (iy+CARDFLAGS), a scf ret @@ -1019,10 +1021,10 @@ testaCartao: ; Destroi AF, C ;------------------------------------------------ marcaErroCartao: - ld c, (iy+WRKAREA.NUMSD) ; cartao atual (1 ou 2) - ld a, (iy+WRKAREA.CARDFLAGS) ; marcar erro + ld c, (iy+NUMSD) ; cartao atual (1 ou 2) + ld a, (iy+CARDFLAGS) ; marcar erro or c - ld (iy+WRKAREA.CARDFLAGS), a + ld (iy+CARDFLAGS), a ret ;------------------------------------------------ @@ -1034,11 +1036,11 @@ calculaCIDoffset: push iy ; copiamos IY para HL pop hl ld d, 0 - ld e, WRKAREA.BCID1 ; DE aponta para buffer BCID1 - ld a, (iy+WRKAREA.NUMSD) ; vamos fazer IX apontar para o buffer correto + ld e, BCID1 ; DE aponta para buffer BCID1 + ld a, (iy+NUMSD) ; vamos fazer IX apontar para o buffer correto dec a ; dependendo do cartao: BCID1 ou BCID2 jr z,.c1 - ld e, WRKAREA.BCID2 ; DE aponta para buffer BCID2 + ld e, BCID2 ; DE aponta para buffer BCID2 .c1: add hl, de ; HL aponta para buffer correto push hl @@ -1055,11 +1057,11 @@ calculaBLOCOSoffset: push iy ; copiamos IY para HL pop hl ld d, 0 - ld e, WRKAREA.BLOCKS1 ; DE aponta para buffer BLOCKS1 - ld a, (iy+WRKAREA.NUMSD) ; Vamos fazer IX apontar para o buffer correto + ld e, BLOCKS1 ; DE aponta para buffer BLOCKS1 + ld a, (iy+NUMSD) ; Vamos fazer IX apontar para o buffer correto dec a ; dependendo do cartao: BLOCKS1 ou BLOCKS2 jr z,.c1 - ld e, WRKAREA.BLOCKS2 ; DE aponta para buffer BLOCKS2 + ld e, BLOCKS2 ; DE aponta para buffer BLOCKS2 .c1: add hl, de ; HL aponta para buffer correto push hl @@ -1101,7 +1103,7 @@ detectaCartao: call SD_SEND_CMD_2_ARGS_GET_R3 ; enviar comando e receber resposta tipo R3 ret c ld a, b ; testa bit CCS do OCR que informa se cartao eh SDV1 ou SDV2 - and $40 + and #40 ld (ix+15), a ; salva informacao da versao do SD (V1 ou V2) no byte 15 do CID call z,mudarTamanhoBlocoPara512 ; se bit CCS do OCR for 1, eh cartao SDV2 (Block address - SDHC ou SDXD) ret c ; e nao precisamos mudar tamanho do bloco para 512 @@ -1111,12 +1113,12 @@ detectaCartao: push iy ; copiamos IY para HL pop hl ld d, 0 - ld e, WRKAREA.BCSD+5 + ld e, BCSD+5 add hl, de ; HL aponta para buffer BCSD+5 - ld a, (iy+WRKAREA.BCSD) - and $C0 ; testa versao do registro CSD + ld a, (iy+BCSD) + and #C0 ; testa versao do registro CSD jr z,.calculaCSD1 - cp $40 + cp #40 jr z,.calculaCSD2 scf ; versao do registro CSD nao reconhecida, informa erro na deteccao ret @@ -1127,7 +1129,7 @@ detectaCartao: ; ----------------------------------- .calculaCSD1: ld a, (hl) - and $0F ; isola READ_BL_LEN + and #0F ; isola READ_BL_LEN push af inc hl ld a, (hl) ; 2 primeiros bits de C_SIZE @@ -1137,7 +1139,7 @@ detectaCartao: ld e, (hl) ; 8 bits de C_SIZE (DE contem os primeiros 10 bits de C_SIZE) inc hl ld a, (hl) - and $C0 ; 2 ultimos bits de C_SIZE + and #C0 ; 2 ultimos bits de C_SIZE add a, a ; rotaciona a esquerda rl e ; rotaciona para DE rl d @@ -1151,7 +1153,7 @@ detectaCartao: ld b, a ; B contem os 2 bits de C_SIZE_MUL inc hl ld a, (hl) ; proximo byte - and $80 ; 1 bit de C_SIZE_MUL + and #80 ; 1 bit de C_SIZE_MUL add a, a ; rotaciona para esquerda jogando no carry rl b ; rotaciona para B inc b ; agora B contem os 3 bits de C_SIZE_MUL @@ -1193,7 +1195,7 @@ detectaCartao: inc hl ; HL ja aponta para BCSD+5, fazer HL apontar para BCSD+7 inc hl ld a, (hl) - and $3F + and #3F ld c, a inc hl ld d, (hl) @@ -1241,7 +1243,7 @@ mudarTamanhoBlocoPara512: ; ------------------------------------------------ testaSDCV2: ld a, CMD8 - ld de, $1AA + ld de, #1AA call SD_SEND_CMD_2_ARGS_GET_R3 ld hl, SD_SEND_CMD1 ; HL aponta para rotina correta jr c,.pula ; cartao recusou CMD8, enviar comando CMD1 @@ -1272,7 +1274,9 @@ lerBlocoCxD: ex de,hl ld hl, PORTSPI - .16 ldi ; LDI x16 + rept 16 + ldi ; LDI x16 + endm ld a, (hl) ld a, (hl) ; byte de resposta or a @@ -1288,7 +1292,7 @@ iniciaSD: ld b, 10 ; enviar 80 pulsos de clock com cartao desabilitado enviaClocksInicio: - ld a, $FF ; manter MOSI em 1 + ld a, #FF ; manter MOSI em 1 ld (PORTSPI), a djnz enviaClocksInicio call setaSDAtual ; ativar cartao atual @@ -1310,7 +1314,7 @@ SD_SEND_CMD0: ; ------------------------------------------------ desabilitaSDs: push af - ld a, $FF ; todos os /CS em 1 + ld a, #FF ; todos os /CS em 1 ld (PORTCFG), a pop af ret @@ -1322,7 +1326,7 @@ SD_SEND_ACMD41: ld a, CMD55 call SD_SEND_CMD_NO_ARGS ld a, ACMD41 - ld bc, $4000 + ld bc, #4000 ld d, c ld e, c jr SD_SEND_CMD_GET_ERROR @@ -1361,7 +1365,7 @@ SD_SEND_CMD_2_ARGS_TEST_BUSY: ld bc, 0 call SD_SEND_CMD ld b, a - and $FE ; testar bit 0 (flag BUSY) + and #FE ; testar bit 0 (flag BUSY) ld a, b jr nz,setaErro ; BUSY em 1, informar erro ret ; sem erros @@ -1412,12 +1416,12 @@ SD_SEND_CMD: ld (PORTSPI), a ex af,af' cp CMD0 - ld b, $95 ; CRC para CMD0 + ld b, #95 ; CRC para CMD0 jr z,enviaCRC cp CMD8 - ld b, $87 ; CRC para CMD8 + ld b, #87 ; CRC para CMD8 jr z,enviaCRC - ld b, $FF ; CRC dummy + ld b, #FF ; CRC dummy enviaCRC: ld a, b ld (PORTSPI), a @@ -1425,31 +1429,31 @@ enviaCRC: ; ------------------------------------------------ ; Esperar que resposta do cartao seja diferente -; de $FF +; de #FF ; Destroi AF, BC ; ------------------------------------------------ WAIT_RESP_NO_FF: ld bc, 1 ; 256 tentativas .loop: ld a, (PORTSPI) - cp $FF ; testa $FF - ret nz ; sai se nao for $FF + cp #FF ; testa #FF + ret nz ; sai se nao for #FF djnz .loop dec c jr nz,.loop ret ; ------------------------------------------------ -; Esperar que resposta do cartao seja $FE +; Esperar que resposta do cartao seja #FE ; Destroi AF, B ; ------------------------------------------------ WAIT_RESP_FE: ld b, 10 ; 10 tentativas .loop: push bc - call WAIT_RESP_NO_FF ; esperar resposta diferente de $FF + call WAIT_RESP_NO_FF ; esperar resposta diferente de #FF pop bc - cp $FE ; resposta � $FE ? + cp #FE ; resposta é #FE ? ret z ; sim, retornamos com carry=0 djnz .loop scf ; erro, carry=1 @@ -1457,7 +1461,7 @@ WAIT_RESP_FE: ; ------------------------------------------------ ; Esperar que resposta do cartao seja diferente -; de $00 +; de #00 ; Destroi A, BC ; ------------------------------------------------ WAIT_RESP_NO_00: @@ -1465,7 +1469,7 @@ WAIT_RESP_NO_00: .loop: ld a, (PORTSPI) or a - ret nz ; se resposta for <> $00, sai + ret nz ; se resposta for <> #00, sai djnz .loop dec c jr nz,.loop @@ -1478,7 +1482,7 @@ WAIT_RESP_NO_00: ; ------------------------------------------------ setaSDAtual: ld a, (PORTSPI) ; dummy read - ld a, (iy+WRKAREA.NUMSD) + ld a, (iy+NUMSD) cpl ; inverte bits ld (PORTCFG), a ret @@ -1527,7 +1531,7 @@ GravarBloco: exx ; hl'=Pointer to R800LDIR helper routine .loopR800: ; R800 optimized loop ld de,PORTSPI - ld a, $FC ; mandar $FC para indicar que os proximos dados + ld a, #FC ; mandar #FC para indicar que os proximos dados ld (de),a ; sao para gravacao call R800LDIR ld (PORTSPI),a ; Send a dummy 16bit CRC @@ -1539,7 +1543,7 @@ GravarBloco: ld c,a .rwaitnoFF: ld a,(PORTSPI) - cp $FF ; a=FF? + cp #FF ; a=FF? jr nz,.rnoFFok in a,(#E7) sub c @@ -1548,7 +1552,7 @@ GravarBloco: djnz .rwaitnoFF ; x50ms wait jr .erroEscritaBlocoR ; error: timeout .rnoFFok: - and $1F ; testa bits erro + and #1F ; testa bits erro cp 5 jr nz,.erroEscritaBlocoR ; resposta errada, informar erro ; Wait for !00h @@ -1576,13 +1580,15 @@ GravarBloco: .loopZ80: ; Z80 optimized loop ld de,PORTSPI - ld a, $FC ; mandar $FC para indicar que os proximos dados + ld a, #FC ; mandar #FC para indicar que os proximos dados ld (de),a ; sao para gravacao - .512 ldi ; 512 vezes o opcode LDI + rept 512 + ldi ; 512 vezes o opcode LDI + endm ld (PORTSPI),a ; Send a dummy 16bit CRC ld (PORTSPI),a call WAIT_RESP_NO_FF ; esperar cartao - and $1F ; testa bits erro + and #1F ; testa bits erro cp 5 jr nz,.erroEscritaBlocoZ ; resposta errada, informar erro call WAIT_RESP_NO_00 ; esperar cartao @@ -1592,7 +1598,7 @@ GravarBloco: .loopend: ld a, (PORTSPI) ; acabou os blocos, fazer 2 dummy reads ld a, (PORTSPI) - ld a, $FD ; enviar $FD para informar ao cartao que acabou os dados + ld a, #FD ; enviar #FD para informar ao cartao que acabou os dados ld (PORTSPI),a ld a, (PORTSPI) ; dummy reads ld a, (PORTSPI) @@ -1618,22 +1624,25 @@ GravarBloco: jp c,terminaLeituraEscritaBloco ; erro - ld a, $FE ; mandar $FE para indicar que vamos mandar dados para gravacao + ld a, #FE ; mandar #FE para indicar que vamos mandar dados para gravacao ld (PORTSPI),a ; Check for a Z80 or R800 + ex de, hl ; ld a,20 db #ED,#F9 ; mulub a,a - exx + ex de, hl ld de,PORTSPI jr c,.r800s ; Use LDIR for R800 - .512 ldi + rept 512 + ldi + endm .part2s: - ld a, $FF ; envia dummy CRC + ld a, #FF ; envia dummy CRC ld (PORTSPI),a ld (PORTSPI),a call WAIT_RESP_NO_FF ; esperar cartao - and $1F ; testa bits erro + and #1F ; testa bits erro cp 5 scf jp nz,terminaLeituraEscritaBloco ; resposta errada, informar erro @@ -1685,7 +1694,7 @@ LerBloco: ld c,a .rwaitFE: ld a,(PORTSPI) - cp $FE + cp #FE jr z,.rFEok djnz .rwaitFE ; fast card wait ld a,(#E7) @@ -1707,7 +1716,7 @@ LerBloco: ld bc,0 .zwaitFE: ld a,(PORTSPI) - cp $FE + cp #FE jr z,.zFEok djnz .zwaitFE ; fast card wait ex (sp),hl @@ -1718,7 +1727,9 @@ LerBloco: jr terminaLeituraEscritaBloco .zFEok: ld hl,PORTSPI - .512 ldi + rept 512 + ldi + endm ld a, (PORTSPI) ; discard 16bit CRC ld a, (PORTSPI) dec ixh ; nblocks=nblocks-1 @@ -1749,7 +1760,9 @@ LerBloco: db #ED,#F9 ; mulub a,a ld hl,PORTSPI jr c,.r800s ; Use LDIR for R800 - .512 ldi + rept 512 + ldi + endm .part2s: ld a, (PORTSPI) ; discard 16bit CRC ld a, (PORTSPI) @@ -1825,12 +1838,12 @@ printString: DecToAscii: ld h, 0 ld l, a ; copiar A para HL - ld (iy+WRKAREA.TEMP),1 ; flag para indicar que devemos cortar os zeros a esquerda + ld (iy+TEMP),1 ; flag para indicar que devemos cortar os zeros a esquerda ld bc, -100 ; centenas call .num1 ld c, -10 ; dezenas call .num1 - ld (iy+WRKAREA.TEMP),2 ; unidade deve exibir 0 se for zero e nao corta-lo + ld (iy+TEMP),2 ; unidade deve exibir 0 se for zero e nao corta-lo ld c, -1 ; unidades .num1: ld a, '0'-1 @@ -1839,11 +1852,11 @@ DecToAscii: add hl, bc ; somar com negativo jr c,.num2 ; ainda nao zeramos sbc hl, bc ; retoma valor original - dec (iy+WRKAREA.TEMP) ; se flag do corte do zero indicar para nao cortar, pula + dec (iy+TEMP) ; se flag do corte do zero indicar para nao cortar, pula jr nz,.naozero cp '0' ; devemos cortar os zeros a esquerda. Eh zero? jr nz,.naozero - inc (iy+WRKAREA.TEMP) ; se for zero, nao salvamos e voltamos a flag + inc (iy+TEMP) ; se for zero, nao salvamos e voltamos a flag ret .naozero: ld (de), a ; eh zero ou eh outro numero, salvar @@ -1864,10 +1877,10 @@ HexToAscii: call .conv ld a, c .conv: - and $0F - add a, $90 + and #0F + add a, #90 daa - adc a, $40 + adc a, #40 daa ld (de), a inc de @@ -1996,7 +2009,7 @@ MYSETSCR: or a ; MSX1? jp z,INITXT ; Yes, change do screen-0 - ld c,$23 ; Block-2, R#3 + ld c,#23 ; Block-2, R#3 ld ix,REDCLK call EXTROM and 1 @@ -2038,7 +2051,7 @@ INICHKSTOP: call printString .wait1: ld a,7 call SNSMAT - and $10 ; Is STOP still pressed? + and #10 ; Is STOP still pressed? jr z,.wait1 ; Wait for STOP to be released xor a ld (INTFLG),a ; Clear STOP flag @@ -2100,7 +2113,7 @@ INSTR800HLP: GTR800LDIR: push iy pop hl ; hl=WorkArea - ld de,WRKAREA.TRLDIR + ld de,TRLDIR add hl,de ret @@ -2118,7 +2131,7 @@ R800DATHLP: ; ========================================================================== strTitle: db "FBLabs SDHC driver " - db "v",VER_MAIN+$30,'.',VER_SEC+$30,'.',VER_REV+$30 + db "v",VER_MAIN+#30,'.',VER_SEC+#30,'.',VER_REV+#30 db 13,10,0 strBootpaused: @@ -2157,5 +2170,5 @@ strSDV2: DRV_END: - ds 3ED0h-(DRV_END-DRV_START), $FF + ds 3ED0h-(DRV_END-DRV_START), #FF diff --git a/driver/driver.bin b/driver/driver.bin deleted file mode 100644 index d2ea528..0000000 Binary files a/driver/driver.bin and /dev/null differ diff --git a/updater/bdos.inc b/updater/bdos.inc index 7dc7804..71e316d 100644 --- a/updater/bdos.inc +++ b/updater/bdos.inc @@ -2,241 +2,239 @@ ; MSX-DOS definitions ; -BDOS = 5 - - MACRO BdosCall function - ld c, function - call BDOS - ENDM - -_TERM0 = $00 ; Program terminate -_CONIN = $01 ; Console input -_CONOUT = $02 ; Console output -_AUXIN = $03 ; Auxiliary input -_AUXOUT = $04 ; Auxiliary output -_LSTOUT = $05 ; Printer output -_DIRIO = $06 ; Direct console I/O -_DIRIN = $07 ; Direct console input -_INNOE = $08 ; Console input without echo -_STROUT = $09 ; String output -_BUFIN = $0A ; Buffered line input -_CONST = $0B ; Console status -_CPMVER = $0C ; Return version number -_DSKRST = $0D ; Disk reset -_SELDSK = $0E ; Select disk -_FOPEN = $0F ; Open file -_FCLOSE = $10 ; Close file -_SFIRST = $11 ; Search for first -_SNEXT = $12 ; Search for next -_FDEL = $13 ; Delete file -_RDSEQ = $14 ; Sequencial read -_WRSEQ = $15 ; Sequencial write -_FMAKE = $16 ; Create file -_FREN = $17 ; Rename file -_LOGIN = $18 ; Get login vector -_CURDRV = $19 ; Get current drive -_SETDTA = $1A ; Set disk transfer address -_ALLOC = $1B ; Get allocation information -_RDRND = $21 ; Random read -_WRRND = $22 ; Random write -_FSIZE = $23 ; Get file size -_SETRND = $24 ; Set random record -_WRBLK = $26 ; Random block write -_RDBLK = $27 ; Random block read -_WRZER = $28 ; Random write with zero fill -_GDATE = $2A ; Get date -_SDATE = $2B ; Set date -_GTIME = $2C ; Get time -_STIME = $2D ; Set time -_VERIFY = $2E ; Set/reset verify flag -_RDABS = $2F ; Absolute sector read -_WRABS = $30 ; Absolute sector write -_DPARM = $31 ; Get disk parameters -_FFIRST = $40 ; Find first entry -_FNEXT = $41 ; Find next entry -_FNEW = $42 ; Find = entry -_OPEN = $43 ; Open file handle -_CREATE = $44 ; Create file handle -_CLOSE = $45 ; Close file handle -_ENSURE = $46 ; Ensure file handle -_DUP = $47 ; Duplicate file handle -_READ = $48 ; Read from file handle -_WRITE = $49 ; Write to file handle -_SEEK = $4A ; Move file handle pointer -_IOCTL = $4B ; I/O control for devices -_HTEST = $4C ; Test file handle -_DELETE = $4D ; Delete file or subdirectory -_RENAME = $4E ; Rename file or subdirectory -_MOVE = $4F ; Move file or subdirectory -_ATTR = $50 ; Get/set file attributes -_FTIME = $51 ; Get/set file date and time -_HDELETE = $52 ; Delete file handle -_HRENAME = $53 ; Rename file handle -_HMOVE = $54 ; Move file handle -_HATTR = $55 ; Get/set file handle attributes -_HFTIME = $56 ; Get/set file handle date and time -_GETDTA = $57 ; Get disk transfer address -_GETVFY = $58 ; Get verify flag setting -_GETCD = $59 ; Get current directory -_CHDIR = $5A ; Change current directory -_PARSE = $5B ; Parse pathname -_PFILE = $5C ; Parse filename -_CHKCHR = $5D ; Check character -_WPATH = $5E ; Get whole path string -_FLUSH = $5F ; Flush disk buffers -_FORK = $60 ; Fork a child process -_JOIN = $61 ; Rejoin parent process -_TERM = $62 ; Terminate with error code -_DEFAB = $63 ; Define abort exit routine -_DEFER = $64 ; Define disk error handler routine -_ERROR = $65 ; GFet previous error code -_EXPLAIN = $66 ; Explain error code -_FORMAT = $67 ; Format a disk -_RAMD = $68 ; Create or destroy RAM disk -_BUFFER = $69 ; Allocate sector buffers -_ASSGIN = $6A ; Logical drive assignment -_GENV = $6B ; Get environment item -_SENV = $6C ; Set environment item -_FENV = $6D ; Find environment item -_DSKCHK = $6E ; Get/set disk check status -_DOSVER = $6F ; Get MSX DOS version number -_REDIR = $70 ; Get/set redirection status +BDOS equ 5 + +BdosCall: MACRO function + ld c, function + call BDOS +ENDM + +_TERM0 equ #00 ; Program terminate +_CONIN equ #01 ; Console input +_CONOUT equ #02 ; Console output +_AUXIN equ #03 ; Auxiliary input +_AUXOUT equ #04 ; Auxiliary output +_LSTOUT equ #05 ; Printer output +_DIRIO equ #06 ; Direct console I/O +_DIRIN equ #07 ; Direct console input +_INNOE equ #08 ; Console input without echo +_STROUT equ #09 ; String output +_BUFIN equ #0A ; Buffered line input +_CONST equ #0B ; Console status +_CPMVER equ #0C ; Return version number +_DSKRST equ #0D ; Disk reset +_SELDSK equ #0E ; Select disk +_FOPEN equ #0F ; Open file +_FCLOSE equ #10 ; Close file +_SFIRST equ #11 ; Search for first +_SNEXT equ #12 ; Search for next +_FDEL equ #13 ; Delete file +_RDSEQ equ #14 ; Sequencial read +_WRSEQ equ #15 ; Sequencial write +_FMAKE equ #16 ; Create file +_FREN equ #17 ; Rename file +_LOGIN equ #18 ; Get login vector +_CURDRV equ #19 ; Get current drive +_SETDTA equ #1A ; Set disk transfer address +_ALLOC equ #1B ; Get allocation information +_RDRND equ #21 ; Random read +_WRRND equ #22 ; Random write +_FSIZE equ #23 ; Get file size +_SETRND equ #24 ; Set random record +_WRBLK equ #26 ; Random block write +_RDBLK equ #27 ; Random block read +_WRZER equ #28 ; Random write with zero fill +_GDATE equ #2A ; Get date +_SDATE equ #2B ; Set date +_GTIME equ #2C ; Get time +_STIME equ #2D ; Set time +_VERIFY equ #2E ; Set/reset verify flag +_RDABS equ #2F ; Absolute sector read +_WRABS equ #30 ; Absolute sector write +_DPARM equ #31 ; Get disk parameters +_FFIRST equ #40 ; Find first entry +_FNEXT equ #41 ; Find next entry +_FNEW equ #42 ; Find equ entry +_OPEN equ #43 ; Open file handle +_CREATE equ #44 ; Create file handle +_CLOSE equ #45 ; Close file handle +_ENSURE equ #46 ; Ensure file handle +_DUP equ #47 ; Duplicate file handle +_READ equ #48 ; Read from file handle +_WRITE equ #49 ; Write to file handle +_SEEK equ #4A ; Move file handle pointer +_IOCTL equ #4B ; I/O control for devices +_HTEST equ #4C ; Test file handle +_DELETE equ #4D ; Delete file or subdirectory +_RENAME equ #4E ; Rename file or subdirectory +_MOVE equ #4F ; Move file or subdirectory +_ATTR equ #50 ; Get/set file attributes +_FTIME equ #51 ; Get/set file date and time +_HDELETE equ #52 ; Delete file handle +_HRENAME equ #53 ; Rename file handle +_HMOVE equ #54 ; Move file handle +_HATTR equ #55 ; Get/set file handle attributes +_HFTIME equ #56 ; Get/set file handle date and time +_GETDTA equ #57 ; Get disk transfer address +_GETVFY equ #58 ; Get verify flag setting +_GETCD equ #59 ; Get current directory +_CHDIR equ #5A ; Change current directory +_PARSE equ #5B ; Parse pathname +_PFILE equ #5C ; Parse filename +_CHKCHR equ #5D ; Check character +_WPATH equ #5E ; Get whole path string +_FLUSH equ #5F ; Flush disk buffers +_FORK equ #60 ; Fork a child process +_JOIN equ #61 ; Rejoin parent process +_TERM equ #62 ; Terminate with error code +_DEFAB equ #63 ; Define abort exit routine +_DEFER equ #64 ; Define disk error handler routine +_ERROR equ #65 ; GFet previous error code +_EXPLAIN equ #66 ; Explain error code +_FORMAT equ #67 ; Format a disk +_RAMD equ #68 ; Create or destroy RAM disk +_BUFFER equ #69 ; Allocate sector buffers +_ASSGIN equ #6A ; Logical drive assignment +_GENV equ #6B ; Get environment item +_SENV equ #6C ; Set environment item +_FENV equ #6D ; Find environment item +_DSKCHK equ #6E ; Get/set disk check status +_DOSVER equ #6F ; Get MSX DOS version number +_REDIR equ #70 ; Get/set redirection status ; Errors ERROR: -.NCOMP = $FF ; Incompatible disk -.WRERR = $FE ; Write error -.DISK = $FD ; Disk error -.NRDY = $FC ; Not ready -.VERFY = $FB ; Verify error -.DATA = $FA ; Data error -.RNF = $F9 ; Sector not found -.WPROT = $F8 ; Write protected disk -.UFORM = $F7 ; Unformatted disk -.NDOS = $F6 ; Not a DOS disk -.WDISK = $F5 ; Wrong disk -.WFILE = $F4 ; Wrong disk for file -.SEEK = $F3 ; Seek error -.IFAT = $F2 ; Bad file allocation table -.NOUPB = $F1 ; -- -.IFORM = $F0 ; Cannot format this drive -.INTER = $DF ; Internal error -.NORAM = $DE ; Not enough memory -.IBDOS = $DC ; Invalid MSX-DOS call -.IDRV = $DB ; Invalid drive -.IFNM = $DA ; Invalid filename -.IPATH = $D9 ; Invalid pathname -.PLONG = $D8 ; Pathname too long -.NOFIL = $D7 ; File not found -.NODIR = $D6 ; Directory not found -.DRFUL = $D5 ; Root directory full -.DKFUL = $D4 ; Disk full -.DUPF = $D3 ; Duplicate filename -.DIRE = $D2 ; Invalid directory move -.FILRO = $D1 ; Read only file -.DIRNE = $D0 ; Directory not empty -.IATTR = $CF ; Invalid attributes -.DOT = $CE ; Invalid . or .. operation -.SYSX = $CD ; System file exists -.DIRX = $CC ; Directory exists -.FILEX = $CB ; File exists -.FOPEN = $CA ; File already in use -.OV64K = $C9 ; Cannot transfer above 64K -.FILE = $C8 ; File allocation error -.EOF = $C7 ; End of file -.ACCV = $C6 ; File access violation -.IPROC = $C5 ; Invalid process id -.NHAND = $C4 ; No spare file handles -.IHAND = $C3 ; Invalid file handle -.NOPEN = $C2 ; File handle not open -.IDEV = $C1 ; Invalid device operation -.IENV = $C0 ; Invalid environment string -.ELONG = $BF ; Environment string too long -.IDATE = $BE ; Invalid date -.ITIME = $BD ; Invalid time -.RAMDX = $BC ; RAM disk (drive H ) already exists -.NRAMD = $BB ; RAM disk does not exist -.HDEAD = $BA ; File handle has been deleted -.EOL = $B9 ; Internal error. Should never occur -.ISBFN = $B8 ; Invalid sub-function number -.STOP = $9F ; Ctrl-STOP pressed -.CTRLC = $9E ; Ctrl-C pressed -.ABORT = $9D ; Disk operation aborted -.OUTERR = $9C ; Error on standard output -.INERR = $9B ; Error on standard input -.BADCOM = $8F ; Wrong version of COMMAND -.BADCM = $8E ; Unrecognized command -.BUFUL = $8D ; Command too long -.OKCMD = $8C ; -- -.IPARM = $8B ; Invalid parameter -.INP = $8A ; Too many parameters -.NOPAR = $89 ; Missing parameter -.IOPT = $88 ; Invalid option -.BADNO = $87 ; Invalid number -.NOHELP = $86 ; File for HELP not found -.BADVER = $85 ; Wrong version of MSX-DOS -.NOCAT = $84 ; Cannot concatenate destination file -.BADEST = $83 ; Cannot create destination file -.COPY = $82 ; File cannot be copied onto itself -.OVDEST = $81 ; Cannot overwrite previous destination file +.NCOMP equ #FF ; Incompatible disk +.WRERR equ #FE ; Write error +.DISK equ #FD ; Disk error +.NRDY equ #FC ; Not ready +.VERFY equ #FB ; Verify error +.DATA equ #FA ; Data error +.RNF equ #F9 ; Sector not found +.WPROT equ #F8 ; Write protected disk +.UFORM equ #F7 ; Unformatted disk +.NDOS equ #F6 ; Not a DOS disk +.WDISK equ #F5 ; Wrong disk +.WFILE equ #F4 ; Wrong disk for file +.SEEK equ #F3 ; Seek error +.IFAT equ #F2 ; Bad file allocation table +.NOUPB equ #F1 ; -- +.IFORM equ #F0 ; Cannot format this drive +.INTER equ #DF ; Internal error +.NORAM equ #DE ; Not enough memory +.IBDOS equ #DC ; Invalid MSX-DOS call +.IDRV equ #DB ; Invalid drive +.IFNM equ #DA ; Invalid filename +.IPATH equ #D9 ; Invalid pathname +.PLONG equ #D8 ; Pathname too long +.NOFIL equ #D7 ; File not found +.NODIR equ #D6 ; Directory not found +.DRFUL equ #D5 ; Root directory full +.DKFUL equ #D4 ; Disk full +.DUPF equ #D3 ; Duplicate filename +.DIRE equ #D2 ; Invalid directory move +.FILRO equ #D1 ; Read only file +.DIRNE equ #D0 ; Directory not empty +.IATTR equ #CF ; Invalid attributes +.DOT equ #CE ; Invalid . or .. operation +.SYSX equ #CD ; System file exists +.DIRX equ #CC ; Directory exists +.FILEX equ #CB ; File exists +.FOPEN equ #CA ; File already in use +.OV64K equ #C9 ; Cannot transfer above 64K +.FILE equ #C8 ; File allocation error +.EOF equ #C7 ; End of file +.ACCV equ #C6 ; File access violation +.IPROC equ #C5 ; Invalid process id +.NHAND equ #C4 ; No spare file handles +.IHAND equ #C3 ; Invalid file handle +.NOPEN equ #C2 ; File handle not open +.IDEV equ #C1 ; Invalid device operation +.IENV equ #C0 ; Invalid environment string +.ELONG equ #BF ; Environment string too long +.IDATE equ #BE ; Invalid date +.ITIME equ #BD ; Invalid time +.RAMDX equ #BC ; RAM disk (drive H ) already exists +.NRAMD equ #BB ; RAM disk does not exist +.HDEAD equ #BA ; File handle has been deleted +.EOL equ #B9 ; Internal error. Should never occur +.ISBFN equ #B8 ; Invalid sub-function number +.STOP equ #9F ; Ctrl-STOP pressed +.CTRLC equ #9E ; Ctrl-C pressed +.ABORT equ #9D ; Disk operation aborted +.OUTERR equ #9C ; Error on standard output +.INERR equ #9B ; Error on standard input +.BADCOM equ #8F ; Wrong version of COMMAND +.BADCM equ #8E ; Unrecognized command +.BUFUL equ #8D ; Command too long +.OKCMD equ #8C ; -- +.IPARM equ #8B ; Invalid parameter +.INP equ #8A ; Too many parameters +.NOPAR equ #89 ; Missing parameter +.IOPT equ #88 ; Invalid option +.BADNO equ #87 ; Invalid number +.NOHELP equ #86 ; File for HELP not found +.BADVER equ #85 ; Wrong version of MSX-DOS +.NOCAT equ #84 ; Cannot concatenate destination file +.BADEST equ #83 ; Cannot create destination file +.COPY equ #82 ; File cannot be copied onto itself +.OVDEST equ #81 ; Cannot overwrite previous destination file ; Allocate segment parameters -USER_SEGMENT = 0 ; Register A -SYSTEM_SEGMENT = 1 ; " " -PRIMARY_MAPPER = 0 ; Register B +USER_SEGMENT equ 0 ; Register A +SYSTEM_SEGMENT equ 1 ; " " +PRIMARY_MAPPER equ 0 ; Register B ; Open file flags (_OPEN) -OPEN_NO_WRITE = 1 -OPEN_NO_READ = 2 -OPEN_INHERITABLE = 4 +OPEN_NO_WRITE equ 1 +OPEN_NO_READ equ 2 +OPEN_INHERITABLE equ 4 ; Seek file flags -SEEK_SET = 0 -SEEK_CUR = 1 -SEEK_END = 2 +SEEK_SET equ 0 +SEEK_CUR equ 1 +SEEK_END equ 2 ; File attributes (bit mask) -FILE_READ_ONLY = 1 ; -FILE_HIDDEN = 2 ; -FILE_SYSTEM = 4 ; -FILE_VOLUME_NAME = 8 ; -FILE_DIRECTORY = 16 ; -FILE_ARCHIVE = 32 ; -FILE_RESERVED = 64 ; -FILE_DEVICE = 128 ; +FILE_READ_ONLY equ 1 ; +FILE_HIDDEN equ 2 ; +FILE_SYSTEM equ 4 ; +FILE_VOLUME_NAME equ 8 ; +FILE_DIRECTORY equ 16 ; +FILE_ARCHIVE equ 32 ; +FILE_RESERVED equ 64 ; +FILE_DEVICE equ 128 ; ; Disk error handler routine parameters in register C -ERROR_WRITING = 1 ; Set if writing -ERROR_NO_IGNORE = 2 ; Set if ignore not recommended -ERROR_AUTO_ABORT = 4 ; Set if auto-abort suggested -ERROR_VALID_SECTOR = 8 ; Set if sector number is valid +ERROR_WRITING equ 1 ; Set if writing +ERROR_NO_IGNORE equ 2 ; Set if ignore not recommended +ERROR_AUTO_ABORT equ 4 ; Set if auto-abort suggested +ERROR_VALID_SECTOR equ 8 ; Set if sector number is valid ; Disk error handler routine return codes -CALL_SYSTEM_ERROR = 0 ; Call system error routine -ERROR_ABORT = 1 ; Abort -ERROR_RETRY = 2 ; Retry -ERROR_IGNORE = 3 ; Ignore +CALL_SYSTEM_ERROR equ 0 ; Call system error routine +ERROR_ABORT equ 1 ; Abort +ERROR_RETRY equ 2 ; Retry +ERROR_IGNORE equ 3 ; Ignore ; Params _RAMD -DESTROY_RAMDISK = 0 -GET_RAMDISK_SIZE = $FF -CREATE_RAMDISK = 1 ; CREATE_RAMDISK+n = 1+n +DESTROY_RAMDISK equ 0 +GET_RAMDISK_SIZE equ #FF +CREATE_RAMDISK equ 1 ; CREATE_RAMDISK+n equ 1+n ; Misc -CR = 13 ; Carridge Return -LF = 10 ; Line Feed -LE = '$' ; Line end -UPPER_CASE_MASK = $DF - -CMD_LENGTH = $80 -CMD_LINE = $82 - -COM_START_ADDR = $100 - -RAMAD0 = $F341 ; slotid DOS ram page 0 -RAMAD1 = $F342 ; slotid DOS ram page 1 -RAMAD2 = $F343 ; slotid DOS ram page 2 -RAMAD3 = $F344 ; slotid DOS ram page 3 -SECBUF = $F34D ; pointer to sectorbuffer, can be used by the diskdriver +CR equ 13 ; Carridge Return +LF equ 10 ; Line Feed +LE equ '$' ; Line end +UPPER_CASE_MASK equ #DF + +CMD_LENGTH equ #80 +CMD_LINE equ #82 + +RAMAD0 equ #F341 ; slotid DOS ram page 0 +RAMAD1 equ #F342 ; slotid DOS ram page 1 +RAMAD2 equ #F343 ; slotid DOS ram page 2 +RAMAD3 equ #F344 ; slotid DOS ram page 3 +SECBUF equ #F34D ; pointer to sectorbuffer, can be used by the diskdriver diff --git a/updater/bios.inc b/updater/bios.inc index 293d201..cadf439 100644 --- a/updater/bios.inc +++ b/updater/bios.inc @@ -2,128 +2,128 @@ ; BIOS definitions ; -PSLTRG = $A8 ; I/O port address of primary slot register +PSLTRG equ #A8 ; I/O port address of primary slot register -WBOOT = $00 -RDSLT = $0C -WRSLT = $14 -CALSTL = $1C -ENASLT = $24 -IDBYT0 = $2B -BASVER = $2D -CALLF = $30 -KEYINT = $38 -WRTVDP = $47 -LDIRMV = $59 -LDIRVM = $5C -CHGMOD = $5F -INITXT = $6C -CHSNS = $9C -CHGET = $9F -CHPUT = $A2 -LPTOUT = $A5 -BREAKX = $B7 -CKCNTC = $BD -ERAFNK = $CC -TOTEXT = $D2 -SNSMAT = $141 -PHYDIO = $144 -KILBUF = $156 -CALBAS = $159 -EXTROM = $15F +WBOOT equ #00 +RDSLT equ #0C +WRSLT equ #14 +CALSTL equ #1C +ENASLT equ #24 +IDBYT0 equ #2B +BASVER equ #2D +CALLF equ #30 +KEYINT equ #38 +WRTVDP equ #47 +LDIRMV equ #59 +LDIRVM equ #5C +CHGMOD equ #5F +INITXT equ #6C +CHSNS equ #9C +CHGET equ #9F +CHPUT equ #A2 +LPTOUT equ #A5 +BREAKX equ #B7 +CKCNTC equ #BD +ERAFNK equ #CC +TOTEXT equ #D2 +SNSMAT equ #141 +PHYDIO equ #144 +KILBUF equ #156 +CALBAS equ #159 +EXTROM equ #15F -RDPRIM = $F380 -WRPRIM = $F385 -CLPRIM = $F38C -CLPRM1 = $F398 -LINL40 = $F3AE -LINLEN = $F3B0 -CNSDFG = $F3DE -LPTPOS = $F415 -PRTFLG = $F416 -CURLIN = $F41C -KBUF = $F41F -BUF = $F55E -TTYPOS = $F661 -VALTYP = $F663 -MEMSIZ = $F672 -STKTOP = $F674 -TXTTAB = $F676 -TEMPPT = $F678 -TEMPST = $F67A -DSCTMP = $F698 -FRETOP = $F69B -AUTLIN = $F6AB -SAVSTK = $F6B1 -VARTAB = $F6C2 -STREND = $F6C6 -DAC = $F7F6 -ARG = $F847 -MAXFIL = $F85F -FILTAB = $F860 -NULBUF = $F862 -PTRFIL = $F864 -FILNAM = $F866 -NLONLY = $F87C -SAVEND = $F87D -EXBRSA = $FAF0 -HOKVLD = $FB20 -YFB21 = $FB21 ; diskdriver table -YFB29 = $FB29 ; diskdriver interrupt table -BOTTOM = $FC48 -HIMEM = $FC4A -CSRSW = $FCA9 -FLBMEM = $FCAE -RUNBNF = $FCBE -SAVENT = $FCBF -EXPTBL = $FCC1 ; slots expanded or not -SLTTBL = $FCC5 -SLTATR = $FCC9 -SLTWRK = $FD09 -PROCNM = $FD89 -DEVICE = $FD99 -H.TIMI = $FD9F -H.KEYI = $FD9A ; interrupt hook -H.DSKO = $FDEF -H.NAME = $FDF9 -H.KILL = $FDFE -H.COPY = $FE08 -H.DSKF = $FE12 -H.DSKI = $FE17 -H.LSET = $FE21 -H.RSET = $FE26 -H.FIEL = $FE2B -H.MKI = $FE30 -H.MKS = $FE35 -H.MKD = $FE3A -H.CVI = $FE3F -H.CVS = $FE44 -H.CVD = $FE49 -H.GETP = $FE4E -H.NOFO = $FE58 -H.NULO = $FE5D -H.NTFL = $FE62 -H.BINS = $FE71 -H.BINL = $FE76 -H.FILE = $FE7B -H.DGET = $FE80 -H.FILO = $FE85 -H.INDS = $FE8A -H.LOC = $FE99 -H.LOF = $FE9E -H.EOF = $FEA3 -H.BAKU = $FEAD -H.PARD = $FEB2 -H.NODE = $FEB7 -H.POSD = $FEBC -H.RUNC = $FECB -H.CLEA = $FED0 -H.LOPD = $FED5 -H.STKE = $FEDA -H.ERRP = $FEFD -H.PHYD = $FFA7 -H.FORM = $FFAC -EXTBIO = $FFCA -DISINT = $FFCF -ENAINT = $FFD4 -EXTVDP = $FFE7 +RDPRIM equ #F380 +WRPRIM equ #F385 +CLPRIM equ #F38C +CLPRM1 equ #F398 +LINL40 equ #F3AE +LINLEN equ #F3B0 +CNSDFG equ #F3DE +LPTPOS equ #F415 +PRTFLG equ #F416 +CURLIN equ #F41C +KBUF equ #F41F +BUF equ #F55E +TTYPOS equ #F661 +VALTYP equ #F663 +MEMSIZ equ #F672 +STKTOP equ #F674 +TXTTAB equ #F676 +TEMPPT equ #F678 +TEMPST equ #F67A +DSCTMP equ #F698 +FRETOP equ #F69B +AUTLIN equ #F6AB +SAVSTK equ #F6B1 +VARTAB equ #F6C2 +STREND equ #F6C6 +DAC equ #F7F6 +ARG equ #F847 +MAXFIL equ #F85F +FILTAB equ #F860 +NULBUF equ #F862 +PTRFIL equ #F864 +FILNAM equ #F866 +NLONLY equ #F87C +SAVEND equ #F87D +EXBRSA equ #FAF0 +HOKVLD equ #FB20 +YFB21 equ #FB21 ; diskdriver table +YFB29 equ #FB29 ; diskdriver interrupt table +BOTTOM equ #FC48 +HIMEM equ #FC4A +CSRSW equ #FCA9 +FLBMEM equ #FCAE +RUNBNF equ #FCBE +SAVENT equ #FCBF +EXPTBL equ #FCC1 ; slots expanded or not +SLTTBL equ #FCC5 +SLTATR equ #FCC9 +SLTWRK equ #FD09 +PROCNM equ #FD89 +DEVICE equ #FD99 +H.TIMI equ #FD9F +H.KEYI equ #FD9A ; interrupt hook +H.DSKO equ #FDEF +H.NAME equ #FDF9 +H.KILL equ #FDFE +H.COPY equ #FE08 +H.DSKF equ #FE12 +H.DSKI equ #FE17 +H.LSET equ #FE21 +H.RSET equ #FE26 +H.FIEL equ #FE2B +H.MKI equ #FE30 +H.MKS equ #FE35 +H.MKD equ #FE3A +H.CVI equ #FE3F +H.CVS equ #FE44 +H.CVD equ #FE49 +H.GETP equ #FE4E +H.NOFO equ #FE58 +H.NULO equ #FE5D +H.NTFL equ #FE62 +H.BINS equ #FE71 +H.BINL equ #FE76 +H.FILE equ #FE7B +H.DGET equ #FE80 +H.FILO equ #FE85 +H.INDS equ #FE8A +H.LOC equ #FE99 +H.LOF equ #FE9E +H.EOF equ #FEA3 +H.BAKU equ #FEAD +H.PARD equ #FEB2 +H.NODE equ #FEB7 +H.POSD equ #FEBC +H.RUNC equ #FECB +H.CLEA equ #FED0 +H.LOPD equ #FED5 +H.STKE equ #FEDA +H.ERRP equ #FEFD +H.PHYD equ #FFA7 +H.FORM equ #FFAC +EXTBIO equ #FFCA +DISINT equ #FFCF +ENAINT equ #FFD4 +EXTVDP equ #FFE7 diff --git a/updater/sdmupd.asm b/updater/sdmupd.asm index 1efb697..e570c90 100644 --- a/updater/sdmupd.asm +++ b/updater/sdmupd.asm @@ -1,9 +1,13 @@ + .CPU Z80 + TITLE updater + .RELAB + ; Projeto MSX SD Mapper ; Copyright (c) 2014 ; Fabio Belavenuto ; -; Baseado no código FL2 versão 2.2 de 29-12-2002 (c) Ramones 2002 +; Baseado no codigo FL2 versao 2.2 de 29-12-2002 (c) Ramones 2002 ; ; ; This documentation describes Open Hardware and is licensed under the CERN OHL v. 1.1. @@ -13,20 +17,15 @@ ; SATISFACTORY QUALITY AND FITNESS FOR A PARTICULAR PURPOSE. ; Please see the CERN OHL v.1.1 for applicable conditions + org #100 - output "sdmupd.com" - - include "bios.inc" - include "bdos.inc" - - - org COM_START_ADDR - + include "BIOS.INC" + include "BDOS.INC" ; *** CONSTANTS *** -IOFW = $5F ; Porta de controle para gravacao da flash -ALG_BYTE = 1 -ALG_PAGE = 2 +IOFW equ #5F ; Porta de controle para gravacao da flash +ALG_BYTE equ 1 +ALG_PAGE equ 2 inicio: @@ -72,14 +71,14 @@ init: checkFlash: ld de, strProcuraFlash call print ; Prints searching message - ld a, $FF + ld a, #FF ld (thisslt), a ; Inits SIGSLOT Routine .loop: di call sigslot ; Calls the next slot (first one if first time) - cp $FF ; Is it the last slot? + cp #FF ; Is it the last slot? jr z, .naoachado ; Yes. FLASH was not found - ld h, $80 ; It is not the last slot. Placed it in page 2 + ld h, #80 ; It is not the last slot. Placed it in page 2 call ENASLT call checkDeviceID ; Searching flash by executing its ID_CHECK command jr c, .loop ; Not found in this slot, continue with next one @@ -98,7 +97,7 @@ checkFlash: ld (strAchado.subslot), a ; ASCII conversion of the Subslot. ld a, (RAMAD2) - ld h, $80 + ld h, #80 call ENASLT ; Restoring page 2 (Memory again) ld de, strAchado @@ -112,7 +111,7 @@ checkFlash: .naoachado: ; FLASH NOT FOUND ld a, (RAMAD2) - ld h, $80 + ld h, #80 call ENASLT ; Memory placed ld de, strNaoAchado jp printErro ; Error message, exiting program @@ -125,13 +124,13 @@ checkFlash: ; ------------------------- checkDeviceID: di - ld a, $F0 ; Comando $F0 (Reset) + ld a, #F0 ; Comando #F0 (Reset) call flashSendCommand2 - ld a, $90 ; Comando $90 (Software ID Entry) + ld a, #90 ; Comando #90 (Software ID Entry) call flashSendCommand2 - ld a, ($8000) ; Ler Manufacturer ID + ld a, (#8000) ; Ler Manufacturer ID ld (flashIdMan), a ; e salvar - ld a, ($8001) ; Ler Product ID + ld a, (#8001) ; Ler Product ID ld (flashIdProd), a ; e salvar call flashIdent ; chamamos funcao que identifica flash ld a, (flashAlg) @@ -142,7 +141,7 @@ checkDeviceID: xor a ; Carry = 0 - OK .sair: push af - ld a, $F0 ; Comando $F0 (Reset) + ld a, #F0 ; Comando #F0 (Reset) call flashSendCommand2 xor a out (IOFW), a ; Desliga modo gravacao da Flash @@ -168,20 +167,20 @@ checkDOS: checkSystem: ld a, (EXPTBL) ld hl, BASVER - call RDSLT ; Check byte $2D (MSX version) + call RDSLT ; Check byte #2D (MSX version) ld (system), a cp 3 ; Turbo R? ret c ; no, return ld iy, (EXPTBL - 1) ; is MSX Turbo R - ld ix, $183 + ld ix, #183 call CALSTL - or $80 + or #80 ld (savecpu), a ; save actual CPU mode - ld a, $80 ; and set Z80 for compatibility + ld a, #80 ; and set Z80 for compatibility systemSetCPU: ld iy, (EXPTBL - 1) - ld ix, $180 + ld ix, #180 call CALSTL ret @@ -374,7 +373,7 @@ loadFile: ld b, 8 ; 8 blocos de 16K = 128K .loop: push bc - call fillPage ; fill page 2 (read buffer) with $FF + call fillPage ; fill page 2 (read buffer) with #FF call load16K ; and load one 16 K page to buffer pop bc push bc @@ -406,14 +405,14 @@ loadFile: ; ------------------ load16K: ; this code load 16 KB from file - ; to buffer (page 2 $8000 - $BFFF) + ; to buffer (page 2 #8000 - #BFFF) ld a, (RAMAD2) - ld h, $80 + ld h, #80 call ENASLT ; mem in page 2 ei - ld de, $8000 ; buffer = $8000 - ld hl, $4000 ; length = $4000 (16K) + ld de, #8000 ; buffer = #8000 + ld hl, #4000 ; length = #4000 (16K) ld a, (dos) cp 2 jr nc, .dos2 ; if DOS 2 make <> load @@ -433,10 +432,10 @@ load16K: ; Fill page 2 with FFH ; --------------------- fillPage: - ld hl, $8000 - ld de, $8001 - ld bc, $3FFF - ld (hl), $FF + ld hl, #8000 + ld de, #8001 + ld bc, #3FFF + ld (hl), #FF ldir ; fill ret @@ -454,7 +453,7 @@ fillName: jr z, .p1 ; 0 dec cp ':' ; end jr z, .p2 - cp '\\' ; params + cp '\' ; params jr z, .p2 .p1: dec hl @@ -480,7 +479,7 @@ delay: push de push bc ; this delay is for erasing operations ld a, (RAMAD1) - ld h, $40 + ld h, #40 call ENASLT ; set mem to page 1 ld a, (erasedelay) ; loop times from delay. ld b, a @@ -492,7 +491,7 @@ delay: pop bc djnz .loop ld a, (flashslt) - ld h, $40 + ld h, #40 call ENASLT ; return flash to page 1 (DOS1 Compatibility) ei pop bc @@ -509,7 +508,7 @@ delay: ; -------------------------------------------------------- sigslot: ld a, (thisslt) ; Returns the next slot, starting by - cp $FF ; slot 0. Returns #FF when there are not more slots + cp #FF ; slot 0. Returns #FF when there are not more slots jr nz, .p1 ; Modifies AF, BC, HL. ld a, (EXPTBL) and %10000000 @@ -545,7 +544,7 @@ sigslot: ld (thisslt), a ret .nomaslt: - ld a, $FF + ld a, #FF ret ; *** FLASH ROUTINES *** @@ -559,17 +558,17 @@ sigslot: flashSendCommand1: push hl push af - ld a, $81 + ld a, #81 out (IOFW), a ; Ativa modo de gravacao e seleciona pagina 1 da flash - ld hl, $5555 ; Escreve no endereco absoluto da flash $5555 - ld (hl), $AA - ld a, $80 + ld hl, #5555 ; Escreve no endereco absoluto da flash #5555 + ld (hl), #AA + ld a, #80 out (IOFW), a ; Mantem modo de gravacao e seleciona pagina 0 da flash - ld hl, $6AAA ; Escreve no endereco absoluto da flash $2AAA - ld (hl), $55 - ld a, $81 + ld hl, #6AAA ; Escreve no endereco absoluto da flash #2AAA + ld (hl), #55 + ld a, #81 out (IOFW), a ; Mantem modo de gravacao e seleciona pagina 1 da flash - ld hl, $5555 ; Escreve no endereco absoluto da flash $5555 + ld hl, #5555 ; Escreve no endereco absoluto da flash #5555 pop af ld (hl), a ; Envia comando pop hl @@ -584,17 +583,17 @@ flashSendCommand1: flashSendCommand2: push hl push af - ld a, $81 + ld a, #81 out (IOFW), a ; Ativa modo de gravacao e seleciona pagina 1 da flash - ld hl, $9555 ; Escreve no endereco absoluto da flash $5555 - ld (hl), $AA - ld a, $80 + ld hl, #9555 ; Escreve no endereco absoluto da flash #5555 + ld (hl), #AA + ld a, #80 out (IOFW), a ; Mantem modo de gravacao e seleciona pagina 0 da flash - ld hl, $AAAA ; Escreve no endereco absoluto da flash $2AAA - ld (hl), $55 - ld a, $81 + ld hl, #AAAA ; Escreve no endereco absoluto da flash #2AAA + ld (hl), #55 + ld a, #81 out (IOFW), a ; Mantem modo de gravacao e seleciona pagina 1 da flash - ld hl, $9555 ; Escreve no endereco absoluto da flash $5555 + ld hl, #9555 ; Escreve no endereco absoluto da flash #5555 pop af ld (hl), a ; Envia comando pop hl @@ -610,23 +609,23 @@ flashSendCommand2: ; ---------------------- writeFlash: ld a, (RAMAD2) - ld h, $80 + ld h, #80 call ENASLT ; mem to page 2 (DOS1) ld a, (flashslt) - ld h, $40 + ld h, #40 call ENASLT ; flash to page 1 - ld hl, $8000 ; buffer pointer - ld de, $4000 ; flash pointer + ld hl, #8000 ; buffer pointer + ld de, #4000 ; flash pointer ld b, d ld c, e di .loop: - ld a, $A0 ; Modo de gravacao de dados + ld a, #A0 ; Modo de gravacao de dados call flashSendCommand1 ld a, (actualpage) - or $80 + or #80 out (IOFW), a ; select 16K page in Flash call .gravaByte ; program byte jr nz, .erro ; ERROR. Z = 0 @@ -641,7 +640,7 @@ writeFlash: xor a out (IOFW), a ; Desliga modo gravacao da Flash ld a, (RAMAD1) - ld h, $40 + ld h, #40 call ENASLT ; Mem to PAGE 1 (DOS 1 Compatibility) pop af ret @@ -681,16 +680,16 @@ eraseFlash: ld de, strApagarFlash call print ; Erase Text Show. ld a, (flashslt) - ld h, $40 + ld h, #40 call ENASLT ; set flash in page 1 di ; xor a ; ld (erasedelay), a ; delay de 256 ciclos - ld a, $80 ; Apaga chip + ld a, #80 ; Apaga chip call flashSendCommand1 - ld a, $10 + ld a, #10 call flashSendCommand1 - ld hl, $4000 + ld hl, #4000 ld a, (hl) ld (togglebit), a .loop: ; testa fim do erase por Toggle Bit @@ -704,13 +703,13 @@ eraseFlash: ; call delay ; make programmed delay. ; call delay ; make programmed delay. ; di - ld a, $F0 ; end command. Reset Command. + ld a, #F0 ; end command. Reset Command. call flashSendCommand1 xor a out (IOFW), a ; Desliga modo gravacao da Flash ei ld a, (RAMAD1) - ld h, $40 + ld h, #40 call ENASLT ; set mem to page 1 ld de, strOk call print @@ -759,7 +758,7 @@ cmpHLcomDE: callBdosCE: call BDOS or a - jp nz, error + jp nz, errord ret ; ----------------- @@ -776,7 +775,7 @@ callBdos: ; print error ; call printErro and set DE pointer to error text ; ----------------------------------------------- -error: +errord: ld de, strErro printErro: ld c, _STROUT @@ -789,10 +788,10 @@ printErro: exitok: call closeFile ; close file (open or not) ld a, (RAMAD1) - ld h, $40 + ld h, #40 call ENASLT ; set mem to page 1 ld a, (RAMAD2) - ld h, $80 + ld h, #80 call ENASLT ; set mem to page 2 ld a, (system) cp 3 ; Turbo R? @@ -971,14 +970,16 @@ showList: ld a, (hl) ; pega ID do produto ld (flashIdProd), a ; e salva inc hl - ld de, (hl) ; vamos pegar a string do fabricante + ld e, (hl) ; vamos pegar a string do fabricante + inc hl + ld d, (hl) ld (flashManPoint), de ; e salvar inc hl + ld e, (hl) ; vamos pegar a string do produto inc hl - ld de, (hl) ; vamos pegar a string do produto + ld d, (hl) ld (flashProdPoint), de ; e salvar inc hl - inc hl ld a, (hl) ; vamos pegar o algoritmo ld (flashAlg), a ; e salvar inc hl @@ -1024,14 +1025,16 @@ flashIdent: jr .loop .ok: inc hl - ld de, (hl) ; vamos pegar a string do fabricante + ld e, (hl) ; vamos pegar a string do fabricante + inc hl + ld d, (hl) ld (flashManPoint), de ; e salvar inc hl + ld e, (hl) ; vamos pegar a string do produto inc hl - ld de, (hl) ; vamos pegar a string do produto + ld d, (hl) ld (flashProdPoint), de ; e salvar inc hl - inc hl ld a, (hl) ; vamos pegar o algoritmo ld (flashAlg), a ; e salvar .naoId: @@ -1043,230 +1046,231 @@ flashIdent: ; *** TEXTS *** strTitulo: - .db "SD Mapper flash programmer utility" - .db 13, 10 - .db "(c) 2014 by Fabio Belavenuto" + db "SD Mapper flash programmer utility" + db 13, 10 + db "(c) 2014 by Fabio Belavenuto" ; fall throw strCrLf: - .db 13, 10, '$' + db 13, 10, '$' strHelp: - .db 13, 10 - .db "Usage:", 13, 10 - .db " sdmupd /opts ", 13, 10 - .db "Example: sdmupd DRIVER.ROM", 13, 10 - .db " sdmupd /e", 13, 10 - .db 13, 10 - .db "Options:", 13, 10 - .db " /h : Show this help.", 13, 10 - .db " /l : Show list of supported chips.", 13, 10 - .db " /e : Only erase flash and exit.", 13, 10 - .db '$' + db 13, 10 + db "Usage:", 13, 10 + db " sdmupd /opts ", 13, 10 + db "Example: sdmupd DRIVER.ROM", 13, 10 + db " sdmupd /e", 13, 10 + db 13, 10 + db "Options:", 13, 10 + db " /h : Show this help.", 13, 10 + db " /l : Show list of supported chips.", 13, 10 + db " /e : Only erase flash and exit.", 13, 10 + db '$' strProcuraFlash: - .db "Searching SD Mapper in system ...", 13, 10 - .db '$' + db "Searching SD Mapper in system ...", 13, 10 + db '$' strNaoAchado: - .db "Oops! SD Mapper not Found!!", 13, 10 - .db '$' + db "Oops! SD Mapper not Found!!", 13, 10 + db '$' strAchado: - .db "Found in slot " + db "Found in slot " .slot: - .db '0' - .db " subslot " + db '0' + db " subslot " .subslot: - .db '0:', 13, 10 - .db '$' + db '0:', 13, 10 + db '$' strTraco: - .db " - $" + db " - $" strOk: - .db " OK!", 13, 10 - .db '$' + db " OK!", 13, 10 + db '$' strErro: - .db 13, 10 - .db "ERROR (BDOS)!!!!", 13, 10 - .db '$' + db 13, 10 + db "ERROR (BDOS)!!!!", 13, 10 + db '$' strErroAbrirArq: - .db 13, 10 - .db "ERROR: Problems opening file ...", 13, 10 - .db '$' + db 13, 10 + db "ERROR: Problems opening file ...", 13, 10 + db '$' strTamanhoErrado: - .db 13, 10 - .db "ERROR: File size must be 128KB" - .db 13, 10, '$' + db 13, 10 + db "ERROR: File size must be 128KB" + db 13, 10, '$' strAbrirArq: - .db 13, 10 - .db "Open file : " + db 13, 10 + db "Open file : " .nomearq: - .db " " - .db 13, 10, '$' + db " " + db 13, 10, '$' strApagarFlash: - .db 13, 10 - .db "Erasing Flash " - .db '$' + db 13, 10 + db "Erasing Flash " + db '$' strPonto: - .db '*$' + db '*$' strGravando: - .dw 13, 10 - .db "Loading " - .db '$' + db 13, 10 + db "Loading " + db '$' strErroAoGravarFlash: - .db 13, 10 - .db "ERROR: Problems writing Flash ...", 13, 10 - .db '$' + db 13, 10 + db "ERROR: Problems writing Flash ...", 13, 10 + db '$' strUpdateCompleto: - .db 13, 10 - .db "Flash programmed succesfully.", 13, 10 - .db '$' + db 13, 10 + db "Flash programmed succesfully.", 13, 10 + db '$' strListaCab: - .db 13, 10 - .db "List of supported flash chips:", 13, 10 - .db "------------------------------", 13, 10 - .db '$' + db 13, 10 + db "List of supported flash chips:", 13, 10 + db "------------------------------", 13, 10 + db '$' ; *** TABLES *** -; AT49F002 = $1F $07 alg byte -; AT49F002T = $1F $08 alg byte -; AT49(H)F010 = $1F $17 alg byte -; AT29C010A = $1F $D5 alg 128-page -; AM29F010 = $01 $20 alg byte -; SST29EE010 = $BF $07 alg 128-page -; SST39SF020 = $BF $B6 alg byte -; W49F002U/N = $DA $0B alg byte -; W49F002B = $DA $25 alg byte -; W39F010 = $DA $A1 alg byte +; AT49F002 = #1F #07 alg byte +; AT49F002T = #1F #08 alg byte +; AT49(H)F010 = #1F #17 alg byte +; AT29C010A = #1F #D5 alg 128-page +; AM29F010 = #01 #20 alg byte +; SST29EE010 = #BF #07 alg 128-page +; SST39SF020 = #BF #B6 alg byte +; W49F002U/N = #DA #0B alg byte +; W49F002B = #DA #25 alg byte +; W39F010 = #DA #A1 alg byte ; tblFlash: - .db $1F, $07 - .dw strAtmel - .dw strAt49f002 - .db ALG_BYTE - .db $1F, $08 - .dw strAtmel - .dw strAt49F002t - .db ALG_BYTE - .db $1F, $17 - .dw strAtmel - .dw strAt49f010 - .db ALG_BYTE - .db $1F, $D5 - .dw strAtmel - .dw strAt29c010a - .db ALG_PAGE - .db $01, $20 - .dw strAMD - .dw strAm29F010 - .db ALG_BYTE - .db $BF, $07 - .dw strSST - .dw strSst29ee010 - .db ALG_PAGE - .db $BF, $B6 - .dw strSST - .dw strSst39sf020 - .db ALG_BYTE - .db $DA, $0B - .dw strWinb - .dw strW49f002un - .db ALG_BYTE - .db $DA, $25 - .dw strWinb - .dw strW49f002b - .db ALG_BYTE - .db $DA, $A1 - .dw strWinb - .dw strW39f010 - .db ALG_BYTE - .db $20, $20 - .dw strSTM - .dw strSTM29F010B - .db ALG_PAGE - .db 0 + db #1F, #07 + dw strAtmel + dw strAt49f002 + db ALG_BYTE + db #1F, #08 + dw strAtmel + dw strAt49F002t + db ALG_BYTE + db #1F, #17 + dw strAtmel + dw strAt49f010 + db ALG_BYTE + db #1F, #D5 + dw strAtmel + dw strAt29c010a + db ALG_PAGE + db #01, #20 + dw strAMD + dw strAm29F010 + db ALG_BYTE + db #BF, #07 + dw strSST + dw strSst29ee010 + db ALG_PAGE + db #BF, #B6 + dw strSST + dw strSst39sf020 + db ALG_BYTE + db #DA, #0B + dw strWinb + dw strW49f002un + db ALG_BYTE + db #DA, #25 + dw strWinb + dw strW49f002b + db ALG_BYTE + db #DA, #A1 + dw strWinb + dw strW39f010 + db ALG_BYTE + db #20, #20 + dw strSTM + dw strSTM29F010B + db ALG_PAGE + db 0 strAtmel: - .db "Atmel $" + db "Atmel $" strAMD: - .db "AMD $" + db "AMD $" strSST: - .db "SST $" + db "SST $" strSTM: - .db "STM $" + db "STM $" strWinb: - .db "Winbond $" + db "Winbond $" strAt49f002: - .db "AT49F002$" + db "AT49F002$" strAt49F002t: - .db "AT49F002T$" + db "AT49F002T$" strAt49f010: - .db "AT49F010$" + db "AT49F010$" strAt29c010a: - .db "AT29C010A$" + db "AT29C010A$" strAm29F010: - .db "AM29F010$" + db "AM29F010$" strSst29ee010: - .db "SST29EE010$" + db "SST29EE010$" strSst39sf020: - .db "SST39SF020$" + db "SST39SF020$" strW49f002un: - .db "W49F002U/N$" + db "W49F002U/N$" strW49f002b: - .db "W49F002B$" + db "W49F002B$" strW39f010: - .db "W39F010$" + db "W39F010$" strSTM29F010B: - .db "STM29F010B$" + db "STM29F010B$" ; *** VARIABLES *** -savesp: .dw 0 ; stack pointer -savecpu: .db 0 ; cpu mode in Turbo R -savecursor: .db 0 ; cursor -dos: .db 0 ; dos version -system: .db 0 ; msx version -options: .db 0 ; options variable 1 -pages: .db 0 ; 16 Kb Pages -actualpage: .db 0 ; Temporal page for load -thisslt: .db 0FFh ; sigslot flag -flashslt: .db 0 ; slot for flash -flashIdMan: .db 0 ; Flash Manufacturer ID -flashIdProd: .db 0 ; Flash Product ID -flashAlg .db 0 ; Flash algorithm -flashManPoint: .dw 0 ; Flash manufacturer string pointer -flashProdPoint: .dw 0 ; Flash product string pointer -erasedelay: .db 0 ; tmp variable for loop times delay -togglebit: .db 0 -sizefiletmp: .ds 4 ; tmp variable for READMAX Code -fileHandle: .db 0 ; DOS 2 File Handle -fileNameDOS2: .ds 64 ; Tmp for fileName -fileNameDOS1: .db " " ; DOS1 fileName for DOS1 Code -filenDOS1Ext: .db " " - .ds 4 +savesp: dw 0 ; stack pointer +savecpu: db 0 ; cpu mode in Turbo R +savecursor: db 0 ; cursor +dos: db 0 ; dos version +system: db 0 ; msx version +options: db 0 ; options variable 1 +pages: db 0 ; 16 Kb Pages +actualpage: db 0 ; Temporal page for load +thisslt: db 0FFh ; sigslot flag +flashslt: db 0 ; slot for flash +flashIdMan: db 0 ; Flash Manufacturer ID +flashIdProd: db 0 ; Flash Product ID +flashAlg: db 0 ; Flash algorithm +flashManPoint: dw 0 ; Flash manufacturer string pointer +flashProdPoint: dw 0 ; Flash product string pointer +erasedelay: db 0 ; tmp variable for loop times delay +togglebit: db 0 +sizefiletmp: ds 4 ; tmp variable for READMAX Code +fileHandle: db 0 ; DOS 2 File Handle +fileNameDOS2: ds 64 ; Tmp for fileName +fileNameDOS1: db " " ; DOS1 fileName for DOS1 Code +filenDOS1Ext: db " " + ds 4 ; *** FCB DOS 1 *** FCB: -unidad: .db 0 -fileName: .ds 8 -extname: .ds 3 - .dw 0 -registro: .dw 0 -sizefile: .ds 4 - .ds 13 +unidad: db 0 +fileName: ds 8 +extname: ds 3 + dw 0 +registro: dw 0 +sizefile: ds 4 + ds 13 sizeread: - .ds 4 - .db 0 + ds 4 + db 0 +end diff --git a/updater/sdmupd.com b/updater/sdmupd.com deleted file mode 100644 index 898bd3b..0000000 Binary files a/updater/sdmupd.com and /dev/null differ