A2osX/BIN/IRC.S.TLS.txt

132 lines
1.8 KiB
Plaintext
Raw Normal View History

2022-04-19 18:24:34 +00:00
NEW
AUTO 3,1
*--------------------------------------
CS.RUN.TLS jsr CS.RUN.TLS.init
>PUSHB hSocket
>PUSHW L.TLS.CHELLO
>PUSHWI TLS.CHELLO.L
>LIBCALL hLIBTCPIP,LIBTCPIP.Write
bcs .9
lda #TIMEOUT.MAX
sta TimeOut
.1 jsr CS.RUN.TLS.Read
bcc .2
ldx TimeOut
bne .1
lda #MLI.E.IO
bra .9
.2
>DEBUG
bra .1
.9 pha
>LDYA L.MSG.TLSKO
>SYSCALL PutS
pla
sec
rts
*--------------------------------------
CS.RUN.TLS.init >LDYA L.MSG.TLS
>SYSCALL PutS
2023-11-12 13:20:15 +00:00
lda A2osX.R16
2022-04-19 18:24:34 +00:00
sta ZPPtr1
2023-11-12 13:20:15 +00:00
lda A2osX.R16+1
2022-04-19 18:24:34 +00:00
and #$7F
sta ZPPtr1+1
>LDYA L.TLS.CHELLO.UT
>STYA ZPPtr2
ldy #31
.10 lda (ZPPtr1),y
sta (ZPPtr2),y
dey
bpl .10
lda #50
sta TimeOut
rts
*--------------------------------------
CS.RUN.TLS.Read >SLEEP
>PUSHB hSocket
>PUSHW ZPBufPtr
>PUSHWI 11
>LIBCALL hLIBTCPIP,LIBTCPIP.Read
bcs .99
cpy #11
bne .9
ldy #TLS.HDR.L-1
.1 lda (ZPBufPtr),y
cmp TLS.HDR,y
bne .9
dey
bpl .1
>PUSHW L.MSG.TLS.HDR
ldy #TLS.LENGTH
lda (ZPBufPtr),y
>PUSHA
iny
lda (ZPBufPtr),y
>PUSHA
ldy #TLS.HS.MT
lda (ZPBufPtr),y
>PUSHA
>PUSHBI 3
>SYSCALL PrintF
>SLEEP
>PUSHB hSocket
>PUSHW ZPBufPtr
ldy #TLS.LENGTH+1
lda (ZPBufPtr),y
sec
sbc #6
tax
dey
lda (ZPBufPtr),y
sbc #0
>PUSHA
txa
>PUSHA
>LIBCALL hLIBTCPIP,LIBTCPIP.Read
bcs .99
>STYA ZPPtr2 RCVD len
.99 rts
.9 lda #MLI.E.IO
sec
rts
*--------------------------------------
MAN
SAVE usr/src/bin/irc.s.tls
LOAD usr/src/bin/irc.s
ASM