A2osX/SBIN/GETTY.S.txt

218 lines
4.0 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/SBIN/GETTY
*--------------------------------------
.INB INC/MACROS.I
.INB INC/A2OSX.I
.INB INC/A2OSX.API.I
.INB INC/KERNEL.I
*--------------------------------------
ZPTmp1 .EQ ZPBIN
*--------------------------------------
* File Header (16 Bytes)
*--------------------------------------
CS.START cld
jmp (.1,x)
.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
*--------------------------------------
.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
.DA 0 End Of Reloc Table
*--------------------------------------
CS.INIT ldy #S.PS.hARGS
lda (pPs),y
bne .1
>LDYA L.MSG.USAGE
jsr PRINT.MSG
sec
rts
.1 >PUSHA
>PUSHBI $20 Push SEP=' '
>PUSHBI 1 Push 1 for getting INDEV
>SYSCALL SYS.PStrGetTkn
bcs .9
sta hDEVNAME
>SYSCALL SYS.GetDevByNameA
bcs .8
txa
ldy #S.PS.hINDEV
sta (pPs),y
lda hDEVNAME
>SYSCALL SYS.FreeMemA
ldy #S.PS.hARGS
lda (pPs),y
>PUSHA
>PUSHBI $20 Push SEP=' '
>PUSHBI 2 Push 1 for getting OUTDEV
>SYSCALL SYS.PStrGetTkn
.9 bcs .99
sta hDEVNAME
>SYSCALL SYS.GetDevByNameA
.8 bcs .98
>STYA pDev
txa
ldy #S.PS.hOUTDEV
sta (pPs),y
ldy #S.PS.hERRDEV
sta (pPs),y
lda hDEVNAME
>SYSCALL SYS.FreeMemA
ldy #S.PS.hARGS
lda (pPs),y
>PUSHA
>PUSHBI $20 Push SEP=' '
>PUSHBI 3 Push 3 for getting BIN
>SYSCALL SYS.PStrGetTkn
bcs .99
ldy #hBinName
sta (pData),y
ldx #DEVMGR.OPEN
jsr pDevJmp if error CS, else...
rts ...Tell TskMgr To stay in memory
.98 pha
lda hDEVNAME
>SYSCALL SYS.FreeMemA
pla
sec
.99 rts
*--------------------------------------
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...
rts
.1 >LDYA L.MSG.GREETINGS
jsr PRINT.MSG
bcs .9
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
>SYSCALL SYS.ExecProcessA
.9 rts
*--------------------------------------
CS.DOEVENT sec
rts
*--------------------------------------
CS.QUIT ldy #hBinName
lda (pData),y
>SYSCALL SYS.FreeMemA
ldx #DEVMGR.CLOSE
jsr pDevJmp
clc
rts
*--------------------------------------
* PRIVATE
*--------------------------------------
PRINT.MSG >STYA ZPTmp1
ldy #0
.1 lda (ZPTmp1),y
beq .2
jsr COUT
bcs .9
iny
bne .1
.2 clc
.9 rts
*--------------------------------------
PRBYTE pha
lsr
lsr
lsr
lsr
ora #$30
cmp #$3A
bcc .1
adc #6
.1 jsr COUT
pla
bcs .9
and #$0F
ora #$30
cmp #$3A
bcc .2
adc #6
.2 jsr COUT
.9 rts
*--------------------------------------
CROUT lda #13
*--------------------------------------
COUT phx
phy
ldx #DEVMGR.COUT
jsr pDevJmp
ply
plx
rts
pDevJmp jmp (pDev)
*--------------------------------------
CS.END
MSG.USAGE >CSTRING "GETTY <INDEV> <OUTDEV> <PROGRAM>"
MSG.GREETINGS >CSTRING "A2osX-GeTTY on Dev="
hDEVNAME .BS 1
*--------------------------------------
.DUMMY
.OR 0
DS.START
hBinName .BS 1
DS.END .ED
MAN
SAVE SBIN/GETTY.S
ASM