A2osX/DRV/CONSOLE.DRV.S.txt

359 lines
6.3 KiB
Plaintext
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

PR#3
PREFIX /A2OSX.SRC
NEW
INC 1
AUTO 6
.LIST OFF
.OP 65C02
.OR $2000
.TF /A2OSX.BOOT/DRV/CONSOLE.DRV
*--------------------------------------
.INB INC/MACROS.I
.INB INC/A2OSX.I
.INB INC/A2OSX.API.I
.INB INC/KERNEL.I
.INB INC/IO.I
*--------------------------------------
CURSOR.BLINK.SPEED .EQ 2
*--------------------------------------
ZPBASL1 .EQ ZPDRV
ZPBASL2 .EQ ZPDRV+2
*--------------------------------------
* File Header (16 Bytes)
*--------------------------------------
CS.START cld
jmp Dev.Detect cld,jmp abs=DRV
.DA #$61 6502,Level 1 (65c02)
.DA #1 DRV Layout Version 1
.DA 0
.DA CS.END-CS.START Code Length
.DA DEV.HEADER-CS.START Device Header Offset
.DA DRV.CS.START-CS.START Driver Code Offset
.DA DRV.CS.END-DRV.CS.START Drv Code Length
*--------------------------------------
* Relocation Table
*--------------------------------------
L.MSG.DETECT .DA MSG.DETECT
.DA 0 End Of Reloc Table
*--------------------------------------
Dev.Detect >LDYA L.MSG.DETECT
>SYSCALL SYS.SysScrPPSTRYA
lda A2osX.SCREENS
ora #A2osX.SCREENS.C
sta A2osX.SCREENS
clc
rts
CS.END
MSG.DETECT >PSTRING "\nApple IIe/IIc 80 Col Driver."
*--------------------------------------
* Device Header (16 Bytes)
*--------------------------------------
DEV.HEADER cld
jmp (DRV.CS.START,x)
.DA #S.DEV.F.EVENT+S.DEV.F.COUT+S.DEV.F.CHAR
>PSTRING "CON" NAME
.HS 00 NAME must Be 5 bytes long
.HS 00.00
.HS 00.00.00.00
*--------------------------------------
* Driver Code
*--------------------------------------
DRV.CS.START .DA OPEN
.DA GETEVENT
.DA COUT
.DA CLOSE
.DA GETINFO
.DA IRQ
L.DEVINFO .DA DEVINFO
.DA 0 end or relocation
*--------------------------------------
OPEN stz CURON
lda #$80
sta INVFLG
jsr HOME
clc
rts
*--------------------------------------
GETEVENT lda A2osX.TIMER16
and #CURSOR.BLINK.SPEED
eor CURON
beq .9
jsr CURBLNK
.9 lda #0 Error = no event
sec
rts
*--------------------------------------
COUT jsr COUT1
clc
rts
*--------------------------------------
CLOSE
* lda A2osX.SCREENS
* and #$FF^A2osX.SCREENS.C
* sta A2osX.SCREENS
clc
rts
*--------------------------------------
GETINFO >LDYA L.DEVINFO
IRQ clc
rts
*--------------------------------------
* PRIVATE
*--------------------------------------
COUT1 pha
jsr CUROFF
pla
cmp #32
bcs .80 regular char
cmp #8
bne .2
ldx CH
beq .10
dec CH
bra .12
.10 ldy CV
bne .11
rts
.11 lda #79
sta CH
dec CV
.12 lda #$20
ora INVFLG
ldx CH
ldy CV
jsr SetCharAtXY
rts
.2 cmp #12
bne .3
jmp HOME
.3 cmp #13
beq CROUT
rts
.80 ora INVFLG
ldx CH
ldy CV
jsr SetCharAtXY
FSOUT ldx CH
cpx #79
beq CROUT1
inc CH
rts
*--------------------------------------
CROUT jsr CLREOL
*--------------------------------------
CROUT1 stz CH
ldy CV
cpy #23
beq SCROLL.UP
inc CV
rts
*--------------------------------------
SCROLL.UP ldx #0
lda RD80STORE
pha
sta SET80STORE
.1 lda BASEL,x
sta ZPBASL1
lda BASEH,x
sta ZPBASL1+1
inx
lda BASEL,x
sta ZPBASL2
lda BASEH,x
sta ZPBASL2+1
ldy #39
sta SETPAGE2
.2 lda (ZPBASL2),y
sta (ZPBASL1),y
dey
bpl .2
ldy #39
sta CLRPAGE2
.3 lda (ZPBASL2),y
sta (ZPBASL1),y
dey
bpl .3
cpx #23
bne .1
jsr CLREOL
pla
bmi .8
sta CLR80STORE
.8 rts
*--------------------------------------
CLREOL ldx CH
.1 phx
ldy CV
lda #$20
ora INVFLG
jsr SetCharAtXY
plx
inx
cpx #80
bne .1
rts
*--------------------------------------
HOME stz CH
stz CV
lda RD80STORE
pha
sta SET80STORE
ldx #23
.1 lda BASEL,x
sta ZPBASL1
lda BASEH,x
sta ZPBASL1+1
lda #' '
ora INVFLG
sta CLRPAGE2
ldy #39
.2 sta (ZPBASL1),y
dey
bpl .2
sta SETPAGE2
ldy #39
.3 sta (ZPBASL1),y
dey
bpl .3
dex
bpl .1
pla
bmi .8
sta CLR80STORE
.8 rts
*--------------------------------------
CUROFF lda CURON
beq CUREXIT.RTS
CURBLNK lda A2osX.ASCREEN
and #A2osX.SCREENS.C
bne CURBLNK1
lda CURON
bne CURBLNK.OFF
rts do not Light if screen is not active
CURBLNK1 lda CURON
bne CURBLNK.OFF
ldx CH
ldy CV
jsr GetCharAtXY
sta CURCHAR
ldx CH
ldy CV
lda #$20
jsr SetCharAtXY
bra CUREXIT
CURBLNK.OFF ldx CH
ldy CV
lda CURCHAR
jsr SetCharAtXY
CUREXIT lda CURON
eor #CURSOR.BLINK.SPEED
sta CURON
CUREXIT.RTS rts
*--------------------------------------
SetCharAtXY pha
lda RD80STORE
pha
sta SET80STORE
txa
lsr
bcc .1
clc
sta CLRPAGE2
bra .2
.1 sta SETPAGE2
.2 adc BASEL,y
sta ZPBASL1
lda BASEH,y
sta ZPBASL1+1
plx
pla
sta (ZPBASL1)
txa
bmi .8
sta CLR80STORE
.8 rts
*--------------------------------------
GetCharAtXY lda RD80STORE
pha
sta SET80STORE
txa
lsr
bcc .1
clc
sta CLRPAGE2
bra .2
.1 sta SETPAGE2
.2 adc BASEL,y
sta ZPBASL1
lda BASEH,y
sta ZPBASL1+1
lda (ZPBASL1)
plx
bmi .8
sta CLR80STORE
.8 rts
*--------------------------------------
DRV.CS.END
BASEL .HS 00.80.00.80.00.80.00.80.28.A8.28.A8.28.A8.28.A8.50.D0.50.D0.50.D0.50.D0
BASEH .HS 04.04.05.05.06.06.07.07.04.04.05.05.06.06.07.07.04.04.05.05.06.06.07.07
CH .BS 1
CV .BS 1
INVFLG .BS 1
CURON .BS 1
CURCHAR .BS 1
DEVINFO .DA #S.DEVINFO.TYPE.CHAR
.DA #80
.DA #24
*--------------------------------------
MAN
SAVE DRV/CONSOLE.DRV.S
ASM