A2osX/DRV/SSC.DRV.S.txt

113 lines
2.0 KiB
Plaintext
Raw Normal View History

2015-03-14 21:48:35 +00:00
PR#3
2015-03-15 22:00:40 +00:00
PREFIX /A2OSX.BUILD
2015-03-14 21:48:35 +00:00
NEW
INC 1
AUTO 6
.LIST OFF
.OP 65C02
.OR $2000
.TF DRV/SSC.DRV
*--------------------------------------
.INB INC/MACROS.I
.INB INC/A2OSX.I
*--------------------------------------
ZPTmpPtr1 .EQ ZPDRV
*--------------------------------------
SIG.05 .EQ $38
SIG.07 .EQ $18
SIG.0B .EQ $01
SIG.0C .EQ $31
*--------------------------------------
* Main DRV entry point
* input :
* X = CMD
* 0 : OPEN
* 2 : GETEVENT
* 4 : OUT
* 6 : CLOSE
*--------------------------------------
* CLD $D8
* JMP (*,x) $7C
* #JMPTABLE
* /JMPTABLE
*--------------------------------------
CS.START cld
jmp (.1,x)
.1 .DA OPEN
.DA GETEVENT
.DA OUT
.DA CLOSE
.DA 0 end or relocation
.DA CS.END-CS.START
*--------------------------------------
OPEN stz ZPTmpPtr1
lda #$C1
sta ZPTmpPtr1+1
.1 ldy #5
lda (ZPTmpPtr1),y
cmp #SIG.05
bne .2
ldy #7
lda (ZPTmpPtr1),y
cmp #SIG.07
bne .2
ldy #$B
lda (ZPTmpPtr1),y
cmp #SIG.0B
bne .2
ldy #$C
lda (ZPTmpPtr1),y
cmp #SIG.0C
beq .3
.2 inc ZPTmpPtr1+1
lda ZPTmpPtr1+1
cmp #$C8
bne .1
beq .99
.3 lda ZPTmpPtr1+1
and #$0F
sta DEVSLOT
ora #$30
sta DEVNAME+4
lda #S.DEV.F.CHAR+S.DEV.F.OUT
sta (pDevContext)
ldy #S.DEV.NAME
ldx #0
.7 lda DEVNAME,x
sta (pDevContext),y
cpx DEVNAME
beq .8
inx
iny
bne .7
.8 clc
rts
.99 lda #DEVMGR.ERRNOHW
sec
rts
*--------------------------------------
GETEVENT lda #0
sec
rts
*--------------------------------------
OUT clc
rts
*--------------------------------------
CLOSE clc
rts
*--------------------------------------
CS.END
DEVNAME >PSTRING "COM0"
DEVSLOT .BS 1
*--------------------------------------
MAN
SAVE DRV/SSC.DRV.S
ASM