A2osX/FSE/FSE.S.STB80.txt

152 lines
4.5 KiB
Plaintext
Raw Permalink Normal View History

2024-02-16 17:51:17 +00:00
NEW
AUTO 3,1
*--------------------------------
C.TMP1 .EQ VAR.BEG-1
C.TMP2 .EQ C.TMP1-1
C.TMP3 .EQ C.TMP2-1
C.TMP4 .EQ C.TMP3-1
.DO C.TMP4<$300
*** VARS<$300
.FIN
*--------------------------------
* STANDARD VIDEO JUMP VECTORS
* 1. READ KEYBOARD KEY CODE
* TURNS ON CURSOR
* GETS KEY CODE
* TURNS OFF CURSOR
* REG-A HAS KEY CODE SIGN BIT ON.
* 2. HORIZONTAL TAB
* REG-A HAS TAB 0-79
* 3. VERTICAL TAB
* REG-A HAS TAB 0-23
* 4. CLEAR TO END OF LINE
* 5. CLEAR TO END OF SCREEN
* 6. CHARACTER OUTPUT ROUTINE
* REG-A HAS CHAR TO OUTPUT.
* MUST NOT SCROLL SCREEN OR
* GO TO NEXT LINE WHEN LAST
* CHARACTER IS PRINTED ON A LINE.
*--------------------------------
JMP C.RD.KBD
JMP C.MY.HTAB
JMP C.MY.VTAB
JMP C.MY.CLREOL
JMP C.MY.CLREOP
JMP C.MY.COUT
*--------------------------------
C.MY.CLP LDA CTR
JSR C.MY.VTAB
C.MY.CLREOP JSR C.MY.CLREOL CLEAR TO END OF LINE
LDA #0 START COL 0 FOR NEXT LINE
JSR C.MY.HTAB
INC CTR BUMP TO NEXT LINE
LDA CTR
CMP LAST.LINE CHK FOR END
BCC C.MY.CLP < END
BEQ C.MY.CLP = END
RTS > END
*--------------------------------
C.MY.HTAB STA C.STB.COL SET HORIZ. POSN
LSR
STA CH CH = POSN/2
RTS
*--------------------------------
C.MY.VTAB STA CV SET VERT POSN
RTS
*--------------------------------
C.MY.COUT STY C.TMP1 SAVE Y REG
AND #$7F MASK OFF HIGH BIT
PHA
LDA CV GET VERT POSN
CLC
ADC C.STB.TOPADR
LDY #18
STY C.CRTC CRTC = REG 18
STA C.CRTC+1 SET LINE POSN
LDA C.STB.COL
INY
STY C.CRTC CRTC = REG 19
STA C.CRTC+1 SET COL POSN
LDA C.STB.TOPADR
LDY #12
STY C.CRTC CRTC = REG 12
STA C.CRTC+1 SET SCROLL POSN
LDY #$1F
STY C.CRTC POINT TO DUMMY REG
PLA
CMP #$20
BCS .1 NON CONTROL CHAR
ORA #$C0 SET INV BIT, MAKE LETR
.1 BIT C.CRTC WAIT FOR RIGHT TIME
BPL .1
STA C.CRTC+3 PUT CHAR IN LATCH
INC C.STB.COL NEXT COLUMN
LDY C.TMP1 RESTORE Y REG
RTS
*--------------------------------
C.MY.CLREOL STY C.TMP3 SAVE Y REG
STX C.TMP4 SAVE X REG
.1 LDY C.STB.COL GET COL POSN
CPY SCREEN.WIDTH END OF LINE
BCS .2 YES
LDA #$A0 A REG = BLANK
JSR C.MY.COUT PRINT IT
JMP .1 NEXT COLUMN
.2 LDY C.TMP3 RESTORE Y REG
LDX C.TMP4 RESTORE X REG
RTS
*--------------------------------
* STB80 IO ROUTINES
*--------------------------------
C.CRTC .EQ $C0B0 CRT CONTROLLER CHIP
C.STB.TOPADR .EQ $57B SCROLL LINE START
C.STB.COL .EQ $5FB COLUMN POSN
*--------------------------------
C.RD.KBD JSR C.CURSOR.ON TURN ON CURSOR
.1 LDA $C000 WAIT FOR KEY
BPL .1
BIT $C010 STROBE KBD TO KILL FLAG BIT
PHA SAVE CHAR
JSR C.CURSOR.OFF TURN OFF CURSOR
PLA RESTORE CHAR
RTS
*--------------------------------
C.CURSOR.ON LDA POSV POSITION VERTICALLY
JSR C.MY.VTAB
LDA POSH
SEC
SBC LEFT.MARGIN
CLC
ADC RM.ADJUST
JSR C.MY.HTAB POSITION HORIZONTALLY
LDA ESC.FLAG TEST ESC MODE
BEQ .1 IT IS IN SCROLL MODE
LDA #$67 EDIT MODE GETS LITTLE CURSOR
BNE .2 ...ALWAYS
.1 LDA #$C0 SCROLL MODE GETS NORMAL CURSOR
.2 PHA
LDA #$0A
STA C.CRTC CTRC = REG 10
PLA
STA C.CRTC+1 SET CURSOR START DATA
C.WRIT LDA #$0F
STA C.CRTC CTRC = REG 15
LDA C.STB.COL
STA C.CRTC+1 SET CURSOR COLUMN POSN
LDA #$0E
STA C.CRTC CRTC = REG 14
LDA CV
CLC
ADC C.STB.TOPADR
STA C.CRTC+1 SET CURSOR LINE POSN
RTS
*--------------------------------
C.CURSOR.OFF LDA #24 LINE 24 IS NON DISPLAYABLE
JSR C.MY.VTAB TAB TO THERE
JMP C.WRIT AND POSN CURSOR THERE
*--------------------------------
MAN
SAVE usr/src/fse/fse.s.stb80
LOAD usr/src/fse/fse.s
ASM