A2osX/BIN/IRC.S.TLS.txt
2022-04-19 20:24:34 +02:00

132 lines
1.8 KiB
Plaintext
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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
lda A2osX.RANDOM16
sta ZPPtr1
lda A2osX.RANDOM16+1
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