From 46f5d18b8bc55a68c5a9b752c150b649ad346547 Mon Sep 17 00:00:00 2001 From: Ivan Tatarinov Date: Sat, 24 Apr 2021 20:46:41 +0300 Subject: [PATCH] utils: separated `Print` function into `Print.inc` file --- utils/Makefile | 12 ++++++++++++ utils/Print.inc | 15 +++++++++++++++ utils/back16m.asm | 9 +-------- utils/back32m.asm | 9 +-------- utils/backup.asm | 9 +-------- utils/corclean.asm | 9 +-------- utils/corebios.asm | 9 +-------- utils/romsback.asm | 9 +-------- utils/romsupgr.asm | 9 +-------- utils/upgr16m.asm | 9 +-------- utils/upgr32m.asm | 9 +-------- utils/upgrade.asm | 9 +-------- 12 files changed, 37 insertions(+), 80 deletions(-) create mode 100644 utils/Print.inc diff --git a/utils/Makefile b/utils/Makefile index 0c2a7f2..060e96c 100644 --- a/utils/Makefile +++ b/utils/Makefile @@ -40,12 +40,14 @@ $(BUILD_DIR): $(BUILD_DIR)/BACK16M: back16m.asm\ zxuno.def\ esxdos.def\ + Print.inc\ | $(BUILD_DIR) $(AS) $(AFLAGS) --raw=$@ $< $(BUILD_DIR)/BACKZX2: back32m.asm\ zxuno.def\ esxdos.def\ + Print.inc\ | $(BUILD_DIR) echo ' define zxdos 1' >back32m.def $(AS) $(AFLAGS) --raw=$@ $< @@ -54,6 +56,7 @@ $(BUILD_DIR)/BACKZX2: back32m.asm\ $(BUILD_DIR)/BACKZXD: back32m.asm\ zxuno.def\ esxdos.def\ + Print.inc\ | $(BUILD_DIR) echo ' define zxdos 0' >back32m.def $(AS) $(AFLAGS) --raw=$@ $< @@ -62,41 +65,48 @@ $(BUILD_DIR)/BACKZXD: back32m.asm\ $(BUILD_DIR)/BACKUP: backup.asm\ zxuno.def\ esxdos.def\ + Print.inc\ | $(BUILD_DIR) $(AS) $(AFLAGS) --raw=$@ $< $(BUILD_DIR)/CORCLEAN: corclean.asm\ zxuno.def\ + Print.inc\ | $(BUILD_DIR) $(AS) $(AFLAGS) --raw=$@ $< $(BUILD_DIR)/COREBIOS: corebios.asm\ zxuno.def\ esxdos.def\ + Print.inc\ | $(BUILD_DIR) $(AS) $(AFLAGS) --raw=$@ $< $(BUILD_DIR)/ROMSBACK: romsback.asm\ zxuno.def\ esxdos.def\ + Print.inc\ | $(BUILD_DIR) $(AS) $(AFLAGS) --raw=$@ $< $(BUILD_DIR)/ROMSUPGR: romsupgr.asm\ zxuno.def\ esxdos.def\ + Print.inc\ | $(BUILD_DIR) $(AS) $(AFLAGS) --raw=$@ $< $(BUILD_DIR)/UPGR16M: upgr16m.asm\ zxuno.def\ esxdos.def\ + Print.inc\ | $(BUILD_DIR) $(AS) $(AFLAGS) --raw=$@ $< $(BUILD_DIR)/UPGRZX2: upgr32m.asm\ zxuno.def\ esxdos.def\ + Print.inc\ | $(BUILD_DIR) echo ' define zxdos 1' >upgr32m.def $(AS) $(AFLAGS) --raw=$@ $< @@ -105,6 +115,7 @@ $(BUILD_DIR)/UPGRZX2: upgr32m.asm\ $(BUILD_DIR)/UPGRZXD: upgr32m.asm\ zxuno.def\ esxdos.def\ + Print.inc\ | $(BUILD_DIR) echo ' define zxdos 0' >upgr32m.def $(AS) $(AFLAGS) --raw=$@ $< @@ -113,6 +124,7 @@ $(BUILD_DIR)/UPGRZXD: upgr32m.asm\ $(BUILD_DIR)/UPGRADE: upgrade.asm\ zxuno.def\ esxdos.def\ + Print.inc\ | $(BUILD_DIR) $(AS) $(AFLAGS) --raw=$@ $< diff --git a/utils/Print.inc b/utils/Print.inc new file mode 100644 index 0000000..b73e491 --- /dev/null +++ b/utils/Print.inc @@ -0,0 +1,15 @@ +; SPDX-FileCopyrightText: Copyright (C) 2019, 2021 Antonio Villena +; +; SPDX-License-Identifier: GPL-3.0-only + +; Compatible compilers: +; SJAsmPlus, + +Print pop hl + db $3e ; ld a,$nn +Print1 rst $10 ; db $d7 + ld a, (hl) + inc hl + or a + jr nz, Print1 + jp (hl) diff --git a/utils/back16m.asm b/utils/back16m.asm index ebc5b38..a47e4e4 100644 --- a/utils/back16m.asm +++ b/utils/back16m.asm @@ -118,14 +118,7 @@ WriteOK ld de, $0040 dz 13, 'Backup complete' ret -Print pop hl - db $3e -Print1 rst $10 - ld a, (hl) - inc hl - or a - jr nz, Print1 - jp (hl) + include Print.inc ; ------------------------ ; Read from SPI flash diff --git a/utils/back32m.asm b/utils/back32m.asm index 24e472a..38d9833 100644 --- a/utils/back32m.asm +++ b/utils/back32m.asm @@ -152,14 +152,7 @@ WriteOK ld de, $0040 jr nc, Bucle ret -Print pop hl - db $3e -Print1 rst $10 - ld a, (hl) - inc hl - or a - jr nz, Print1 - jp (hl) + include Print.inc ; ------------------------ ; Read from SPI flash diff --git a/utils/backup.asm b/utils/backup.asm index f292dfe..a1c35f1 100644 --- a/utils/backup.asm +++ b/utils/backup.asm @@ -102,14 +102,7 @@ WriteOK ld de, $0040 dz 13, 'Backup complete' ret -Print pop hl - db $3e -Print1 rst $10 - ld a, (hl) - inc hl - or a - jr nz, Print1 - jp (hl) + include Print.inc ; ------------------------ ; Read from SPI flash diff --git a/utils/corclean.asm b/utils/corclean.asm index 130ecd7..2bc08aa 100644 --- a/utils/corclean.asm +++ b/utils/corclean.asm @@ -72,14 +72,7 @@ normal ld a, 0 out (c), a ret -Print pop hl - db $3e -Print1 rst $10 - ld a, (hl) - inc hl - or a - jr nz, Print1 - jp (hl) + include Print.inc ; ------------------------ ; Read from SPI flash diff --git a/utils/corebios.asm b/utils/corebios.asm index 52b7c6e..756bdf2 100644 --- a/utils/corebios.asm +++ b/utils/corebios.asm @@ -130,14 +130,7 @@ normal ld a, 0 out (c), a ret -Print pop hl - db $3e -Print1 rst $10 - ld a, (hl) - inc hl - or a - jr nz, Print1 - jp (hl) + include Print.inc ; ------------------------ ; Read from SPI flash diff --git a/utils/romsback.asm b/utils/romsback.asm index 701262e..82ba681 100644 --- a/utils/romsback.asm +++ b/utils/romsback.asm @@ -152,14 +152,7 @@ wrear0 wreg flash_cs, 0 ; activamos spi, enviando un 0 wreg flash_cs, 1 ; desactivamos spi, enviando un 1 ret -Print pop hl - db $3e -Print1 rst $10 - ld a, (hl) - inc hl - or a - jr nz, Print1 - jp (hl) + include Print.inc ; ------------------------ ; Read from SPI flash diff --git a/utils/romsupgr.asm b/utils/romsupgr.asm index 7b06127..663853d 100644 --- a/utils/romsupgr.asm +++ b/utils/romsupgr.asm @@ -179,14 +179,7 @@ wrear0 wreg flash_cs, 0 ; activamos spi, enviando un 0 wreg flash_cs, 1 ; desactivamos spi, enviando un 1 ret -Print pop hl - db $3e -Print1 rst $10 - ld a, (hl) - inc hl - or a - jr nz, Print1 - jp (hl) + include Print.inc ; ------------------------ ; Read from SPI flash diff --git a/utils/upgr16m.asm b/utils/upgr16m.asm index c6d7f9d..74976ff 100644 --- a/utils/upgr16m.asm +++ b/utils/upgr16m.asm @@ -124,14 +124,7 @@ ReadOK ld a, $40 dz 13, 'Upgrade complete' ret -Print pop hl - db $3e -Print1 rst $10 - ld a, (hl) - inc hl - or a - jr nz, Print1 - jp (hl) + include Print.inc ; ------------------------ ; Write to SPI flash diff --git a/utils/upgr32m.asm b/utils/upgr32m.asm index 05f37d8..debf9be 100644 --- a/utils/upgr32m.asm +++ b/utils/upgr32m.asm @@ -157,14 +157,7 @@ ReadOK ld a, $40 jr nz, Bucle ret -Print pop hl - db $3e -Print1 rst $10 - ld a, (hl) - inc hl - or a - jr nz, Print1 - jp (hl) + include Print.inc ; ------------------------ ; Write to SPI flash diff --git a/utils/upgrade.asm b/utils/upgrade.asm index de2c706..088ab52 100644 --- a/utils/upgrade.asm +++ b/utils/upgrade.asm @@ -107,14 +107,7 @@ ReadOK ld a, $40 dz 13, 'Upgrade complete' ret -Print pop hl - db $3e -Print1 rst $10 - ld a, (hl) - inc hl - or a - jr nz, Print1 - jp (hl) + include Print.inc ; ------------------------ ; Write to SPI flash