mirror of
https://github.com/bobbimanners/emailler.git
synced 2024-08-07 07:29:03 +00:00
added xmodem_iac_escape variable which controls whether $FF is escaped in tcp stream handed to xmodem (i.e. if remote end is a real telnet server, not raw RS232<->TCP stream)
git-svn-id: http://svn.code.sf.net/p/netboot65/code@229 93682198-c243-4bdb-bd91-e943c89aac3b
This commit is contained in:
parent
a16f32597d
commit
406f66d648
@ -15,6 +15,9 @@
|
||||
KEY_BACK_IN_HISTORY=KEYCODE_F3
|
||||
KEY_NEW_SERVER=KEYCODE_F5
|
||||
|
||||
XMODEM_IN_TELNET = 1
|
||||
|
||||
.import xmodem_iac_escape
|
||||
|
||||
.include "../inc/telnet.i"
|
||||
|
||||
@ -285,7 +288,6 @@ telnet_menu:
|
||||
jsr setup_screen
|
||||
jsr cls
|
||||
|
||||
|
||||
ldax #menu_header_msg
|
||||
jsr print_ascii_as_native
|
||||
ldax #telnet_menu_msg
|
||||
|
@ -95,6 +95,9 @@ telnet_main_entry:
|
||||
sta telnet_line_mode
|
||||
lda #1
|
||||
sta telnet_local_echo
|
||||
.ifdef XMODEM_IN_TELNET
|
||||
sta xmodem_iac_escape
|
||||
.endif
|
||||
jmp @after_mode_set
|
||||
@petscii_mode:
|
||||
lda #1
|
||||
@ -102,10 +105,16 @@ telnet_main_entry:
|
||||
lda #0
|
||||
sta telnet_local_echo
|
||||
sta telnet_line_mode
|
||||
.ifdef XMODEM_IN_TELNET
|
||||
sta xmodem_iac_escape
|
||||
.endif
|
||||
jmp @after_mode_set
|
||||
@line_mode:
|
||||
lda #0
|
||||
sta telnet_use_native_charset
|
||||
.ifdef XMODEM_IN_TELNET
|
||||
sta xmodem_iac_escape
|
||||
.endif
|
||||
lda #1
|
||||
sta telnet_local_echo
|
||||
sta telnet_line_mode
|
||||
|
@ -18,6 +18,8 @@ CAN = $18
|
||||
|
||||
.export xmodem_receive
|
||||
|
||||
.export xmodem_iac_escape ;are IAC bytes ($FF) escaped?
|
||||
|
||||
.import ip65_process
|
||||
.import ip65_error
|
||||
.import tcp_callback
|
||||
@ -77,6 +79,7 @@ xmodem_receive:
|
||||
;recieve a file via XMODEM (checksum mode only, not CRC)
|
||||
;assumes that a tcp connection has already been set up, and that the other end is waiting to start sending
|
||||
;inputs: AX points to routine to call once for each byte in downloaded file (e.g. save to disk, print to screen, whatever) - byte will be in A
|
||||
; xmodem_iac_escape should be set to non-zero if the remote end escapes $FF bytes (i.e. if it is a real telnet server)
|
||||
;outputs: none
|
||||
|
||||
|
||||
@ -172,7 +175,9 @@ xmodem_receive:
|
||||
@next_byte:
|
||||
lda #XMODEM_TIMEOUT_SECONDS
|
||||
jsr getc
|
||||
bcs @exit
|
||||
bcc :+
|
||||
jmp @exit
|
||||
:
|
||||
ldx block_ptr
|
||||
sta xmodem_block_buffer,x
|
||||
adc checksum
|
||||
@ -200,6 +205,22 @@ xmodem_receive:
|
||||
lda received_checksum
|
||||
cmp checksum
|
||||
beq @checksum_ok
|
||||
;checksum error :-(
|
||||
inc error_number
|
||||
ldax #checksum_error_msg
|
||||
jsr print_ascii_as_native
|
||||
lda error_number
|
||||
jsr print_hex
|
||||
jsr print_cr
|
||||
lda error_number
|
||||
cmp #XMODEM_MAX_ERRORS
|
||||
bcs :+
|
||||
jmp @wait_for_block_start
|
||||
:
|
||||
lda #KPR_ERROR_TOO_MANY_ERRORS
|
||||
sta ip65_error
|
||||
jmp @exit
|
||||
|
||||
jsr send_nak
|
||||
jmp @next_block
|
||||
|
||||
@ -264,6 +285,22 @@ send_ack:
|
||||
|
||||
|
||||
getc:
|
||||
jsr @real_getc
|
||||
bcc :+ ;of we got an error, then bail
|
||||
rts
|
||||
:
|
||||
cmp #$ff
|
||||
beq @got_ff
|
||||
clc
|
||||
rts
|
||||
@got_ff:
|
||||
lda xmodem_iac_escape
|
||||
bne @real_getc ;need to skip over the $FF and go read another byte
|
||||
lda #$ff
|
||||
clc
|
||||
rts
|
||||
|
||||
@real_getc:
|
||||
sta getc_timeout_seconds
|
||||
|
||||
clc
|
||||
@ -279,7 +316,6 @@ getc:
|
||||
sta getc_timeout_end
|
||||
|
||||
@poll_loop:
|
||||
; inc $d021
|
||||
jsr next_char
|
||||
bcs @no_char
|
||||
rts ;done!
|
||||
@ -309,7 +345,8 @@ expecting: .byte "expecting",0
|
||||
receiving: .byte "receiving",0
|
||||
bad_block_number: .byte "bad block number",0
|
||||
checksum_msg: .byte "checksum $",0
|
||||
timeout_msg: .byte "timeout $",0
|
||||
checksum_error_msg : .byte "checksum error - error count $",0
|
||||
timeout_msg: .byte "timeout error - error count $",0
|
||||
|
||||
.segment "APP_SCRATCH"
|
||||
xmodem_stream_buffer: .res 1600
|
||||
@ -321,6 +358,7 @@ received_checksum: .res 1
|
||||
block_ptr: .res 1
|
||||
error_number: .res 1
|
||||
user_abort: .res 1
|
||||
xmodem_iac_escape: .res 1
|
||||
|
||||
;-- LICENSE FOR xmodem.s --
|
||||
; The contents of this file are subject to the Mozilla Public License
|
||||
|
@ -2,8 +2,6 @@
|
||||
.include "../inc/commonprint.i"
|
||||
.include "../inc/net.i"
|
||||
|
||||
; .include "../ip65/xmodem.s"
|
||||
|
||||
.import parse_dotted_quad
|
||||
.import dotted_quad_value
|
||||
|
||||
@ -18,7 +16,8 @@
|
||||
.import tcp_inbound_data_ptr
|
||||
.import tcp_inbound_data_length
|
||||
|
||||
.import xmodem_receive
|
||||
.import xmodem_receive
|
||||
.import xmodem_iac_escape
|
||||
|
||||
.import tcp_send
|
||||
.import tcp_send_data_len
|
||||
@ -61,12 +60,18 @@ init:
|
||||
lda #14
|
||||
jsr print_a ;switch to lower case
|
||||
|
||||
|
||||
lda #1
|
||||
; lda #0
|
||||
sta xmodem_iac_escape
|
||||
lda #0
|
||||
sta $dc08 ;set deciseconds - starts TOD going
|
||||
jsr print_cr
|
||||
init_ip_via_dhcp
|
||||
jsr print_ip_config
|
||||
|
||||
ldax #starting
|
||||
jsr print_ascii_as_native
|
||||
jsr print_cr
|
||||
|
||||
lda #'1'
|
||||
@ -175,8 +180,6 @@ open_file:
|
||||
jsr $FFC0 ; call OPEN
|
||||
bcs @error ; if carry set, the file could not be opened
|
||||
|
||||
ldx #$02 ; filenumber 2
|
||||
jsr $FFC9 ; call CHKOUT (file 2 now used as output)
|
||||
rts
|
||||
@error:
|
||||
sta ip65_error
|
||||
@ -215,6 +218,8 @@ close_file:
|
||||
|
||||
.rodata
|
||||
|
||||
starting:
|
||||
.byte "saving to "
|
||||
fname: .byte "@0:XMODEM.TMP,P,W" ; @0: means 'overwrite if existing', ',P,W' is required to make this an output file
|
||||
fname_end:
|
||||
.byte 0
|
||||
@ -222,7 +227,7 @@ first_message:
|
||||
.byte "yo!",0
|
||||
|
||||
start_download:
|
||||
.byte "R",0
|
||||
.byte "B",0 ;b=Binary, i.e. trigger IAC escape, R=receive text, i.e. no IAC escape
|
||||
.data
|
||||
|
||||
tcp_dest_ip:
|
||||
|
Loading…
Reference in New Issue
Block a user