2015-03-14 21:48:35 +00:00
|
|
|
|
PR#3
|
2017-03-29 15:48:15 +00:00
|
|
|
|
PREFIX /A2OSX.BUILD
|
2015-03-14 21:48:35 +00:00
|
|
|
|
NEW
|
|
|
|
|
INC 1
|
|
|
|
|
AUTO 6
|
|
|
|
|
.LIST OFF
|
|
|
|
|
.OP 65C02
|
|
|
|
|
.OR $2000
|
2017-03-29 15:48:15 +00:00
|
|
|
|
.TF /A2OSX.BUILD/SBIN/GETTY
|
2015-03-14 21:48:35 +00:00
|
|
|
|
*--------------------------------------
|
2017-03-29 15:48:15 +00:00
|
|
|
|
.INB /A2OSX.BUILD/INC/MACROS.I
|
|
|
|
|
.INB /A2OSX.BUILD/INC/A2OSX.I
|
|
|
|
|
.INB /A2OSX.BUILD/INC/NET.TELNET.I
|
2015-03-14 21:48:35 +00:00
|
|
|
|
*--------------------------------------
|
2017-03-03 16:37:15 +00:00
|
|
|
|
TIMEOUT.MAX .EQ 10 1 sec.
|
|
|
|
|
*--------------------------------------
|
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
|
2015-09-13 20:35:07 +00:00
|
|
|
|
L.MSG.USAGE .DA MSG.USAGE
|
2017-03-03 16:37:15 +00:00
|
|
|
|
L.MSG.TELNET.OPT .DA MSG.TELNET.OPT
|
2015-09-13 20:35:07 +00:00
|
|
|
|
L.MSG.GREETINGS .DA MSG.GREETINGS
|
2017-02-03 16:58:13 +00:00
|
|
|
|
L.TERM .DA TERM
|
2015-06-03 18:30:57 +00:00
|
|
|
|
.DA 0 End Of Reloc Table
|
2015-03-14 21:48:35 +00:00
|
|
|
|
*--------------------------------------
|
2016-10-24 15:54:43 +00:00
|
|
|
|
CS.INIT >SYSCALL GetArgC
|
2016-08-17 06:25:58 +00:00
|
|
|
|
cmp #1
|
2015-09-13 20:35:07 +00:00
|
|
|
|
bne .1
|
|
|
|
|
|
|
|
|
|
>LDYA L.MSG.USAGE
|
2017-08-22 06:37:03 +00:00
|
|
|
|
>SYSCALL PrintFYA
|
2015-11-22 22:30:06 +00:00
|
|
|
|
lda #0
|
2015-09-13 20:35:07 +00:00
|
|
|
|
sec
|
|
|
|
|
rts
|
|
|
|
|
|
2016-08-17 06:25:58 +00:00
|
|
|
|
.1 lda #1
|
2016-10-24 15:54:43 +00:00
|
|
|
|
>SYSCALL GetArgA
|
2016-06-07 06:10:18 +00:00
|
|
|
|
|
2017-01-12 17:43:45 +00:00
|
|
|
|
>SYSCALL MkNodYA
|
|
|
|
|
bcs .9
|
|
|
|
|
|
|
|
|
|
ldy #S.PS.hStdIn
|
2015-06-03 18:30:57 +00:00
|
|
|
|
sta (pPs),y
|
2017-01-12 17:43:45 +00:00
|
|
|
|
ldy #S.PS.hStdOut
|
2015-06-03 18:30:57 +00:00
|
|
|
|
sta (pPs),y
|
2017-01-12 17:43:45 +00:00
|
|
|
|
ldy #S.PS.hStdErr
|
2015-06-03 18:30:57 +00:00
|
|
|
|
sta (pPs),y
|
2015-10-19 20:35:00 +00:00
|
|
|
|
|
2016-08-17 06:25:58 +00:00
|
|
|
|
lda #2
|
2016-10-24 15:54:43 +00:00
|
|
|
|
>SYSCALL GetArgA
|
2017-01-12 17:43:45 +00:00
|
|
|
|
bcs .9
|
2015-03-14 21:48:35 +00:00
|
|
|
|
|
2016-11-01 17:18:04 +00:00
|
|
|
|
>SYSCALL ExpandPStrYA
|
2017-01-12 17:43:45 +00:00
|
|
|
|
bcs .9
|
2016-11-01 17:18:04 +00:00
|
|
|
|
|
2016-08-17 06:25:58 +00:00
|
|
|
|
txa
|
2016-11-01 17:18:04 +00:00
|
|
|
|
|
2015-06-03 18:30:57 +00:00
|
|
|
|
ldy #hBinName
|
|
|
|
|
sta (pData),y
|
2017-03-03 16:37:15 +00:00
|
|
|
|
|
|
|
|
|
lda (pPs)
|
|
|
|
|
ora #S.PS.F.EVENT Now accept events
|
|
|
|
|
sta (pPs)
|
|
|
|
|
|
2016-06-07 06:10:18 +00:00
|
|
|
|
clc
|
2017-01-12 17:43:45 +00:00
|
|
|
|
.9 rts
|
2015-03-14 21:48:35 +00:00
|
|
|
|
*--------------------------------------
|
2017-03-03 16:37:15 +00:00
|
|
|
|
CS.RUN jsr Init.Timeout
|
|
|
|
|
|
|
|
|
|
.66 >SYSCALL Sleep
|
|
|
|
|
>SYSCALL GetC
|
|
|
|
|
bcc .1
|
|
|
|
|
bcs .66
|
|
|
|
|
* jsr Wait.Timeout
|
|
|
|
|
* bcc .66
|
|
|
|
|
|
|
|
|
|
* jmp .2
|
|
|
|
|
|
2017-02-04 22:07:06 +00:00
|
|
|
|
|
2017-03-03 16:37:15 +00:00
|
|
|
|
.10 >SYSCALL Sleep
|
2017-02-03 16:58:13 +00:00
|
|
|
|
>SYSCALL GetC
|
2017-03-03 16:37:15 +00:00
|
|
|
|
bcs .1
|
|
|
|
|
|
2017-03-01 15:22:00 +00:00
|
|
|
|
|
|
|
|
|
|
2017-03-03 16:37:15 +00:00
|
|
|
|
.1 cmp #IAC
|
|
|
|
|
beq .11
|
|
|
|
|
|
|
|
|
|
jmp .2
|
|
|
|
|
|
|
|
|
|
.11 >SYSCALL Sleep
|
2017-03-01 15:22:00 +00:00
|
|
|
|
>SYSCALL GetC
|
2017-03-03 16:37:15 +00:00
|
|
|
|
bcs .11
|
|
|
|
|
|
|
|
|
|
ldy #IAC.VERB
|
|
|
|
|
sta (pData),y
|
2017-03-01 15:22:00 +00:00
|
|
|
|
|
2017-03-03 16:37:15 +00:00
|
|
|
|
* jsr PRINT.DEBUG
|
2017-02-03 16:58:13 +00:00
|
|
|
|
|
2017-03-03 16:37:15 +00:00
|
|
|
|
.12 >SYSCALL Sleep
|
|
|
|
|
>SYSCALL GetC
|
|
|
|
|
bcs .12
|
|
|
|
|
|
|
|
|
|
ldy #IAC.OPT
|
|
|
|
|
sta (pData),y
|
|
|
|
|
|
|
|
|
|
* jsr PRINT.DEBUG
|
|
|
|
|
|
|
|
|
|
ldy #IAC.VERB
|
|
|
|
|
lda (pData),y
|
|
|
|
|
cmp #SB
|
|
|
|
|
bne .10
|
|
|
|
|
|
|
|
|
|
ldy #IAC.OPT
|
|
|
|
|
lda (pData),y
|
|
|
|
|
cmp #TELOPT.TTYPE
|
|
|
|
|
bne .15 only interested in Term Type, go get IAC,SE
|
|
|
|
|
|
|
|
|
|
.13 >SYSCALL Sleep
|
|
|
|
|
>SYSCALL GetC
|
|
|
|
|
bcs .13
|
|
|
|
|
|
|
|
|
|
cmp #SB.IS not a valid reply, go get IAC,SE
|
|
|
|
|
bne .15
|
|
|
|
|
|
|
|
|
|
lda #0
|
|
|
|
|
sta (pData) reset IAC.TERM
|
|
|
|
|
|
|
|
|
|
.14 >SYSCALL Sleep
|
|
|
|
|
>SYSCALL GetC
|
|
|
|
|
bcs .14
|
|
|
|
|
|
|
|
|
|
cmp #IAC
|
|
|
|
|
beq .16 end of DATA, go wait SE
|
|
|
|
|
|
|
|
|
|
pha
|
2017-02-03 16:58:13 +00:00
|
|
|
|
lda (pData)
|
|
|
|
|
inc
|
|
|
|
|
tay
|
2017-03-03 16:37:15 +00:00
|
|
|
|
sta (pData)
|
|
|
|
|
pla
|
|
|
|
|
|
2017-02-03 16:58:13 +00:00
|
|
|
|
sta (pData),y
|
2017-03-03 16:37:15 +00:00
|
|
|
|
bra .14
|
|
|
|
|
|
|
|
|
|
.15 >SYSCALL Sleep
|
|
|
|
|
>SYSCALL GetC
|
|
|
|
|
bcs .15
|
2017-02-03 16:58:13 +00:00
|
|
|
|
|
2017-03-03 16:37:15 +00:00
|
|
|
|
cmp #IAC
|
|
|
|
|
bne .15
|
|
|
|
|
|
|
|
|
|
.16 >SYSCALL Sleep
|
|
|
|
|
>SYSCALL GetC
|
|
|
|
|
bcs .16
|
|
|
|
|
|
|
|
|
|
cmp #SE
|
|
|
|
|
bne .16
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
jmp .10
|
|
|
|
|
|
|
|
|
|
.2
|
|
|
|
|
|
|
|
|
|
lda (pData)
|
2017-03-01 15:22:00 +00:00
|
|
|
|
beq .5
|
2017-03-03 16:37:15 +00:00
|
|
|
|
>PUSHW pData
|
2017-02-04 22:07:06 +00:00
|
|
|
|
>PUSHW L.TERM
|
|
|
|
|
>SYSCALL SetEnv
|
2017-02-03 16:58:13 +00:00
|
|
|
|
|
2017-03-03 16:37:15 +00:00
|
|
|
|
.5
|
|
|
|
|
|
|
|
|
|
>LDYA L.MSG.TELNET.OPT
|
2017-08-22 06:37:03 +00:00
|
|
|
|
>SYSCALL PrintFYA
|
2017-03-03 16:37:15 +00:00
|
|
|
|
bcs *
|
|
|
|
|
|
|
|
|
|
>LDYA L.MSG.GREETINGS
|
2017-08-22 06:37:03 +00:00
|
|
|
|
>SYSCALL PrintFYA
|
2015-06-03 18:30:57 +00:00
|
|
|
|
|
2015-11-22 22:30:06 +00:00
|
|
|
|
bcs .8 unable to send greetings...loop..
|
2015-06-03 18:30:57 +00:00
|
|
|
|
|
|
|
|
|
ldy #hBinName
|
|
|
|
|
lda (pData),y
|
2016-10-24 15:54:43 +00:00
|
|
|
|
>SYSCALL GetMemPtrA
|
|
|
|
|
>SYSCALL ExecProcessNewEnvYA
|
2015-06-03 18:30:57 +00:00
|
|
|
|
.9 rts
|
2015-11-22 22:30:06 +00:00
|
|
|
|
|
|
|
|
|
.8 clc
|
|
|
|
|
rts
|
2015-03-14 21:48:35 +00:00
|
|
|
|
*--------------------------------------
|
2017-03-03 16:37:15 +00:00
|
|
|
|
CS.DOEVENT lda (pEvent)
|
|
|
|
|
bpl .9 is it a TIMER event?
|
|
|
|
|
|
|
|
|
|
ldy #TimeOut
|
|
|
|
|
lda (pData),y
|
|
|
|
|
beq .9
|
|
|
|
|
|
|
|
|
|
dec
|
|
|
|
|
sta (pData),y
|
|
|
|
|
|
|
|
|
|
.9 sec do not discard TIMER event
|
|
|
|
|
rts
|
2015-03-14 21:48:35 +00:00
|
|
|
|
*--------------------------------------
|
2015-06-03 18:30:57 +00:00
|
|
|
|
CS.QUIT ldy #hBinName
|
|
|
|
|
lda (pData),y
|
2016-10-03 15:59:36 +00:00
|
|
|
|
beq .1
|
2016-10-24 15:54:43 +00:00
|
|
|
|
>SYSCALL FreeMemA
|
2015-06-03 18:30:57 +00:00
|
|
|
|
|
2016-10-03 15:59:36 +00:00
|
|
|
|
.1 ldx #DEVMGR.CLOSE
|
2016-06-07 06:10:18 +00:00
|
|
|
|
* jsr pDevJmp
|
2015-06-03 18:30:57 +00:00
|
|
|
|
|
|
|
|
|
clc
|
2015-03-14 21:48:35 +00:00
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2017-03-01 15:22:00 +00:00
|
|
|
|
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
|
|
|
|
|
*--------------------------------------
|
2017-03-03 16:37:15 +00:00
|
|
|
|
Init.Timeout ldy #TimeOut
|
|
|
|
|
lda #TIMEOUT.MAX
|
|
|
|
|
sta (pData),y
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
Wait.TimeOut sec
|
|
|
|
|
ldy #TimeOut
|
|
|
|
|
lda (pData),y
|
|
|
|
|
beq .9
|
|
|
|
|
clc
|
|
|
|
|
.9 rts
|
|
|
|
|
*--------------------------------------
|
2015-03-14 21:48:35 +00:00
|
|
|
|
CS.END
|
2017-03-01 15:22:00 +00:00
|
|
|
|
PRINT.DEBUG.CHAR .AS "0123456789ABCDEF"
|
2017-02-28 16:58:36 +00:00
|
|
|
|
MSG.USAGE >CSTR "GETTY <DEV> <PROGRAM>\r\n"
|
2017-03-03 16:37:15 +00:00
|
|
|
|
MSG.TELNET.OPT
|
|
|
|
|
* .DA #IAC,#WILL,#TELOPT.BINARY
|
2017-02-28 16:58:36 +00:00
|
|
|
|
* .DA #IAC,#DO,#TELOPT.LINEMODE
|
|
|
|
|
* .DA #IAC,#SB,#TELOPT.LINEMODE,#1,#0,#IAC,#SE
|
2017-03-03 16:37:15 +00:00
|
|
|
|
.DA #IAC,#DONT,#TELOPT.ECHO
|
2017-02-28 16:58:36 +00:00
|
|
|
|
.DA #IAC,#WILL,#TELOPT.ECHO
|
2017-03-03 16:37:15 +00:00
|
|
|
|
.DA #IAC,#WILL,#TELOPT.SGA
|
|
|
|
|
.DA #IAC,#DO,#TELOPT.SGA
|
2017-02-28 16:58:36 +00:00
|
|
|
|
* .DA #IAC,#DO,#TELOPT.NAWS
|
2017-03-03 16:37:15 +00:00
|
|
|
|
.DA #IAC,#DO,#TELOPT.TTYPE
|
|
|
|
|
.DA #IAC,#SB,#TELOPT.TTYPE,#SB.SEND,#IAC,#SE
|
|
|
|
|
.DA #0
|
2017-02-28 16:58:36 +00:00
|
|
|
|
MSG.GREETINGS >CSTR "\r\nA2osX-GeTTY\r\n"
|
2017-02-03 16:58:13 +00:00
|
|
|
|
TERM >PSTR "TERM"
|
|
|
|
|
* \e[12h
|
2015-03-14 21:48:35 +00:00
|
|
|
|
*--------------------------------------
|
2015-06-03 18:30:57 +00:00
|
|
|
|
.DUMMY
|
|
|
|
|
.OR 0
|
2017-02-03 16:58:13 +00:00
|
|
|
|
DS.START
|
2017-03-03 16:37:15 +00:00
|
|
|
|
IAC.TERM .BS 64
|
2015-06-03 18:30:57 +00:00
|
|
|
|
hBinName .BS 1
|
2017-03-03 16:37:15 +00:00
|
|
|
|
TimeOut .BS 1
|
|
|
|
|
IAC.VERB .BS 1
|
|
|
|
|
IAC.OPT .BS 1
|
2015-06-03 18:30:57 +00:00
|
|
|
|
DS.END .ED
|
2015-03-14 21:48:35 +00:00
|
|
|
|
MAN
|
2017-03-29 15:48:15 +00:00
|
|
|
|
SAVE /A2OSX.SRC/SBIN/GETTY.S
|
2015-03-14 21:48:35 +00:00
|
|
|
|
ASM
|