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

220 lines
5.1 KiB
Plaintext
Raw Normal View History

NEW
AUTO 3,1
*--------------------------------------
.PH $A800
*--------------------------------
VIDEX.SCREEN.WIDTH .EQ $A5
*--------------------------------
VIDEX.SLOT .EQ 3 ASSUME SLOT 3
*--------------------------------
VIDEX.CARD .EQ VIDEX.SLOT*256+$C000
VIDEX.COUT1 .EQ VIDEX.SLOT*256+$C007
VIDEX.REG .EQ VIDEX.SLOT*16+$C080
VIDEX.DATA .EQ VIDEX.SLOT*16+$C081
*--------------------------------
VIDEX.BASEL .EQ $0478+VIDEX.SLOT
VIDEX.BASEH .EQ $04F8+VIDEX.SLOT
VIDEX.HORIZ .EQ $0578+VIDEX.SLOT
VIDEX.CHAR .EQ $0678+VIDEX.SLOT
*--------------------------------
* I/O VECTORS -- 3 BYTES EACH
*--------------------------------
JMP VIDEX.INIT
JMP VIDEX.WARM
JMP VIDEX.READ.KEY.WITH.CASE
JMP VIDEX.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 VIDEX.PICK.SCREEN
JMP VIDEX.HTABX
JMP VIDEX.HTAB
JMP VIDEX.VTAB
*---Case Toggle MUST go here-----
LDA CASEFLG
EOR #$80
STA CASEFLG
RTS
*--------------------------------
* VARIABLE LENGTH ROUTINES
*--------------------------------
VIDEX.HTABX
PHA
TXA
JSR VIDEX.HTAB
PLA
RTS
*--------------------------------
VIDEX.GET.HORIZ.POSN
LDA VIDEX.HORIZ
RTS
*--------------------------------
VIDEX.VTAB
STA CV
LDA VIDEX.HORIZ
VIDEX.HTAB
PHA SAVE HORIZ POSN
LDA #$9E
JSR VIDEX.COUT1
PLA GET HORIZ POSN
CLC
ADC #$A0
JSR VIDEX.COUT1
LDA CV
ORA #$A0
JMP VIDEX.COUT1
*--------------------------------
VIDEX.INIT
LDA #80
STA VIDEX.SCREEN.WIDTH
STA CASEFLG CLEAR CASEFLG (BIT7=0)
LDA #$8C CLEAR SCREEN AND START VIDEX-80
JSR VIDEX.CARD
VIDEX.INSTALL.VECTORS
LDX #1
.1 LDA VIDEX.VECTORS,X
STA $36,X
STA VIDEX.SLOT*2+$BE10,X
LDA VIDEX.VECTORS+2,X
BIT F.EXEC
BMI .2
STA $38,X
.2 STA VIDEX.SLOT*2+$BE20,X
DEX
BPL .1
RTS
*--------------------------------
VIDEX.VECTORS
.DA VIDEX.COUT
.DA VIDEX.RDKEY
*--------------------------------
VIDEX.WARM
CLD
LDX CV
JSR MON.INIT
STX CV
JMP VIDEX.INSTALL.VECTORS
*--------------------------------
* READ KEY WITH CASE CONTROL
*--------------------------------
VIDEX.READ.KEY.WITH.CASE
JSR MON.RDKEY
ORA #$80 REQUIRED FOR EXEC COMMAND
CLC SIGNAL NO OPEN APPLE
RTS
*--------------------------------
VIDEX.RDKEY
CLD
LDA #$0A SELECT BLINKING DOUBLE UNDERLINE CURSOR
STA VIDEX.REG
LDA #$67
STA VIDEX.DATA
LDA #$0B
STA VIDEX.REG
LDA #$08
STA VIDEX.DATA
.1 LDA $C000
BPL .1
STA $C010
PHA
LDA #$0A HIDE THE CURSOR
STA VIDEX.REG
LDA #$09
STA VIDEX.DATA
PLA
CMP #$8D
BNE .2
JSR IO.CLREOL
LDA #$8D
.2 BIT CASEFLG TEST CASE CONVERSION FLAG
BPL .6 DO NOT CONVERT
CMP #$B0
BCC .6 DO NOT CONVERT
BIT $C063 TEST PADDLE BUTTON
BMI .5 NO SHIFTKEY PRESSED
CMP #$B0
BEQ .4
CMP #$C0
BNE .3
LDA #$D0
.3 CMP #$DB
BCC .6
AND #$CF
BNE .6
.4 LDA #$DD
.5 ORA #$20
.6 AND #$7F
STA VIDEX.CHAR
ORA #$80
SEC
RTS
*--------------------------------
VIDEX.COUT
CLD
CMP #$80 NORMAL OR INVERSE?
BCS .1 ...NORMAL
PHA ...80-COLUMN
LDA #$8F SELECT INVERSE DISPLAY
JSR VIDEX.COUT1
PLA
ORA #$80 MAKE PRINTABLE CHARACTER
CMP #$A0
BCS .2
ORA #$40
.2 JSR VIDEX.COUT1
LDA #$8E SELECT NORMAL DISPLAY
.1 JMP VIDEX.COUT1
*--------------------------------
* GET CHARACTER OFF CURRENT SCREEN LINE, COLUMN (Y)
*--------------------------------
VIDEX.PICK.SCREEN
STX SAVEX
BIT $CFFF TURN ON $C800 VIDEO SPACE
BIT VIDEX.CARD
*---CALCULATE POSITION-----------
CLC
TYA COLUMN 0-79
ADC VIDEX.BASEL
PHA
LDA #0
ADC VIDEX.BASEH
PHA
ASL
AND #$0C USE BIT 0 AND 1 FOR PAGING
TAX
LDA VIDEX.REG,X
PLA
LSR ODD/EVEN PAGE
PLA
TAX
*---GET CHAR FROM WINDOW---------
LDA $CC00,X
BCC .1
LDA $CD00,X
.1 ORA #$80
STA VIDEX.CHAR
LDX SAVEX
RTS
*--------------------------------
SAVEX .BS 1
CASEFLG .BS 1
*--------------------------------------
.EP
*--------------------------------------
MAN
SAVE usr/src/scmasm.31/io.s.videx
LOAD usr/src/scmasm.31/scmasm.s
ASM