A2osX/SCMASM.31/IO.S.IIE.ULTRA.txt

271 lines
7.0 KiB
Plaintext
Raw Permalink Normal View History

NEW
AUTO 3,1
*--------------------------------------
.PH $A800
*--------------------------------
* VIDEX ULTRATERM DRIVER -- ASSUME SLOT 3
ULTRA.SLOT .EQ 3
SKMOD .EQ 1 SHIFT KEY MOD (=0 FOR //E VERSION)
*--------------------------------
* TO MAKE THE EDIT COMMAND USE MORE THAN 24 LINES,
* CHANGE $17 TO $1F OR $2F AT $803A
*--------------------------------
ULTRA.SCREEN.WIDTH .EQ $A5
*--------------------------------
ULTRA.CARD .EQ ULTRA.SLOT*256+$C000
ULTRA.COUT1 .EQ ULTRA.SLOT*256+$C007
*--------------------------------
ULTRA.REG .EQ ULTRA.SLOT*16+$C080
ULTRA.DATA .EQ ULTRA.SLOT*16+$C081
*--------------------------------
ULTRA.HORIZ .EQ $0578+ULTRA.SLOT
ULTRA.START .EQ $06F8+ULTRA.SLOT TOP-OF-SCREEN ADDRESS / 16
ULTRA.CHPG .EQ $0678
ULTRA.TEMPX .EQ $0778
ULTRA.TEMPY .EQ $07F8
ULTRA.FLAGS .EQ $07F8+ULTRA.SLOT
*--------------------------------
* I/O VECTORS -- 3 BYTES EACH
*--------------------------------
JMP ULTRA.INIT
JMP ULTRA.WARM
JMP ULTRA.READ.KEY.WITH.CASE
JMP ULTRA.GET.HORIZ.POSN
LDA #$8C ^L--HOME
.HS 2C
LDA #$9D ^]--CLREOL
.HS 2C
LDA #$8B ^K--CLREOP
.HS 2C
LDA #$9F ^_--UP
.HS 2C
LDA #$8A ^J--DOWN
.HS 2C
LDA #$88 ^H--LEFT
.HS 2C
LDA #$9C ^\--RIGHT
NOP
JMP MON.COUT
JMP ULTRA.PICK.SCREEN
JMP ULTRA.HTABX
JMP ULTRA.HTAB
JMP ULTRA.VTAB
*---Case Toggle MUST go here-----
LDA ULTRA.FLAGS
EOR #$40
STA ULTRA.FLAGS
RTS
*--------------------------------
* VARIABLE LENGTH ROUTINES
*--------------------------------
ULTRA.HTABX
PHA
TXA
JSR ULTRA.HTAB
PLA
RTS
*--------------------------------
ULTRA.GET.HORIZ.POSN
LDA ULTRA.HORIZ
RTS
*--------------------------------
ULTRA.VTAB
STA CV
LDA ULTRA.HORIZ
ULTRA.HTAB
PHA SAVE HORIZ POSN
LDA #$9E
JSR ULTRA.COUT1
PLA GET HORIZ POSN
JSR .1
LDA CV
.1 CLC ADD $A0 OFFSET
ADC #$A0
JMP ULTRA.COUT1
*--------------------------------
ULTRA.INIT
LDA #80
STA ULTRA.SCREEN.WIDTH
LDA #$8C CLEAR SCREEN AND START VIDEX-80
STA $C00B SWITCH OFF //E C3 ROM
STA $C006 SWITCH OFF //E C100-C7FF ROM
JSR ULTRA.CARD
ULTRA.INSTALL.VECTORS
LDX #1
.1 LDA ULTRA.VECTORS,X
STA $36,X
STA ULTRA.SLOT*2+$BE10,X
LDA ULTRA.VECTORS+2,X
BIT F.EXEC
BMI .2
STA $38,X
.2 STA ULTRA.SLOT*2+$BE20,X
DEX
BPL .1
RTS
*--------------------------------
ULTRA.VECTORS
.DA ULTRA.COUT
.DA ULTRA.RDKEY
*--------------------------------
ULTRA.WARM
CLD
LDX CV
JSR MON.INIT
STX CV
JMP ULTRA.INSTALL.VECTORS
*--------------------------------
* READ KEY WITH CASE CONTROL
*--------------------------------
ULTRA.READ.KEY.WITH.CASE
JSR MON.RDKEY
ORA #$80 REQUIRED FOR EXEC COMMAND
CLC SIGNAL NO OPEN APPLE
RTS
*--------------------------------
ULTRA.RDKEY
CLD
LDA #$0A SELECT BLINKING DOUBLE UNDERLINE CURSOR
STA ULTRA.REG
LDA #$67
STA ULTRA.DATA
LDA #$0B
STA ULTRA.REG
LDA #$08
STA ULTRA.DATA
.1 LDA $C000
BPL .1
STA $C010
PHA
LDA #$06 HIDE THE CURSOR
STA ULTRA.DATA
PLA
CMP #$8D
BNE .2
JSR IO.CLREOL
LDA #$8D
.DO SKMOD
.2 PHA CHECK SHIFT LOCK FLAG
LDA ULTRA.FLAGS
ASL
ASL
PLA
BCC .5 ...SHIFT LOCK IS ON
CMP #$C0
BCC .5 NOT IN ALPHA RANGE
BEQ .3 ...@ IS CAPITAL P
ORA #$20 ADJUST TO LOWER CASE
BIT $C063 TEST SHIFT KEY (PB3)
BMI .5 ...NOT PRESSED, LOWER CASE
CMP #$FB
BCC .4 ...NORMAL A-Z
.3 EOR #$10 CHANGE @ to P, [\]^_ to KLMNO
.4 AND #$DF UPPER CASE
.5 RTS
.ELSE
.2 RTS
.FIN
*--------------------------------
ULTRA.COUT
CLD
PHA
STA MON.INVFLG BIT 7 CONTROLS INV/NORM
CMP #$20 CATCH INV CTRL CHARS
BCS .1 ...NOT ONE
ORA #$40 MAKE CTRL VISIBLE
.1 JSR ULTRA.COUT1
LDA #$FF
STA MON.INVFLG
PLA
RTS
*--------------------------------
W16TBL .DA #80/16
.DA #96/16
.DA #160/16
.DA #80/16
.DA #80/16
.DA #80/16
.DA #160/16
.DA #128/16
*--------------------------------
* GET CHARACTER OFF CURRENT SCREEN LINE, COLUMN (Y)
*--------------------------------
ULTRA.PICK.SCREEN
STY ULTRA.TEMPY
STX ULTRA.TEMPX
BIT $CFFF
BIT ULTRA.CARD TURN ON SCREEN
*--------------------------------
LDA ULTRA.FLAGS GET MODE (0...7)
AND #$07
TAY Y = MODE INDEX (0...7)
*--------------------------------
LDA ULTRA.TEMPY HORIZ. POSN
CPY #$06 132 COL MODE?
BNE .1 ...NOT 132 COLUMNS
ADC #14 ADJUST FOR 132 COLUMN MODE
.1 STA ULTRA.CHPG
*--------------------------------
LDX W16TBL,Y GET WIDTH/16
LDA ULTRA.START CV*(WIDTH/16) + START
.2 CLC INCLUDE 'CLC' IN LOOP ON PURPOSE
ADC CV TO FORCE WRAP-AROUND
DEX
BNE .2
*--------------------------------
PHA
LSR *16
LSR
LSR
LSR
TAX SAVE PAGE VALUE IN X-REG
PLA
ASL
ASL
ASL
ASL
*--------------------------------
CLC + CH (or CH+15 if 132 columns)
ADC ULTRA.CHPG
STA ULTRA.CHPG
BCC .3
INX ADD CARRY TO PAGE VALUE
*--------------------------------
.3 TXA GET PAGE VALUE
AND #$0F
ORA MODETBL,Y
STA ULTRA.REG+2
*--------------------------------
ASL
AND #$0C
TAY
LDA ULTRA.REG,Y
TXA GET PAGE VALUE AGAIN
LSR SET CARRY IF IN 2ND PAGE
*--------------------------------
LDY ULTRA.CHPG
LDA $CC00,Y
BCC .4
LDA $CD00,Y
.4 ORA #$80 MAKE HIGH ASCII
LDY ULTRA.TEMPY RESTORE REGS
LDX ULTRA.TEMPX
RTS ALL DONE
*--------------------------------
MODETBL .HS 40 80X24 (VIDEOTERM EMULATION)
.HS 50 96X24
.HS 70 160X24
.HS 50 80X24 INTERLACE
.HS 50 80X32 INTERLACE
.HS 50 80X48 INTERLACE
.HS 70 132X24 INTERLACE
.HS 70 128X32 INTERLACE
*--------------------------------------
.EP
*--------------------------------------
MAN
SAVE usr/src/scmasm.31/io.s.ultra
LOAD usr/src/scmasm.31/scmasm.s
ASM