Skip to content

Commit

Permalink
Merge pull request #52 from ivan-tat/master
Browse files Browse the repository at this point in the history
utils: separated `rdflsh` function into `rdflsh.inc` file
  • Loading branch information
ivan-tat authored Apr 24, 2021
2 parents aa3c0d1 + d8b2b69 commit e5f4812
Show file tree
Hide file tree
Showing 12 changed files with 82 additions and 315 deletions.
8 changes: 8 additions & 0 deletions utils/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,15 @@ $(BUILD_DIR)/BACK16M: back16m.asm\
zxuno.def\
esxdos.def\
Print.inc\
rdflsh.inc\
| $(BUILD_DIR)
$(AS) $(AFLAGS) --raw=$@ $<

$(BUILD_DIR)/BACKZX2: back32m.asm\
zxuno.def\
esxdos.def\
Print.inc\
rdflsh.inc\
| $(BUILD_DIR)
echo ' define zxdos 1' >back32m.def
$(AS) $(AFLAGS) --raw=$@ $<
Expand All @@ -57,6 +59,7 @@ $(BUILD_DIR)/BACKZXD: back32m.asm\
zxuno.def\
esxdos.def\
Print.inc\
rdflsh.inc\
| $(BUILD_DIR)
echo ' define zxdos 0' >back32m.def
$(AS) $(AFLAGS) --raw=$@ $<
Expand All @@ -66,33 +69,38 @@ $(BUILD_DIR)/BACKUP: backup.asm\
zxuno.def\
esxdos.def\
Print.inc\
rdflsh.inc\
| $(BUILD_DIR)
$(AS) $(AFLAGS) --raw=$@ $<

$(BUILD_DIR)/CORCLEAN: corclean.asm\
zxuno.def\
Print.inc\
rdflsh.inc\
| $(BUILD_DIR)
$(AS) $(AFLAGS) --raw=$@ $<

$(BUILD_DIR)/COREBIOS: corebios.asm\
zxuno.def\
esxdos.def\
Print.inc\
rdflsh.inc\
| $(BUILD_DIR)
$(AS) $(AFLAGS) --raw=$@ $<

$(BUILD_DIR)/ROMSBACK: romsback.asm\
zxuno.def\
esxdos.def\
Print.inc\
rdflsh.inc\
| $(BUILD_DIR)
$(AS) $(AFLAGS) --raw=$@ $<

$(BUILD_DIR)/ROMSUPGR: romsupgr.asm\
zxuno.def\
esxdos.def\
Print.inc\
rdflsh.inc\
| $(BUILD_DIR)
$(AS) $(AFLAGS) --raw=$@ $<

Expand Down
2 changes: 2 additions & 0 deletions utils/Print.inc
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
; Print.inc
;
; SPDX-FileCopyrightText: Copyright (C) 2019, 2021 Antonio Villena
;
; SPDX-License-Identifier: GPL-3.0-only
Expand Down
46 changes: 1 addition & 45 deletions utils/back16m.asm
Original file line number Diff line number Diff line change
Expand Up @@ -119,51 +119,7 @@ WriteOK ld de, $0040
ret

include Print.inc

; ------------------------
; Read from SPI flash
; Parameters:
; DE: destination address
; HL: source address without last byte
; A: number of pages (256 bytes) to read
; ------------------------
rdflsh ex af, af'
xor a
push hl
wreg flash_cs, 0 ; activamos spi, enviando un 0
wreg flash_spi, 3 ; envio flash_spi un 3, orden de lectura
pop hl
push hl
out (c), h
out (c), l
out (c), a
ex af, af'
ex de, hl
in f, (c)
rdfls1 ld e, $20
rdfls2 ini
inc b
ini
inc b
ini
inc b
ini
inc b
ini
inc b
ini
inc b
ini
inc b
ini
inc b
dec e
jr nz, rdfls2
dec a
jr nz, rdfls1
wreg flash_cs, 1
pop hl
ret
include rdflsh.inc

rst28 ld bc, zxuno_port + $100
pop hl
Expand Down
46 changes: 1 addition & 45 deletions utils/back32m.asm
Original file line number Diff line number Diff line change
Expand Up @@ -153,51 +153,7 @@ WriteOK ld de, $0040
ret

include Print.inc

; ------------------------
; Read from SPI flash
; Parameters:
; DE: destination address
; HL: source address without last byte
; A: number of pages (256 bytes) to read
; ------------------------
rdflsh ex af, af'
xor a
push hl
wreg flash_cs, 0 ; activamos spi, enviando un 0
wreg flash_spi, 3 ; envio flash_spi un 3, orden de lectura
pop hl
push hl
out (c), h
out (c), l
out (c), a
ex af, af'
ex de, hl
in f, (c)
rdfls1 ld e, $20
rdfls2 ini
inc b
ini
inc b
ini
inc b
ini
inc b
ini
inc b
ini
inc b
ini
inc b
ini
inc b
dec e
jr nz, rdfls2
dec a
jr nz, rdfls1
wreg flash_cs, 1
pop hl
ret
include rdflsh.inc

rst28 ld bc, zxuno_port + $100
pop hl
Expand Down
46 changes: 1 addition & 45 deletions utils/backup.asm
Original file line number Diff line number Diff line change
Expand Up @@ -103,51 +103,7 @@ WriteOK ld de, $0040
ret

include Print.inc

; ------------------------
; Read from SPI flash
; Parameters:
; DE: destination address
; HL: source address without last byte
; A: number of pages (256 bytes) to read
; ------------------------
rdflsh ex af, af'
xor a
push hl
wreg flash_cs, 0 ; activamos spi, enviando un 0
wreg flash_spi, 3 ; envio flash_spi un 3, orden de lectura
pop hl
push hl
out (c), h
out (c), l
out (c), a
ex af, af'
ex de, hl
in f, (c)
rdfls1 ld e, $20
rdfls2 ini
inc b
ini
inc b
ini
inc b
ini
inc b
ini
inc b
ini
inc b
ini
inc b
ini
inc b
dec e
jr nz, rdfls2
dec a
jr nz, rdfls1
wreg flash_cs, 1
pop hl
ret
include rdflsh.inc

rst28 ld bc, zxuno_port + $100
pop hl
Expand Down
46 changes: 1 addition & 45 deletions utils/corclean.asm
Original file line number Diff line number Diff line change
Expand Up @@ -73,51 +73,7 @@ normal ld a, 0
ret

include Print.inc

; ------------------------
; Read from SPI flash
; Parameters:
; DE: destination address
; HL: source address without last byte
; A: number of pages (256 bytes) to read
; ------------------------
rdflsh ex af, af'
xor a
push hl
wreg flash_cs, 0 ; activamos spi, enviando un 0
wreg flash_spi, 3 ; envio flash_spi un 3, orden de lectura
pop hl
push hl
out (c), h
out (c), l
out (c), a
ex af, af'
ex de, hl
in f, (c)
rdfls1 ld e, $20
rdfls2 ini
inc b
ini
inc b
ini
inc b
ini
inc b
ini
inc b
ini
inc b
ini
inc b
ini
inc b
dec e
jr nz, rdfls2
dec a
jr nz, rdfls1
wreg flash_cs, 1
pop hl
ret
include rdflsh.inc

; ------------------------
; Write to SPI flash
Expand Down
46 changes: 1 addition & 45 deletions utils/corebios.asm
Original file line number Diff line number Diff line change
Expand Up @@ -131,51 +131,7 @@ normal ld a, 0
ret

include Print.inc

; ------------------------
; Read from SPI flash
; Parameters:
; DE: destination address
; HL: source address without last byte
; A: number of pages (256 bytes) to read
; ------------------------
rdflsh ex af, af'
xor a
push hl
wreg flash_cs, 0 ; activamos spi, enviando un 0
wreg flash_spi, 3 ; envio flash_spi un 3, orden de lectura
pop hl
push hl
out (c), h
out (c), l
out (c), a
ex af, af'
ex de, hl
in f, (c)
rdfls1 ld e, $20
rdfls2 ini
inc b
ini
inc b
ini
inc b
ini
inc b
ini
inc b
ini
inc b
ini
inc b
ini
inc b
dec e
jr nz, rdfls2
dec a
jr nz, rdfls1
wreg flash_cs, 1
pop hl
ret
include rdflsh.inc

; ------------------------
; Write to SPI flash
Expand Down
5 changes: 5 additions & 0 deletions utils/esxdos.def
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
; Compatible compilers:
; SJAsmPlus, <https://github.com/sjasmplus/sjasmplus/>

ifndef esxdos_def_included
define esxdos_def_included

define FA_READ 0x01
define FA_WRITE 0x02
define FA_OPEN_AL 0x08
Expand All @@ -21,3 +24,5 @@
rst $08
defb dato
endm

endif ; !esxdos_def_included
Loading

0 comments on commit e5f4812

Please sign in to comment.