mirror of
https://github.com/A2osX/A2osX.git
synced 2024-09-10 22:54:59 +00:00
226 lines
4.0 KiB
Plaintext
226 lines
4.0 KiB
Plaintext
PR#3
|
||
PREFIX /A2OSX.SRC
|
||
NEW
|
||
INC 1
|
||
AUTO 6
|
||
.LIST OFF
|
||
.OP 65C02
|
||
.OR $2000
|
||
.TF /A2OSX.BOOT/SBIN/GETTY
|
||
*--------------------------------------
|
||
.INB /A2OSX.DEV/INC/MACROS.I
|
||
.INB /A2OSX.DEV/INC/A2OSX.I
|
||
.INB /A2OSX.DEV/INC/NET.TELNET.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.TELNETOPT .DA MSG.TELNETOPT
|
||
L.MSG.GREETINGS .DA MSG.GREETINGS
|
||
L.TERM .DA TERM
|
||
.DA 0 End Of Reloc Table
|
||
*--------------------------------------
|
||
CS.INIT >SYSCALL GetArgC
|
||
cmp #1
|
||
bne .1
|
||
|
||
>LDYA L.MSG.USAGE
|
||
>SYSCALL CPrintFYA
|
||
lda #0
|
||
sec
|
||
rts
|
||
|
||
.1 lda #1
|
||
>SYSCALL GetArgA
|
||
|
||
>SYSCALL MkNodYA
|
||
bcs .9
|
||
|
||
ldy #S.PS.hStdIn
|
||
sta (pPs),y
|
||
ldy #S.PS.hStdOut
|
||
sta (pPs),y
|
||
ldy #S.PS.hStdErr
|
||
sta (pPs),y
|
||
|
||
lda #2
|
||
>SYSCALL GetArgA
|
||
bcs .9
|
||
|
||
>SYSCALL ExpandPStrYA
|
||
bcs .9
|
||
|
||
txa
|
||
|
||
ldy #hBinName
|
||
sta (pData),y
|
||
clc
|
||
.9 rts
|
||
*--------------------------------------
|
||
CS.RUN
|
||
>LDYA L.MSG.TELNETOPT
|
||
>SYSCALL CPrintFYA
|
||
bcs *
|
||
|
||
lda #$83
|
||
jsr PRINT.DEBUG
|
||
|
||
.1 >SYSCALL Sleep
|
||
>SYSCALL GetC
|
||
bcs .2
|
||
|
||
jsr PRINT.DEBUG
|
||
bra .1
|
||
|
||
.2 lda #5 Ctrl-E
|
||
>SYSCALL PutCA
|
||
bcs *
|
||
|
||
lda #$84
|
||
jsr PRINT.DEBUG
|
||
|
||
.3 >SYSCALL Sleep
|
||
>SYSCALL GetC
|
||
bcs .4
|
||
|
||
jsr PRINT.DEBUG
|
||
|
||
tax
|
||
lda (pData)
|
||
cmp #63
|
||
beq .4
|
||
inc
|
||
sta (pData)
|
||
tay
|
||
txa
|
||
sta (pData),y
|
||
bra .3
|
||
|
||
.4 lda (pData)
|
||
beq .5
|
||
>PUSHW pdata
|
||
>PUSHW L.TERM
|
||
>SYSCALL SetEnv
|
||
|
||
.5 >LDYA L.MSG.GREETINGS
|
||
>SYSCALL CPrintFYA
|
||
|
||
bcs .8 unable to send greetings...loop..
|
||
|
||
ldy #hBinName
|
||
lda (pData),y
|
||
>SYSCALL GetMemPtrA
|
||
>SYSCALL ExecProcessNewEnvYA
|
||
.9 rts
|
||
|
||
.8 clc
|
||
rts
|
||
*--------------------------------------
|
||
CS.DOEVENT sec
|
||
rts
|
||
*--------------------------------------
|
||
CS.QUIT ldy #hBinName
|
||
lda (pData),y
|
||
beq .1
|
||
>SYSCALL FreeMemA
|
||
|
||
.1 ldx #DEVMGR.CLOSE
|
||
* jsr pDevJmp
|
||
|
||
clc
|
||
rts
|
||
*--------------------------------------
|
||
PRINT.DEBUG phx
|
||
phy
|
||
pha
|
||
|
||
lda #2
|
||
>SYSCALL GetDevByIDA
|
||
bcs .9
|
||
|
||
>STYA ZPTmp1
|
||
lda (ZPTmp1)
|
||
sta PRINT.DEBUG.JMP+1
|
||
ldy #1
|
||
lda (ZPTmp1),y
|
||
sta PRINT.DEBUG.JMP+2
|
||
|
||
lda #'{'
|
||
ldx #DEVMGR.WRITE
|
||
jsr PRINT.DEBUG.JMP
|
||
|
||
pla
|
||
pha
|
||
lsr
|
||
lsr
|
||
lsr
|
||
lsr
|
||
tax
|
||
lda PRINT.DEBUG.CHAR,x
|
||
|
||
ldx #DEVMGR.WRITE
|
||
jsr PRINT.DEBUG.JMP
|
||
|
||
pla
|
||
pha
|
||
and #$0F
|
||
tax
|
||
lda PRINT.DEBUG.CHAR,x
|
||
|
||
ldx #DEVMGR.WRITE
|
||
jsr PRINT.DEBUG.JMP
|
||
|
||
lda #'}'
|
||
ldx #DEVMGR.WRITE
|
||
jsr PRINT.DEBUG.JMP
|
||
|
||
.9 pla
|
||
ply
|
||
plx
|
||
rts
|
||
PRINT.DEBUG.JMP jmp $ffff
|
||
*--------------------------------------
|
||
CS.END
|
||
PRINT.DEBUG.CHAR .AS "0123456789ABCDEF"
|
||
MSG.USAGE >CSTR "GETTY <DEV> <PROGRAM>\r\n"
|
||
MSG.TELNETOPT
|
||
* .DA #IAC,#DO,#TELOPT.LINEMODE
|
||
* .DA #IAC,#SB,#TELOPT.LINEMODE,#1,#0,#IAC,#SE
|
||
.DA #IAC,#WILL,#TELOPT.BINARY
|
||
.DA #IAC,#WILL,#TELOPT.ECHO
|
||
* .DA #IAC,#WILL,#TELOPT.SGA
|
||
* .DA #IAC,#DO,#TELOPT.NAWS
|
||
.DA #IAC,#DO,TELOPT.TTYPE
|
||
.DA #13,#10,#0
|
||
MSG.GREETINGS >CSTR "\r\nA2osX-GeTTY\r\n"
|
||
TERM >PSTR "TERM"
|
||
* \e[12h
|
||
*--------------------------------------
|
||
.DUMMY
|
||
.OR 0
|
||
DS.START
|
||
InBuf .BS 64
|
||
hBinName .BS 1
|
||
DS.END .ED
|
||
MAN
|
||
SAVE SBIN/GETTY.S
|
||
ASM
|