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-10-05 15:39:17 +00:00
|
|
|
|
TIMEOUT.MAX .EQ 100 1 sec.
|
2017-03-03 16:37:15 +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
|
2017-10-05 15:39:17 +00:00
|
|
|
|
.DA CS.END-CS.START CS
|
|
|
|
|
.DA DS.END-DS.START DS
|
|
|
|
|
.DA #16 SS
|
2017-10-19 15:27:38 +00:00
|
|
|
|
.DA #0 ZP
|
2015-06-03 18:30:57 +00:00
|
|
|
|
.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-10-05 15:39:17 +00:00
|
|
|
|
L.MSG.TELNETOPT .DA MSG.TELNETOPT
|
2015-09-13 20:35:07 +00:00
|
|
|
|
L.MSG.GREETINGS .DA MSG.GREETINGS
|
2017-10-05 15:39:17 +00:00
|
|
|
|
L.ENV.TERM .DA ENV.TERM
|
|
|
|
|
L.HEX .DA HEX
|
|
|
|
|
L.HEX2 .DA HEX2
|
2015-06-03 18:30:57 +00:00
|
|
|
|
.DA 0 End Of Reloc Table
|
2015-03-14 21:48:35 +00:00
|
|
|
|
*--------------------------------------
|
2017-09-14 15:21:06 +00:00
|
|
|
|
CS.INIT ldy #S.PS.ARGC
|
|
|
|
|
lda (pPs),y
|
|
|
|
|
cmp #2
|
|
|
|
|
bne .9
|
2015-09-13 20:35:07 +00:00
|
|
|
|
|
2017-09-14 15:21:06 +00:00
|
|
|
|
lda #1
|
2017-08-24 12:46:48 +00:00
|
|
|
|
>SYSCALL GetArg.A
|
2016-06-07 06:10:18 +00:00
|
|
|
|
|
2017-08-31 06:23:29 +00:00
|
|
|
|
>SYSCALL MkNod.YA
|
2017-01-12 17:43:45 +00:00
|
|
|
|
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
|
2017-08-24 12:46:48 +00:00
|
|
|
|
>SYSCALL GetArg.A
|
2017-01-12 17:43:45 +00:00
|
|
|
|
bcs .9
|
2015-03-14 21:48:35 +00:00
|
|
|
|
|
2017-08-24 15:29:22 +00:00
|
|
|
|
>SYSCALL ExpandStr.YA
|
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
|
|
|
|
|
2017-09-19 15:34:01 +00:00
|
|
|
|
>STA.G hBinName
|
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-09-14 15:21:06 +00:00
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
>LDYA L.MSG.USAGE
|
|
|
|
|
>SYSCALL PrintF.YA
|
|
|
|
|
lda #0
|
|
|
|
|
sec
|
2017-01-12 17:43:45 +00:00
|
|
|
|
.9 rts
|
2015-03-14 21:48:35 +00:00
|
|
|
|
*--------------------------------------
|
2017-10-05 15:39:17 +00:00
|
|
|
|
CS.RUN >SYSCALL Sleep
|
|
|
|
|
>SYSCALL GetChar
|
|
|
|
|
bcs CS.RUN
|
2017-09-15 06:37:15 +00:00
|
|
|
|
|
2017-10-23 15:39:19 +00:00
|
|
|
|
.11
|
|
|
|
|
* jsr PRINTA2
|
2017-10-05 15:39:17 +00:00
|
|
|
|
>SYSCALL Sleep
|
2017-08-31 06:23:29 +00:00
|
|
|
|
>SYSCALL GetChar
|
2017-10-05 15:39:17 +00:00
|
|
|
|
|
|
|
|
|
bcc .11
|
|
|
|
|
|
|
|
|
|
jsr Init.Timeout
|
2017-03-03 16:37:15 +00:00
|
|
|
|
|
2017-10-05 15:39:17 +00:00
|
|
|
|
ldy #0
|
2017-03-03 16:37:15 +00:00
|
|
|
|
|
2017-10-05 15:39:17 +00:00
|
|
|
|
.1 lda MSG.TELNETOPT,y
|
|
|
|
|
phy
|
|
|
|
|
>SYSCALL PutChar.A
|
|
|
|
|
ply
|
|
|
|
|
iny
|
|
|
|
|
cpy #MSG.TELNETOPT.LEN
|
|
|
|
|
bne .1
|
|
|
|
|
|
|
|
|
|
* >LDYA L.MSG.TELNETOPT
|
|
|
|
|
* >SYSCALL PrintF.YA
|
|
|
|
|
* bcs *
|
|
|
|
|
|
|
|
|
|
CS.RUN.LOOP
|
2017-02-04 22:07:06 +00:00
|
|
|
|
|
2017-10-05 15:39:17 +00:00
|
|
|
|
.1 >SYSCALL Sleep
|
2017-08-31 06:23:29 +00:00
|
|
|
|
>SYSCALL GetChar
|
2017-10-05 15:39:17 +00:00
|
|
|
|
bcs .4
|
2017-03-03 16:37:15 +00:00
|
|
|
|
|
2017-10-23 15:39:19 +00:00
|
|
|
|
* jsr PRINTA
|
2017-03-01 15:22:00 +00:00
|
|
|
|
|
2017-10-05 15:39:17 +00:00
|
|
|
|
cmp #IAC
|
|
|
|
|
beq CS.RUN.IACMODE
|
2017-03-01 15:22:00 +00:00
|
|
|
|
|
2017-10-05 15:39:17 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.4 jsr Wait.Timeout
|
|
|
|
|
bcc .1
|
|
|
|
|
|
|
|
|
|
>LDYA L.MSG.GREETINGS
|
|
|
|
|
>SYSCALL PrintF.YA
|
2017-03-03 16:37:15 +00:00
|
|
|
|
|
2017-10-05 15:39:17 +00:00
|
|
|
|
bcs .8 unable to send greetings...reset..
|
2017-03-03 16:37:15 +00:00
|
|
|
|
|
2017-10-05 15:39:17 +00:00
|
|
|
|
ldy #hBinName
|
|
|
|
|
lda (pData),y
|
|
|
|
|
>SYSCALL GetMemPtr.A
|
2017-10-19 06:19:54 +00:00
|
|
|
|
>SYSCALL ExecPS.YA
|
2017-10-05 15:39:17 +00:00
|
|
|
|
.9 rts
|
|
|
|
|
|
|
|
|
|
.8 clc
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CS.RUN.IACMODE >SYSCALL Sleep Wait for IAC VERB (or SB)
|
2017-08-31 06:23:29 +00:00
|
|
|
|
>SYSCALL GetChar
|
2017-10-05 15:39:17 +00:00
|
|
|
|
bcs CS.RUN.IACMODE
|
2017-03-03 16:37:15 +00:00
|
|
|
|
|
2017-10-05 15:39:17 +00:00
|
|
|
|
>STA.G IAC.VERB
|
2017-10-23 15:39:19 +00:00
|
|
|
|
* jsr PRINTA
|
2017-03-01 15:22:00 +00:00
|
|
|
|
|
2017-10-05 15:39:17 +00:00
|
|
|
|
.1 >SYSCALL Sleep Wait for IAC OPT
|
2017-08-31 06:23:29 +00:00
|
|
|
|
>SYSCALL GetChar
|
2017-10-05 15:39:17 +00:00
|
|
|
|
bcs .1
|
2017-03-03 16:37:15 +00:00
|
|
|
|
|
2017-10-05 15:39:17 +00:00
|
|
|
|
>STA.G IAC.OPT
|
2017-10-23 15:39:19 +00:00
|
|
|
|
* jsr PRINTA
|
2017-03-03 16:37:15 +00:00
|
|
|
|
|
2017-10-05 15:39:17 +00:00
|
|
|
|
>LDA.G IAC.VERB
|
2017-03-03 16:37:15 +00:00
|
|
|
|
cmp #SB
|
2017-10-05 15:39:17 +00:00
|
|
|
|
beq CS.RUN.IACSB
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CS.RUN.IACVERB
|
2017-10-23 15:39:19 +00:00
|
|
|
|
* lda #'.'
|
|
|
|
|
* >SYSCALL PutChar.A
|
2017-10-05 15:39:17 +00:00
|
|
|
|
jmp CS.RUN.LOOP
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CS.RUN.IACSB
|
|
|
|
|
.1 >SYSCALL Sleep
|
2017-08-31 06:23:29 +00:00
|
|
|
|
>SYSCALL GetChar
|
2017-10-05 15:39:17 +00:00
|
|
|
|
bcs .1
|
|
|
|
|
|
|
|
|
|
>STA.G IAC.SB
|
2017-03-03 16:37:15 +00:00
|
|
|
|
|
2017-10-23 15:39:19 +00:00
|
|
|
|
* jsr PRINTA
|
2017-10-05 15:39:17 +00:00
|
|
|
|
|
2017-03-03 16:37:15 +00:00
|
|
|
|
lda #0
|
2017-10-05 15:39:17 +00:00
|
|
|
|
sta (pData) reset IAC.SB.DATA
|
2017-03-03 16:37:15 +00:00
|
|
|
|
|
2017-10-05 15:39:17 +00:00
|
|
|
|
.2 >SYSCALL Sleep
|
2017-08-31 06:23:29 +00:00
|
|
|
|
>SYSCALL GetChar
|
2017-10-05 15:39:17 +00:00
|
|
|
|
bcs .2
|
|
|
|
|
|
2017-03-03 16:37:15 +00:00
|
|
|
|
cmp #IAC
|
2017-10-05 15:39:17 +00:00
|
|
|
|
beq .4 end of DATA, go wait SE
|
2017-03-03 16:37:15 +00:00
|
|
|
|
|
|
|
|
|
pha
|
2017-10-23 15:39:19 +00:00
|
|
|
|
* jsr PRINTA
|
2017-03-03 16:37:15 +00:00
|
|
|
|
|
2017-10-05 15:39:17 +00:00
|
|
|
|
ldy #IAC.SB.DATA-1
|
2017-03-03 16:37:15 +00:00
|
|
|
|
|
2017-10-05 15:39:17 +00:00
|
|
|
|
.3 iny
|
|
|
|
|
lda (pData),y
|
|
|
|
|
bne .3
|
2017-02-03 16:58:13 +00:00
|
|
|
|
|
2017-10-05 15:39:17 +00:00
|
|
|
|
pla
|
|
|
|
|
sta (pData),y
|
|
|
|
|
iny
|
|
|
|
|
lda #0
|
|
|
|
|
sta (pData),y
|
|
|
|
|
bra .2
|
2017-03-03 16:37:15 +00:00
|
|
|
|
|
2017-10-05 15:39:17 +00:00
|
|
|
|
.4 >SYSCALL Sleep
|
2017-08-31 06:23:29 +00:00
|
|
|
|
>SYSCALL GetChar
|
2017-10-05 15:39:17 +00:00
|
|
|
|
bcs .4
|
2017-03-03 16:37:15 +00:00
|
|
|
|
|
|
|
|
|
cmp #SE
|
2017-10-05 15:39:17 +00:00
|
|
|
|
bne .8
|
2017-03-03 16:37:15 +00:00
|
|
|
|
|
2017-10-05 15:39:17 +00:00
|
|
|
|
>LDA.G IAC.OPT
|
|
|
|
|
cmp #TELOPT.TTYPE
|
|
|
|
|
bne .8
|
2015-06-03 18:30:57 +00:00
|
|
|
|
|
2017-10-05 15:39:17 +00:00
|
|
|
|
>LDA.G IAC.SB
|
|
|
|
|
cmp #SB.IS
|
|
|
|
|
bne .8
|
2015-11-22 22:30:06 +00:00
|
|
|
|
|
2017-10-05 15:39:17 +00:00
|
|
|
|
>PUSHEA.G IAC.SB.DATA
|
|
|
|
|
>PUSHW L.ENV.TERM
|
|
|
|
|
>SYSCALL SetEnv
|
|
|
|
|
|
2017-10-23 15:39:19 +00:00
|
|
|
|
.8
|
|
|
|
|
* lda #':'
|
|
|
|
|
* >SYSCALL PutChar.A
|
2017-10-05 15:39:17 +00:00
|
|
|
|
jmp CS.RUN.LOOP
|
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
|
2017-08-25 06:37:21 +00:00
|
|
|
|
>SYSCALL FreeMem.A
|
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-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
|
|
|
|
|
*--------------------------------------
|
2017-10-05 15:39:17 +00:00
|
|
|
|
PRINTA pha
|
|
|
|
|
>PUSHA
|
|
|
|
|
>LDYA L.HEX
|
|
|
|
|
>SYSCALL PrintF.YA
|
|
|
|
|
pla
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
PRINTA2 pha
|
|
|
|
|
>PUSHA
|
|
|
|
|
>LDYA L.HEX2
|
|
|
|
|
>SYSCALL PrintF.YA
|
|
|
|
|
pla
|
|
|
|
|
rts
|
2015-03-14 21:48:35 +00:00
|
|
|
|
CS.END
|
2017-09-14 15:21:06 +00:00
|
|
|
|
MSG.USAGE >CSTR "Usage : GETTY <DEV> <PROGRAM>\r\n"
|
2017-10-05 15:39:17 +00:00
|
|
|
|
MSG.TELNETOPT .DA #IAC,#WILL,#TELOPT.BINARY
|
|
|
|
|
.DA #IAC,#DO,#TELOPT.LINEMODE
|
|
|
|
|
.DA #IAC,#SB,#TELOPT.LINEMODE,#SB.SEND,#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
|
2017-10-05 15:39:17 +00:00
|
|
|
|
MSG.TELNETOPT.LEN .EQ *-MSG.TELNETOPT
|
|
|
|
|
MSG.GREETINGS >CSTR "\r\nA2osX-GeTTY 0.9.1\r\n"
|
|
|
|
|
ENV.TERM >CSTR "TERM"
|
|
|
|
|
HEX >CSTR "[%h]"
|
|
|
|
|
HEX2 >CSTR "{%h}"
|
2017-02-03 16:58:13 +00:00
|
|
|
|
* \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-10-05 15:39:17 +00:00
|
|
|
|
IAC.SB.DATA .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
|
2017-10-05 15:39:17 +00:00
|
|
|
|
IAC.SB .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
|