utils: used `esxdos` macro when possible

This commit is contained in:
Ivan Tatarinov 2021-04-24 20:01:38 +03:00
parent 0d09f30e80
commit 363ea0a7a3
3 changed files with 15 additions and 30 deletions

View File

@ -54,16 +54,14 @@ normal ld a, 0
out (c), a
ret
init xor a
rst $08
db M_GETSETDRV ; A = unidad actual
esxdos M_GETSETDRV ; A = unidad actual
jr nc, SDCard
call Print
dz 'SD card not inserted'
ret
SDCard ld b, FA_WRITE | FA_OPEN_AL ; B = modo de apertura
ld hl, FileName ; HL = Puntero al nombre del fichero (ASCIIZ)
rst $08
db F_OPEN
esxdos F_OPEN
ld (handle+1), a
jr nc, FileFound
call Print
@ -87,8 +85,7 @@ Bucle push hl
punto ld hl, $8000
ld bc, $4000
handle ld a, 0
rst $08
db F_WRITE
esxdos F_WRITE
pop hl
jr nc, WriteOK
call Print
@ -98,8 +95,7 @@ WriteOK ld de, $0040
add hl, de
bit 6, h
jr z, Bucle
rst $08
db F_CLOSE
esxdos F_CLOSE
call Print
dz 13, 'Backup complete'
ret

View File

@ -45,8 +45,7 @@ Nonlock ld a, scandbl_ctrl
or $80
out (c), a
xor a
rst $08
db M_GETSETDRV ; A = unidad actual
esxdos M_GETSETDRV ; A = unidad actual
jr nc, SDCard
call Print
dz 'SD card not inserted'
@ -54,8 +53,7 @@ Nonlock ld a, scandbl_ctrl
SDCard ld (drive+1), a
ld b, FA_READ ; B = modo de apertura
ld hl, FileCore ; HL = Puntero al nombre del fichero (ASCIIZ)
rst $08
db F_OPEN
esxdos F_OPEN
jr nc, FileFound
call Print
dz 'File SPECTRUM.ZX1 not found'
@ -64,8 +62,7 @@ FileFound ld (handle2+1), a
drive: ld a, 0
ld b, FA_READ ; B = modo de apertura
ld hl, FileBios ; HL = Puntero al nombre del fichero (ASCIIZ)
rst $08
db F_OPEN
esxdos F_OPEN
jr nc, FileFound2
call Print
dz 'File FIRMWARE.ZX1 not found'
@ -78,15 +75,13 @@ FileFound2 ld (handle+1), a
ld hl, $8000
ld bc, $4000
handle ld a, 0
rst $08
db F_READ
esxdos F_READ
jr nc, GoodRead
call Print
dz 'Error reading FIRMWARE.ZX1'
ret
GoodRead ld a, (handle+1)
rst $08
db F_CLOSE
esxdos F_CLOSE
ld a, $40
ld hl, $8000
exx
@ -107,8 +102,7 @@ Bucle ld a, ixl
punto ld hl, $8000
ld bc, $4000
handle2: ld a, 0
rst $08
db F_READ
esxdos F_READ
jr nc, GoodRead2
call Print
dz 'Error reading SPECTRUM.ZX1'
@ -122,8 +116,7 @@ GoodRead2 ld a, $40
dec ixl
jr nz, Bucle
ld a, (handle2+1)
rst $08
db F_CLOSE
esxdos F_CLOSE
call Print
dz 13, 'Upgrade complete', 13
ld bc, zxuno_port

View File

@ -54,16 +54,14 @@ normal ld a, 0
out (c), a
ret
init xor a
rst $08
db M_GETSETDRV ; A = unidad actual
esxdos M_GETSETDRV ; A = unidad actual
jr nc, SDCard
call Print
dz 'SD card not inserted'
ret
SDCard ld b, FA_READ ; B = modo de apertura
ld hl, FileName ; HL = Puntero al nombre del fichero (ASCIIZ)
rst $08
db F_OPEN
esxdos F_OPEN
ld (handle+1), a
jr nc, FileFound
call Print
@ -88,8 +86,7 @@ Bucle ld a, ixl
punto ld hl, $8000
ld bc, $4000
handle ld a, 0
rst $08
db F_READ
esxdos F_READ
jr nc, ReadOK
call Print
dz 'Read Error'
@ -103,8 +100,7 @@ ReadOK ld a, $40
dec ixl
jr nz, Bucle
ld a, (handle+1)
rst $08
db F_CLOSE
esxdos F_CLOSE
call Print
dz 13, 'Upgrade complete'
ret