2013-12-27 13:57:56 +00:00
|
|
|
.include "../inc/common.i"
|
|
|
|
.include "../inc/commonprint.i"
|
|
|
|
.include "../inc/net.i"
|
2013-12-19 21:04:19 +00:00
|
|
|
|
2015-08-28 13:19:52 +00:00
|
|
|
.export start
|
|
|
|
|
2013-12-27 13:57:56 +00:00
|
|
|
.import exit_to_basic
|
2013-12-19 21:04:19 +00:00
|
|
|
|
2013-12-27 13:57:56 +00:00
|
|
|
.import copymem
|
|
|
|
.importzp copy_src
|
|
|
|
.importzp copy_dest
|
2013-12-19 21:04:19 +00:00
|
|
|
|
2013-12-27 13:57:56 +00:00
|
|
|
.import tftp_upload
|
|
|
|
.import tftp_upload_from_memory
|
|
|
|
.import tftp_set_callback_vector
|
|
|
|
.import tftp_ip
|
|
|
|
.import tftp_filesize
|
2017-05-02 18:36:58 +00:00
|
|
|
.import tftp_filename
|
2013-12-13 21:24:03 +00:00
|
|
|
|
|
|
|
|
2014-04-28 16:41:54 +00:00
|
|
|
; keep LD65 happy
|
2016-03-30 14:06:45 +00:00
|
|
|
.segment "INIT"
|
|
|
|
.segment "ONCE"
|
2014-04-28 16:41:54 +00:00
|
|
|
|
|
|
|
|
2013-12-27 13:57:56 +00:00
|
|
|
.segment "STARTUP"
|
2013-12-13 21:24:03 +00:00
|
|
|
|
2013-12-27 13:57:56 +00:00
|
|
|
; switch to lower case charset
|
2013-12-29 22:39:35 +00:00
|
|
|
lda #14
|
|
|
|
jsr print_a
|
2013-12-15 21:50:01 +00:00
|
|
|
|
2015-08-28 13:19:52 +00:00
|
|
|
start:
|
2013-12-13 21:24:03 +00:00
|
|
|
jsr print_cr
|
2013-12-27 13:57:56 +00:00
|
|
|
init_ip_via_dhcp
|
2013-12-13 21:24:03 +00:00
|
|
|
jsr print_ip_config
|
|
|
|
|
|
|
|
ldax #upload_callback
|
|
|
|
jsr tftp_set_callback_vector
|
|
|
|
lda #0
|
|
|
|
sta block_number
|
|
|
|
ldax #test_file
|
|
|
|
stax tftp_filename
|
|
|
|
lda #$ff
|
|
|
|
ldx #$3
|
2013-12-27 13:57:56 +00:00
|
|
|
: sta tftp_ip,x
|
2013-12-13 21:24:03 +00:00
|
|
|
dex
|
2013-12-19 21:04:19 +00:00
|
|
|
bpl :-
|
|
|
|
|
2013-12-13 21:24:03 +00:00
|
|
|
ldax #sending_via_callback
|
|
|
|
jsr print
|
|
|
|
jsr tftp_upload
|
|
|
|
bcs @error
|
|
|
|
print_ok
|
2013-12-19 21:04:19 +00:00
|
|
|
|
2013-12-13 21:24:03 +00:00
|
|
|
ldax #basic_file
|
|
|
|
stax tftp_filename
|
2013-12-19 21:04:19 +00:00
|
|
|
|
2013-12-13 21:24:03 +00:00
|
|
|
ldax #$2000
|
|
|
|
stax tftp_filesize
|
|
|
|
ldax #sending_ram
|
|
|
|
jsr print
|
|
|
|
jsr tftp_upload_from_memory
|
|
|
|
bcs @error
|
|
|
|
print_ok
|
2015-08-28 13:19:52 +00:00
|
|
|
jmp exit_to_basic
|
2013-12-19 21:04:19 +00:00
|
|
|
|
2013-12-13 21:24:03 +00:00
|
|
|
@error:
|
|
|
|
print_failed
|
|
|
|
rts
|
|
|
|
upload_callback:
|
|
|
|
stax copy_dest
|
|
|
|
ldax #buffer1
|
|
|
|
stax copy_src
|
|
|
|
inc block_number
|
|
|
|
lda block_number
|
|
|
|
ldx #00
|
|
|
|
@next_byte:
|
|
|
|
sta buffer1,x
|
|
|
|
sta buffer2,x
|
|
|
|
inx
|
|
|
|
bne @next_byte
|
|
|
|
cmp #7
|
|
|
|
beq @last_block
|
2013-12-19 21:04:19 +00:00
|
|
|
ldax #512
|
2013-12-13 21:24:03 +00:00
|
|
|
jmp :+
|
|
|
|
@last_block:
|
|
|
|
ldax #129
|
2013-12-27 13:57:56 +00:00
|
|
|
: stax block_length
|
2013-12-13 21:24:03 +00:00
|
|
|
jsr copymem
|
|
|
|
ldax block_length
|
|
|
|
rts
|
2013-12-19 21:04:19 +00:00
|
|
|
|
|
|
|
|
2013-12-27 13:57:56 +00:00
|
|
|
.rodata
|
2013-12-19 21:04:19 +00:00
|
|
|
|
2013-12-27 13:57:56 +00:00
|
|
|
test_file: .byte "TESTFILE.BIN",0
|
|
|
|
basic_file: .byte "CBMBASIC.BIN",0
|
|
|
|
sending_via_callback: .byte "SENDING VIA CALLBACK...",0
|
|
|
|
sending_ram: .byte "SENDING RAM...",0
|
2013-12-19 21:04:19 +00:00
|
|
|
|
|
|
|
|
2013-12-27 13:57:56 +00:00
|
|
|
.bss
|
2013-12-19 21:04:19 +00:00
|
|
|
|
2013-12-27 13:57:56 +00:00
|
|
|
block_number: .res 1
|
|
|
|
block_length: .res 2
|
|
|
|
buffer1: .res 256
|
|
|
|
buffer2: .res 256
|
2013-12-13 21:24:03 +00:00
|
|
|
|
|
|
|
|
2013-12-19 21:04:19 +00:00
|
|
|
|
2014-04-13 16:36:04 +00:00
|
|
|
; -- LICENSE FOR tftp.s --
|
2013-12-13 21:24:03 +00:00
|
|
|
; The contents of this file are subject to the Mozilla Public License
|
|
|
|
; Version 1.1 (the "License"); you may not use this file except in
|
|
|
|
; compliance with the License. You may obtain a copy of the License at
|
|
|
|
; http://www.mozilla.org/MPL/
|
2013-12-27 13:57:56 +00:00
|
|
|
;
|
2013-12-13 21:24:03 +00:00
|
|
|
; Software distributed under the License is distributed on an "AS IS"
|
|
|
|
; basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
|
|
|
|
; License for the specific language governing rights and limitations
|
|
|
|
; under the License.
|
2013-12-27 13:57:56 +00:00
|
|
|
;
|
2013-12-13 21:24:03 +00:00
|
|
|
; The Original Code is ip65.
|
2013-12-27 13:57:56 +00:00
|
|
|
;
|
2013-12-13 21:24:03 +00:00
|
|
|
; The Initial Developer of the Original Code is Jonno Downes,
|
|
|
|
; jonno@jamtronix.com.
|
|
|
|
; Portions created by the Initial Developer are Copyright (C) 2009
|
2013-12-27 13:57:56 +00:00
|
|
|
; Jonno Downes. All Rights Reserved.
|
2013-12-13 21:24:03 +00:00
|
|
|
; -- LICENSE END --
|