2018-02-23 15:36:05 +00:00
|
|
|
.include "../inc/common.inc"
|
2017-11-06 22:36:44 +00:00
|
|
|
|
|
|
|
.export _tcp_listen
|
|
|
|
.export _tcp_connect
|
|
|
|
.export _tcp_close
|
|
|
|
.export _tcp_send
|
|
|
|
.export _tcp_send_keep_alive
|
|
|
|
|
|
|
|
.import tcp_listen
|
|
|
|
.import tcp_connect
|
|
|
|
.import tcp_close
|
|
|
|
.import tcp_inbound_data_ptr
|
|
|
|
.import tcp_inbound_data_length
|
|
|
|
.import tcp_send
|
|
|
|
.import tcp_send_keep_alive
|
|
|
|
|
|
|
|
.import tcp_callback
|
2017-11-08 19:59:06 +00:00
|
|
|
.import tcp_remote_ip
|
2017-11-06 22:36:44 +00:00
|
|
|
.import tcp_connect_ip
|
|
|
|
.import tcp_send_data_len
|
|
|
|
|
2017-11-07 22:05:05 +00:00
|
|
|
.import pushax, popax, popeax
|
2017-11-06 22:36:44 +00:00
|
|
|
.importzp ptr1, sreg
|
|
|
|
|
2017-11-07 22:05:05 +00:00
|
|
|
|
|
|
|
.data
|
|
|
|
|
|
|
|
callback:
|
|
|
|
ldax tcp_inbound_data_ptr
|
|
|
|
jsr pushax
|
|
|
|
ldax tcp_inbound_data_length
|
|
|
|
jmpvector:
|
2017-11-12 14:05:06 +00:00
|
|
|
jmp $ffff
|
2017-11-07 22:05:05 +00:00
|
|
|
|
|
|
|
|
|
|
|
.code
|
|
|
|
|
2017-11-06 22:36:44 +00:00
|
|
|
_tcp_listen:
|
2017-11-07 22:05:05 +00:00
|
|
|
stax jmpvector+1
|
|
|
|
ldax #callback
|
2017-11-06 22:36:44 +00:00
|
|
|
stax tcp_callback
|
|
|
|
jsr popax
|
|
|
|
jsr tcp_listen
|
2017-11-08 19:59:06 +00:00
|
|
|
bcs error
|
|
|
|
ldax tcp_remote_ip+2
|
|
|
|
stax sreg
|
|
|
|
ldax tcp_remote_ip
|
|
|
|
rts
|
|
|
|
|
|
|
|
error:
|
2017-11-06 22:36:44 +00:00
|
|
|
ldx #$00
|
|
|
|
txa
|
2017-11-08 19:59:06 +00:00
|
|
|
stax sreg
|
2017-11-06 22:36:44 +00:00
|
|
|
rts
|
|
|
|
|
|
|
|
_tcp_connect:
|
2017-11-07 22:05:05 +00:00
|
|
|
stax jmpvector+1
|
|
|
|
ldax #callback
|
2017-11-06 22:36:44 +00:00
|
|
|
stax tcp_callback
|
|
|
|
jsr popax
|
|
|
|
stax ptr1
|
|
|
|
jsr popeax
|
|
|
|
stax tcp_connect_ip
|
|
|
|
ldax sreg
|
|
|
|
stax tcp_connect_ip+2
|
|
|
|
ldax ptr1
|
|
|
|
jsr tcp_connect
|
|
|
|
ldx #$00
|
|
|
|
txa
|
|
|
|
rol
|
|
|
|
rts
|
|
|
|
|
|
|
|
_tcp_close:
|
|
|
|
jsr tcp_close
|
|
|
|
ldx #$00
|
|
|
|
txa
|
|
|
|
rol
|
|
|
|
rts
|
|
|
|
|
|
|
|
_tcp_send:
|
|
|
|
stax tcp_send_data_len
|
|
|
|
jsr popax
|
|
|
|
jsr tcp_send
|
|
|
|
ldx #$00
|
|
|
|
txa
|
|
|
|
rol
|
|
|
|
rts
|
|
|
|
|
|
|
|
_tcp_send_keep_alive:
|
|
|
|
jsr tcp_send_keep_alive
|
|
|
|
ldx #$00
|
|
|
|
txa
|
|
|
|
rol
|
|
|
|
rts
|