diff --git a/utils/Makefile b/utils/Makefile index 060e96c..a02f85a 100644 --- a/utils/Makefile +++ b/utils/Makefile @@ -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=$@ $< diff --git a/utils/Print.inc b/utils/Print.inc index b73e491..8361278 100644 --- a/utils/Print.inc +++ b/utils/Print.inc @@ -1,3 +1,5 @@ +; Print.inc +; ; SPDX-FileCopyrightText: Copyright (C) 2019, 2021 Antonio Villena ; ; SPDX-License-Identifier: GPL-3.0-only diff --git a/utils/back16m.asm b/utils/back16m.asm index a47e4e4..0bb5114 100644 --- a/utils/back16m.asm +++ b/utils/back16m.asm @@ -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 diff --git a/utils/back32m.asm b/utils/back32m.asm index 38d9833..357b5db 100644 --- a/utils/back32m.asm +++ b/utils/back32m.asm @@ -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 diff --git a/utils/backup.asm b/utils/backup.asm index a1c35f1..57957b4 100644 --- a/utils/backup.asm +++ b/utils/backup.asm @@ -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 diff --git a/utils/corclean.asm b/utils/corclean.asm index 2bc08aa..f935b85 100644 --- a/utils/corclean.asm +++ b/utils/corclean.asm @@ -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 diff --git a/utils/corebios.asm b/utils/corebios.asm index 756bdf2..8728d06 100644 --- a/utils/corebios.asm +++ b/utils/corebios.asm @@ -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 diff --git a/utils/esxdos.def b/utils/esxdos.def index 1621eda..2f712c4 100644 --- a/utils/esxdos.def +++ b/utils/esxdos.def @@ -7,6 +7,9 @@ ; Compatible compilers: ; 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 diff --git a/utils/rdflsh.inc b/utils/rdflsh.inc new file mode 100644 index 0000000..53e235d --- /dev/null +++ b/utils/rdflsh.inc @@ -0,0 +1,55 @@ +; rdflsh.inc +; +; SPDX-FileCopyrightText: Copyright (C) 2019, 2021 Antonio Villena +; +; SPDX-License-Identifier: GPL-3.0-only + +; Compatible compilers: +; 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 diff --git a/utils/romsback.asm b/utils/romsback.asm index 82ba681..948a5e6 100644 --- a/utils/romsback.asm +++ b/utils/romsback.asm @@ -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 diff --git a/utils/romsupgr.asm b/utils/romsupgr.asm index 663853d..da9e359 100644 --- a/utils/romsupgr.asm +++ b/utils/romsupgr.asm @@ -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 diff --git a/utils/zxuno.def b/utils/zxuno.def index 9f0b12a..f5faa92 100644 --- a/utils/zxuno.def +++ b/utils/zxuno.def @@ -7,6 +7,9 @@ ; Compatible compilers: ; 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