2015-03-14 21:48:35 +00:00
|
|
|
|
NEW
|
2017-12-22 21:24:30 +00:00
|
|
|
|
PREFIX /A2OSX.BUILD
|
|
|
|
|
AUTO 4,1
|
2015-03-14 21:48:35 +00:00
|
|
|
|
.LIST OFF
|
|
|
|
|
.OP 65C02
|
|
|
|
|
.OR $2000
|
2018-07-23 15:28:42 +00:00
|
|
|
|
.TF SBIN/GETTY
|
2015-03-14 21:48:35 +00:00
|
|
|
|
*--------------------------------------
|
2018-07-23 15:28:42 +00:00
|
|
|
|
.INB INC/MACROS.I
|
|
|
|
|
.INB INC/A2OSX.I
|
|
|
|
|
.INB INC/NET.TELNET.I
|
2015-03-14 21:48:35 +00:00
|
|
|
|
*--------------------------------------
|
2018-09-12 15:27:00 +00:00
|
|
|
|
TIMEOUT.MAX .EQ 100 10 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
|
2018-09-19 15:25:42 +00:00
|
|
|
|
.DA #S.PS.F.EVENT S.PS.F
|
|
|
|
|
.DA #0
|
2017-10-05 15:39:17 +00:00
|
|
|
|
.DA CS.END-CS.START CS
|
|
|
|
|
.DA DS.END-DS.START DS
|
2018-04-26 15:38:02 +00:00
|
|
|
|
.DA #64 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
|
|
|
|
|
L.MSG.GREETINGS .DA MSG.GREETINGS
|
2018-09-12 15:27:00 +00:00
|
|
|
|
L.TELNETOPTS .DA TELNETOPTS
|
2018-09-13 15:29:02 +00:00
|
|
|
|
L.TELNETOPT.TTYPE .DA TELNETOPT.TTYPE
|
2018-09-14 13:08:30 +00:00
|
|
|
|
L.TELNETOPT.LMODE .DA TELNETOPT.LMODE
|
2017-10-05 15:39:17 +00:00
|
|
|
|
L.ENV.TERM .DA ENV.TERM
|
2018-09-12 20:48:12 +00:00
|
|
|
|
L.MSG.DEBUG .DA MSG.DEBUG
|
2015-06-03 18:30:57 +00:00
|
|
|
|
.DA 0 End Of Reloc Table
|
2015-03-14 21:48:35 +00:00
|
|
|
|
*--------------------------------------
|
2018-09-19 15:25:42 +00:00
|
|
|
|
CS.INIT clc
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CS.RUN ldy #S.PS.ARGC
|
2017-09-14 15:21:06 +00:00
|
|
|
|
lda (pPs),y
|
2018-10-18 15:32:57 +00:00
|
|
|
|
cmp #3
|
|
|
|
|
|
2018-09-19 15:25:42 +00:00
|
|
|
|
bcc .90
|
2018-10-18 15:32:57 +00:00
|
|
|
|
|
2018-10-05 14:58:38 +00:00
|
|
|
|
>PUSHWI 0 auxtype
|
|
|
|
|
>PUSHBI 0 type
|
|
|
|
|
>PUSHBI O.RDWR
|
2018-07-17 15:45:59 +00:00
|
|
|
|
lda #1
|
2018-10-16 15:48:03 +00:00
|
|
|
|
>SYSCALL ArgV get /dev/xxx
|
2018-10-05 14:58:38 +00:00
|
|
|
|
>SYSCALL fopen
|
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
|
2018-04-26 15:38:02 +00:00
|
|
|
|
iny #S.PS.hStdOut
|
2015-06-03 18:30:57 +00:00
|
|
|
|
sta (pPs),y
|
2018-04-26 15:38:02 +00:00
|
|
|
|
iny #S.PS.hStdErr
|
2015-06-03 18:30:57 +00:00
|
|
|
|
sta (pPs),y
|
2015-10-19 20:35:00 +00:00
|
|
|
|
|
2018-07-17 15:45:59 +00:00
|
|
|
|
>STA.G hDEV
|
2018-09-19 15:25:42 +00:00
|
|
|
|
bra CS.RUN.LOOP0
|
|
|
|
|
|
2018-04-16 05:53:19 +00:00
|
|
|
|
.90 >LDYA L.MSG.USAGE
|
2018-08-22 15:23:27 +00:00
|
|
|
|
>SYSCALL puts
|
2018-10-18 15:32:57 +00:00
|
|
|
|
lda #K.E.SYN
|
2017-09-14 15:21:06 +00:00
|
|
|
|
sec
|
2017-01-12 17:43:45 +00:00
|
|
|
|
.9 rts
|
2018-09-19 15:25:42 +00:00
|
|
|
|
|
|
|
|
|
CS.RUN.LOOP0 >LDYA L.ENV.TERM
|
2018-09-14 13:08:30 +00:00
|
|
|
|
>SYSCALL UnSetEnv
|
|
|
|
|
|
2018-09-19 15:25:42 +00:00
|
|
|
|
.1 >PUSHWI TELNETOPTS.LEN
|
2018-09-12 15:27:00 +00:00
|
|
|
|
>PUSHW L.TELNETOPTS
|
|
|
|
|
ldy #S.PS.hStdOut
|
|
|
|
|
lda (pPs),y
|
2018-10-05 14:58:38 +00:00
|
|
|
|
>SYSCALL fwrite
|
2018-09-19 15:25:42 +00:00
|
|
|
|
bcc .2 sent!
|
|
|
|
|
|
|
|
|
|
tay
|
|
|
|
|
bne CS.RUN.9 error ?
|
|
|
|
|
|
|
|
|
|
>SLEEP
|
|
|
|
|
|
|
|
|
|
bra .1 no data sent, loop
|
|
|
|
|
|
|
|
|
|
.2 >PUSHWI K.VER
|
2018-09-12 15:27:00 +00:00
|
|
|
|
>PUSHBI 2
|
|
|
|
|
>LDYA L.MSG.GREETINGS
|
|
|
|
|
>SYSCALL printf
|
2017-10-05 15:39:17 +00:00
|
|
|
|
|
2018-09-14 13:08:30 +00:00
|
|
|
|
bcs CS.RUN.9 unable to send greetings...reset..
|
2017-03-03 16:37:15 +00:00
|
|
|
|
|
2018-09-12 15:27:00 +00:00
|
|
|
|
jsr Init.Timeout
|
|
|
|
|
|
2018-09-19 15:25:42 +00:00
|
|
|
|
CS.RUN.LOOP1 >SLEEP
|
2018-09-14 13:08:30 +00:00
|
|
|
|
|
|
|
|
|
>SYSCALL GetChar
|
|
|
|
|
bcs .1
|
2017-03-01 15:22:00 +00:00
|
|
|
|
|
2018-09-12 20:48:12 +00:00
|
|
|
|
cmp #IAC
|
|
|
|
|
beq CS.RUN.IACMODE
|
|
|
|
|
>SYSCALL PutChar
|
2018-09-14 13:08:30 +00:00
|
|
|
|
bcc .2
|
|
|
|
|
|
2018-09-19 15:25:42 +00:00
|
|
|
|
bra CS.RUN.LOOP1
|
2017-03-03 16:37:15 +00:00
|
|
|
|
|
2018-09-14 13:08:30 +00:00
|
|
|
|
.1 jsr Wait.Timeout
|
2018-09-19 15:25:42 +00:00
|
|
|
|
bcc CS.RUN.LOOP1
|
2017-03-03 16:37:15 +00:00
|
|
|
|
|
2018-10-15 06:25:40 +00:00
|
|
|
|
.2 >PUSHBI S.PS.F.DUPENV+S.PS.F.HOLD
|
2018-10-18 15:32:57 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lda #2
|
|
|
|
|
>SYSCALL ArgV
|
|
|
|
|
>SYSCALL puts
|
|
|
|
|
|
2018-10-15 06:25:40 +00:00
|
|
|
|
lda #2
|
2018-10-16 15:48:03 +00:00
|
|
|
|
>SYSCALL ArgV
|
2018-10-15 06:25:40 +00:00
|
|
|
|
>SYSCALL Exec
|
2018-09-19 15:25:42 +00:00
|
|
|
|
bcs CS.RUN.9
|
|
|
|
|
|
|
|
|
|
>SLEEP
|
|
|
|
|
|
|
|
|
|
jmp CS.RUN.LOOP0
|
2017-10-05 15:39:17 +00:00
|
|
|
|
|
2018-09-19 15:25:42 +00:00
|
|
|
|
clc
|
|
|
|
|
CS.RUN.9 rts
|
2017-10-05 15:39:17 +00:00
|
|
|
|
*--------------------------------------
|
2018-09-14 13:08:30 +00:00
|
|
|
|
CS.RUN.IACMODE >SLEEP Wait for IAC CMD (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
|
|
|
|
|
2018-09-13 15:29:02 +00:00
|
|
|
|
>STA.G IAC.CMD
|
2017-03-01 15:22:00 +00:00
|
|
|
|
|
2018-09-14 13:08:30 +00:00
|
|
|
|
.1 >SLEEP Wait for IAC SUBCMD
|
2017-08-31 06:23:29 +00:00
|
|
|
|
>SYSCALL GetChar
|
2017-10-05 15:39:17 +00:00
|
|
|
|
bcs .1
|
2018-09-12 20:48:12 +00:00
|
|
|
|
|
2018-09-13 15:29:02 +00:00
|
|
|
|
>STA.G IAC.SUBCMD
|
|
|
|
|
tax
|
2017-03-03 16:37:15 +00:00
|
|
|
|
|
2018-09-13 15:29:02 +00:00
|
|
|
|
>LDA.G IAC.CMD
|
2017-03-03 16:37:15 +00:00
|
|
|
|
cmp #SB
|
2018-09-14 13:08:30 +00:00
|
|
|
|
beq CS.RUN.IAC.SB
|
2017-10-05 15:39:17 +00:00
|
|
|
|
*--------------------------------------
|
2018-09-14 13:08:30 +00:00
|
|
|
|
CS.RUN.IAC.CMD cmp #WILL
|
2018-09-13 15:29:02 +00:00
|
|
|
|
bne .8
|
|
|
|
|
|
|
|
|
|
cpx #TELOPT.TTYPE
|
|
|
|
|
bne .2
|
|
|
|
|
|
|
|
|
|
>PUSHWI TELNETOPT.TTYPE.LEN
|
|
|
|
|
>PUSHW L.TELNETOPT.TTYPE
|
|
|
|
|
bra .7
|
2018-04-16 15:25:39 +00:00
|
|
|
|
|
2018-09-13 15:29:02 +00:00
|
|
|
|
.2 cpx #TELOPT.LINEMODE
|
|
|
|
|
bne .8
|
|
|
|
|
|
2018-09-14 13:08:30 +00:00
|
|
|
|
>PUSHWI TELNETOPT.LMODE.LEN
|
|
|
|
|
>PUSHW L.TELNETOPT.LMODE
|
2018-09-13 15:29:02 +00:00
|
|
|
|
|
|
|
|
|
.7 ldy #S.PS.hStdOut
|
|
|
|
|
lda (pPs),y
|
2018-10-05 14:58:38 +00:00
|
|
|
|
>SYSCALL fwrite
|
2018-09-13 15:29:02 +00:00
|
|
|
|
|
2018-09-19 15:25:42 +00:00
|
|
|
|
.8 jmp CS.RUN.LOOP1
|
2017-10-05 15:39:17 +00:00
|
|
|
|
*--------------------------------------
|
2018-09-14 13:08:30 +00:00
|
|
|
|
CS.RUN.IAC.SB
|
|
|
|
|
.1 >SLEEP Wait for IAC SB.IS or SEND
|
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
|
|
|
|
|
2018-09-14 13:08:30 +00:00
|
|
|
|
>STA.G IAC.SB.CMD
|
|
|
|
|
|
|
|
|
|
>STZ.G IAC.SB.LEN
|
2017-03-03 16:37:15 +00:00
|
|
|
|
|
2017-11-17 16:16:05 +00:00
|
|
|
|
.2 >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
|
|
|
|
|
|
2018-09-14 13:08:30 +00:00
|
|
|
|
>LDA.G IAC.SB.LEN
|
|
|
|
|
clc
|
|
|
|
|
adc #IAC.SB.DATA
|
|
|
|
|
tay
|
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
|
2018-09-14 13:08:30 +00:00
|
|
|
|
|
|
|
|
|
>INC.G IAC.SB.LEN
|
2017-10-05 15:39:17 +00:00
|
|
|
|
bra .2
|
2017-03-03 16:37:15 +00:00
|
|
|
|
|
2017-11-17 16:16:05 +00:00
|
|
|
|
.4 >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
|
|
|
|
|
2018-09-13 15:29:02 +00:00
|
|
|
|
>LDA.G IAC.SUBCMD
|
2017-10-05 15:39:17 +00:00
|
|
|
|
cmp #TELOPT.TTYPE
|
|
|
|
|
bne .8
|
2015-06-03 18:30:57 +00:00
|
|
|
|
|
2018-09-14 13:08:30 +00:00
|
|
|
|
>LDA.G IAC.SB.CMD
|
2017-10-05 15:39:17 +00:00
|
|
|
|
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
|
2018-09-06 15:36:44 +00:00
|
|
|
|
>LDYA L.ENV.TERM
|
2017-10-05 15:39:17 +00:00
|
|
|
|
>SYSCALL SetEnv
|
|
|
|
|
|
2018-09-19 15:25:42 +00:00
|
|
|
|
.8 jmp CS.RUN.LOOP1
|
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?
|
|
|
|
|
|
2018-09-12 15:27:00 +00:00
|
|
|
|
>LDA.G TimeOut
|
2017-03-03 16:37:15 +00:00
|
|
|
|
beq .9
|
|
|
|
|
|
|
|
|
|
dec
|
|
|
|
|
sta (pData),y
|
|
|
|
|
|
|
|
|
|
.9 sec do not discard TIMER event
|
|
|
|
|
rts
|
2015-03-14 21:48:35 +00:00
|
|
|
|
*--------------------------------------
|
2018-09-07 14:12:42 +00:00
|
|
|
|
CS.QUIT >LDA.G hDEV
|
2018-04-16 15:25:39 +00:00
|
|
|
|
beq .8
|
|
|
|
|
|
2018-10-05 14:58:38 +00:00
|
|
|
|
>SYSCALL fclose
|
2018-04-16 15:25:39 +00:00
|
|
|
|
|
|
|
|
|
.8 clc
|
2015-03-14 21:48:35 +00:00
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2018-09-12 15:27:00 +00:00
|
|
|
|
Init.Timeout lda #TIMEOUT.MAX
|
|
|
|
|
>STA.G TimeOut
|
2017-03-03 16:37:15 +00:00
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
Wait.TimeOut sec
|
2018-09-12 15:27:00 +00:00
|
|
|
|
>LDA.G TimeOut
|
2017-03-03 16:37:15 +00:00
|
|
|
|
beq .9
|
|
|
|
|
clc
|
|
|
|
|
.9 rts
|
|
|
|
|
*--------------------------------------
|
2015-03-14 21:48:35 +00:00
|
|
|
|
CS.END
|
2018-08-22 15:23:27 +00:00
|
|
|
|
MSG.USAGE .AZ "Usage : GETTY <DEV> <PROGRAM>"
|
2018-09-12 15:27:00 +00:00
|
|
|
|
MSG.GREETINGS .AZ "\r\nA2osX-GeTTY %d.%d\r\n"
|
2018-09-12 20:48:12 +00:00
|
|
|
|
MSG.DEBUG .AZ "{%h}"
|
2018-09-12 15:27:00 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
TELNETOPTS .DA #IAC,#WILL,#TELOPT.BINARY
|
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
|
2018-09-12 15:27:00 +00:00
|
|
|
|
.DA #IAC,#DO,#TELOPT.NAWS
|
2017-03-03 16:37:15 +00:00
|
|
|
|
.DA #IAC,#DO,#TELOPT.TTYPE
|
2018-09-13 15:29:02 +00:00
|
|
|
|
.DA #IAC,#DO,#TELOPT.LINEMODE
|
2018-09-12 15:27:00 +00:00
|
|
|
|
TELNETOPTS.LEN .EQ *-TELNETOPTS
|
2018-09-14 13:08:30 +00:00
|
|
|
|
*--------------------------------------
|
2018-09-13 15:29:02 +00:00
|
|
|
|
TELNETOPT.TTYPE .DA #IAC,#SB,#TELOPT.TTYPE,#SB.SEND,#IAC,#SE
|
|
|
|
|
TELNETOPT.TTYPE.LEN .EQ *-TELNETOPT.TTYPE
|
2018-09-14 13:08:30 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
TELNETOPT.LMODE .DA #IAC,#SB,#TELOPT.LINEMODE,#SB.SEND,#0,#IAC,#SE
|
|
|
|
|
TELNETOPT.LMODE.LEN .EQ *-TELNETOPT.LMODE
|
2018-04-11 15:35:51 +00:00
|
|
|
|
ENV.TERM .AZ "TERM"
|
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
|
2018-07-17 15:45:59 +00:00
|
|
|
|
hDEV .BS 1
|
2018-04-16 15:25:39 +00:00
|
|
|
|
TimeOut .BS 1
|
2018-09-14 13:08:30 +00:00
|
|
|
|
IAC.CMD .BS 1
|
|
|
|
|
IAC.SUBCMD .BS 1
|
|
|
|
|
IAC.SB.CMD .BS 1
|
|
|
|
|
IAC.SB.LEN .BS 1
|
|
|
|
|
IAC.SB.DATA .BS 32
|
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
|