A2osX/SBIN/GETTY.S.txt

135 lines
2.6 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
*--------------------------------------
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 >SYSCALL SYS.GetArgC
cmp #1
bne .1
>LDYA L.MSG.USAGE
>SYSCALL SYS.PStrOutYA
lda #0
sec
rts
.1 lda #1
>SYSCALL SYS.GetArgA
>SYSCALL SYS.GetDevByNameYA
bcs .98
>STYA pDev
txa
ldy #S.PS.hINDEV
sta (pPs),y
ldy #S.PS.hOUTDEV
sta (pPs),y
ldy #S.PS.hERRDEV
sta (pPs),y
ldx #DEVMGR.OPEN
jsr pDevJmp
bcs .99
lda #2
>SYSCALL SYS.GetArgA
bcs .99
>SYSCALL SYS.NewPStrYA
bcs .99
txa
ldy #hBinName
sta (pData),y
clc
rts
.98 sec
.99 rts
*--------------------------------------
CS.RUN lda #13 try send a CR...
>SYSCALL SYS.COutA Device Is Ready ?
bcs .8 no..loop...
lda pDev
clc
adc #S.DEV.NAME
tay
lda pDev+1
adc /S.DEV.NAME
>PUSHYA
>LDYA L.MSG.GREETINGS
>SYSCALL SYS.PStrOutYA
bcs .8 unable to send greetings...loop..
ldy #hBinName
lda (pData),y
>SYSCALL SYS.GetMemPtrA
>SYSCALL SYS.ExecProcessNewEnvYA
.9 rts
.8 clc
rts
*--------------------------------------
CS.DOEVENT sec
rts
*--------------------------------------
CS.QUIT ldy #hBinName
lda (pData),y
beq .1
>SYSCALL SYS.FreeMemA
.1 ldx #DEVMGR.CLOSE
* jsr pDevJmp
clc
rts
*--------------------------------------
CS.END
MSG.USAGE >PSTRING "GETTY <DEV> <PROGRAM>"
MSG.GREETINGS >PSTRING "\e[12h\nA2osX-GeTTY on Dev=%S\n"
*--------------------------------------
.DUMMY
.OR 0
DS.START
hBinName .BS 1
DS.END .ED
MAN
SAVE SBIN/GETTY.S
ASM