A2osX/SBIN/GETTY.S.txt

200 lines
3.7 KiB
Plaintext
Raw Normal View History

2015-03-14 21:48:35 +00:00
PR#3
2015-06-03 18:30:57 +00:00
PREFIX /A2OSX.SRC
2015-03-14 21:48:35 +00:00
NEW
INC 1
AUTO 6
.LIST OFF
.OP 65C02
.OR $2000
2015-06-03 18:30:57 +00:00
.TF /A2OSX.BOOT/SBIN/GETTY
2015-03-14 21:48:35 +00:00
*--------------------------------------
.INB INC/MACROS.I
.INB INC/A2OSX.I
2015-06-03 18:30:57 +00:00
.INB INC/A2OSX.API.I
.INB INC/KERNEL.I
2015-03-14 21:48:35 +00:00
*--------------------------------------
2015-06-03 18:30:57 +00:00
ZPTmp1 .EQ ZPBIN
2015-03-14 21:48:35 +00:00
*--------------------------------------
2015-06-03 18:30:57 +00:00
* File Header (16 Bytes)
2015-03-14 21:48:35 +00:00
*--------------------------------------
CS.START cld
jmp (.1,x)
2015-06-03 18:30:57 +00:00
.DA #$61 6502,Level 1 (65c02)
.DA #1 BIN Layout Version 1
.DA 0
.DA CS.END-CS.START
.DA DS.END-DS.START Data Segment to Allocate
.DA 0
.DA 0
*--------------------------------------
* Relocation Table
*--------------------------------------
2015-03-14 21:48:35 +00:00
.1 .DA CS.INIT
.DA CS.RUN
.DA CS.DOEVENT
.DA CS.QUIT
L.MSG.USAGE .DA MSG.USAGE
L.MSG.GREETINGS .DA MSG.GREETINGS
2015-06-03 18:30:57 +00:00
.DA 0 End Of Reloc Table
2015-03-14 21:48:35 +00:00
*--------------------------------------
CS.INIT ldy #S.PS.hARGS
2015-06-03 18:30:57 +00:00
lda (pPs),y
bne .1
>LDYA L.MSG.USAGE
jsr PRINT.MSG
sec
rts
.1 >PUSHA
2015-03-14 21:48:35 +00:00
>PUSHBI $20 Push SEP=' '
>PUSHBI 1 Push 1 for getting INDEV
>SYSCALL SYS.PStrGetTkn
2015-10-19 20:35:00 +00:00
bcs .98
2015-03-14 21:48:35 +00:00
sta hDEVNAME
>SYSCALL SYS.GetDevByNameA
2015-10-19 20:35:00 +00:00
bcs .99
2015-03-14 21:48:35 +00:00
2015-06-03 18:30:57 +00:00
txa
2015-03-14 21:48:35 +00:00
ldy #S.PS.hINDEV
2015-06-03 18:30:57 +00:00
sta (pPs),y
2015-03-14 21:48:35 +00:00
ldy #S.PS.hOUTDEV
2015-06-03 18:30:57 +00:00
sta (pPs),y
2015-03-14 21:48:35 +00:00
ldy #S.PS.hERRDEV
2015-06-03 18:30:57 +00:00
sta (pPs),y
2015-10-19 20:35:00 +00:00
2015-03-14 21:48:35 +00:00
lda hDEVNAME
>SYSCALL SYS.FreeMemA
ldy #S.PS.hARGS
2015-06-03 18:30:57 +00:00
lda (pPs),y
2015-03-14 21:48:35 +00:00
>PUSHA
>PUSHBI $20 Push SEP=' '
2015-10-19 20:35:00 +00:00
>PUSHBI 2 Push 3 for getting BIN
2015-03-14 21:48:35 +00:00
>SYSCALL SYS.PStrGetTkn
bcs .99
2015-06-03 18:30:57 +00:00
ldy #hBinName
sta (pData),y
ldx #DEVMGR.OPEN
jsr pDevJmp if error CS, else...
2015-03-14 21:48:35 +00:00
2015-06-03 18:30:57 +00:00
rts ...Tell TskMgr To stay in memory
2015-03-14 21:48:35 +00:00
.98 pha
lda hDEVNAME
>SYSCALL SYS.FreeMemA
pla
sec
.99 rts
*--------------------------------------
2015-06-03 18:30:57 +00:00
CS.RUN ldy #S.PS.hOUTDEV
lda (pPs),y
>SYSCALL SYS.GetDevByIDA
>STYA pDev
lda #13 try send a CR...
jsr COUT Device Is Ready ?
bcc .1
clc no..loop...
2015-03-14 21:48:35 +00:00
rts
2015-06-03 18:30:57 +00:00
.1 >LDYA L.MSG.GREETINGS
2015-03-14 21:48:35 +00:00
jsr PRINT.MSG
bcs .9
2015-06-03 18:30:57 +00:00
ldy #S.PS.hINDEV
lda (pPs),y
jsr PRBYTE
bcs .9
lda #','
jsr COUT
bcs .9
ldy #S.PS.hOUTDEV
lda (pPs),y
jsr PRBYTE
bcs .9
ldy #hBinName
lda (pData),y
2015-10-19 20:35:00 +00:00
>SYSCALL SYS.ExecProcessNewEnvA
2015-06-03 18:30:57 +00:00
.9 rts
2015-03-14 21:48:35 +00:00
*--------------------------------------
2015-06-03 18:30:57 +00:00
CS.DOEVENT sec
2015-03-14 21:48:35 +00:00
rts
*--------------------------------------
2015-06-03 18:30:57 +00:00
CS.QUIT ldy #hBinName
lda (pData),y
>SYSCALL SYS.FreeMemA
ldx #DEVMGR.CLOSE
jsr pDevJmp
clc
2015-03-14 21:48:35 +00:00
rts
*--------------------------------------
* PRIVATE
*--------------------------------------
2015-06-03 18:30:57 +00:00
PRINT.MSG >STYA ZPTmp1
2015-03-14 21:48:35 +00:00
ldy #0
2015-06-03 18:30:57 +00:00
.1 lda (ZPTmp1),y
2015-03-14 21:48:35 +00:00
beq .2
jsr COUT
2015-06-03 18:30:57 +00:00
bcs .9
2015-03-14 21:48:35 +00:00
iny
bne .1
2015-06-03 18:30:57 +00:00
.2 clc
.9 rts
2015-03-14 21:48:35 +00:00
*--------------------------------------
PRBYTE pha
lsr
lsr
lsr
lsr
2015-06-03 18:30:57 +00:00
ora #$30
cmp #$3A
2015-03-14 21:48:35 +00:00
bcc .1
adc #6
.1 jsr COUT
pla
2015-06-03 18:30:57 +00:00
bcs .9
2015-03-14 21:48:35 +00:00
and #$0F
2015-06-03 18:30:57 +00:00
ora #$30
cmp #$3A
bcc .2
2015-03-14 21:48:35 +00:00
adc #6
2015-06-03 18:30:57 +00:00
.2 jsr COUT
.9 rts
2015-03-14 21:48:35 +00:00
*--------------------------------------
CROUT lda #13
*--------------------------------------
2015-06-03 18:30:57 +00:00
COUT phx
2015-03-14 21:48:35 +00:00
phy
2015-06-03 18:30:57 +00:00
ldx #DEVMGR.COUT
jsr pDevJmp
2015-03-14 21:48:35 +00:00
ply
plx
rts
2015-06-03 18:30:57 +00:00
pDevJmp jmp (pDev)
2015-03-14 21:48:35 +00:00
*--------------------------------------
CS.END
MSG.USAGE >CSTRING "GETTY <INDEV> <OUTDEV> <PROGRAM>"
2015-06-03 18:30:57 +00:00
MSG.GREETINGS >CSTRING "A2osX-GeTTY on Dev="
2015-03-14 21:48:35 +00:00
hDEVNAME .BS 1
*--------------------------------------
2015-06-03 18:30:57 +00:00
.DUMMY
.OR 0
DS.START
hBinName .BS 1
DS.END .ED
2015-03-14 21:48:35 +00:00
MAN
SAVE SBIN/GETTY.S
ASM