mirror of
https://github.com/bobbimanners/emailler.git
synced 2024-10-11 17:23:39 +00:00
fixed unreliable detection of remote disconnect plus border colour now indicates connection status properly
git-svn-id: http://svn.code.sf.net/p/netboot65/code@238 93682198-c243-4bdb-bd91-e943c89aac3b
This commit is contained in:
parent
0df937be7c
commit
638c50fe56
@ -13,6 +13,11 @@
|
|||||||
.import telnet_ip
|
.import telnet_ip
|
||||||
.import filter_number
|
.import filter_number
|
||||||
|
|
||||||
|
.export telnet_on_connection
|
||||||
|
|
||||||
|
.bss
|
||||||
|
original_border: .res 1
|
||||||
|
|
||||||
.code
|
.code
|
||||||
telnet_main_entry:
|
telnet_main_entry:
|
||||||
;prompt for a hostname, then resolve to an IP address
|
;prompt for a hostname, then resolve to an IP address
|
||||||
@ -117,8 +122,22 @@ telnet_main_entry:
|
|||||||
jsr print_ascii_as_native
|
jsr print_ascii_as_native
|
||||||
ldax #mode
|
ldax #mode
|
||||||
jsr print_ascii_as_native
|
jsr print_ascii_as_native
|
||||||
jsr telnet_connect
|
|
||||||
|
lda $d020
|
||||||
|
sta original_border
|
||||||
|
|
||||||
|
jsr telnet_connect
|
||||||
|
|
||||||
|
lda original_border
|
||||||
|
sta $d020
|
||||||
|
;reset the background colour
|
||||||
|
|
||||||
jmp telnet_main_entry
|
jmp telnet_main_entry
|
||||||
|
|
||||||
|
telnet_on_connection:
|
||||||
|
;toggle the background colour
|
||||||
|
dec $d020
|
||||||
|
rts
|
||||||
|
|
||||||
;constants
|
;constants
|
||||||
connecting_in: .byte "connecting in ",0
|
connecting_in: .byte "connecting in ",0
|
||||||
|
@ -2,7 +2,9 @@
|
|||||||
;to use:
|
;to use:
|
||||||
;set the following variables - telnet_use_native_charset,telnet_port,telnet_ip
|
;set the following variables - telnet_use_native_charset,telnet_port,telnet_ip
|
||||||
;then call telnet_connect
|
;then call telnet_connect
|
||||||
|
;you must also define (and export) these function
|
||||||
|
; telnet_menu - called whenever the F1 key is pressed.
|
||||||
|
; telnet_on_connection - called after succesful connection
|
||||||
|
|
||||||
.include "../inc/common.i"
|
.include "../inc/common.i"
|
||||||
|
|
||||||
@ -41,6 +43,7 @@
|
|||||||
.export telnet_ip
|
.export telnet_ip
|
||||||
|
|
||||||
.import telnet_menu
|
.import telnet_menu
|
||||||
|
.import telnet_on_connection
|
||||||
|
|
||||||
.segment "IP65ZP" : zeropage
|
.segment "IP65ZP" : zeropage
|
||||||
|
|
||||||
@ -48,6 +51,12 @@
|
|||||||
buffer_ptr: .res 2 ; source pointer
|
buffer_ptr: .res 2 ; source pointer
|
||||||
|
|
||||||
.code
|
.code
|
||||||
|
|
||||||
|
;connect to a remote telnet server
|
||||||
|
;inputs:
|
||||||
|
;telnet_use_native_charset: set to 0 if remote server uses standard ASCII, 1 if remote server uses the 'native' charset (i.e. PETSCII)
|
||||||
|
;telnet_port: port number to connect to
|
||||||
|
;telnet_ip: ip address of remote server
|
||||||
telnet_connect:
|
telnet_connect:
|
||||||
lda telnet_use_native_charset
|
lda telnet_use_native_charset
|
||||||
bne :+
|
bne :+
|
||||||
@ -73,6 +82,9 @@ telnet_connect:
|
|||||||
jsr print_errorcode
|
jsr print_errorcode
|
||||||
rts
|
rts
|
||||||
@connect_ok:
|
@connect_ok:
|
||||||
|
|
||||||
|
jsr telnet_on_connection
|
||||||
|
|
||||||
ldax #ok_msg
|
ldax #ok_msg
|
||||||
jsr print
|
jsr print
|
||||||
jsr print_cr
|
jsr print_cr
|
||||||
@ -82,15 +94,6 @@ telnet_connect:
|
|||||||
|
|
||||||
@main_polling_loop:
|
@main_polling_loop:
|
||||||
|
|
||||||
jsr ip65_process
|
|
||||||
lda connection_closed
|
|
||||||
beq @not_disconnected
|
|
||||||
ldax #disconnected
|
|
||||||
jsr print
|
|
||||||
rts
|
|
||||||
@not_disconnected:
|
|
||||||
|
|
||||||
@inner_loop:
|
|
||||||
jsr timer_read
|
jsr timer_read
|
||||||
txa
|
txa
|
||||||
adc #$20 ;32 x 1/4 = ~ 8seconds
|
adc #$20 ;32 x 1/4 = ~ 8seconds
|
||||||
@ -100,9 +103,15 @@ telnet_connect:
|
|||||||
cpx telnet_timeout
|
cpx telnet_timeout
|
||||||
bne @no_timeout
|
bne @no_timeout
|
||||||
jsr tcp_send_keep_alive
|
jsr tcp_send_keep_alive
|
||||||
jmp @inner_loop
|
jmp @main_polling_loop
|
||||||
@no_timeout:
|
@no_timeout:
|
||||||
jsr ip65_process
|
jsr ip65_process
|
||||||
|
lda connection_closed
|
||||||
|
beq @not_disconnected
|
||||||
|
ldax #disconnected
|
||||||
|
jsr print
|
||||||
|
rts
|
||||||
|
@not_disconnected:
|
||||||
lda iac_response_buffer_length
|
lda iac_response_buffer_length
|
||||||
beq @no_iac_response
|
beq @no_iac_response
|
||||||
ldx #0
|
ldx #0
|
||||||
@ -120,7 +129,7 @@ telnet_connect:
|
|||||||
cmp #KEYCODE_F1
|
cmp #KEYCODE_F1
|
||||||
bne @not_telnet_menu
|
bne @not_telnet_menu
|
||||||
jsr telnet_menu
|
jsr telnet_menu
|
||||||
jmp @inner_loop
|
jmp @main_polling_loop
|
||||||
@not_telnet_menu:
|
@not_telnet_menu:
|
||||||
tax
|
tax
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user