Merge pull request #52 from ivan-tat/master

utils: separated `rdflsh` function into `rdflsh.inc` file
This commit is contained in:
Ivan Tatarinov 2021-04-24 21:23:55 +03:00 committed by GitHub
commit e5f4812081
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 82 additions and 315 deletions

View File

@ -41,6 +41,7 @@ $(BUILD_DIR)/BACK16M: back16m.asm\
zxuno.def\
esxdos.def\
Print.inc\
rdflsh.inc\
| $(BUILD_DIR)
$(AS) $(AFLAGS) --raw=$@ $<
@ -48,6 +49,7 @@ $(BUILD_DIR)/BACKZX2: back32m.asm\
zxuno.def\
esxdos.def\
Print.inc\
rdflsh.inc\
| $(BUILD_DIR)
echo ' define zxdos 1' >back32m.def
$(AS) $(AFLAGS) --raw=$@ $<
@ -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=$@ $<
@ -66,12 +69,14 @@ $(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=$@ $<
@ -79,6 +84,7 @@ $(BUILD_DIR)/COREBIOS: corebios.asm\
zxuno.def\
esxdos.def\
Print.inc\
rdflsh.inc\
| $(BUILD_DIR)
$(AS) $(AFLAGS) --raw=$@ $<
@ -86,6 +92,7 @@ $(BUILD_DIR)/ROMSBACK: romsback.asm\
zxuno.def\
esxdos.def\
Print.inc\
rdflsh.inc\
| $(BUILD_DIR)
$(AS) $(AFLAGS) --raw=$@ $<
@ -93,6 +100,7 @@ $(BUILD_DIR)/ROMSUPGR: romsupgr.asm\
zxuno.def\
esxdos.def\
Print.inc\
rdflsh.inc\
| $(BUILD_DIR)
$(AS) $(AFLAGS) --raw=$@ $<

View File

@ -1,3 +1,5 @@
; Print.inc
;
; SPDX-FileCopyrightText: Copyright (C) 2019, 2021 Antonio Villena
;
; SPDX-License-Identifier: GPL-3.0-only

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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
@ -21,3 +24,5 @@
rst $08
defb dato
endm
endif ; !esxdos_def_included

55
utils/rdflsh.inc Normal file
View File

@ -0,0 +1,55 @@
; rdflsh.inc
;
; SPDX-FileCopyrightText: Copyright (C) 2019, 2021 Antonio Villena
;
; SPDX-License-Identifier: GPL-3.0-only
; Compatible compilers:
; SJAsmPlus, <https://github.com/sjasmplus/sjasmplus/>
include zxuno.def
; ------------------------
; 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

View File

@ -153,51 +153,7 @@ wrear0 wreg flash_cs, 0 ; activamos spi, enviando un 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
rst28 ld bc, zxuno_port + $100
pop hl

View File

@ -180,51 +180,7 @@ wrear0 wreg flash_cs, 0 ; activamos spi, enviando un 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

View File

@ -7,6 +7,9 @@
; Compatible compilers:
; SJAsmPlus, <https://github.com/sjasmplus/sjasmplus/>
ifndef zxuno_def_included
define zxuno_def_included
define zxuno_port $fc3b
define master_conf 0
define master_mapper 1
@ -44,3 +47,5 @@
call rst28
defb dir, dato
endm
endif ; !zxuno_def_included