mirror of
https://github.com/A2osX/A2osX.git
synced 2024-11-25 20:33:13 +00:00
146 lines
2.9 KiB
Plaintext
146 lines
2.9 KiB
Plaintext
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 ldy #S.PS.hARGS
|
||
lda (pPs),y
|
||
bne .1
|
||
|
||
>LDYA L.MSG.USAGE
|
||
>SYSCALL SYS.PSTROutYA
|
||
lda #0
|
||
sec
|
||
rts
|
||
|
||
.1 >PUSHA
|
||
>PUSHBI $20 Push SEP=' '
|
||
>PUSHBI 1 Push 1 for getting INDEV
|
||
>SYSCALL SYS.PStrGetTkn
|
||
bcs .99
|
||
|
||
sta hDEVNAME
|
||
>SYSCALL SYS.GetDevByNameA
|
||
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
|
||
|
||
lda hDEVNAME
|
||
>SYSCALL SYS.FreeMemA
|
||
|
||
ldy #S.PS.hARGS
|
||
lda (pPs),y
|
||
>PUSHA
|
||
>PUSHBI $20 Push SEP=' '
|
||
>PUSHBI 2 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 lda #13 try send a CR...
|
||
>SYSCALL SYS.COutA Device Is Ready ?
|
||
|
||
bcs .8 no..loop...
|
||
|
||
.1 >LDYA L.MSG.GREETINGS
|
||
>SYSCALL SYS.PSTROutYA
|
||
|
||
bcs .8 unable to send greetings...loop..
|
||
|
||
ldy #S.PS.hOUTDEV
|
||
lda (pPs),y
|
||
>SYSCALL SYS.HexOutA
|
||
bcs .8
|
||
|
||
lda #13
|
||
>SYSCALL SYS.COutA
|
||
bcs .8
|
||
|
||
ldy #hBinName
|
||
lda (pData),y
|
||
ldy #0
|
||
>SYSCALL SYS.ExecProcessNewEnvYA
|
||
.9 rts
|
||
|
||
.8 clc
|
||
rts
|
||
*--------------------------------------
|
||
CS.DOEVENT sec
|
||
rts
|
||
*--------------------------------------
|
||
CS.QUIT ldy #hBinName
|
||
lda (pData),y
|
||
>SYSCALL SYS.FreeMemA
|
||
|
||
ldx #DEVMGR.CLOSE
|
||
jsr pDevJmp
|
||
|
||
clc
|
||
rts
|
||
*--------------------------------------
|
||
CS.END
|
||
MSG.USAGE >PSTRING "GETTY <DEV> <PROGRAM>"
|
||
MSG.GREETINGS >PSTRING "A2osX-GeTTY on Dev="
|
||
hDEVNAME .BS 1
|
||
*--------------------------------------
|
||
.DUMMY
|
||
.OR 0
|
||
DS.START
|
||
hBinName .BS 1
|
||
DS.END .ED
|
||
MAN
|
||
SAVE SBIN/GETTY.S
|
||
ASM
|