Updates to MSBASIC and SA-5510 for use with SD card.

This commit is contained in:
Philip Smart
2021-04-25 10:33:11 +01:00
parent d7a9d7cdc9
commit 8ebdd783ef
10 changed files with 8042 additions and 244 deletions

View File

@@ -39,27 +39,26 @@
DB 01h ; Code Type, 01 = Machine Code.
HEADER1: IF BUILD_MZ80A = 1
DB "MS-BASIC(MZ-80A)", 0DH ; Title/Name (17 bytes).
DW CODEEND - CODESTART ; Size of program.
DW CODESTART ; Load address of program.
DW CODESTART ; Exec address of program.
DB "MS-BASIC(MZ-80A)", 0DH ; Title/Name (17 bytes).
DW CODEEND - CODESTART ; Size of program.
DW CODESTART ; Load address of program.
DW CODESTART ; Exec address of program.
ENDIF
HEADER2: IF BUILD_MZ700 = 1
DB "MS-BASIC(MZ700)", 0DH, 0DH, 0DH, 0DH ; Title/Name (17 bytes).
DW (CODEEND - CODESTART) + (RELOCEND - RELOC) ; Size of program.
DW 01200H ; Load address of program.
DW RELOC ; Exec address of program.
DB "MS-BASIC(MZ700)", 0DH, 0DH, 0DH, 0DH ; Title/Name (17 bytes).
DW (CODEEND - CODESTART) + (RELOCEND - RELOC) ; Size of program.
DW 01200H ; Load address of program.
DW RELOC ; Exec address of program.
ENDIF
HEADER3: IF BUILD_TZFS = 1
HEADER3: IF BUILD_MZ80A_TZFS+BUILD_MZ700_TZFS > 0
IF BUILD_80C = 0
DB "MS-BASIC(TZFS40)", 0DH ; Title/Name (17 bytes).
DW (CODEEND - CODESTART) + (RELOCEND - RELOC) ; Size of program.
DW 01200H ; Load address of program.
DW RELOC ; Exec address of program.
ELSE
IF BUILD_80C = 1
DB "MS-BASIC(TZFS80)", 0DH ; Title/Name (17 bytes).
DW (CODEEND - CODESTART) + (RELOCEND - RELOC) ; Size of program.
DW 01200H ; Load address of program.
@@ -85,7 +84,7 @@ BUILD2: IF BUILD_MZ700 = 1
ORG 0000H
ENDIF
BUILD3: IF BUILD_TZFS = 1
BUILD3: IF BUILD_MZ80A_TZFS + BUILD_MZ700_TZFS > 0
ORG 0000H
ENDIF
@@ -101,7 +100,7 @@ STARTB:
DW ABPASS ; Return integer in AB
VECTORS: IF BUILD_MZ700+BUILD_TZFS > 1
VECTORS: IF BUILD_MZ700+BUILD_MZ700_TZFS > 1
ALIGN 0038H
ORG 0038H
INTVEC: DS 3 ; Space for the Interrupt vector.
@@ -115,7 +114,7 @@ CSTART: DI ; Disable Interrupts and sat mode. NB.
IM 1
LD SP,STACK ; Start of workspace RAM
MEMSW0: IF BUILD_MZ700+BUILD_TZFS > 1
MEMSW0: IF BUILD_MZ700+BUILD_MZ700_TZFS > 1
LD A,TZMM_MZ700_0 ; Ensure the top part of RAM is set to use the mainboard as we need to configure hardware.
OUT (MMCFG),A
ENDIF
@@ -198,10 +197,7 @@ INIT80CHAR: IF BUILD_80C = 1
ELSE
; Default falls through to 40 column mode.
INIT40CHAR: LD A, 40 ; Set BASIC to 40 column width.
LD (INITABW),A
XOR A ; As we call RFS for SD services, specifically DIR listing, we have to ensure RFS is configured for 40 column output mode.
LD (SCRNMODE), A
INIT40CHAR: XOR A ; Setup scrolling to use MZ80K mode for 40 chars.
LD (SPAGE), A
ENDIF
;
@@ -212,8 +208,6 @@ INIT80END: LD A,000H ; Clear the screen buffer.
LD HL,ARAM
CALL CLR8
;
LD A,COLW
LD (LWIDTH),A ; Setup the initial terminal width.
CALL MLDSP
CALL BEL ; Beep to indicate startup - for cases where screen is slow to startup.
LD A,0FFH
@@ -233,7 +227,7 @@ INITANSI: IF INCLUDE_ANSITERM = 1 ; If the ansi terminal emulator is buil
LD A,05H ; Enable interrupts at hardware level, this must be done before switching memory mode.
LD (KEYPF),A
;
MEMSW1: IF BUILD_MZ700+BUILD_TZFS > 0
MEMSW1: IF BUILD_MZ700+BUILD_MZ700_TZFS > 0
LD A,TZMM_MZ700_2 ; Enable the full 64K memory range before starting BASIC initialisation.
OUT (MMCFG),A
ENDIF
@@ -243,7 +237,7 @@ MEMSW1: IF BUILD_MZ700+BUILD_TZFS > 0
MEMSZ1: IF BUILD_MZ80A = 1
LD BC,MAXMEM - WRKSPC ; Clear to top of physical RAM.
ENDIF
MEMSZ2: IF BUILD_MZ700+BUILD_TZFS > 0
MEMSZ2: IF BUILD_MZ700+BUILD_MZ700_TZFS > 0
LD BC,10000H - WRKSPC ; Clear to top of physical RAM.
ENDIF
LD E,00H
@@ -370,7 +364,7 @@ WORDS: DB 'E'+80H,"ND" ; 0x80
DB 'A'+80H,"NSITERM" ; 0xa2
; Optional commands to be builtin when a tranZPUter board is present.
OPTIONS0: IF BUILD_TZFS = 1
OPTIONS0: IF BUILD_MZ80A_TZFS + BUILD_MZ700_TZFS > 0
DB 'C'+80H,"LOAD" ; 0xa3
DB 'C'+80H,"SAVE" ; 0xa4
DB 'L'+80H,"OAD" ; 0xa5
@@ -511,32 +505,32 @@ WORDTB: DW PEND
DW SETANSITERM ; Enable/disable the ANSI Terminal Emulator.
; Optional commands to be builtin when a tranZPUter board is present.
OPTIONS1A: IF BUILD_TZFS = 1
DW CLOADTZ ; Load tokenised BASIC program.
DW CSAVETZ ; Save tokenised BASIC program.
DW LOAD ; Load ASCII text BASIC program.
DW SAVE ; Save BASIC as ASCII text.
DW SETFREQ ; Set the CPU Frequency.
DW DIRSDCARD ; List out the SD directory.
DW SETDIR ; Change directory for all load and save operations.
OPTIONS1A: IF BUILD_MZ80A_TZFS + BUILD_MZ700_TZFS > 0
DW CLOADTZ ; Load tokenised BASIC program.
DW CSAVETZ ; Save tokenised BASIC program.
DW LOAD ; Load ASCII text BASIC program.
DW SAVE ; Save BASIC as ASCII text.
DW SETFREQ ; Set the CPU Frequency.
DW DIRSDCARD ; List out the SD directory.
DW SETDIR ; Change directory for all load and save operations.
ENDIF
OPTIONS2A: IF BUILD_MZ700 = 1
DW CLOAD80A ; Load tokenised BASIC program from tape.
DW CSAVE80A ; Save tokenised BASIC program to tape.
DW REM
DW REM
DW REM
DW REM
DW REM
DW CLOAD80A ; Load tokenised BASIC program from tape.
DW CSAVE80A ; Save tokenised BASIC program to tape.
DW REM
DW REM
DW REM
DW REM
DW REM
ENDIF
OPTIONS3A: IF BUILD_MZ80A = 1
DW CLOAD80A ; Load tokenised BASIC program from tape.
DW CSAVE80A ; Save tokenised BASIC program to tape.
DW REM
DW REM
DW REM
DW REM
DW REM
DW CLOAD80A ; Load tokenised BASIC program from tape.
DW CSAVE80A ; Save tokenised BASIC program to tape.
DW REM
DW REM
DW REM
DW REM
DW REM
ENDIF
DW NEW
@@ -685,7 +679,7 @@ INITAB: JP WARMST ; Warm start jump
RET
DB 1 ; POS (x) number (1)
INITABW: DB COLW ; Terminal width
INITABW: DB 0FFH ; Terminal width set to initial state of 255 which means unlimited width. Applicable to data output not physical screen.
IF BUILD_80C = 1
DB 28 ; Width for commas (3 columns)
ELSE
@@ -1183,9 +1177,11 @@ PUTCTL: LD A,B ; Get number of bytes in buffer
OUTIT: CALL OUTC ; Output the character entered
JP MORINP ; Get another character
OUTNBS: CALL OUTC ; Output bell and back over it
LD A,BACKS ; Set back space
JP OUTIT ; Output it and get more
OUTNBS: CALL PRNT ; Strange, get to end of line ring bell then back space???? Disabled, just ring bell. This area of code needs a new handler.
JP MORINP ; Get another character
;CALL OUTC ; Output bell and back over it
;LD A,BACKS ; Set back space
;JP OUTIT ; Output it and get more
CPDEHL: LD A,H ; Get H
SUB D ; Compare with D
@@ -1815,10 +1811,10 @@ STTLIN: LD A,(CURPOS) ; Make sure on new line
ENDINP: LD (HL),0 ; Mark end of buffer
LD HL,BUFFER-1 ; Point to buffer
PRNTCRLF: LD A,CR ; Load a CR
CALL OUTC ; Output character
LD A,LF ; Load a LF
PRNTCRLF: LD A,CR ; Load a CR
CALL OUTC ; Output character
;LD A,LF ; Load a LF
;CALL OUTC ; Output character
DONULL: XOR A ; Set to position 0
LD (CURPOS),A ; Store it
LD A,(NULLS) ; Get number of nulls
@@ -4576,7 +4572,7 @@ SETANSIERR: LD E,BV ; ?BV Error
;----------------------------------------
; TZFS Commands.
;----------------------------------------
OPTIONS1C: IF BUILD_TZFS = 1
OPTIONS1C: IF BUILD_MZ80A_TZFS + BUILD_MZ700_TZFS > 0
; Method to load BASIC text program.
LOAD: LD A,TAPELOAD ; Set the type of operation into the flag var.
@@ -4684,7 +4680,7 @@ LDBUF: LD A,(TZSVC_FILE_SEC) ; Update the virtual file sector number
JP NZ, SDRDER ; Same thing, if K64F read from file returns an error, read error (SD removed or disk error!)!
RET
; Method to load a NASIC program which is stored as TEXT into memory. This is accomplied sector by sector, line by line,
; Method to load a BASIC program which is stored as TEXT into memory. This is accomplied sector by sector, line by line,
; each line needs to be read, tokenised and stored.
;
LDTXT: CALL LDOPEN ; Open file, read the first sector of data.
@@ -5082,8 +5078,8 @@ PRTDIR: PUSH BC
PUSH DE
PUSH HL
;
LD A,(LWIDTH) ; At the moment only cater for 40/80 columns.
CP COLW
LD A,COLW ; At the moment only cater for 40/80 columns.
CP 80
LD H,47
JR NZ,PRTDIR0
LD H,93
@@ -5110,9 +5106,9 @@ PRTNOWAIT: LD A,E
CP 20
LD A,20
JR C, PRTDIR2
LD A,(LWIDTH) ; 40 Char mode? 2 columns of filenames displayed so NL.
CP 0
JR Z,PRTDIR1
LD A,COLW ; 40 Char mode? 2 columns of filenames displayed so NL.
CP 80
JR NZ,PRTDIR1
LD A,L ; 80 Char mode we print 4 columns of filenames.
CP 40
LD A,40
@@ -5320,8 +5316,7 @@ OPTIONS3C: IF BUILD_MZ80A+BUILD_MZ700 > 0
; Method to load a cassette image (tokenised basic script).
;
CLOAD80A: CALL CURSOROFF
LD A,CTAPELOAD ; Set the type of operatiom into the flag var.
CLOAD80A: LD A,CTAPELOAD ; Set the type of operatiom into the flag var.
LD (TPFLAG),A
LD A,(HL) ; Get byte after "CLOAD"
; CP ZTIMES ; "*" token? ("CLOAD*")
@@ -5394,13 +5389,11 @@ CLOAD80A_2: CALL CLRPTR ; Initialise memory to NEW state ready
CMTVERF:
CMTLOADE: LD HL,OKMSG ; "Ok" message
CALL PRS ; Output string
CALL CURSORON
JP SETPTR ; Set up line pointers
; Method to save a cassette image (tokenised basic script).
;
CSAVE80A: CALL CURSOROFF
LD A,CTAPESAVE ; Set the type of operatiom into the flag var.
CSAVE80A: LD A,CTAPESAVE ; Set the type of operatiom into the flag var.
LD (TPFLAG),A
;
LD B,1 ; Flag "CSAVE"
@@ -5441,7 +5434,6 @@ CSAVE80A_1: LD A,(DE) ; Copy filename into service record.
JR C,CMTSVER
LD HL,CMTMSGOK ; 'OK!'
CALL PRS
CALL CURSORON
POP DE
POP HL
RET
@@ -5455,7 +5447,6 @@ OPTIONS3B: IF BUILD_MZ80A = 1
;--------------------------------------
CMTNONAM: LD HL,CMTBADFN ; Must give a name for SD card load and save.
CMTERR: CALL PRS
CALL CURSORON
POP AF ; Waste return address.
JP ERRIN
CMTFNTG: LD HL,CMTFNTOOG
@@ -5486,7 +5477,7 @@ CMTMSGOK: DB "Saved", C
MONITR:
MONITR2 IF BUILD_MZ700+BUILD_TZFS > 0
MONITR2 IF BUILD_MZ700+BUILD_MZ700_TZFS > 0
; Switch memory back to TZFS mode.
LD A, TZMM_TZFS
OUT (MMCFG),A
@@ -5507,7 +5498,7 @@ TIMIN: LD (SPISRSAVE),SP ; Use a
PUSH DE
PUSH HL
;
MEMSW2: IF BUILD_MZ700+BUILD_TZFS > 0
MEMSW2: IF BUILD_MZ700+BUILD_MZ700_TZFS > 0
LD A,TZMM_MZ700_0 ; We meed to be in memory mode 10 to process the interrupts as this allows us access to the hardware.
OUT (MMCFG),A
ENDIF
@@ -5739,7 +5730,7 @@ ISRKEYRPT: LD A,(KEYCOUNT) ; Get c
LD (KEYWRITE),HL ; Store updated pointer.
;
ISREXIT:
MEMSW3: IF BUILD_MZ700+BUILD_TZFS > 0
MEMSW3: IF BUILD_MZ700+BUILD_MZ700_TZFS > 0
LD A,TZMM_MZ700_2 ; Return to the full 64K memory mode.
OUT (MMCFG),A
ENDIF
@@ -6126,7 +6117,7 @@ KTBLC: ; CTRL ON
;
; Keyboard routine for the MZ-700 hardware.
;
IF BUILD_MZ700 = 1
IF BUILD_MZ700 + BUILD_MZ700_TZFS > 0
;
; KEY BOARD SWEEP
; EXIT B,D7=0 NO DATA
@@ -6263,7 +6254,7 @@ ISRKEYRPT: LD A,(KEYCOUNT) ; Get c
LD (KEYWRITE),HL ; Store updated pointer.
;
ISREXIT
MEMSW3: IF BUILD_MZ700+BUILD_TZFS > 0
MEMSW3: IF BUILD_MZ700+BUILD_MZ700_TZFS > 0
LD A,TZMM_MZ700_2 ; Return to the full 64K memory mode.
OUT (MMCFG),A
ENDIF
@@ -6684,7 +6675,7 @@ KTBLC: ; CONTROL CODE
;-------------------------------------------------------------------------------
; SERVICE COMMAND METHODS
;-------------------------------------------------------------------------------
SVC_CMD: IF BUILD_TZFS = 1
SVC_CMD: IF BUILD_MZ80A_TZFS + BUILD_MZ700_TZFS > 0
; Method to send a command to the I/O processor and verify it is being acted upon.
; THe method, after sending the command, polls the service structure result to see if the I/O processor has updated it. If it doesnt update the result
@@ -7023,11 +7014,11 @@ TIMESET: LD (TIMESEC),HL ; Load
LD (HL),E ; Place current time in Counter 2
LD (HL),D
DEC HL
IF BUILD_MZ80A = 1
IF BUILD_MZ80A + BUILD_MZ80A_TZFS > 0
LD (HL),03BH ; Place divisor in Counter 1, = 315, thus 31500/315 = 100
LD (HL),001H
ENDIF
IF BUILD_MZ700 = 1
IF BUILD_MZ700 + BUILD_MZ700_TZFS > 0
LD (HL),09CH ; Place divisor in Counter 1, = 156, thus 15611/156 = 100
LD (HL),000H
ENDIF
@@ -7039,10 +7030,10 @@ TIMESET: LD (TIMESEC),HL ; Load
LD (00038H),A
; Interrupt vector stored in RAM for the MZ80A (monitor ROM not writeable!!!).
TIMESET1: IF BUILD_MZ80A = 1
TIMESET1: IF BUILD_MZ80A + BUILD_MZ80A_TZFS > 0
LD (01039H),IX
ENDIF
TIMESET2: IF BUILD_MZ700+BUILD_TZFS > 0
TIMESET2: IF BUILD_MZ700+BUILD_MZ700_TZFS > 0
LD (00039H),IX
ENDIF
RET
@@ -7197,15 +7188,19 @@ MODE: LD HL,KEYPF
RET
; Method to check if a key has been pressed and stored in buffer..
CHKKY: LD A, (KEYCOUNT)
CHKKY: CALL CURSORON
LD A, (KEYCOUNT)
OR A
JR Z,CHKKY2
LD A,0FFH
RET
JR CHKKY3
CHKKY2: XOR A
CHKKY3: CALL CURSOROFF
OR A
RET
GETKY: PUSH HL
GETKY: CALL CURSORON
PUSH HL
LD A,(KEYCOUNT)
OR A
JR Z,GETKY2
@@ -7254,6 +7249,7 @@ PRCKY8:
PRCKYX:
PRCKYE:
POP HL
CALL CURSOROFF
RET
;-------------------------------------------------------------------------------
@@ -7357,6 +7353,7 @@ NL: LD A,(DPRNT)
LTNL: LD A,0CDH
JR PRNT5
PRTT: CALL PRTS
LD A,(DPRNT)
OR A
@@ -7380,9 +7377,9 @@ NEWLINE: CALL NL
;
CURSOROFF: PUSH HL
DI
CALL CURSRSTR ; Restore character under the cursor.
LD HL,FLASHCTL ; Indicate cursor is now off.
RES 7,(HL)
CALL CURSRSTR ; Restore character under the cursor.
EI
POP HL
RET
@@ -7428,8 +7425,8 @@ DSPXYTOA1: ADD HL,DE
DEC B
JP P,DSPXYTOA1
LD B,000H
ADD HL,BC
RES 3,H
ADD HL,BC ; Add in column.
RES 3,H ; Make sure we are in VRAM not ARAM.
LD (DSPXYADDR),HL ; Store the new address.
LD A,(HL) ; Store the new character.
LD (FLASH),A
@@ -7446,24 +7443,25 @@ PRTS: LD A,020H
; Function to print a character to the screen. If the character is a control code it is processed as necessary
; otherwise the character is converted from ASCII display and displayed.
;
PRNT: DI
PRNT: CALL CURSOROFF ; Disable the cursor before printing.
DI
;
LD (SPISRSAVE),SP ; Share the interrupt stack for banked access as the BASIC stack goes out of scope.
LD SP,ISRSTACK ; Interrupts are disabled so we can safely use this stack.
;
MEMSW4: IF BUILD_MZ700+BUILD_TZFS > 0
MEMSW4: IF BUILD_MZ700+BUILD_MZ700_TZFS > 0
PUSH AF
LD A,TZMM_MZ700_0 ; Enable access to the hardware by paging out the upper bank.
OUT (MMCFG),A
POP AF
ENDIF
;
CALL CURSRSTR ; Restore char under cursor.
CP 00DH
JR Z,NEWLINE
CP 00AH
JR Z,NEWLINE
CP 07FH
JR Z,DELETECHR
JP Z,DELETECHR
CP BACKS
JP Z,DELETECHR
PUSH BC
@@ -7474,7 +7472,7 @@ MEMSW4: IF BUILD_MZ700+BUILD_TZFS > 0
POP BC
PRNT1: CALL DSPXYTOADDR
;
MEMSW5: IF BUILD_MZ700+BUILD_TZFS > 0
MEMSW5: IF BUILD_MZ700+BUILD_MZ700_TZFS > 0
LD A,TZMM_MZ700_2 ; Enable access to the hardware by paging out the upper bank.
OUT (MMCFG),A
ENDIF
@@ -7490,7 +7488,7 @@ PRNTSTR: LD A,(DE)
JR Z,PRNTSTR6
INC DE
;
CALL CURSRSTR ; Restore char under cursor.
CALL CURSOROFF ; Turn cursor off for any printing.
CP 00DH
JR NZ,PRNTSTR2
PRNTSTR1: LD A,(DPRNT)
@@ -8189,7 +8187,7 @@ WTAP3: POP HL
LD BC,00080H
LD HL,IBUFE
RD1: DI
MEMSWRT0: IF BUILD_MZ700+BUILD_TZFS > 0
MEMSWRT0: IF BUILD_MZ700+BUILD_MZ700_TZFS > 0
LD (SPISRSAVE),SP ; Share the interrupt stack whilst accessing hardware as the BASIC stack goes out of scope.
LD SP,ISRSTACK ; Interrupts are disabled so we can safely use this stack.
LD A,TZMM_MZ700_0 ; We meed to be in memory mode 10 to access the tape hardware.
@@ -8238,7 +8236,7 @@ RTP2: CALL EDGE
RTP3: CALL RBYTE
JP C,RTP6
; For TZFS/RFS page in top bank of memory for potential data store.
MEMSWRT1: IF BUILD_MZ700+BUILD_TZFS > 0
MEMSWRT1: IF BUILD_MZ700+BUILD_MZ700_TZFS > 0
EX AF,AF'
LD A,TZMM_MZ700_2
OUT (MMCFG),A
@@ -8268,7 +8266,7 @@ MEMSWRT1: IF BUILD_MZ700+BUILD_TZFS > 0
JP NZ,RTP5
RTP8: XOR A
RET2: CALL MSTOP
MEMSWRT4: IF BUILD_MZ700+BUILD_TZFS > 0
MEMSWRT4: IF BUILD_MZ700+BUILD_MZ700_TZFS > 0
EX AF,AF'
LD A,TZMM_MZ700_2 ; Return to the full 64K memory mode.
OUT (MMCFG),A
@@ -8682,7 +8680,7 @@ ANSI_NN: CP "?" ; Simpl
CP "@" ; Is it a letter?
JP C,ANSIEXIT ; Abandon if not letter; something wrong
ANSIFOUND: CALL CURSRSTR ; Restore any character under the cursor.
ANSIFOUND: CALL CURSOROFF ; Turn cursor off and restore any character under the cursor.
LD HL,(NUMBERPOS) ; Get value of number buffer
LD A,(HAVELOADED) ; Did we put anything in this byte?
OR A
@@ -8692,11 +8690,6 @@ AF1: INC HL
LD A,254
LD (HL),A ; Mark end of sequence (for unlimited length sequences)
;Disable cursor as unwanted side effects such as screen flicker may occur.
LD A,(FLASHCTL)
BIT 7,A
CALL NZ,CURSOROFF
XOR A
LD (CURSORCOUNT),A ; Restart count
LD A,0C9h
@@ -8730,7 +8723,7 @@ AF1: INC HL
CP "u"
JP Z,RCP ; Restore the cursor position
ANSIEXIT: CALL CURSORON ; If t
ANSIEXIT: ;CALL CURSORON ; If t
LD HL,NUMBERBUF ; Numbers buffer position
LD (NUMBERPOS),HL
XOR A
@@ -9080,7 +9073,7 @@ CALC3: POP DE
; BC = length
CLRSCRN: DI
;
MEMSW6: IF BUILD_MZ700+BUILD_TZFS > 0
MEMSW6: IF BUILD_MZ700+BUILD_MZ700_TZFS > 0
LD A,TZMM_MZ700_0 ; Enable access to the hardware by paging out the upper bank.
OUT (MMCFG),A
ENDIF
@@ -9105,7 +9098,7 @@ MEMSW6: IF BUILD_MZ700+BUILD_TZFS > 0
LD (HL),A
LDIR
MEMSW7: IF BUILD_MZ700+BUILD_TZFS > 0
MEMSW7: IF BUILD_MZ700+BUILD_MZ700_TZFS > 0
LD A,TZMM_MZ700_2 ; Enable access to the hardware by paging out the upper bank.
OUT (MMCFG),A
ENDIF
@@ -9289,7 +9282,7 @@ COLOUR EQU 0
REBOOT: DI
REBOOTTZ: IF BUILD_MZ700+BUILD_TZFS > 0
REBOOTTZ: IF BUILD_MZ700+BUILD_MZ700_TZFS > 0
LD A,TZMM_TZFS
OUT (MMCFG),A
ENDIF
@@ -9320,7 +9313,7 @@ REBOOT80A: IF BUILD_MZ80A = 1
;--------------------------------------
BFREE: DB " Bytes free",CR,LF,0,0
SIGNON: IF BUILD_TZFS = 1
SIGNON: IF BUILD_MZ80A_TZFS + BUILD_MZ700_TZFS > 0
DB "Microsoft Basic (TZFS) Ver 4.7b",CR,LF
DB "Copyright ",40,"C",41
DB " 1978 by Microsoft",CR,LF,0,0
@@ -9532,64 +9525,23 @@ CODEEND:
; For TZFS builds the image needs to be relocated from 0x1200 to 0x0000 on startup after switching the memory mode.
RELOCSTART: IF BUILD_MZ700+BUILD_TZFS > 0
ORG $ + 1200H
RELOCSTART: IF BUILD_MZ700+BUILD_MZ700_TZFS > 0
ORG $ + 1200H
ENDIF
; Switch memory.
RELOC: LD A, TZMM_MZ700_0 ; Switch to the MZ700 memory map where the lower 4K 0000:0FFF is in block 6, we therefore preserve the Monitor for exit.
OUT (MMCFG),A
; Switch memory.
RELOC: IF BUILD_MZ700+BUILD_MZ700_TZFS > 0
LD A, TZMM_MZ700_0 ; Switch to the MZ700 memory map where the lower 4K 0000:0FFF is in block 6, we therefore preserve the Monitor for exit.
OUT (MMCFG),A
; Move the image down and start.
LD DE, 0000H
LD HL, 01200H
LD BC, CODEEND - CODESTART
LDIR
JP 0000H
; ; For RFS builds a two stage relocation is needed, a) relocate to tranzputer RAM, b) run the TZFS relocation code.
;RELOC_RFS: IF BUILD_RFS = 1
;
; ; Switch memory.
;RELOCRFS: LD A, TZMM_BOOT ; Go to boot mode, copy the relocation code to EC80H and execute.
; OUT (MMCFG),A
;
; ; Move the relocation code to EC80H.
; LD DE, 0EC80H
; LD HL, RELOCRFS2
; LD BC, RELOCRFS2END - RELOCRFS2
; LDIR
; JP 0EC80H ; Run the relocation code.
;
; ENDIF
; Move the image down and start.
LD DE, 0000H
LD HL, 01200H
LD BC, CODEEND - CODESTART
LDIR
JP 0000H
ENDIF
RELOCEND:
;
;RELOCRFS2: ; Move the image down into tranZPUter memory and then start the real relocation.
; LD HL, 01200H
; LD BC, (CODEEND - CODESTART) + (RELOCEND - RELOC) ; Size of program.
;
; ; Fetch a byte from main DRAM and write it into Bank 0 same location.
;RELOCRFS2_1:LD A,TZMM_BOOT
; OUT (MMCFG),A
; LD A,(HL)
; ;
; EX AF,AF'
; LD A,TZMM_TZFS
; OUT (MMCFG),A
; EX AF,AF'
; ;
; LD (HL),A
; INC HL
; DEC BC
; LD A,B
; OR C
; JR NZ, RELOCRFS2_1
; ;
; LD DE, 00000H ; Copy the reboot handler into Bank 0 at 00000H.
; LD HL, 0EC80H + (REBOOTRFS - RELOCRFS2)
; LD BC, RELOCRFS2END - REBOOTRFS
; LDIR
; ;
; JP RELOC ; Jump into the original TZFS relocation code.
; Reboot handler for RFS mode. This code is transferred into RAM bank 0 at 0000H as this is not used for BASIC
; and executed when a return to the Monitor ROM is needed. Location 004AH in the Monitor ROM is the startup vector.

File diff suppressed because it is too large Load Diff

View File

@@ -463,8 +463,9 @@ TZSVCDIR_ENTSZ: EQU 32 ; Size
TZSVCWAITIORETRIES: EQU 500 ; Wait retries for IO response.
TZSVCWAITCOUNT: EQU 65535 ; Wait retries for IO request response.
TZSVC_FTYPE_MZF: EQU 0 ; File type being handled is an MZF
TZSVC_FTYPE_CAS: EQU 1 ; File type being handled is an CASsette BASIC script.
TZSVC_FTYPE_BAS: EQU 2 ; File type being handled is an BASic script
TZSVC_FTYPE_MZFHDR: EQU 1 ; File type being handled is an MZF Header.
TZSVC_FTYPE_CAS: EQU 2 ; File type being handled is an CASsette BASIC script.
TZSVC_FTYPE_BAS: EQU 3 ; File type being handled is an BASic script
TZSVC_FTYPE_ALL: EQU 10 ; Handle any filetype.
TZSVC_FTYPE_ALLFMT: EQU 11 ; Special case for directory listings, all files but truncated and formatted.

View File

@@ -1 +1 @@
BUILD_VERSION EQU 2
BUILD_VERSION EQU 3

View File

@@ -48,7 +48,8 @@
IF BUILD_VERSION = 0
BUILD_MZ80A EQU 1 ; Build for the standard Sharp MZ80A, no lower memory. Manually change MAXMEM above.
BUILD_MZ700 EQU 0 ; Build for the Sharp MZ-700 base hardware.
BUILD_TZFS EQU 0 ; Build for TZFS where extended memory is available.
BUILD_MZ80A_TZFS EQU 0 ; Build for TZFS running on an MZ-80A where extended memory is available.
BUILD_MZ700_TZFS EQU 0 ; Build for TZFS running on an MZ-700 where extended memory is available.
BUILD_VIDEOMODULE EQU 0 ; Build for the Video Module v2 board (=1) otherwise build for the 80Char Colour Board v1.0
BUILD_80C EQU 0
INCLUDE_ANSITERM EQU 1 ; Include the Ansi terminal emulation processor in the build.
@@ -57,16 +58,18 @@ INCLUDE_ANSITERM EQU 1 ; Inclu
IF BUILD_VERSION = 1
BUILD_MZ80A EQU 0
BUILD_MZ700 EQU 1 ; Build for the Sharp MZ-700 base hardware.
BUILD_TZFS EQU 0
BUILD_MZ80A_TZFS EQU 0 ; Build for TZFS running on an MZ-80A where extended memory is available.
BUILD_MZ700_TZFS EQU 0 ; Build for TZFS running on an MZ-700 where extended memory is available.
BUILD_VIDEOMODULE EQU 0 ; Build for the Video Module v2 board (=1) otherwise build for the 80Char Colour Board v1.0
BUILD_80C EQU 0
INCLUDE_ANSITERM EQU 1 ; Include the Ansi terminal emulation processor in the build.
ENDIF
; TZFS Enhanced MZ-80A with no video card upgrade.
; TZFS Enhanced MZ-80A/MZ-700 with no video card upgrade.
IF BUILD_VERSION = 2
BUILD_MZ80A EQU 0
BUILD_MZ700 EQU 0 ; Build for the Sharp MZ-700 base hardware.
BUILD_TZFS EQU 1
BUILD_MZ80A_TZFS EQU 0 ; Build for TZFS running on an MZ-80A where extended memory is available.
BUILD_MZ700_TZFS EQU 1 ; Build for TZFS running on an MZ-700 where extended memory is available.
BUILD_VIDEOMODULE EQU 0 ; Build for the Video Module v2 board (=1) otherwise build for the 80Char Colour Board v1.0
BUILD_80C EQU 0
INCLUDE_ANSITERM EQU 1 ; Include the Ansi terminal emulation processor in the build.
@@ -75,7 +78,8 @@ INCLUDE_ANSITERM EQU 1 ; Inclu
IF BUILD_VERSION = 3
BUILD_MZ700 EQU 0 ; Build for the Sharp MZ-700 base hardware.
BUILD_MZ80A EQU 0
BUILD_TZFS EQU 1
BUILD_MZ80A_TZFS EQU 0 ; Build for TZFS running on an MZ-80A where extended memory is available.
BUILD_MZ700_TZFS EQU 1 ; Build for TZFS running on an MZ-700 where extended memory is available.
BUILD_VIDEOMODULE EQU 1 ; Build for the Video Module v2 board (=1) otherwise build for the 80Char Colour Board v1.0
BUILD_80C EQU 1
INCLUDE_ANSITERM EQU 1 ; Include the Ansi terminal emulation processor in the build.
@@ -95,7 +99,7 @@ KEYBUFSIZE EQU 64 ; Ensur
IF BUILD_MZ80A = 1
MAXMEM EQU 0CFFFH ; Top of RAM on a standard Sharp MZ80A.
ELSE
MAXMEM EQU 10000H - TZSVCSIZE ; Top of RAM on the tranZPUter/
MAXMEM EQU 10000H - TZSVCSIZE ; Top of RAM on the tranZPUter
ENDIF
; Tape load/save modes. Used as a flag to enable common code.
@@ -443,8 +447,9 @@ TZSVCDIR_ENTSZ: EQU 32 ; Size
TZSVCWAITIORETRIES: EQU 500 ; Wait retries for IO response.
TZSVCWAITCOUNT: EQU 65535 ; Wait retries for IO request response.
TZSVC_FTYPE_MZF: EQU 0 ; File type being handled is an MZF
TZSVC_FTYPE_CAS: EQU 1 ; File type being handled is an CASsette BASIC script.
TZSVC_FTYPE_BAS: EQU 2 ; File type being handled is an BASic script
TZSVC_FTYPE_MZFHDR: EQU 1 ; File type being handled is an MZF Header.
TZSVC_FTYPE_CAS: EQU 2 ; File type being handled is an CASsette BASIC script.
TZSVC_FTYPE_BAS: EQU 3 ; File type being handled is an BASic script
TZSVC_FTYPE_ALL: EQU 10 ; Handle any filetype.
TZSVC_FTYPE_ALLFMT: EQU 11 ; Special case for directory listings, all files but truncated and formatted.
TZSVCCMD: DS virtual 1 ; Service command.

View File

@@ -488,6 +488,8 @@ TRK0FD3: DS virtual 1 ; Flopp
TRK0FD4: DS virtual 1 ; Floppy Disk 4 track 0 indicator.
RETRIES: DS virtual 1 ; Retries count for a command.
BPARA: DS virtual 1
CMTINACTIVE: DS virtual 1 ; Flag to indicate if the CMT is inactive (1)/SD active (0) for the CMT wrapper handlers.
CMTFILENO: DS virtual 1 ; Sequential file access file number. Used when no filename is given, uses the directory entry number for the set wildcard,
DS virtual (TZVARMEM + TZVARSIZE) - $ ; Top of variable area downwards is used as the working stack, SA1510 space isnt used.
TZSTACK: EQU TZVARMEM + TZVARSIZE
@@ -507,8 +509,9 @@ TZSVCDIR_ENTSZ: EQU 32 ; Size
TZSVCWAITIORETRIES: EQU 5 ; Wait retries for IO response.
TZSVCWAITCOUNT: EQU 65535 ; Wait retries for IO request response.
TZSVC_FTYPE_MZF: EQU 0 ; File type being handled is an MZF
TZSVC_FTYPE_CAS: EQU 1 ; File type being handled is an CASsette BASIC script.
TZSVC_FTYPE_BAS: EQU 2 ; File type being handled is an BASic script
TZSVC_FTYPE_MZFHDR: EQU 1 ; File type being handled is an MZF Header.
TZSVC_FTYPE_CAS: EQU 2 ; File type being handled is an CASsette BASIC script.
TZSVC_FTYPE_BAS: EQU 3 ; File type being handled is an BASic script
TZSVC_FTYPE_ALL: EQU 10 ; Handle any filetype.
TZSVC_FTYPE_ALLFMT: EQU 11 ; Special case for directory listings, all files but truncated and formatted.
TZSVCCMD: DS virtual 1 ; Service command.

View File

@@ -24,6 +24,9 @@
;- - Added optional machine model code on load command to enable 700/800
;- programs to be loaded without changing the MZ800 mode switch.
;- Apr 2021 - Added 40/80 Colour Card control. Reorganised to free up space.
;- Apr 2021 - Updated to add ?RDI/?RDD/?WRI/?WRD/DIR/CD methods to ease conversion of
;- programs from cassette storage to SD storage, first conversion being
;- BASIC SA-5510.
;-
;--------------------------------------------------------------------------------------------------------
;- This source file is free software: you can redistribute it and-or modify
@@ -88,6 +91,21 @@ BANKTOBANK_:JMPTOBNK
ALIGN TZFSJMPTABLE
ORG TZFSJMPTABLE
;------------------------------------------------------------------------------------------
; External function Jump table.
; This table is used by external (to TZFS) programs to invoke functionality as required.
; The entry point is fixed, starting at TZFSJMPTABLE incrementing by 3 for each call.
;------------------------------------------------------------------------------------------
CMT_RDINF: JP _CMT_RDINF ; UROMADDR+80H - Tape/SD intercept handler - Read Header
CMT_RDDATA: JP _CMT_RDDATA ; UROMADDR+83H - Tape/SD intercept handler - Read Data
CMT_WRINF: JP _CMT_WRINF ; UROMADDR+86H - Tape/SD intercept handler - Write Header
CMT_WRDATA: JP _CMT_WRDATA ; UROMADDR+89H - Tape/SD intercept handler - Write Data
CMT_VERIFY: JP _CMT_VERIFY ; UROMADDR+8CH - Tape/SD intercept handler - Verify Data
CMT_DIR: JP _CMT_DIR ; UROMADDR+8FH - SD card directory listing command.
CMT_CD: JP _CMT_CD ; UROMADDR+92H - SD change directory command.
SET_FREQ: JP ?SETFREQ ; UROMADDR+95H - Set Frequency command.
;------------------------------------------------------------------------------------------
; Enhanced function Jump table.
; This table is generally used by a banked page to call a function within another banked
@@ -115,6 +133,7 @@ BANKTOBANK_:JMPTOBNK
?PTESTX: CALLBNK PTESTX, TZMM_TZFS3
?GETMODEL: CALLBNK GETMODEL, TZMM_TZFS3
?PLTST: CALLBNK PLTST, TZMM_TZFS3
CNV_ATOS: CALLBNK CNVSTR_AS, TZMM_TZFS2 ;
;-----------------------------------------
@@ -1156,6 +1175,8 @@ GETSDDIRENT:PUSH BC
LD A,(TZSVCDIRSEC) ; Do we have this sector in the buffer? If we do, use it.
CP C
JR Z,GETDIRSD0
LD A,TZSVC_FTYPE_MZF ; Setup to filter on MZF type files.
LD (TZSVC_FILE_TYPE),A
LD A,C
LD (TZSVCDIRSEC), A ; Store the directory sector we need.
;
@@ -1218,7 +1239,8 @@ SETWILDCARD:LD HL, TZSVCWILDC ; Locat
; The file number and file name are then printed out in tabular format. The file number can be used in Load/Save commands
; instead of the filename.
;
; No inputs or outputs.
; Inputs:
; DE = Pointer to BUFER start of wildcard if present.
;
DIRSDCARD: CALL SETWILDCARD
LD A,1 ; Setup screen for printing, account for the title line. TMPLINECNT is used for page pause.
@@ -1256,20 +1278,45 @@ LOADSDCP: LD A,0FFH
LD (SDAUTOEXEC),A
JR LOADSD2
; Method/entry point to load a file header only. This method is for compatibility with the Sharp ?RDI/?RDD methods.
;
LOADSDINF: LD A,TZSVC_FTYPE_MZFHDR
JR LOADSD2C
; Method/entry point to load a file with header already preset. This method is for compatibility with the Sharp ?RDI/?RDD methods.
;
LOADSDDATA: LD A,0FEH ; Mark dont execute and dont print details.
LD (SDAUTOEXEC),A
XOR A
LD (SDCOPY),A
LD A,TZSVC_FTYPE_MZF ; Full file load.
LD (TZSVC_FILE_TYPE),A
LD HL,(DTADR) ; Load address comes from the header as caller may have changed it, ie. BASIC.
LD (TZSVC_LOADADDR),HL
LD A,0FFH ; Reset result code ready for new result.
LD (RESULT),A
JR LOADSD3A ; Load program defined in CMT header.
; Load a program from the SD Card into RAM and/or execute it.
;
; DE points to a number or filename to load.
LOADSDCARDX:LD A,0FFH
JR LOADSD1
LOADSDCARD: LD A,000H
LOADSDCARD: XOR A
LOADSD1: LD (SDAUTOEXEC),A
XOR A ; Clear copying flag.
LOADSD2: LD (SDCOPY),A
LD A,TZSVC_FTYPE_MZF ; Default to full file load.
;
LD HL,0FFFFH ; Setup the load address to 0xFFFF = load address definded in file MZF header.
LD (TZSVC_LOADADDR),HL
;
LOADSD2C: LD (TZSVC_FILE_TYPE),A
;
PUSH DE
LD A,0FFH ; For interbank calls, save result in a memory variable.
LD (RESULT),A
PUSH DE
LD A,0FFh ; Tag the filenumber as invalid.
LD (TZSVC_FILE_NO), A
CALL _2HEX
JR C, LOADSD2A ;
@@ -1282,27 +1329,33 @@ LOADSD2A: CALL ?GETMODEL ; Get m
INC A ; Mainboard mode.
LOADSD2B: LD (TZSVC_MEM_TARGET), A
POP HL
LD A,(TZSVC_FILE_NO) ; Test to see if a file number was found, if one wasnt then a filename was given, so copy.
LD A,(TZSVC_FILE_NO) ; Test to see if a file number was found, if none then a filename was given, so copy.
CP 0FFH
JR NZ,LOADSD3A
LOADSD3: LD DE,TZSVC_FILENAME
LD BC,TZSVCFILESZ
LDIR ; Copy in the MZF filename.
LOADSD3A: LD A,TZSVC_FTYPE_MZF ; Set to MZF type files.
LD (TZSVC_FILE_TYPE),A
LD A,TZSVC_CMD_LOADFILE
;
LOADSD3A: LD A,TZSVC_CMD_LOADFILE
LD (TZSVCCMD), A ; Load up the command into the service record.
CALL SVC_CMD ; And make communications with the I/O processor, returning with the required record.
OR A
JR Z, LOADSD4
LD A,255 ; Report I/O error as 255.
RET
JP LOADSDX2
LOADSD4: LD A,(TZSVCRESULT)
OR A
JR NZ, LOADSD4A
LD A,(TZSVC_FILE_TYPE) ; Check to see if we are making a full file load, if header only then return.
CP TZSVC_FTYPE_MZF
JR Z, LOADSD14
JR LOADSDX
LOADSD4A: LD DE,MSGNOTFND
CALL ?PRINTMSG ; Print message that file wasnt found.
RET
LD A,1
JR LOADSDX2
; The file has been found and loaded into memory by the I/O processor.
LD DE,MSGLOAD+1 ; Skip initial CR.
@@ -1312,6 +1365,8 @@ LOADSD4A: LD DE,MSGNOTFND
LOADSD14: LD A,(SDAUTOEXEC) ; Autoexecute turned off?
CP 0FFh
JP Z,LOADSD15 ; Go back to monitor if it has been turned off, else execute.
CP 0FEH ; Extension for ?RDD - if set to 0FEH then dont print information just return.
JR Z,LOADSDX
;
LD A,(TZSVCSECTOR+TZFS_ATRB) ; Fetch the CMT data from the service sector.
LD HL,(TZSVCSECTOR+TZFS_EXADR) ; Save the execution address as it may not be in scope later on.
@@ -1524,13 +1579,14 @@ SAVESDCARD: CALL GETCMTPARM ; Get t
LD A,C
OR A
RET NZ ; Exit if an error occurred.
XOR A ; Disable the copy flag.
;
LD A,OBJCD ; Set attribute: OBJ
LD (ATRB),A
;
SAVESDDATA: XOR A ; Disable the copy flag.
SAVESD1: LD (SDCOPY),A
LD A,0FFH ; Interbank calls, pass result via a memory variable. Assume failure unless updated.
LD (RESULT),A
LD A,OBJCD ; Set attribute: OBJ
LD (ATRB),A
; Save the file by making a service call to the I/O processor, it will allocate a filename on the SD, read the tranZPUter memory directly based on the values in the
; service record.
@@ -1570,6 +1626,8 @@ CHGSDDIR: LD HL, TZSVC_DIRNAME ; Locat
LD B,TZSVCDIRSZ-1 ; Ensure we dont overflow the buffer.
CALL GETSTRING
;
LD A,TZSVC_FTYPE_MZF ; Setup to filter on MZF type files.
LD (TZSVC_FILE_TYPE),A
LD A,TZSVC_CMD_CHANGEDIR ; Inform I/O processor that a directory change has taken place, allows it to cache the new dir.
LD (TZSVCCMD), A ; Load up the command into the service record.
CALL SVC_CMD ; And make communications wit the I/O processor, returning with the required record.
@@ -1587,6 +1645,7 @@ CHGDIR1: LD A,(TZSVCRESULT)
JR CHGDIR3
CHGDIR2: LD A,0 ; Success.
CHGDIR3: LD (RESULT),A
OR A
RET
;-------------------------------------------------------------------------------
@@ -2057,6 +2116,168 @@ GETSTR2: XOR A ; Place
; END OF UTILITIES
;-------------------------------------------------------------------------------
;-------------------------------------------------------------------------------
; API METHODS - Intercept handlers to provide enhanced services to
; existing MA-700 BIOS API functions.
;-------------------------------------------------------------------------------
; Method to check if the active drive is the CMT.
CHECKCMT: LD A,(CMTINACTIVE) ; Test the flag to see if the default is to use the CMT for the CMT/SD intercept handlers.
OR A ; Flag set to > 0 if the CMT is not active.
RET
; Convert the lower 4 bits of A into a Hex character.
TOHEXDIGIT: AND 00FH ; Simple logic, add 30H to get 0..9, add additional 7 if value >= 10 to get digits A..F.
CP 00AH
JR C,NOADD
ADD A,007H
NOADD: ADD A,030H
RET
; Convert a number into Hex string and store in buffer pointed to by DE.
;
TOHEX: PUSH DE
PUSH AF ; Save AF to retrieve lower 4 bits.
RRCA ; Shift upper 4 bits to lower to convert to hex.
RRCA
RRCA
RRCA
CALL TOHEXDIGIT
LD (DE),A ; Store and convert lower 4 bits.
INC DE
POP AF
CALL TOHEXDIGIT
LD (DE),A
INC DE
LD A,CR ; Terminate with a CR.
LD (DE),A
POP DE ; DE back to start of string.
RET
; Handler to intercept the CMT Read Header Information call.
; DE contains a pointer to memory containing the file to load. If (DE) = NULL then
; load the next sequential file from the SD card directory.
; DE = Filename.
;
; No registers or flags should be affected as we dont know the caller state.
_CMT_RDINF: CALL CHECKCMT ; If drive is set to the CMT Unit exit with Z set so that the original CMT handlers are called.
JP Z,?RDI
LD A,(DE) ; Check to see if empty string given, if so expand the default Next file number into the buffer.
CP CR
JR NZ,_CMT_RDINF1
LD A,(CMTFILENO) ; Get next sequential number and convert to hex.
PUSH AF
CALL TOHEX
POP AF
INC A ; Increment number so next call retrieves the next sequential file.
LD (CMTFILENO),A
;
_CMT_RDINF1:PUSH DE
CALL LOADSDINF ; DE already points to the filename, call LOADSDINF to locate it on the SD card and setup the header.
POP DE
OR A
SCF
RET NZ ; > 0 = fail, return with carry set.
; Copy the filename into the Buffer provided allowing for file number to name expansion.
LD HL,NAME
LD BC,TZSVCFILESZ
LDIR
;
OR A
RET ; 0 = success, return with carry clear.
; Handler to intercept the CMT Read Data call and insert selectable SD Card
; Drive functionality.
;
; No registers or flags should be affected as we dont know the caller state.
_CMT_RDDATA:CALL LOADSDDATA
OR A
JR NZ,_CMT_RDERR
RET
_CMT_RDERR: SCF
RET
; Handler to intercept the CMT Write Header Information call and insert selectable
; SD Card RFS Drive functionality.
;
; No registers or flags should be affected as we dont know the caller state.
;
; At the moment, the WRINF call only creates a filename if none specified. The actual write to file occurs in WRDATA. Once I have more understanding of
; how the sequential data mode works I can adapt it to be compatible.
_CMT_WRINF: LD DE,NAME ; Caller has already setup the CMT header so we use this for processing.
;
CALL CHECKCMT
JP Z,?WRI
;
LD A,(DE) ; Check to see if empty string given, if so create a default name.
CP CR
JR NZ,_CMT_WRINF1
;
LD HL,DEFAULTFN
LD BC,DEFAULTFNE - DEFAULTFN
LDIR
LD A,(CMTFILENO) ; Get next sequential number and convert to hex.
PUSH AF
CALL TOHEX
POP AF
INC A ; Increment number so next call retrieves the next sequential file.
LD (CMTFILENO),A
;
_CMT_WRINF1:LD A,0 ; Always success as nothing is written.
OR A
RET
; Handler to intercept the CMT Write Data call and insert selectable SD Card RFS
; Drive functionality.
;
; No registers or flags should be affected as we dont know the caller state.
_CMT_WRDATA:CALL SAVESDDATA
LD A,(RESULT)
OR A
JR NZ,_CMT_RDERR
RET
; Handler to intercept the CMT Verify Data call and insert selectable SD Card
; Drive functionality.
;
; No registers or flags should be affected as we dont know the caller state.
_CMT_VERIFY:CALL CHECKCMT
JR Z,_VERIFY
LD DE,MSGNOVERIFY
JR SD_ERRMSG
_VERIFY: JP ?VRFY
SD_NOTFND: LD DE,MSGNOTFND
SD_ERRMSG: CALL ?PRINTMSG
LD A,1
OR A
RET
; Method list the active directory contents.
_CMT_DIR: CALL CHECKCMT ; Cannot DIR tape drive so give error.
JP Z,_CMT_NODIR
CALL DIRSDCARD ; List the directory contents with optional directory/wildcard filter.
RET
_CMT_NODIR: LD DE,MSGNOCMTDIR
JR SD_ERRMSG
; Method to set the active directory or CMT unit/SD card. ie. \BAS to change to directory \BAS on the SD card, C to switch to CMT unit.
_CMT_CD: LD A,(DE)
CP 'C' ; Check to see if we are enabling the CMT unit.
JR NZ,_CMT_CD2
XOR A ; CMT is now active so clear the inactive flag.
_CMT_CD1: LD (CMTINACTIVE),A
RET
_CMT_CD2: CALL CHGSDDIR ; Change directory, if not valid do not update the CMTINACTIVE flag.
RET NZ
LD A,1
JR _CMT_CD1
;-------------------------------------------------------------------------------
; END OF API METHODS
;-------------------------------------------------------------------------------
; A method used when testing hardware, scope and code will change but one of its purposes is to generate a scope signal pattern.
;
@@ -2068,7 +2289,8 @@ LOCALTEST: LD A,0
; Quick load prgram names.
CPMFILENAME:DB 0 ; "CPM223", 000H, 000H, 000H, 000H, 000H, 000H, 000H, 000H, 000H, 000H, 000H, 000H
BASICFILENM:DB 0 ; "BASIC SA-5510", 000H
DEFAULTFN: DB "DEFAULT"
DEFAULTFNE: EQU $
; Error tone.
ERRTONE: DB "A0", 0D7H, "ARA", 0D7H, "AR", 00DH

View File

@@ -175,6 +175,68 @@ PRTSTRE: POP DE
POP AF
RET
; Method to convert a string with Sharp ASCII codes into standard ASCII codes via map lookup.
; Inputs: DE = pointer to string for conversion.
; B = Maximum number of characters to convert if string not terminated.
;
CNVSTR_SA: PUSH HL
PUSH DE
PUSH BC
CNVSTRSA1: LD A,(DE) ; Get character for conversion.
OR A ; Exit at End of String (NULL, CR)
JR Z,CNVSTRSAEX
CP 00DH
JR Z,CNVSTRSAEX
CP 020H ; No point mapping control characters.
JR C,CNVSTRSA2
;
LD HL,SHARPTOASC ; Start of mapping table.
PUSH BC
LD C,A
LD B,0
ADD HL,BC ; Add in character offset.
POP BC
LD A,(HL)
LD (DE),A ; Map character.
CNVSTRSA2: INC DE
DJNZ CNVSTRSA1
CNVSTRSAEX: POP BC ; Restore all registers used except AF.
POP DE
POP HL
RET
; Method to convert a string with standard ASCII into Sharp ASCII codes via scan lookup in the mapping table.
; Inputs: DE = pointer to string for conversion.
; B = Maximum number of characters to convert if string not terminated.
CNVSTR_AS: PUSH HL
PUSH DE
PUSH BC
CNVSTRAS1: LD A,(DE) ; Get character for conversion.
OR A ; Exit at End of String (NULL, CR)
JR Z,CNVSTRSAEX
CP 00DH
JR Z,CNVSTRSAEX
CP 020H ; No point mapping control characters.
JR C,CNVSTRAS5
LD HL,SHARPTOASC + 020H
PUSH BC
LD B, 0100H - 020H
CNVSTRAS2: CP (HL) ; Go through table looking for a match.
JR Z,CNVSTRAS3
INC HL
DJNZ CNVSTRAS2
JR CNVSTRAS4 ; No match then dont convert.
CNVSTRAS3: LD BC,SHARPTOASC ; On match or expiration of BC subtract table starting point to arrive at index.
OR A
SBC HL,BC
LD A,L ; Index is used as the converted character.
CNVSTRAS4: LD (DE),A
POP BC
CNVSTRAS5: INC DE
DJNZ CNVSTRAS1
JR CNVSTRSAEX
; TRUE ASCII TO DISPLAY CODE TABLE
;
ATBL: DB 0CCH ; NUL '\0' (null character)
@@ -307,6 +369,26 @@ ATBL: DB 0CCH ; NUL '\0' (null character)
DB 0C0H ; DEL
ATBLE: EQU $
; Mapping table to convert between Sharp ASCII and standard ASCII.
; Sharp -> ASCII : Index with Sharp value into table to obtain conversion.
; ASCII -> Sharp : Scan into table looking for value, on match the idx is the conversion. NB 0x20 = 0x20.
SHARPTOASC: DB 000H, 020H, 020H, 020H, 020H, 020H, 020H, 020H, 020H, 020H, 020H, 020H, 020H, 000H, 020H, 020H ; 0x0F
DB 020H, 020H, 020H, 020H, 020H, 020H, 020H, 020H, 020H, 020H, 020H, 020H, 020H, 020H, 020H, 020H ; 0x1F
DB 020H, 021H, 022H, 023H, 024H, 025H, 026H, 027H, 028H, 029H, 02AH, 02BH, 02CH, 02DH, 02EH, 02FH ; 0x2F
DB 030H, 031H, 032H, 033H, 034H, 035H, 036H, 037H, 038H, 039H, 03AH, 03BH, 03CH, 03DH, 03EH, 03FH ; 0x3F
DB 040H, 041H, 042H, 043H, 044H, 045H, 046H, 047H, 048H, 049H, 04AH, 04BH, 04CH, 04DH, 04EH, 04FH ; 0x4F
DB 050H, 051H, 052H, 053H, 054H, 055H, 056H, 057H, 058H, 059H, 05AH, 05BH, 05CH, 05DH, 05EH, 05FH ; 0x5F
DB 020H, 020H, 020H, 020H, 020H, 020H, 020H, 020H, 020H, 020H, 020H, 020H, 020H, 020H, 020H, 020H ; 0x6F
DB 020H, 020H, 020H, 020H, 020H, 020H, 020H, 020H, 020H, 020H, 020H, 020H, 020H, 020H, 020H, 020H ; 0x7F
DB 020H, 020H, 020H, 020H, 020H, 020H, 020H, 020H, 020H, 020H, 020H, 020H, 020H, 020H, 020H, 020H ; 0x8F
DB 020H, 020H, 065H, 020H, 020H, 020H, 074H, 067H, 068H, 020H, 062H, 078H, 064H, 072H, 070H, 063H ; 0x9F
DB 071H, 061H, 07AH, 077H, 073H, 075H, 069H, 020H, 04FH, 06BH, 066H, 076H, 020H, 075H, 042H, 06AH ; 0xAF
DB 06EH, 020H, 055H, 06DH, 020H, 020H, 020H, 06FH, 06CH, 041H, 06FH, 061H, 020H, 079H, 020H, 020H ; 0xBF
DB 020H, 020H, 020H, 020H, 020H, 020H, 020H, 020H, 020H, 020H, 020H, 020H, 020H, 020H, 020H, 020H ; 0xCF
DB 020H, 020H, 020H, 020H, 020H, 020H, 020H, 020H, 020H, 020H, 020H, 020H, 020H, 020H, 020H, 020H ; 0xDF
DB 020H, 020H, 020H, 020H, 020H, 020H, 020H, 020H, 020H, 020H, 020H, 020H, 020H, 020H, 020H, 020H ; 0xEF
DB 020H, 020H, 020H, 020H, 020H, 020H, 020H, 020H, 020H, 020H, 020H, 020H, 020H, 020H, 020H, 020H ; 0xFF
;-------------------------------------------------------------------------------
; END OF PRINT ROUTINE METHODS
;-------------------------------------------------------------------------------
@@ -327,66 +409,57 @@ FDCJMPL2: JP (IX)
;-------------------------------------------------------------------------------
; 0 + <- 39
; -----------------------------------------
MSGSON: DB "+ TZFS v1.5 ", 000H ; Version 1.0-> first split from RFS v2.0
MSGSONEND: DB " **", 00DH, 000H ; Signon banner termination.
MSGSONT80: DB "(T80)", 000H ; T80 CPU detected.
MSGNOTFND: DB "Not Found", 00DH, 000H
MSGBADCMD: DB "???", 00DH, 000H
MSGSDRERR: DB "SD Read error, Sec:",0FBH, 000H
MSGSVFAIL: DB "Save failed.", 00DH, 000H
MSGERAFAIL: DB "Erase failed.", 00DH, 000H
MSGCDFAIL: DB "Directory invalid.", 00DH, 000H
MSGERASEDIR:DB "Deleted dir entry:",0FBH, 000H
MSGCMTDATA: DB "Load:",0FEH,",Exec:",0FFH, ",Size:", 0FBH, 00DH, 000H
MSGNOTBIN: DB "Not binary", 00DH, 000H
MSGLOAD: DB 00DH, "Loading ",'"',0FAH,'"', 00DH, 000H
MSGSAVE: DB 00DH, "Filename: ", 000H
MSGE1: DB 00DH, "Check sum error!", 00DH, 000H ; Check sum error.
MSGCMTWRITE:DB 00DH, "Writing ", '"',0FAH,'"', 00DH, 000H
MSGOK: DB 00DH, "OK!", 00DH, 000H
MSGSAVEOK: DB "Tape image saved.", 00DH, 000H
MSGBOOTDRV: DB 00DH, "Floppy boot drive ?", 000H
MSGLOADERR: DB 00DH, "Disk loading error", 00DH, 000H
MSGIPLLOAD: DB 00DH, "Disk loading ", 000H
MSGDSKNOTMST:DB 00DH, "This is not a boot disk", 00Dh, 000H
MSGINITM: DB "Init memory", 00DH, 000H
MSGREAD4HEX:DB "Bad hex number", 00DH, 000H
MSGT2SDERR: DB "Copy from Tape to SD Failed", 00DH, 000H
MSGSD2TERR: DB "Copy from SD to Tape Failed", 00DH, 000H
MSGT2SDOK: DB "Success, Tape to SD done.", 00DH, 000H
MSGSD2TOK: DB "Success, SD to Tape done.", 00DH, 000H
MSGUNKNHW: DB "Unknown hardware, cannot change!", 00DH, 000H
MSGFAILBIOS:DB "Failed to load alternate BIOS!", 00DH, 000H
MSGFAILEXIT:DB "TZFS exit failed, I/O proc error!", 00DH, 000H
MSGFREQERR: DB "Error, failed to change frequency!", 00DH, 000H
MSGBADNUM: DB "Error, bad number supplied!", 00DH, 000H
MSGNOFPGA: DB "Error, no FPGA video module!", 00DH, 000H
MSGT80ERR: DB "Error, failed to switch to T80 CPU!", 00DH, 000H
MSGZ80ERR: DB "Error, failed to switch to Z80 CPU!", 00DH, 000H
MSGZPUERR: DB "Error, failed to switch to ZPU CPU!", 00DH, 000H
MSGNOSOFTCPU:DB "No soft cpu hardware!", 00DH, 000H
MSGNOT80CPU:DB "T80 not available!", 00DH, 000H
MSGNOZPUCPU:DB "ZPU Evo not available!", 00DH, 000H
MSGSON: DB "+ TZFS v1.5 ", NULL ; Version 1.0-> first split from RFS v2.0
MSGSONEND: DB " **", CR, NULL ; Signon banner termination.
MSGSONT80: DB "(T80)", NULL ; T80 CPU detected.
MSGNOTFND: DB "Not Found", CR, NULL
MSGBADCMD: DB "???", CR, NULL
MSGSDRERR: DB "SD Read error, Sec:",0FBH, NULL
MSGSVFAIL: DB "Save failed.", CR, NULL
MSGERAFAIL: DB "Erase failed.", CR, NULL
MSGCDFAIL: DB "Directory invalid.", CR, NULL
MSGERASEDIR:DB "Deleted dir entry:",0FBH, NULL
MSGCMTDATA: DB "Load:",0FEH,",Exec:",0FFH, ",Size:", 0FBH, CR, NULL
MSGNOTBIN: DB "Not binary", CR, NULL
MSGLOAD: DB CR, "Loading ",'"',0FAH,'"', CR, NULL
MSGSAVE: DB CR, "Filename: ", NULL
MSGE1: DB CR, "Check sum error!", CR, NULL ; Check sum error.
MSGCMTWRITE:DB CR, "Writing ", '"',0FAH,'"', CR, NULL
MSGOK: DB CR, "OK!", CR, NULL
MSGSAVEOK: DB "Tape image saved.", CR, NULL
MSGBOOTDRV: DB CR, "Floppy boot drive ?", NULL
MSGLOADERR: DB CR, "Disk loading error", CR, NULL
MSGIPLLOAD: DB CR, "Disk loading ", NULL
MSGDSKNOTMST:DB CR, "This is not a boot disk", CR, NULL
MSGINITM: DB "Init memory", CR, NULL
MSGREAD4HEX:DB "Bad hex number", CR, NULL
MSGT2SDERR: DB "Copy from Tape to SD Failed", CR, NULL
MSGSD2TERR: DB "Copy from SD to Tape Failed", CR, NULL
MSGT2SDOK: DB "Success, Tape to SD done.", CR, NULL
MSGSD2TOK: DB "Success, SD to Tape done.", CR, NULL
MSGUNKNHW: DB "Unknown hardware, cannot change!", CR, NULL
MSGFAILBIOS:DB "Failed to load alternate BIOS!", CR, NULL
MSGFAILEXIT:DB "TZFS exit failed, I/O proc error!", CR, NULL
MSGFREQERR: DB "Error, failed to change frequency!", CR, NULL
MSGBADNUM: DB "Error, bad number supplied!", CR, NULL
MSGNOFPGA: DB "Error, no FPGA video module!", CR, NULL
MSGT80ERR: DB "Error, failed to switch to T80 CPU!", CR, NULL
MSGZ80ERR: DB "Error, failed to switch to Z80 CPU!", CR, NULL
MSGZPUERR: DB "Error, failed to switch to ZPU CPU!", CR, NULL
MSGNOSOFTCPU:DB "No soft cpu hardware!", CR, NULL
MSGNOT80CPU:DB "T80 not available!", CR, NULL
;
OKCHECK: DB ", CHECK: ", 00Dh, 000H
OKMSG: DB " OK.", 00Dh, 000H
OKCHECK: DB ", CHECK: ", CR, NULL
OKMSG: DB " OK.", CR, NULL
DONEMSG: DB 11h
DB "RAM TEST COMPLETE.", 00Dh, 000H
BITMSG: DB " BIT: ", 00Dh, 000H
BANKMSG: DB " BANK: ", 00Dh, 000H
MSG_TIMERTST:DB "8253 TIMER TEST", 00Dh, 000H
MSG_TIMERVAL:DB "READ VALUE 1: ", 00Dh, 000H
MSG_TIMERVAL2:DB "READ VALUE 2: ", 00Dh, 000H
MSG_TIMERVAL3:DB "READ DONE.", 00Dh, 000H
DB "RAM TEST COMPLETE.", CR, NULL
BITMSG: DB " BIT: ", CR, NULL
BANKMSG: DB " BANK: ", CR, NULL
MSG_TIMERTST:DB "8253 TIMER TEST", CR, NULL
MSG_TIMERVAL:DB "READ VALUE 1: ", CR, NULL
MSG_TIMERVAL2:DB "READ VALUE 2: ", CR, NULL
MSG_TIMERVAL3:DB "READ DONE.", CR, NULL
SVCRESPERR: DB "I/O Response Error, time out!",00DH, 000H
SVCIOERR: DB "I/O Error, time out!", 00DH, 000H
;TESTMSG: DB "HL is:",0FBH, 00DH, 000H
;TESTMSG2: DB "DE is:",0FBH, 00DH, 000H
;TESTMSG3: DB "BC is:",0FBH, 00DH, 000H
;TESTMSG4: DB "4 is:",0FBH, 00DH, 000H
; The FDC controller uses it's busy/wait signal as a ROM address line input, this
; causes a jump in the code dependent on the signal status. It gets around the 2MHz Z80 not being quick
@@ -395,6 +468,20 @@ SVCIOERR: DB "I/O Error, time out!", 00DH, 000H
ORG FDCJMP2
FDCJMPH2: JP (IY)
; Continuation of messages after the Floppy Disk controller fixed location.
MSGNOZPUCPU:DB "ZPU Evo not available!", CR, NULL
MSGNOCMTDIR:DB "CMT has no directory.", CR, NULL
MSGNOVERIFY:DB "No Verify for SD drive.", CR, NULL
SVCRESPERR: DB "I/O Response Error, time out!", CR, NULL
SVCIOERR: DB "I/O Error, time out!", CR, NULL
;TESTMSG: DB "HL is:",0FBH, 00DH, 000H
;TESTMSG2: DB "DE is:",0FBH, 00DH, 000H
;TESTMSG3: DB "BC is:",0FBH, 00DH, 000H
;TESTMSG4: DB "4 is:",0FBH, 00DH, 000H
;-------------------------------------------------------------------------------
; START OF HELP SCREEN FUNCTIONALITY

Binary file not shown.

View File

@@ -36,7 +36,7 @@ JARDIR=${ROOTDIR}/software/tools
ASM=glass-0.5.jar
BUILDROMLIST="MZ800_1Z_013B MZ800_9Z_504M MZ800_IOCS MZ80AFI monitor_SA1510 monitor_80c_SA1510 monitor_1Z-013A monitor_80c_1Z-013A monitor_1Z-013A-KM monitor_80c_1Z-013A-KM MZ80B_IPL"
#BUILDMZFLIST="hi-ramcheck sharpmz-test"
BUILDMZFLIST="5Z009-1B MSBASIC_MZ80A MSBASIC_MZ700 MSBASIC_TZFS sharpmz-test"
BUILDMZFLIST="5Z009-1B SA-5510_TZFS MSBASIC_MZ80A MSBASIC_MZ700 MSBASIC_TZ40 MSBASIC_TZ80 sharpmz-test"
ASMDIR=${ROOTDIR}/software/asm
ASMTMPDIR=${ROOTDIR}/software/tmp
INCDIR=${ROOTDIR}/software/asm/include
@@ -63,9 +63,12 @@ do
elif [[ ${SRCNAME} = "MSBASIC_MZ700" ]]; then
ASMNAME="MSBASIC.asm"
echo "BUILD_VERSION EQU 1" > ${INCDIR}/MSBASIC_BuildVersion.asm
elif [[ ${SRCNAME} = "MSBASIC_TZFS" ]]; then
elif [[ ${SRCNAME} = "MSBASIC_TZ40" ]]; then
ASMNAME="MSBASIC.asm"
echo "BUILD_VERSION EQU 2" > ${INCDIR}/MSBASIC_BuildVersion.asm
elif [[ ${SRCNAME} = "MSBASIC_TZ80" ]]; then
ASMNAME="MSBASIC.asm"
echo "BUILD_VERSION EQU 3" > ${INCDIR}/MSBASIC_BuildVersion.asm
fi
# Assemble the source.