mirror of
https://github.com/bobbimanners/emailler.git
synced 2024-11-15 17:09:16 +00:00
Avoid trash of zero page variable.
It's not save to presume any zero page variable to stay intact after using the Ethernet drivers to perform actual network I/O. In example a necessary ARP lookup may require network I/O in not anticipated scenarios. Therefore the tftp_filename is rather to be placed in a normal variable and copied to a zero page variable just-in-time.
This commit is contained in:
parent
39975cab33
commit
8745021d7d
@ -20,6 +20,7 @@ TFTP_TIMER_MASK = $F8 ; mask lower two bits, means we wait for 8 x1/4
|
|||||||
.export tftp_set_callback_vector
|
.export tftp_set_callback_vector
|
||||||
.export tftp_callback_vector
|
.export tftp_callback_vector
|
||||||
.export tftp_clear_callbacks
|
.export tftp_clear_callbacks
|
||||||
|
.export tftp_filename
|
||||||
.export tftp_filesize
|
.export tftp_filesize
|
||||||
.export tftp_upload_from_memory
|
.export tftp_upload_from_memory
|
||||||
.import ip65_process
|
.import ip65_process
|
||||||
@ -49,8 +50,6 @@ TFTP_TIMER_MASK = $F8 ; mask lower two bits, means we wait for 8 x1/4
|
|||||||
|
|
||||||
.import timer_read
|
.import timer_read
|
||||||
|
|
||||||
.exportzp tftp_filename = ptr3
|
|
||||||
|
|
||||||
|
|
||||||
.bss
|
.bss
|
||||||
|
|
||||||
@ -88,6 +87,7 @@ tftp_actual_server_ip: .res 4 ; this is read from the reply - it may n
|
|||||||
tftp_just_set_new_load_address: .res 1
|
tftp_just_set_new_load_address: .res 1
|
||||||
|
|
||||||
tftp_opcode: .res 2 ; will be set to 4 if we are doing a RRQ, or 7 if we are doing a DIR
|
tftp_opcode: .res 2 ; will be set to 4 if we are doing a RRQ, or 7 if we are doing a DIR
|
||||||
|
tftp_filename: .res 2 ; pointer to null terminated name of file to upload/download
|
||||||
tftp_filesize: .res 2 ; will be set by tftp_download, needs to be set before calling tftp_upload_from_memory
|
tftp_filesize: .res 2 ; will be set by tftp_download, needs to be set before calling tftp_upload_from_memory
|
||||||
tftp_bytes_remaining: .res 2
|
tftp_bytes_remaining: .res 2
|
||||||
|
|
||||||
@ -238,6 +238,8 @@ send_request_packet:
|
|||||||
sta tftp_state
|
sta tftp_state
|
||||||
ldax tftp_opcode
|
ldax tftp_opcode
|
||||||
stax tftp_outp
|
stax tftp_outp
|
||||||
|
ldax tftp_filename
|
||||||
|
stax ptr1
|
||||||
|
|
||||||
ldx #$01 ; we inc x/y at start of loop, so
|
ldx #$01 ; we inc x/y at start of loop, so
|
||||||
ldy #$ff ; set them to be 1 below where we want the copy to begin
|
ldy #$ff ; set them to be 1 below where we want the copy to begin
|
||||||
@ -245,7 +247,7 @@ send_request_packet:
|
|||||||
inx
|
inx
|
||||||
iny
|
iny
|
||||||
bmi @error_in_send ; if we get to 0x80 bytes, we've gone too far
|
bmi @error_in_send ; if we get to 0x80 bytes, we've gone too far
|
||||||
lda (tftp_filename),y
|
lda (ptr1),y
|
||||||
sta tftp_outp,x
|
sta tftp_outp,x
|
||||||
bne @copy_filename_loop
|
bne @copy_filename_loop
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user