Added interrupt driven keyboard buffer with autorepeat

Interrupt driven cursor flash with NO, CAPS and SHIFTLOCK modes.
Optimised some of the code and removed redundancies
This commit is contained in:
Philip Smart
2020-03-11 15:41:27 +00:00
parent b85b3538ff
commit 8e0a5c7d29
26 changed files with 1091 additions and 1128 deletions

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@@ -33,283 +33,194 @@
; USER ROM CPM CBIOS BANK 1
;
;======================================
ORG UROMADDR
ORG UROMADDR
;-----------------------------------------------------------------------------------------
; Common code spanning all banks to ensure that a Monitor is selected upon power up/reset.
;-----------------------------------------------------------------------------------------
NOP
XOR A ; We shouldnt arrive here after a reset, if we do, select MROM bank 0
LD (RFSBK1),A ; and start up - ie. SA1510 Monitor.
XOR A ; We shouldnt arrive here after a reset, ensure MROM and UROM are set to bank 0
LD (RFSBK1),A ; then a restart will take place as Bank 0 will jump to vector 00000H
LD (RFSBK2),A
NOP
JP 00000h
; After switching in Bank 0, it will automatically continue processing in Bank 0 at the XOR A instructionof ROMFS:
; Jump table for entry into this pages public functions.
JP ?MLDY ; 9 QMELDY
JP ?TEMP ; 12 QTEMP
JP MLDST ; 15 QMSTA
JP MLDSP ; 18 QMSTP
JP ?BEL ; 21 QBEL
JP ?TMST ; 24 QTIMST
JP ?TMRD ; 27 QTIMRD
JP ?REBOOT ; 9 REBOOT
JP ?MLDY ; 12 QMELDY
JP ?TEMP ; 15 QTEMP
JP MLDST ; 18 QMSTA
JP MLDSP ; 21 QMSTP
JP ?BEL ; 24 QBEL
; Method to reboot the machine into startup mode, ie. Monitor at MROM Bank 0, UROM at Bank 0.
?REBOOT: LD A,(MEMSWR) ; Switch memory to power up state, ie. Monitor ROM at 00000H
JP UROMADDR ; Now run the code at the bank start which switches to bank 0, intitialises and then calls 00000H
; Melody function.
?MLDY: PUSH BC
PUSH DE
PUSH HL
LD A,002H
LD (OCTV),A
LD B,001H
MLD1: LD A,(DE)
CP 00DH
JR Z,MLD4
CP 0C8H
JR Z,MLD4
CP 0CFH
JR Z,MLD2
CP 02DH
JR Z,MLD2
CP 02BH
JR Z,MLD3
CP 0D7H
JR Z,MLD3
CP 023H
LD HL,MTBL
JR NZ,MLD1A
LD HL,M?TBL
INC DE
MLD1A: CALL ONPU
JR C,MLD1
CALL RYTHM
JR C,MLD5
CALL MLDST
LD B,C
JR MLD1
MLD2: LD A,003H
MLD2A: LD (OCTV),A
INC DE
JR MLD1
MLD3: LD A,001H
JR MLD2A
MLD4: CALL RYTHM
MLD5: PUSH AF
CALL MLDSP
POP AF
POP HL
POP DE
POP BC
RET
ONPU: PUSH BC
LD B,008H
LD A,(DE)
ONP1A: CP (HL)
JR Z,ONP2
INC HL
INC HL
INC HL
DJNZ ONP1A
SCF
INC DE
POP BC
RET
ONP2: INC HL
PUSH DE
LD E,(HL)
INC HL
LD D,(HL)
EX DE,HL
LD A,H
OR A
JR Z,ONP2B
LD A,(OCTV)
ONP2A: DEC A
JR Z,ONP2B
ADD HL,HL
JR ONP2A
ONP2B: LD (RATIO),HL
LD HL,OCTV
LD (HL),002H
DEC HL
POP DE
INC DE
LD A,(DE)
LD B,A
AND 0F0H
CP 030H
JR Z,ONP2C
LD A,(HL)
JR ONP2D
ONP2C: INC DE
LD A,B
AND 00FH
LD (HL),A
ONP2D: LD HL,OPTBL
ADD A,L
LD L,A
LD C,(HL)
LD A,(TEMPW)
LD B,A
XOR A
JP MLDDLY
RYTHM: LD HL,KEYPA
LD (HL),0F0H
INC HL
LD A,(HL)
AND 081H
JR NZ,L02D5
SCF
RET
L02D5: LD A,(SUNDG)
RRCA
JR C,L02D5
L02DB: LD A,(SUNDG)
RRCA
JR NC,L02DB
DJNZ L02D5
XOR A
RET
MLDST: LD HL,(RATIO)
LD A,H
OR A
JR Z,MLDSP
PUSH DE
EX DE,HL
LD HL,CONT0
LD (HL),E
LD (HL),D
LD A,001H
POP DE
JR L02C4
MLDSP: LD A,034H
LD (CONTF),A
XOR A
L02C4: LD (SUNDG),A
RET
MLDDLY: ADD A,C
DJNZ MLDDLY
POP BC
LD C,A
XOR A
RET
?TEMP: PUSH AF
PUSH BC
AND 00FH
LD B,A
LD A,008H
SUB B
LD (TEMPW),A
POP BC
POP AF
RET
?MLDY: PUSH BC
PUSH DE
PUSH HL
LD A,002H
LD (OCTV),A
LD B,001H
MLD1: LD A,(DE)
CP 00DH
JR Z,MLD4
CP 0C8H
JR Z,MLD4
CP 0CFH
JR Z,MLD2
CP 02DH
JR Z,MLD2
CP 02BH
JR Z,MLD3
CP 0D7H
JR Z,MLD3
CP 023H
LD HL,MTBL
JR NZ,MLD1A
LD HL,M?TBL
INC DE
MLD1A: CALL ONPU
JR C,MLD1
CALL RYTHM
JR C,MLD5
CALL MLDST
LD B,C
JR MLD1
MLD2: LD A,003H
MLD2A: LD (OCTV),A
INC DE
JR MLD1
MLD3: LD A,001H
JR MLD2A
MLD4: CALL RYTHM
MLD5: PUSH AF
CALL MLDSP
POP AF
POP HL
POP DE
POP BC
RET
ONPU: PUSH BC
LD B,008H
LD A,(DE)
ONP1A: CP (HL)
JR Z,ONP2
INC HL
INC HL
INC HL
DJNZ ONP1A
SCF
INC DE
POP BC
RET
ONP2: INC HL
PUSH DE
LD E,(HL)
INC HL
LD D,(HL)
EX DE,HL
LD A,H
OR A
JR Z,ONP2B
LD A,(OCTV)
ONP2A: DEC A
JR Z,ONP2B
ADD HL,HL
JR ONP2A
ONP2B: LD (RATIO),HL
LD HL,OCTV
LD (HL),002H
DEC HL
POP DE
INC DE
LD A,(DE)
LD B,A
AND 0F0H
CP 030H
JR Z,ONP2C
LD A,(HL)
JR ONP2D
ONP2C: INC DE
LD A,B
AND 00FH
LD (HL),A
ONP2D: LD HL,OPTBL
ADD A,L
LD L,A
LD C,(HL)
LD A,(TEMPW)
LD B,A
XOR A
JP MLDDLY
RYTHM: LD HL,KEYPA
LD (HL),0F0H
INC HL
LD A,(HL)
AND 081H
JR NZ,L02D5
SCF
RET
L02D5: LD A,(SUNDG)
RRCA
JR C,L02D5
L02DB: LD A,(SUNDG)
RRCA
JR NC,L02DB
DJNZ L02D5
XOR A
RET
MLDST: LD HL,(RATIO)
LD A,H
OR A
JR Z,MLDSP
PUSH DE
EX DE,HL
LD HL,CONT0
LD (HL),E
LD (HL),D
LD A,001H
POP DE
JR L02C4
MLDSP: LD A,034H
LD (CONTF),A
XOR A
L02C4: LD (SUNDG),A
RET
MLDDLY: ADD A,C
DJNZ MLDDLY
POP BC
LD C,A
XOR A
RET
?TEMP: PUSH AF
PUSH BC
AND 00FH
LD B,A
LD A,008H
SUB B
LD (TEMPW),A
POP BC
POP AF
RET
?BEL: PUSH DE
LD DE,00DB1H
CALL ?MLDY
POP DE
RET
?TMST: DI
PUSH BC
PUSH DE
PUSH HL
LD (AMPM),A
LD A,0F0H
LD (TIMFG),A
LD HL,0A8C0H
XOR A
SBC HL,DE
PUSH HL
INC HL
EX DE,HL
LD HL,CONTF
LD (HL),074H
LD (HL),0B0H
DEC HL
LD (HL),E
LD (HL),D
DEC HL
LD (HL),00AH
LD (HL),000H
INC HL
INC HL
LD (HL),080H
DEC HL
L0323: LD C,(HL)
LD A,(HL)
CP D
JR NZ,L0323
LD A,C
CP E
JR NZ,L0323
DEC HL
NOP
NOP
NOP
LD (HL),00CH
LD (HL),07BH
INC HL
POP DE
L0336: LD C,(HL)
LD A,(HL)
CP D
JR NZ,L0336
LD A,C
CP E
JR NZ,L0336
POP HL
POP DE
POP BC
EI
RET
?TMRD: PUSH HL
LD HL,CONTF
LD (HL),080H
DEC HL
DI
LD E,(HL)
LD D,(HL)
EI
LD A,E
OR D
JR Z,?TMR1
XOR A
LD HL,0A8C0H
SBC HL,DE
JR C,?TMR2
EX DE,HL
LD A,(AMPM)
POP HL
RET
?TMR1: LD DE,0A8C0H
?TMR1A: LD A,(AMPM)
XOR 001H
POP HL
RET
?TMR2: DI
LD HL,CONT2
LD A,(HL)
CPL
LD E,A
LD A,(HL)
CPL
LD D,A
EI
INC DE
JR ?TMR1A
?BEL: PUSH DE
LD DE,00DB1H
CALL ?MLDY
POP DE
RET
MTBL: DB 043H

View File

@@ -39,25 +39,17 @@
; Common code spanning all banks to ensure that a Monitor is selected upon power up/reset.
;-----------------------------------------------------------------------------------------
NOP
XOR A ; We shouldnt arrive here after a reset, if we do, select MROM bank 0
LD (RFSBK1),A ; and start up - ie. SA1510 Monitor.
XOR A ; We shouldnt arrive here after a reset, ensure MROM and UROM are set to bank 0
LD (RFSBK1),A ; then a restart will take place as Bank 0 will jump to vector 00000H
LD (RFSBK2),A
NOP
JP 00000h
; After switching in Bank 0, it will automatically continue processing in Bank 0 at the XOR A instructionof ROMFS:
; Jump table for entry into this pages functions.
JP ?NL ; 9 QNL
JP ?PRTS ; 12 QPRTS
JP ?PRNT ; 15 QPRNT
JP ?DACN ; 18 QDACN
JP ?ADCN ; 21 QADCN
JP ?PRTHX ; 24 QPRTHX
JP ?SAVE ; 27 QSAVE
JP ?LOAD ; 30 QLOAD
JP ?FLAS ; 33 QFLAS
JP PRNT3 ; 36 QPRNT3
JP PRTHL ; 39 QPRTHL
JP ?DPCT ; 42 QDPCT
JP ?ANSITERM ; 45 QANSITERM
JP ?PRNT ; 9 QPRNT
JP ?PRTHX ; 12 QPRTHX
JP ?PRTHL ; 15 QPRTHL
JP ?ANSITERM ; 18 QANSITERM
; CR PAGE MODE1
@@ -113,47 +105,50 @@ DPCT1: ADD HL,BC
EX DE,HL
JP (HL)
?SAVE: LD HL,FLSDT
LD (HL),0EFH
LD A,(KANAF)
OR A
JR Z,L0270
LD (HL),0FFH
L0270: LD A,(HL)
PUSH AF
CALL ?PONT
LD A,(HL)
LD (FLASH),A
POP AF
LD (HL),A
XOR A
LD HL,KEYPA
LD (HL),A
CPL
LD (HL),A
RET
?LOAD: PUSH AF
LD A,(FLASH)
CALL ?PONT
LD (HL),A
POP AF
RET
?FLAS: PUSH AF
PUSH HL
LD A,(KEYPC)
RLCA
RLCA
JR C,FLAS1
LD A,(FLSDT)
FLAS2: CALL ?PONT
LD (HL),A
FLAS3: POP HL
POP AF
RET
FLAS1: LD A,(FLASH)
JR FLAS2
;?SAVE: LD HL,FLSDT
; LD A,(SFTLK)
; OR A
; LD (HL),043H ; Thick block cursor when lower case.
; JR Z,SAVE1
; CP 1
; LD (HL),03EH ; Thick underscore when CAPS lock.
; JR Z,SAVE1
; LD (HL),0EFH ; Block cursor when SHIFT lock.
;SAVE1: LD A,(HL)
; PUSH AF
; CALL ?PONT
; LD A,(HL)
; LD (FLASH),A
; POP AF
; LD (HL),A
; XOR A
; LD HL,KEYPA
; LD (HL),A
; CPL
; LD (HL),A
; RET
;
;?LOAD: PUSH AF
; LD A,(FLASH)
; CALL ?PONT
; LD (HL),A
; POP AF
; RET
;
;?FLAS: PUSH AF
; PUSH HL
; LD A,(KEYPC)
; RLCA
; RLCA
; JR C,FLAS1
; LD A,(FLSDT)
;FLAS2: CALL ?PONT
; LD (HL),A
;FLAS3: POP HL
; POP AF
; RET
;FLAS1: LD A,(FLASH)
; JR FLAS2
?PRT: LD A,C
@@ -204,25 +199,113 @@ L098C: SUB 00AH
JR NZ,L098C
RET
; Delete a character on screen.
?DELCHR: LD A,0C7H
CALL ?DPCT
JR ?PRNT1
?NEWLINE: CALL ?NL
JR ?PRNT1
;
; Function to disable the cursor display.
;
CURSOROFF: DI
CALL CURSRSTR ; Restore character under the cursor.
LD HL,FLASHCTL ; Indicate cursor is now off.
RES 7,(HL)
EI
RET
;
; Function to enable the cursor display.
;
CURSORON: DI
CALL DSPXYTOADDR ; Update the screen address for where the cursor should appear.
LD HL,FLASHCTL ; Indicate cursor is now on.
SET 7,(HL)
EI
RET
;
; Function to restore the character beneath the cursor iff the cursor is being dislayed.
;
CURSRSTR: PUSH HL
PUSH AF
LD HL,FLASHCTL ; Check to see if there is a cursor at the current screen location.
BIT 6,(HL)
JR Z,CURSRSTR1
RES 6,(HL)
LD HL,(DSPXYADDR) ; There is so we must restore the original character before further processing.
LD A,(FLASH)
LD (HL),A
CURSRSTR1: POP AF
POP HL
RET
;
; Function to convert XY co-ordinates to a physical screen location and save.
;
DSPXYTOADDR:PUSH HL
PUSH DE
PUSH BC
LD BC,(DSPXY) ; Calculate the new cursor position based on the XY coordinates.
LD DE,COLW
LD HL,SCRN - COLW
DSPXYTOA1: ADD HL,DE
DEC B
JP P,DSPXYTOA1
LD B,000H
ADD HL,BC
RES 3,H
LD (DSPXYADDR),HL ; Store the new address.
LD A,(HL) ; Store the new character.
LD (FLASH),A
DSPXYTOA2: POP BC
POP DE
POP HL
RET
;
; Function to print a space.
;
?PRTS: LD A,020H
?PRNT: CP 00DH
JR Z,?NL
; 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
CALL CURSRSTR ; Restore char under cursor.
CP 00DH
JR Z,?NEWLINE
CP 00AH
JR Z,?NL
JR Z,?NEWLINE
CP 07FH
JR Z,?DELCHR
CP BACKS
JR Z,?DELCHR
PUSH BC
LD C,A
LD B,A
CALL ?PRT
LD A,B
POP BC
?PRNT1: CALL DSPXYTOADDR
EI
RET
PRTHL: LD A,H
;
; Function to print out the contents of HL as 4 digit Hexadecimal.
;
?PRTHL: LD A,H
CALL ?PRTHX
LD A,L
JR ?PRTHX
LD B,E
LD B,E
RET
;
; Function to print out the contents of A as 2 digit Hexadecimal
;
?PRTHX: PUSH AF
RRCA
RRCA
@@ -233,11 +316,6 @@ PRTHL: LD A,H
POP AF
CALL ASC
JP ?PRNT
L03D5: POP DE
POP HL
POP BC
POP AF
RET
ASC: AND 00FH
CP 00AH
@@ -376,17 +454,12 @@ CLRS1: LD A,(SCLDSP)
HOM0: LD HL,00000H
JP CURS3
ALPHA: XOR A
ALPHI: LD (KANAF),A
?RSTR: POP HL
?RSTR1: POP DE
POP BC
POP AF
RET
KANA: LD A,001H
JR ALPHI
DEL: LD HL,(DSPXY)
LD A,H
OR L
@@ -518,8 +591,8 @@ DACN1: OR A
DW CLRS
DW DEL
DW INST
DW ALPHA
DW KANA
DW ?RSTR
DW ?RSTR
DW ?RSTR
DW REV
DW .CR
@@ -838,22 +911,22 @@ ANSI_NN: CP "?" ; Simpl
CP "@" ; Is it a letter?
JP C,ANSIEXIT ; Abandon if not letter; something wrong
ANSIFOUND: LD HL,(NUMBERPOS) ; Get value of number buffer
ANSIFOUND: CALL CURSRSTR ; 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
JR NZ,AF1
LD (HL),255 ; Mark the fact that nothing was put in
AF1: INC HL
LD A,254
LD (HL),A ; Mark end of sequence (for unlimited length
; sequences)
;*** Disable cursor, because it might well move!
LD A,(CURSORON)
OR A ; Well, what do we have here?!
; CALL NZ,ToggleCursor ; If cursor on, then remove
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 (CURSORON),A ; And cursor is now off
LD (CURSORCOUNT),A ; Restart count
LD A,0C9h
LD (CHGCURSMODE),A ; Disable flashing temp.
@@ -886,7 +959,8 @@ AF1: INC HL
CP "u"
JP Z,RCP ; Restore the cursor position
ANSIEXIT: LD HL,NUMBERBUF ; Numbers buffer position
ANSIEXIT: CALL CURSORON ; If t
LD HL,NUMBERBUF ; Numbers buffer position
LD (NUMBERPOS),HL
XOR A
LD (CHARACTERNO),A ; Next time it runs, it will be the
@@ -947,8 +1021,7 @@ AnsiNumber: LD HL,(NUMBERPOS) ; Get a
LD (HAVELOADED),A ; Yes, we _have_ put something in!
JP AnsiMore
AN1:
LD A,(HL) ; Stored value in A; TBA in C
AN1: LD A,(HL) ; Stored value in A; TBA in C
ADD A,A ; 2 *
LD D,A ; Save the 2* for later
ADD A,A ; 4 *
@@ -1040,7 +1113,7 @@ CUB: CALL GetNumber ; Numbe
CUBget: LD A,(DSPXY) ; A <- Column
CP B ; Too far?
JR C,CUB1a
SUB B
SUB B
JR CUB1b
CUB1a: LD A,0
CUB1b: LD (DSPXY),A ; Column <-A
@@ -1137,7 +1210,7 @@ ED1_2: EX DE,HL ; Value
LD HL,(DSPXY) ; _that_ value again!
POP BC ; Number to blank
CALL CALCSCADDR
CALL CLRSCRN ; Now do it!
CALL CLRSCRN ; Now do it!
JP ANSIEXIT ; Then exit properly
;*** Option 1 - clear from cursor to beginning of screen
@@ -1159,7 +1232,7 @@ ED2_2: EX DE,HL ; Value
PUSH HL ; Value saved for later
LD HL,0 ; Find the begining!
POP BC ; Number to blank
CALL CLRSCRN ; Now do it!
CALL CLRSCRN ; Now do it!
JP ANSIEXIT ; Then exit properly
; *** ANSI CLEAR LINE

View File

@@ -38,10 +38,11 @@
; Common code spanning all banks to ensure that a Monitor is selected upon power up/reset.
;-----------------------------------------------------------------------------------------
NOP
XOR A ; We shouldnt arrive here after a reset, if we do, select MROM bank 0
LD (RFSBK1),A ; and start up - ie. SA1510 Monitor.
XOR A ; We shouldnt arrive here after a reset, ensure MROM and UROM are set to bank 0
LD (RFSBK1),A ; then a restart will take place as Bank 0 will jump to vector 00000H
LD (RFSBK2),A
NOP
JP 00000h
; After switching in Bank 0, it will automatically continue processing in Bank 0 at the XOR A instructionof ROMFS:
; Jump table for entry into this pages functions.

View File

@@ -38,10 +38,11 @@
; Common code spanning all banks to ensure that a Monitor is selected upon power up/reset.
;-----------------------------------------------------------------------------------------
NOP
XOR A ; We shouldnt arrive here after a reset, if we do, select MROM bank 0
LD (RFSBK1),A ; and start up - ie. SA1510 Monitor.
XOR A ; We shouldnt arrive here after a reset, ensure MROM and UROM are set to bank 0
LD (RFSBK1),A ; then a restart will take place as Bank 0 will jump to vector 00000H
LD (RFSBK2),A
NOP
JP 00000h
; After switching in Bank 0, it will automatically continue processing in Bank 0 at the XOR A instructionof ROMFS:
; Jump table for entry into this pages functions.

View File

@@ -74,9 +74,10 @@ DPBLOCK7 EQU DPBLOCK6 + DPSIZE
; BIOS equates
NDISKS EQU 4 ; Number of Disk Drives
KEYBUFSIZE EQU 16 ; Ensure this is a power of 2, max size 256.
; Debugging
ENADEBUG EQU 1 ; Enable debugging logic, 1 = enable, 0 = disable
ENADEBUG EQU 0 ; Enable debugging logic, 1 = enable, 0 = disable
;-----------------------------------------------
; Configurable settings.
@@ -92,9 +93,8 @@ SECMSK EQU HSTBLK-1 ; secto
WRALL EQU 0 ; write to allocated
WRDIR EQU 1 ; write to directory
WRUAL EQU 2 ; write to unallocated
MTROFFSECS EQU 10 ; Time from last access to motor being switched off in seconds.
TMRTICKINTV EQU 5 ; Number of 0.010mSec ticks per interrupt, ie. resolution of RTC.
MTROFFMSECS EQU 100 ; Time from last access to motor being switched off in seconds in TMRTICKINTV ticks.
COLW: EQU 80 ; Width of the display screen (ie. columns).
ROW: EQU 25 ; Number of rows on display screen.
SCRNSZ: EQU COLW * ROW ; Total size, in bytes, of the screen display area.
@@ -106,29 +106,18 @@ MODE80C: EQU 1
;-------------------------------------------------------
; Public functions in CBIOS User ROM Bank 1.
QMELDY EQU 9 + UROMADDR
QTEMP EQU 12 + UROMADDR
QMSTA EQU 15 + UROMADDR
QMSTP EQU 18 + UROMADDR
QBEL EQU 21 + UROMADDR
QTIMST EQU 24 + UROMADDR
QTIMRD EQU 27 + UROMADDR
QREBOOT EQU 9 + UROMADDR
QMELDY EQU 12 + UROMADDR
QTEMP EQU 15 + UROMADDR
QMSTA EQU 18 + UROMADDR
QMSTP EQU 21 + UROMADDR
QBEL EQU 24 + UROMADDR
; Public functions in CBIOS User ROM Bank 1.
QNL EQU 9 + UROMADDR
QPRTS EQU 12 + UROMADDR
QPRNT EQU 15 + UROMADDR
QDACN EQU 18 + UROMADDR
QADCN EQU 21 + UROMADDR
QPRTHX EQU 24 + UROMADDR
QSAVE EQU 27 + UROMADDR
QLOAD EQU 30 + UROMADDR
QFLAS EQU 33 + UROMADDR
QPRNT3 EQU 36 + UROMADDR
QPRTHL EQU 39 + UROMADDR
QDPCT EQU 42 + UROMADDR
QANSITERM EQU 45 + UROMADDR
QPRNT EQU 9 + UROMADDR
QPRTHX EQU 12 + UROMADDR
QPRTHL EQU 15 + UROMADDR
QANSITERM EQU 18 + UROMADDR
;-----------------------------------------------
@@ -264,18 +253,30 @@ CTRL_RB EQU 01DH
CTRL_CAPPA EQU 01EH
CTRL_UNDSCR EQU 01FH
CTRL_AT EQU 000H
CURSRIGHT EQU 0F0H
CURSLEFT EQU 0F1H
CURSUP EQU 0F2H
CURSDOWN EQU 0F3H
DBLZERO EQU 0F4H
INSERT EQU 0F5H
CLR EQU 0F6H
NOKEY EQU 0F0H
CURSRIGHT EQU 0F1H
CURSLEFT EQU 0F2H
CURSUP EQU 0F3H
CURSDOWN EQU 0F4H
DBLZERO EQU 0F5H
INSERT EQU 0F6H
CLRKEY EQU 0F7H
HOMEKEY EQU 0F8H
BREAKKEY EQU 0FBH
;-----------------------------------------------
; BIOS WORK AREA (MZ80A)
;-----------------------------------------------
ORG CBIOSDATA
; Keyboard processing, ensure starts where LSB = 0.
VARSTART EQU $ ; Start of variables.
KEYBUF: DS virtual KEYBUFSIZE ; Interrupt driven keyboard buffer.
KEYCOUNT: DS virtual 1
KEYWRITE: DS virtual 2 ; Pointer into the buffer where the next character should be placed.
KEYREAD: DS virtual 2 ; Pointer into the buffer where the next character can be read.
KEYLAST: DS virtual 1 ; KEY LAST VALUE
KEYRPT: DS virtual 1 ; KEY REPEAT COUNTER
;
SPV:
IBUFE: ; TAPE BUFFER (128 BYTES)
@@ -286,8 +287,11 @@ DTADR: DS virtual 2 ; DATA
EXADR: DS virtual 2 ; EXECUTION ADDRESS
SWPW: DS virtual 10 ; SWEEP WORK
KDATW: DS virtual 2 ; KEY WORK
KANAF: DS virtual 1 ; KANA FLAG (01=GRAPHIC MODE)
;KANAF: DS virtual 1 ; KANA FLAG (01=GRAPHIC MODE)
DSPXY: DS virtual 2 ; DISPLAY COORDINATES
DSPXYLST: DS virtual 2 ; Last known cursor position, to compare with DSPXY to detect changes.
FLASHCTL: DS virtual 1 ; CURSOR FLASH CONTROL. BIT 0 = Cursor On/Off, BIT 1 = Cursor displayed.
DSPXYADDR: DS virtual 2 ; Address of last known position.
MANG: DS virtual 6 ; COLUMN MANAGEMENT
MANGE: DS virtual 1 ; COLUMN MANAGEMENT END
PBIAS: DS virtual 1 ; PAGE BIAS
@@ -310,8 +314,8 @@ ONTYO: DS virtual 1 ; ONTYO
OCTV: DS virtual 1 ; OCTAVE WORK
RATIO: DS virtual 2 ; ONPU RATIO
;BUFER: DS virtual 81 ; GET LINE BUFFER
KEYBUF: DS virtual 1 ; KEY BUFFER
KEYRPT: DS virtual 2 ; KEY REPEAT COUNTER
;KEYBUF: DS virtual 1 ; KEY BUFFER
TIMESEC DS virtual 6 ; RTC 48bit TIME IN MILLISECONDS
FDCCMD DS virtual 1 ; LAST FDC COMMAND SENT TO CONTROLLER.
MOTON DS virtual 1 ; MOTOR ON = 1, OFF = 0
INVFDCDATA: DS virtual 1 ; INVERT DATA COMING FROM FDC, 1 = INVERT, 0 = AS IS
@@ -374,7 +378,6 @@ JSW_FF DS virtual 1 ; Byte
JSW_LF DS virtual 1 ; Byte value to turn on/off LF routine
CHARACTER DS virtual 1 ; To buffer character to be printed.
CURSORPOS DS virtual 2 ; Cursor position, default 0,0.
CURSORON DS virtual 1 ; Cursor on/off toggle value
BOLDMODE DS virtual 1
HIBRITEMODE DS virtual 1 ; 0 means on, &C9 means off
UNDERSCMODE DS virtual 1
@@ -382,9 +385,15 @@ ITALICMODE DS virtual 1
INVMODE DS virtual 1
CHGCURSMODE DS virtual 1
ANSIMODE DS virtual 1 ; 1 = on, 0 = off
VARIABLEEND DS virtual 1
COLOUR EQU 0
DS virtual 128
BIOSSTACK EQU $ ; Perhaps change to 0080? ; BIOS Stack.
SPSAVE: DS virtual 2 ; CPM Stack save.
SPISRSAVE: DS virtual 2
VAREND EQU $ ; End of variables
; Stack space for the CBIOS.
DS virtual 128
BIOSSTACK EQU $
; Stack space for the Interrupt Service Routine.
DS virtual 32 ; Max 8 stack pushes.
ISRSTACK EQU $

View File

@@ -43,7 +43,15 @@
; Common code spanning all banks.
;--------------------------------
ROMFS: NOP
LD A, (ROMBK1) ; Ensure all banks are at default on
JR ROMFS_0 ; Skip the reset vector.
NOP
NOP
NOP
NOP
NOP
NOP
JP 00000H ; Common point when an alternate bank needs to reset the system.
ROMFS_0: LD A, (ROMBK1) ; Ensure all banks are at default on
CP 4 ; If the ROMBK1 value is 255, an illegal value, then the machine has just started so skip.
JR C, ROMFS_2
XOR A ; Clear the lower stack space as we use it for variables.

View File

@@ -38,19 +38,12 @@
; Common code spanning all banks.
;--------------------------------
ROMFS1: NOP
LD A, (ROMBK1) ; Ensure all banks are at default on
CP 4 ; If the ROMBK1 value is 255, an illegal value, then the machine has just started so skip.
JR C, ROMFS1_2
XOR A ; Clear the lower stack space as we use it for variables.
LD B, 7*8
LD HL, 01000H
ROMFS1_1: LD (HL),A
INC HL
DJNZ ROMFS1_1
ROMFS1_2: LD (RFSBK1),A ; start up.
LD A, (ROMBK2)
LD (RFSBK2),A
JP MONITOR
XOR A ; We shouldnt arrive here after a reset, if we do, select UROM bank 0
LD (RFSBK1),A
LD (RFSBK2),A ; and start up - ie. SA1510 Monitor.
ALIGN_NOPS 0E829H
; After switching in Bank 0, it will automatically continue processing in Bank 0 at the XOR A instructionof ROMFS:
;
; Bank switching code, allows a call to code in another bank.

View File

@@ -38,21 +38,11 @@
; Common code spanning all banks.
;--------------------------------
ROMFS2: NOP
LD A, (ROMBK1) ; Ensure all banks are at default on
CP 4 ; If the ROMBK1 value is 255, an illegal value, then the machine has just started so skip.
JR C, ROMFS2_2
XOR A ; Clear the lower stack space as we use it for variables.
LD B, 7*8
LD HL, 01000H
ROMFS2_1: LD (HL),A
INC HL
DJNZ ROMFS2_1
ROMFS2_2: LD (RFSBK1),A ; start up.
LD A, (ROMBK2)
LD (RFSBK2),A
JP MONITOR
XOR A ; We shouldnt arrive here after a reset, if we do, select UROM bank 0
LD (RFSBK1),A
LD (RFSBK2),A ; and start up - ie. SA1510 Monitor.
ALIGN_NOPS 0E829H
;
; Bank switching code, allows a call to code in another bank.
; This code is duplicated in each bank such that a bank switch doesnt affect logic flow.
;

View File

@@ -43,19 +43,10 @@ MODE80C EQU 0
; Common code spanning all banks.
;--------------------------------
ROMFS3: NOP
LD A, (ROMBK1) ; Ensure all banks are at default on
CP 4 ; If the ROMBK1 value is 255, an illegal value, then the machine has just started so skip.
JR C, ROMFS3_2
XOR A ; Clear the lower stack space as we use it for variables.
LD B, 7*8
LD HL, 01000H
ROMFS3_1: LD (HL),A
INC HL
DJNZ ROMFS3_1
ROMFS3_2: LD (RFSBK1),A ; start up.
LD A, (ROMBK2)
LD (RFSBK2),A
JP MONITOR
XOR A ; We shouldnt arrive here after a reset, if we do, select UROM bank 0
LD (RFSBK1),A
LD (RFSBK2),A ; and start up - ie. SA1510 Monitor.
ALIGN_NOPS 0E829H
;
; Bank switching code, allows a call to code in another bank.

View File

@@ -1,93 +0,0 @@
;--------------------------------------------------------------------------------------------------------
;-
;- Name: rfs_bank4.asm
;- Created: October 2018
;- Author(s): Philip Smart
;- Description: Sharp MZ series Rom Filing System.
;- This assembly language program is written to utilise the banked flashroms added with
;- the MZ-80A RFS hardware upgrade.
;-
;- Credits:
;- Copyright: (c) 2018 Philip Smart <philip.smart@net2net.org>
;-
;- History: October 2018 - Merged 2 utilities to create this compilation.
;-
;--------------------------------------------------------------------------------------------------------
;- This source file is free software: you can redistribute it and-or modify
;- it under the terms of the GNU General Public License as published
;- by the Free Software Foundation, either version 3 of the License, or
;- (at your option) any later version.
;-
;- This source file is distributed in the hope that it will be useful,
;- but WITHOUT ANY WARRANTY; without even the implied warranty of
;- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;- GNU General Public License for more details.
;-
;- You should have received a copy of the GNU General Public License
;- along with this program. If not, see <http://www.gnu.org/licenses/>.
;--------------------------------------------------------------------------------------------------------
;======================================
;
; USER ROM BANK 4
;
;======================================
ORG 0E800h
;--------------------------------
; Common code spanning all banks.
;--------------------------------
ROMFS4: NOP
LD A, (ROMBK1) ; Ensure all banks are at default on
CP 4 ; If the ROMBK1 value is 255, an illegal value, then the machine has just started so skip.
JR C, ROMFS4_2
XOR A ; Clear the lower stack space as we use it for variables.
LD B, 7*8
LD HL, 01000H
ROMFS4_1: LD (HL),A
INC HL
DJNZ ROMFS4_1
ROMFS4_2: LD (RFSBK1),A ; start up.
LD A, (ROMBK2)
LD (RFSBK2),A
JP MONITOR
;
; Bank switching code, allows a call to code in another bank.
; This code is duplicated in each bank such that a bank switch doesnt affect logic flow.
;
BKSW4to0: PUSH AF
LD A, ROMBANK4 ; Calling bank (ie. us).
PUSH AF
LD A, ROMBANK0 ; Required bank to call.
JR BKSW4_0
BKSW4to1: PUSH AF
LD A, ROMBANK4 ; Calling bank (ie. us).
PUSH AF
LD A, ROMBANK1 ; Required bank to call.
JR BKSW4_0
BKSW4to2: PUSH AF
LD A, ROMBANK4 ; Calling bank (ie. us).
PUSH AF
LD A, ROMBANK2 ; Required bank to call.
JR BKSW4_0
BKSW4to3: PUSH AF
LD A, ROMBANK4 ; Calling bank (ie. us).
PUSH AF
LD A, ROMBANK3 ; Required bank to call.
;
BKSW4_0: PUSH BC ; Save BC for caller.
LD BC, BKSWRET4 ; Place bank switchers return address on stack.
PUSH BC
LD (RFSBK2), A ; Bank switch in user rom space, A=bank.
LD (TMPSTACKP),SP ; Save the stack pointer as some old code corrupts it.
JP (HL) ; Jump to required function.
BKSWRET4: POP BC
POP AF ; Get bank which called us.
LD (RFSBK2), A ; Return to that bank.
POP AF
RET ; Return to caller.
ALIGN 0EFFFh
DB 0FFh

View File

@@ -73,7 +73,7 @@ SS1: LD (SWRK),A
JR FD2
ST1: CALL NL
LD A,03EH
LD A,'*'
CALL PRNT
LD DE,BUFER
CALL GETL

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.