Fix SFD700 build failures caused by Glass assembler IF scope limitations

Glass Z80 assembler (v0.5.1) makes labels inside IF blocks invisible from
outside those blocks. This caused multiple build failures for the SFD700
target:

- JP _PRTMZF/_PRTDBG in jump table: replaced with DB 0C3H + DW encoding
  which resolves same-condition scope forward references via DW
- LD DE,MSG* across IF scopes: created LDDE macro (DB 011H + DW) that
  produces identical machine code to LD DE,nn for all build targets
- SFD700 command table (CMDTABLE2): moved after all INCLUDE statements
  so DW function references resolve as backward same-scope references
- Removed FD/FDDIR entry from SFD700 command table — FDDIR only exists
  for ROMDISK/picoZ80 builds (MZ-700 WD1773 FDC direct access)
- Fixed PRTSTR→PRINTMSG undefined symbol in rfs_bank7.asm
- Fixed BUILD_PICOZ80 comment (was incorrectly labelled as SFD700)

All three build targets (ROMDISK, SFD700, picoZ80) verified clean.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Philip Smart
2026-03-28 22:55:26 +00:00
parent 0bdc2f83c5
commit dbfa22baa4
8 changed files with 183 additions and 162 deletions

View File

@@ -1,3 +1,11 @@
; Load DE with immediate value, using DB+DW encoding to work around Glass
; assembler forward reference scope limitation with LD instruction.
; DB 011H + DW nn produces identical machine code to LD DE,nn.
LDDE: MACRO ?val
DB 011H
DW ?val
ENDM
; the following is only to get the original length of 2048 bytes ; the following is only to get the original length of 2048 bytes
ALIGN: MACRO ?boundary ALIGN: MACRO ?boundary
DS ?boundary - 1 - ($ + ?boundary - 1) % ?boundary, 0FFh DS ?boundary - 1 - ($ + ?boundary - 1) % ?boundary, 0FFh

View File

@@ -52,7 +52,7 @@ VIDEOMODULE_ENA EQU 0 ; Targe
; to the target. ; to the target.
BUILD_ROMDISK EQU 0 ; RFS is built for the MZ-80A RomDisk card. BUILD_ROMDISK EQU 0 ; RFS is built for the MZ-80A RomDisk card.
BUILD_SFD700 EQU 0 ; RFS is built for the SFD700 Floppy Disk Controller. BUILD_SFD700 EQU 0 ; RFS is built for the SFD700 Floppy Disk Controller.
BUILD_PICOZ80 EQU 1 ; RFS is built for the SFD700 Floppy Disk Controller. BUILD_PICOZ80 EQU 1 ; RFS is built for the picoZ80 board.
BUILD_MZ80A EQU 0 ; RFS is customised to operate on an MZ-80A. BUILD_MZ80A EQU 0 ; RFS is customised to operate on an MZ-80A.
BUILD_MZ700 EQU 1 ; RFS is customised to operate on an MZ-700. BUILD_MZ700 EQU 1 ; RFS is customised to operate on an MZ-700.

View File

@@ -48,111 +48,6 @@
; Bring in additional resources. ; Bring in additional resources.
INCLUDE "rfs_definitions.asm" INCLUDE "rfs_definitions.asm"
IF BUILD_SFD700 = 1
ORG 0E000H
ALIGN 0E300H
ENDIF
; Monitor command table (SFD700). This table contains the list of recognised commands along with the
; handler function and bank in which it is located.
;
; 7 6:3 2:0
; MATCH BANK SIZE
CMDTABLE2: IF BUILD_SFD700 = 1
DB 000H | 038H | 003H
DB "ASM" ; Assembler.
DW ASM_MAIN
DB 000H | 000H | 005H
DB "BASIC" ; Load and run BASIC SA-5510.
DW LOADBASIC
DB 000H | 020H | 001H
DB 'B' ; Bell.
DW SGX
DB 000H | 000H | 003H
DB "CPM" ; Load and run CPM.
DW LOADCPM
DB 000H | 018H | 002H
DB "CP" ; Copy Memory.
DW MCOPY
DB 000H | 018H | 003H
DB "DUC" ; Dump SD Card file contents (hex or text).
DW DUMPSDCARD
DB 000H | 018H | 001H
DB 'C' ; Clear Memory.
DW INITMEMX
DB 000H | 038H | 004H
DB "DASM" ; Disassembler.
DW DASM_MAIN
DB 000H | 018H | 001H
DB 'D' ; Dump Memory.
DW DUMPX
DB 000H | 008H | 002H
DB "FL" ; 'FL' RFS Floppy load.
DW FDCK
DB 000H | 008H | 002H
DB "FD" ; 'FD' Floppy directory.
DW FDDIR
DB 000H | 058H | 001H
DB 'H' ; Help screen (bank 11).
DW HELP
DB 000H | 018H | 002H ; Bank 3, 2-char command.
DB "IN" ; I/O port input.
DW INX
DB 000H | 000H | 002H
DB "IR" ; List ROM directory.
DW DIRROM
DB 000H | 000H | 001H
DB 'J' ; Jump to address.
DW GOTOX
DB 000H | 020H | 004H
DB "LTNX" ; Load from CMT without auto execution.
DW LOADTAPENX
DB 000H | 020H | 002H
DB "LT" ; Load from CMT
DW LOADTAPE
DB 000H | 000H | 004H
DB "LRNX" ; Load from ROM without auto execution.
DW LOADROMNX
DB 000H | 000H | 002H
DB "LR" ; Load from ROM
DW LOADROM
DB 000H | 020H | 001H
DB "L" ; Original Load from CMT
DW LOADTAPE
DB 000H | 018H | 001H
DB 'M' ; Edit Memory.
DW MCORX
DB 000H | 018H | 003H ; Bank 3, 3-char command.
DB "OUT" ; I/O port output.
DW OUTX
DB 000H | 018H | 001H
DB 'P' ; Printer test.
DW PTESTX
DB 000H | 020H | 001H
DB 'R' ; Memory test.
DW MEMTEST
DB 000H | 020H | 002H
DB "ST" ; Save to CMT
DW SAVEX
DB 000H | 020H | 001H
DB 'S' ; Save to CMT
DW SAVEX
DB 000H | 000H | 004H
DB "TEST" ; A test function used in debugging.
DW LOCALTEST
DB 000H | 020H | 001H
DB 'T' ; Timer test.
DW TIMERTST
DB 000H | 000H | 001H
DB 'V' ; Verify CMT Save.
DW VRFYX
DB 0FFH ; END OF TABLE
ENDIF
IF BUILD_SFD700 = 1
ALIGN UROMADDR
ENDIF
;============================================================ ;============================================================
; ;
; USER ROM BANK 0 - Main RFS Entry point and functions. ; USER ROM BANK 0 - Main RFS Entry point and functions.
@@ -269,8 +164,18 @@ _PRTDBG: LD HL,RFSJMPTABLE+3 ; Bank
; Enhanced function Jump table. ; Enhanced function Jump table.
; This table is generally used by the monitor ROM to call functions within the User ROM. ; This table is generally used by the monitor ROM to call functions within the User ROM.
;------------------------------------------------------------------------------------------ ;------------------------------------------------------------------------------------------
IF BUILD_ROMDISK+BUILD_PICOZ80 = 1
PRTMZF: JP _PRTMZF ; UROMADDR+A0H - Print out an MZF header stored in the IBUFE location. PRTMZF: JP _PRTMZF ; UROMADDR+A0H - Print out an MZF header stored in the IBUFE location.
PRTDBG: JP _PRTDBG ; UROMADDR+A3H - Print out debug information, if enabled. PRTDBG: JP _PRTDBG ; UROMADDR+A3H - Print out debug information, if enabled.
ENDIF
IF BUILD_SFD700 = 1
; SFD700: Use DB+DW encoding for JP — Glass cannot resolve forward
; references to labels in IF scope blocks via JP instruction.
PRTMZF: DB 0C3H ; JP _PRTMZF
DW _PRTMZF
PRTDBG: DB 0C3H ; JP _PRTDBG
DW _PRTDBG
ENDIF
CMT_RDINF: JP _CMT_RDINF ; UROMADDR+A6H - Tape/SD intercept handler - Read Header CMT_RDINF: JP _CMT_RDINF ; UROMADDR+A6H - Tape/SD intercept handler - Read Header
CMT_RDDATA: JP _CMT_RDDATA ; UROMADDR+A9H - Tape/SD intercept handler - Read Data CMT_RDDATA: JP _CMT_RDDATA ; UROMADDR+A9H - Tape/SD intercept handler - Read Data
CMT_WRINF: JP _CMT_WRINF ; UROMADDR+ACH - Tape/SD intercept handler - Write Header CMT_WRINF: JP _CMT_WRINF ; UROMADDR+ACH - Tape/SD intercept handler - Write Header
@@ -379,10 +284,10 @@ SIGNON1: CALL DPCT
LD A,(TZPU) LD A,(TZPU)
OR A OR A
JR Z,SIGNON2 JR Z,SIGNON2
LD DE,MSGSONTZ LDDE MSGSONTZ
JR SIGNON3 JR SIGNON3
; ;
SIGNON2: LD DE,MSGSON ; Sign on message, SIGNON2: LDDE MSGSON ; Sign on message,
SIGNON3: LD HL,PRINTMSG SIGNON3: LD HL,PRINTMSG
CALL BKSW0to6 CALL BKSW0to6
; JR ST1X ; JR ST1X
@@ -398,7 +303,7 @@ SIGNON3: LD HL,PRINTMSG
; Place error code in C to print as a number and report with the error message. ; Place error code in C to print as a number and report with the error message.
ADD A,'0' ADD A,'0'
LD C,A LD C,A
LD DE,MSGSDINITER LDDE MSGSDINITER
LD HL,PRINTMSG LD HL,PRINTMSG
CALL BKSW0to6 CALL BKSW0to6
ENDIF ENDIF
@@ -499,7 +404,7 @@ CMDNOCMP: LD A,(BUFER+1) ; If no
JR Z,CMDCMPEND JR Z,CMDCMPEND
CP 00DH CP 00DH
JR Z,CMDCMPEND JR Z,CMDCMPEND
LD DE,MSGBADCMD LDDE MSGBADCMD
LD HL,PRINTMSG LD HL,PRINTMSG
CALL BKSW0to6 CALL BKSW0to6
CMDCMPEND: LD A,(RESULT) CMDCMPEND: LD A,(RESULT)
@@ -728,7 +633,7 @@ SETMODE80: IF BUILD_ROMDISK+BUILD_PICOZ80 = 1
JP MONIT JP MONIT
ENDIF ENDIF
NOTZPU: LD DE,MSGNOTZINST ; No tranZPUter installed. NOTZPU: LDDE MSGNOTZINST ; No tranZPUter installed.
LD HL,PRINTMSG LD HL,PRINTMSG
CALL BKSW0to6 CALL BKSW0to6
RET RET
@@ -961,7 +866,7 @@ DIRROM: ;DI ; Disab
LD A,1 ; Account for the title. LD A,1 ; Account for the title.
LD (TMPLINECNT),A LD (TMPLINECNT),A
; ;
LD DE,MSGRDIRLST ; Print out header. LDDE MSGRDIRLST ; Print out header.
LD HL,PRINTMSG LD HL,PRINTMSG
CALL BKSW0to6 CALL BKSW0to6
@@ -1152,7 +1057,7 @@ MROMLOAD0: PUSH BC ; Prese
PUSH AF ; Preserve 7:6 of A which is upper bank select. PUSH AF ; Preserve 7:6 of A which is upper bank select.
LD A,(ROMBK1) ; Page in monitor so we can print a message. LD A,(ROMBK1) ; Page in monitor so we can print a message.
HWSELMROM HWSELMROM
LD DE,MSGLOAD+1 ; Skip initial file type identifier. LDDE MSGLOAD+1 ; Skip initial file type identifier.
LD BC,NAME LD BC,NAME
LD HL,PRINTMSG LD HL,PRINTMSG
CALL BKSW0to6 CALL BKSW0to6
@@ -1168,7 +1073,7 @@ LROMNTFND: POP HL ; Dont
LD A,(ROMBK1) LD A,(ROMBK1)
HWSELMROM HWSELMROM
LD HL,PRINTMSG LD HL,PRINTMSG
LD DE,MSGNOTFND ; Not found LDDE MSGNOTFND ; Not found
CALL BKSW0to6 CALL BKSW0to6
LOADROMEND:;EI LOADROMEND:;EI
RET RET
@@ -1179,7 +1084,7 @@ LOADROMEND:;EI
LROMLOAD: PUSH BC LROMLOAD: PUSH BC
; ;
PUSH BC ; Print Loading <file> PUSH BC ; Print Loading <file>
LD DE,MSGLOAD+1 LDDE MSGLOAD+1
LD BC,NAME LD BC,NAME
LD HL,PRINTMSG LD HL,PRINTMSG
CALL BKSW0to6 CALL BKSW0to6
@@ -1491,14 +1396,14 @@ _CMT_VERIFY:CALL SETDRIVE ; Set d
RET NZ RET NZ
CALL CHECKCMT CALL CHECKCMT
JR Z,_VERIFY JR Z,_VERIFY
LD DE,MSGNOVERIFY LDDE MSGNOVERIFY
JR SD_ERRMSG JR SD_ERRMSG
_VERIFY: JP ?VRFY _VERIFY: JP ?VRFY
SD_INVDRV: LD DE,MSGINVDRV ; Invalid drive specified. SD_INVDRV: LDDE MSGINVDRV ; Invalid drive specified.
JR SD_ERRMSG JR SD_ERRMSG
SD_NOTFND: LD DE,MSGNOTFND SD_NOTFND: LDDE MSGNOTFND
SD_ERRMSG: LD HL,PRINTMSG SD_ERRMSG: LD HL,PRINTMSG
CALL BKSW0to6 ; Print message that file wasnt found. CALL BKSW0to6 ; Print message that file wasnt found.
LD A,1 LD A,1
@@ -1513,7 +1418,7 @@ _CMT_DIR: CALL SETDRIVE ; Chang
LD HL,DIRSDCARD LD HL,DIRSDCARD
CALL BKSW0to2 ; Call the standard RFS directory command. CALL BKSW0to2 ; Call the standard RFS directory command.
RET RET
_CMT_NODIR: LD DE,MSGNOCMTDIR _CMT_NODIR: LDDE MSGNOCMTDIR
JR SD_ERRMSG JR SD_ERRMSG
; Stub to call the ASCII to Sharp ASCII conversion routine stored in Bank 5. ; Stub to call the ASCII to Sharp ASCII conversion routine stored in Bank 5.
@@ -1585,3 +1490,111 @@ MEND:
INCLUDE "rfs_bank9.asm" INCLUDE "rfs_bank9.asm"
INCLUDE "rfs_bank10.asm" INCLUDE "rfs_bank10.asm"
INCLUDE "rfs_bank11.asm" INCLUDE "rfs_bank11.asm"
;============================================================
;
; SFD700 COMMAND TABLE
;
; Placed after all bank includes so DW forward references to
; functions in various IF blocks are resolved as backward refs.
;============================================================
IF BUILD_SFD700 = 1
ORG 0E000H
ALIGN 0E300H
ENDIF
; Monitor command table (SFD700). This table contains the list of recognised commands along with the
; handler function and bank in which it is located.
;
; 7 6:3 2:0
; MATCH BANK SIZE
CMDTABLE2: IF BUILD_SFD700 = 1
DB 000H | 038H | 003H
DB "ASM" ; Assembler.
DW ASM_MAIN
DB 000H | 000H | 005H
DB "BASIC" ; Load and run BASIC SA-5510.
DW LOADBASIC
DB 000H | 020H | 001H
DB 'B' ; Bell.
DW SGX
DB 000H | 000H | 003H
DB "CPM" ; Load and run CPM.
DW LOADCPM
DB 000H | 018H | 002H
DB "CP" ; Copy Memory.
DW MCOPY
DB 000H | 018H | 003H
DB "DUC" ; Dump SD Card file contents (hex or text).
DW DUMPSDCARD
DB 000H | 018H | 001H
DB 'C' ; Clear Memory.
DW INITMEMX
DB 000H | 038H | 004H
DB "DASM" ; Disassembler.
DW DASM_MAIN
DB 000H | 018H | 001H
DB 'D' ; Dump Memory.
DW DUMPX
DB 000H | 008H | 002H
DB "FL" ; 'FL' RFS Floppy load.
DW FDCK
; NB: FD/FDDIR command not available on SFD700 — FDDIR only exists
; for ROMDISK/picoZ80 builds (MZ-700 WD1773 FDC). SFD700 uses
; AFI ROM at F000 via FDCK for floppy operations.
DB 000H | 058H | 001H
DB 'H' ; Help screen (bank 11).
DW HELP
DB 000H | 018H | 002H ; Bank 3, 2-char command.
DB "IN" ; I/O port input.
DW INX
DB 000H | 000H | 002H
DB "IR" ; List ROM directory.
DW DIRROM
DB 000H | 000H | 001H
DB 'J' ; Jump to address.
DW GOTOX
DB 000H | 020H | 004H
DB "LTNX" ; Load from CMT without auto execution.
DW LOADTAPENX
DB 000H | 020H | 002H
DB "LT" ; Load from CMT
DW LOADTAPE
DB 000H | 000H | 004H
DB "LRNX" ; Load from ROM without auto execution.
DW LOADROMNX
DB 000H | 000H | 002H
DB "LR" ; Load from ROM
DW LOADROM
DB 000H | 020H | 001H
DB "L" ; Original Load from CMT
DW LOADTAPE
DB 000H | 018H | 001H
DB 'M' ; Edit Memory.
DW MCORX
DB 000H | 018H | 003H ; Bank 3, 3-char command.
DB "OUT" ; I/O port output.
DW OUTX
DB 000H | 018H | 001H
DB 'P' ; Printer test.
DW PTESTX
DB 000H | 020H | 001H
DB 'R' ; Memory test.
DW MEMTEST
DB 000H | 020H | 002H
DB "ST" ; Save to CMT
DW SAVEX
DB 000H | 020H | 001H
DB 'S' ; Save to CMT
DW SAVEX
DB 000H | 000H | 004H
DB "TEST" ; A test function used in debugging.
DW LOCALTEST
DB 000H | 020H | 001H
DB 'T' ; Timer test.
DW TIMERTST
DB 000H | 000H | 001H
DB 'V' ; Verify CMT Save.
DW VRFYX
DB 0FFH ; END OF TABLE
ENDIF

View File

@@ -171,7 +171,7 @@ FLOPPY: IF BUILD_ROMDISK+BUILD_PICOZ80 = 1
CP 00Dh ; CP 00Dh ;
JR NZ,GETBOOTDSK ; JR NZ,GETBOOTDSK ;
CALL DSKINIT ; Initialise disk and flags. CALL DSKINIT ; Initialise disk and flags.
L000F: LD DE,MSGBOOTDRV ; L000F: LDDE MSGBOOTDRV ;
LD HL,PRINTMSG LD HL,PRINTMSG
CALL BKSW1to6 CALL BKSW1to6
LD DE,011A3H ; LD DE,011A3H ;
@@ -202,7 +202,7 @@ L0049: LD C,(HL) ;
INC HL ; INC HL ;
INC DE ; INC DE ;
DJNZ L0049 ; DJNZ L0049 ;
LD DE,MSGIPLLOAD ; LDDE MSGIPLLOAD ;
LD HL,PRINTMSG LD HL,PRINTMSG
CALL BKSW1to6 CALL BKSW1to6
LD DE,0CE07H ; Program name stored at 8th byte in boot sector. LD DE,0CE07H ; Program name stored at 8th byte in boot sector.
@@ -226,10 +226,10 @@ NOTCPM: LD HL,(0CE14H) ; G
LD HL,(0CE18H) ; Get the execution address LD HL,(0CE18H) ; Get the execution address
JP (HL) ; And execute. JP (HL) ; And execute.
DSKLOADERR: LD DE,MSGLOADERR ; Loading error message DSKLOADERR: LDDE MSGLOADERR ; Loading error message
JR L008F ; (+003h) JR L008F ; (+003h)
L008C: LD DE,MSGDSKNOTMST ; This is not a boot/master disk message. L008C: LDDE MSGDSKNOTMST ; This is not a boot/master disk message.
L008F: LD HL,PRINTMSG L008F: LD HL,PRINTMSG
CALL BKSW1to6 CALL BKSW1to6
LD DE,ERRTONE ; Play error tone. LD DE,ERRTONE ; Play error tone.
@@ -557,7 +557,7 @@ L0300: IN A,(0D8H) ; State
CP 00DH CP 00DH
JR NZ,FD7BOOT JR NZ,FD7BOOT
CALL FD7INIT ; Initialise disk and flags. CALL FD7INIT ; Initialise disk and flags.
FD7PRMPT: LD DE,MSGBOOTDRV FD7PRMPT: LDDE MSGBOOTDRV
LD HL,PRINTMSG LD HL,PRINTMSG
CALL BKSW1to6 CALL BKSW1to6
LD DE,011A3H LD DE,011A3H
@@ -594,7 +594,7 @@ FD7CHK: LD C,(HL)
DJNZ FD7CHK DJNZ FD7CHK
; ;
; Valid boot disk - print loading message and program name. ; Valid boot disk - print loading message and program name.
LD DE,MSGIPLLOAD LDDE MSGIPLLOAD
LD HL,PRINTMSG LD HL,PRINTMSG
CALL BKSW1to6 CALL BKSW1to6
LD DE,0CF07H ; Program name in boot sector. LD DE,0CF07H ; Program name in boot sector.
@@ -646,9 +646,9 @@ FD7EXEC: LD BC,00200H ; Defau
; ;
; Error handlers. ; Error handlers.
FD7NOTMST: CALL FD7INIT FD7NOTMST: CALL FD7INIT
LD DE,MSGDSKNOTMST LDDE MSGDSKNOTMST
JR FD7ERR JR FD7ERR
FD7LOADERR: LD DE,MSGLOADERR FD7LOADERR: LDDE MSGLOADERR
FD7ERR: LD HL,PRINTMSG FD7ERR: LD HL,PRINTMSG
CALL BKSW1to6 CALL BKSW1to6
LD DE,ERRTONE LD DE,ERRTONE
@@ -967,7 +967,7 @@ FDDIR_GO: LD (BPARA),A ; Store
ADD A,'1' ADD A,'1'
LD C,A LD C,A
PUSH BC PUSH BC
LD DE,MSGFDDIR LDDE MSGFDDIR
LD HL,PRINTMSG LD HL,PRINTMSG
CALL BKSW1to6 CALL BKSW1to6
POP BC POP BC
@@ -1008,7 +1008,7 @@ FDDIR_IPL: LD A,(DE)
LD HL,(0CF18H) LD HL,(0CF18H)
PUSH HL PUSH HL
LD BC,(0CF14H) LD BC,(0CF14H)
LD DE,MSGFDINFO LDDE MSGFDINFO
LD HL,PRINTMSG LD HL,PRINTMSG
CALL BKSW1to6 CALL BKSW1to6
POP BC POP BC
@@ -1080,7 +1080,7 @@ FDDIR_ENT: ; Check type byte at (HL). 00 = empty/deleted, FF = unused → skip
INC HL INC HL
LD D,(HL) LD D,(HL)
PUSH DE ; Stack: exec addr. PUSH DE ; Stack: exec addr.
LD DE,MSGFDINFO LDDE MSGFDINFO
LD HL,PRINTMSG LD HL,PRINTMSG
CALL BKSW1to6 CALL BKSW1to6
POP BC ; Clean exec. POP BC ; Clean exec.

View File

@@ -1060,7 +1060,7 @@ GETDIRSD3: OR A
DIRSDERR: EX DE,HL ; Print error message, show HL as it contains sector number where error occurred. DIRSDERR: EX DE,HL ; Print error message, show HL as it contains sector number where error occurred.
PUSH HL PUSH HL
POP BC ; HL to BC as the call requires the value to be displayed in BC. POP BC ; HL to BC as the call requires the value to be displayed in BC.
LD DE,MSGSDRERR LDDE MSGSDRERR
CALL SDPRINT ; Print out the filename. CALL SDPRINT ; Print out the filename.
POP DE POP DE
POP BC POP BC
@@ -1112,7 +1112,7 @@ WRSDDIRENT: LD A,(DIRSECBUF) ; Get t
XOR A XOR A
WRSDDIRENT1:OR A WRSDDIRENT1:OR A
RET RET
DIRSDWERR: LD DE,MSGSDWERR DIRSDWERR: LDDE MSGSDWERR
PUSH HL PUSH HL
POP BC ; HL to BC as the call requires the value to be displayed in BC. POP BC ; HL to BC as the call requires the value to be displayed in BC.
CALL SDPRINT ; Print out the filename. CALL SDPRINT ; Print out the filename.
@@ -1139,7 +1139,7 @@ DIRSDCARD: LD A,1 ; Setup
JR Z,DIRSDP JR Z,DIRSDP
ADD A,'0' ADD A,'0'
DIRSDP: LD C,A ; C is printed as a character embedded in the message. DIRSDP: LD C,A ; C is printed as a character embedded in the message.
LD DE,MSGCDIRLST ; Print out header. LDDE MSGCDIRLST ; Print out header.
CALL SDPRINT ; Print out the header. CALL SDPRINT ; Print out the header.
; ;
DIRSD0: LD E,0 ; Directory entry number DIRSD0: LD E,0 ; Directory entry number
@@ -1263,11 +1263,11 @@ ERASESD: CALL FINDSDX
JR NZ,ERASESD1 ; Failure, the report and exit. JR NZ,ERASESD1 ; Failure, the report and exit.
POP BC ; Get the directory entry number. POP BC ; Get the directory entry number.
LD B,0 LD B,0
LD DE,MSGERASEDIR LDDE MSGERASEDIR
XOR A ; Success. XOR A ; Success.
JR SDPRINTRES JR SDPRINTRES
ERASESD1: LD A,1 ERASESD1: LD A,1
LD DE,MSGERAFAIL ; Fail, print out message. LDDE MSGERAFAIL ; Fail, print out message.
SDPRINTRES: LD (RESULT),A SDPRINTRES: LD (RESULT),A
SDPRINT: LD HL,PRINTMSG SDPRINT: LD HL,PRINTMSG
CALL BKSW2to6 ; Print out the filename. CALL BKSW2to6 ; Print out the filename.
@@ -1294,7 +1294,7 @@ LOADSD2: LD (SDCOPY),A
LD (RESULT),A LD (RESULT),A
CALL FINDSDX CALL FINDSDX
JP Z,LOADSD10 JP Z,LOADSD10
LOADSD3: LD DE,MSGNOTFND LOADSD3: LDDE MSGNOTFND
JR SDPRINT JR SDPRINT
; Helper method for the CMT replacement functions3. This method is inter bank called to locate a file pointed to by DE and set the header information. ; Helper method for the CMT replacement functions3. This method is inter bank called to locate a file pointed to by DE and set the header information.
@@ -1376,7 +1376,7 @@ LOADSD9A: LD (DTADR),DE
JR LOADSDX ; Exit with ok. JR LOADSDX ; Exit with ok.
; ;
LOADSD10: CALL LOADSD9 ; Modularised file find as the CMT replacement functions need it. LOADSD10: CALL LOADSD9 ; Modularised file find as the CMT replacement functions need it.
LD DE,MSGLOAD+1 ; Skip initial CR. LDDE MSGLOAD+1 ; Skip initial CR.
LD BC,NAME LD BC,NAME
CALL SDPRINT ; Print out the filename. CALL SDPRINT ; Print out the filename.
CALL LOADSD11 CALL LOADSD11
@@ -1423,7 +1423,7 @@ LOADSD14: LD A,(SDAUTOEXEC) ; Autoe
JR LOADSDEXIT JR LOADSDEXIT
; ;
; Load only. ; Load only.
LOADSD15: LD DE,MSGCMTDATA ; Indicate where the program was loaded and the execution address. LOADSD15: LDDE MSGCMTDATA ; Indicate where the program was loaded and the execution address.
LD HL,(DTADR) LD HL,(DTADR)
PUSH HL PUSH HL
LD HL,(EXADR) LD HL,(EXADR)
@@ -1438,10 +1438,10 @@ LOADSDEXIT: LD (RESULT),A ; 0 = N
RET RET
; Not a binary file so cannot execute. ; Not a binary file so cannot execute.
LOADSD17: LD DE,MSGNOTBIN LOADSD17: LDDE MSGNOTBIN
JR LOADSDERR2 JR LOADSDERR2
LOADSDERR: LD DE,MSGSDRERR ; Print out the filename. LOADSDERR: LDDE MSGSDRERR ; Print out the filename.
LD BC,(TMPCNT) LD BC,(TMPCNT)
LOADSDERR2: CALL SDPRINT LOADSDERR2: CALL SDPRINT
LOADSDXERR: LD A,2 LOADSDXERR: LD A,2
@@ -1476,7 +1476,7 @@ SAVESD1: LD (SDCOPY),A
; Find free slot. ; Find free slot.
CALL GETDIRFREE CALL GETDIRFREE
JR NC,SAVESD4 JR NC,SAVESD4
LD DE,MSGDIRFULL ; Directory is full so abort command. LDDE MSGDIRFULL ; Directory is full so abort command.
LD A,1 ; Directory full code. LD A,1 ; Directory full code.
JP SDPRINTRES JP SDPRINTRES
; ;
@@ -1484,7 +1484,7 @@ SAVESD4: PUSH DE ; Save
PUSH HL PUSH HL
LD B,0 LD B,0
LD C,E LD C,E
LD DE,MSGSVDIRENT LDDE MSGSVDIRENT
CALL SDPRINT ; Print out the filename. CALL SDPRINT ; Print out the filename.
POP HL ; HL points to the directory entry buffer. POP HL ; HL points to the directory entry buffer.
LD A,080H LD A,080H
@@ -1599,7 +1599,7 @@ SAVESD8: ; Data written, now write out the directory entry.
LD A,0 ; Success. LD A,0 ; Success.
LD (RESULT),A LD (RESULT),A
RET RET
SAVESD9: LD DE,MSGSVFAIL ; Fail, print out message. SAVESD9: LDDE MSGSVFAIL ; Fail, print out message.
LD A,1 ; Write failed code. LD A,1 ; Write failed code.
JP SDPRINTRES ; Print out the filename. JP SDPRINTRES ; Print out the filename.

View File

@@ -163,9 +163,9 @@ TAPE2SD: ; Load from tape into memory, filling the tape CMT header and loadin
LD A,(RESULT) LD A,(RESULT)
OR A OR A
JR NZ,TAPE2SDERR JR NZ,TAPE2SDERR
LD DE,MSGT2SDOK LDDE MSGT2SDOK
JR TAPE2SDERR2 JR TAPE2SDERR2
TAPE2SDERR: LD DE,MSGT2SDERR TAPE2SDERR: LDDE MSGT2SDERR
TAPE2SDERR2:LD HL,PRINTMSG TAPE2SDERR2:LD HL,PRINTMSG
CALL BKSW3to6 CALL BKSW3to6
RET RET
@@ -187,7 +187,7 @@ SD2TAPE: ; Load from SD, fill the CMT header then call CMT save.
OR A OR A
JR NZ,SD2TAPEERR JR NZ,SD2TAPEERR
RET RET
SD2TAPEERR: LD DE,MSGSD2TERR SD2TAPEERR: LDDE MSGSD2TERR
JR TAPE2SDERR2 JR TAPE2SDERR2
RET RET
;------------------------------------------------------------------------------- ;-------------------------------------------------------------------------------
@@ -364,7 +364,7 @@ INITMEMX: CALL _2HEX
JR NC,INITMEMX1 JR NC,INITMEMX1
LD A,000H LD A,000H
INITMEMX1: PUSH AF INITMEMX1: PUSH AF
LD DE,MSGINITM LDDE MSGINITM
LD HL,PRINTMSG LD HL,PRINTMSG
CALL BKSW1to6 CALL BKSW1to6
LD HL,1200h LD HL,1200h
@@ -400,7 +400,7 @@ GETCMTPARM: CALL READ4HEX ; Start
JR C,GETCMT1 JR C,GETCMT1
LD (EXADR),HL ; buffer LD (EXADR),HL ; buffer
CALL NL CALL NL
LD DE,MSGSAVE ; 'FILENAME? ' LDDE MSGSAVE ; 'FILENAME? '
LD HL,PRINTMSG LD HL,PRINTMSG
CALL BKSW2to6 ; Print out the filename. CALL BKSW2to6 ; Print out the filename.
LD DE,BUFER LD DE,BUFER
@@ -428,7 +428,7 @@ READ4HEX: CALL HLHEX
INC DE INC DE
OR A ; Clear carry flag. OR A ; Clear carry flag.
RET RET
READ4HEXERR:LD DE,MSGREAD4HEX ; Load up error message, print and exit. READ4HEXERR:LDDE MSGREAD4HEX ; Load up error message, print and exit.
READ4HEXPRE:LD HL,PRINTMSG READ4HEXPRE:LD HL,PRINTMSG
CALL BKSW1to6 CALL BKSW1to6
SCF SCF
@@ -608,7 +608,7 @@ DUMPSD1B: LD A,(TMPSIZE) ; Read
; Print: "filename" CR Load:XXXX, Exec:YYYY, Size:ZZZZ CR ; Print: "filename" CR Load:XXXX, Exec:YYYY, Size:ZZZZ CR
; 0xFF=stack[0]=Load, 0xFE=stack[1]=Exec, 0xFD=stack[2]=Size ; 0xFF=stack[0]=Load, 0xFE=stack[1]=Exec, 0xFD=stack[2]=Size
; 0xFA=filename from BC ; 0xFA=filename from BC
LD DE,MSGDCHEAD LDDE MSGDCHEAD
LD HL,(DTADRSTORE) ; Original MZF load address. LD HL,(DTADRSTORE) ; Original MZF load address.
PUSH HL ; Stack param 1 (0xFF). PUSH HL ; Stack param 1 (0xFF).
LD HL,(EXADR) LD HL,(EXADR)

View File

@@ -162,7 +162,7 @@ LOADTAPE2: LD (CMTCOPY),A ; Set c
LD (RESULT),A LD (RESULT),A
CALL ?RDI CALL ?RDI
JP C,?ERX2 JP C,?ERX2
LD DE,MSGLOAD ; 'LOADING ' LDDE MSGLOAD ; 'LOADING '
LD BC,NAME LD BC,NAME
LD HL,PRINTMSG LD HL,PRINTMSG
CALL BKSW4to6 CALL BKSW4to6
@@ -210,7 +210,7 @@ LOADTAPELM: LD A,(MEMSW) ; Perfo
LD BC,00100h LD BC,00100h
LD HL,(EXADR) ; Fetch exec address and run. LD HL,(EXADR) ; Fetch exec address and run.
JP (HL) JP (HL)
LOADTAPE6: LD DE,MSGCMTDATA LOADTAPE6: LDDE MSGCMTDATA
PUSH HL ; Load address as parameter 2. PUSH HL ; Load address as parameter 2.
LD HL,(EXADR) LD HL,(EXADR)
PUSH HL ; Execution address as parameter 1. PUSH HL ; Execution address as parameter 1.
@@ -254,7 +254,7 @@ CMTWRI0: JR C,CMTWRI2
PUSH HL PUSH HL
PUSH DE PUSH DE
PUSH BC PUSH BC
LD DE,MSGCMTWRITE LDDE MSGCMTWRITE
LD BC,NAME LD BC,NAME
LD HL,PRINTMSG LD HL,PRINTMSG
CALL BKSW4to6 CALL BKSW4to6
@@ -322,7 +322,7 @@ SAVEX1: LD (SDCOPY),A
LD (DTADR),DE LD (DTADR),DE
SAVEX2: CALL ?WRD ; data SAVEX2: CALL ?WRD ; data
JR C,?ERX1 JR C,?ERX1
LD DE,MSGSAVEOK ; 'OK!' LDDE MSGSAVEOK ; 'OK!'
LD HL,PRINTMSG LD HL,PRINTMSG
CALL BKSW4to6 CALL BKSW4to6
LD A,0 ; Success. LD A,0 ; Success.
@@ -332,7 +332,7 @@ SAVEX2: CALL ?WRD ; data
JR NZ,?ERX3 JR NZ,?ERX3
LD (RESULT),A ; Set break key pressed code. LD (RESULT),A ; Set break key pressed code.
RET Z RET Z
?ERX3: LD DE,MSGE1 ; 'CHECK SUM ER.' ?ERX3: LDDE MSGE1 ; 'CHECK SUM ER.'
LD HL,PRINTMSG LD HL,PRINTMSG
CALL BKSW4to6 CALL BKSW4to6
RET RET
@@ -342,7 +342,7 @@ SAVEX2: CALL ?WRD ; data
; ;
VRFYX: CALL ?VRFY VRFYX: CALL ?VRFY
JP C,?ERX2 JP C,?ERX2
LD DE,MSGOK ; 'OK!' LDDE MSGOK ; 'OK!'
LD HL,PRINTMSG LD HL,PRINTMSG
CALL BKSW4to6 CALL BKSW4to6
RET RET
@@ -773,7 +773,7 @@ QDGO: LD (RESULT),A ; Store
JP C,QDERR_EXIT ; Error reading header JP C,QDERR_EXIT ; Error reading header
; Print "Loading <filename>" ; Print "Loading <filename>"
LD DE,MSGLOAD+1 ; Skip leading CR LDDE MSGLOAD+1 ; Skip leading CR
LD BC,NAME LD BC,NAME
LD HL,PRINTMSG LD HL,PRINTMSG
CALL BKSW4to6 CALL BKSW4to6
@@ -812,7 +812,7 @@ QDBOOT1: LD (QDLOADADDR),HL
CALL QDMOTOR_OFF CALL QDMOTOR_OFF
; Display loaded file info (QD: DTADR=size, EXADR=load addr) ; Display loaded file info (QD: DTADR=size, EXADR=load addr)
LD DE,MSGCMTDATA LDDE MSGCMTDATA
LD HL,(QDLOADADDR) LD HL,(QDLOADADDR)
PUSH HL ; Load address for 0FEH PUSH HL ; Load address for 0FEH
PUSH HL ; Exec address for 0FFH (same for QD) PUSH HL ; Exec address for 0FFH (same for QD)
@@ -858,17 +858,17 @@ QDERR_EXIT: ; Common error/return handler — motor off
RET NC ; No error, just return RET NC ; No error, just return
; Display error message based on error code in A ; Display error message based on error code in A
LD DE,MSGQDERR ; Default: "QD: Read error" LDDE MSGQDERR ; Default: "QD: Read error"
CP 028H CP 028H
JR Z,QDERR_SHOW ; End of tape (file not found) JR Z,QDERR_SHOW ; End of tape (file not found)
CP 032H CP 032H
JR NZ,QDERR_SHOW2 JR NZ,QDERR_SHOW2
LD DE,MSGQDERR ; Not ready LDDE MSGQDERR ; Not ready
JR QDERR_SHOW JR QDERR_SHOW
QDERR_SHOW2: QDERR_SHOW2:
CP 036H CP 036H
JR NZ,QDERR_SHOW JR NZ,QDERR_SHOW
LD DE,MSGQDFMT ; Unformat / bad format LDDE MSGQDFMT ; Unformat / bad format
QDERR_SHOW: LD HL,PRINTMSG QDERR_SHOW: LD HL,PRINTMSG
CALL BKSW4to6 CALL BKSW4to6
RET RET

View File

@@ -195,7 +195,7 @@ DASM_SPCOUT: CALL PRNTS ; Pad with spaces to 15 bytes
LD HL,ASM_BUF ; Send Assembly string LD HL,ASM_BUF ; Send Assembly string
EX DE,HL EX DE,HL
LD HL,PRTSTR LD HL,PRINTMSG
CALL BKSW7to6 CALL BKSW7to6
LD A,(COUNT_C) ; Get Row Count LD A,(COUNT_C) ; Get Row Count