mirror of
https://github.com/bobbimanners/emailler.git
synced 2024-08-20 17:29:45 +00:00
git-svn-id: http://svn.code.sf.net/p/netboot65/code@116 93682198-c243-4bdb-bd91-e943c89aac3b
This commit is contained in:
parent
c9b386c8de
commit
945ace04a4
@ -15,3 +15,15 @@
|
||||
stx 1+(arg)
|
||||
.endmacro
|
||||
|
||||
|
||||
.macro phax
|
||||
pha
|
||||
txa
|
||||
pha
|
||||
.endmacro
|
||||
|
||||
.macro plax
|
||||
pla
|
||||
tax
|
||||
pla
|
||||
.endmacro
|
@ -35,7 +35,8 @@ NB65_TFTP_DIRECTORY_LISTING EQU $20 ;inputs: AX points to a TFTP parameter st
|
||||
NB65_TFTP_DOWNLOAD EQU $21 ;inputs: AX points to a TFTP parameter structure, outputs: TFTP param structure updated with
|
||||
;NB65_TFTP_POINTER updated to reflect actual load address (if load address $0000 originally passed in)
|
||||
NB65_TFTP_CALLBACK_DOWNLOAD EQU $22 ;inputs: AX points to a TFTP parameter structure, outputs: none
|
||||
NB65_TFTP_CALLBACK_UPLOAD EQU $23 ;upload: AX points to a TFTP parameter structure, outputs: none
|
||||
NB65_TFTP_UPLOAD EQU $23 ;upload: AX points to a TFTP parameter structure, outputs: none
|
||||
NB65_TFTP_CALLBACK_UPLOAD EQU $24 ;upload: AX points to a TFTP parameter structure, outputs: none
|
||||
|
||||
NB65_DNS_RESOLVE EQU $30 ;inputs: AX points to a DNS parameter structure, outputs: DNS param structure updated with
|
||||
;NB65_DNS_HOSTNAME_IP updated with IP address corresponding to hostname.
|
||||
@ -63,6 +64,7 @@ NB65_DRIVER_NAME EQU $1A ;2 byte pointer to name of driver
|
||||
NB65_TFTP_IP EQU $00 ;4 byte IP address of TFTP server
|
||||
NB65_TFTP_FILENAME EQU $04 ;2 byte pointer to asciiz filename (or filemask in case of NB65_TFTP_DIRECTORY_LISTING)
|
||||
NB65_TFTP_POINTER EQU $06 ;2 byte pointer to memory location data to be stored in OR address of callback function
|
||||
NB65_TFTP_FILESIZE EQU $08 ;2 byte file length (filled in by NB65_TFTP_DOWNLOAD, must be passed in to NB65_TFTP_UPLOAD)
|
||||
|
||||
;offsets in DNS parameter structure (used by NB65_DNS_RESOLVE)
|
||||
NB65_DNS_HOSTNAME EQU $00 ;2 byte pointer to asciiz hostname to resolve (can also be a dotted quad string)
|
||||
|
@ -23,6 +23,7 @@
|
||||
.import tftp_download
|
||||
.import tftp_upload
|
||||
.import tftp_set_callback_vector
|
||||
.import tftp_filesize
|
||||
.import dns_ip
|
||||
.import dns_resolve
|
||||
.import dns_set_hostname
|
||||
@ -46,7 +47,7 @@ nb65_params = copy_src
|
||||
|
||||
.data
|
||||
|
||||
old_ax: .res 2
|
||||
|
||||
jmp_old_irq:
|
||||
jmp $0000
|
||||
|
||||
@ -102,7 +103,6 @@ set_tftp_callback_vector:
|
||||
|
||||
nb65_dispatcher:
|
||||
stax nb65_params
|
||||
stax old_ax
|
||||
|
||||
|
||||
cpy #NB65_INITIALIZE
|
||||
@ -132,37 +132,6 @@ irq_handler_installed:
|
||||
:
|
||||
|
||||
|
||||
|
||||
cpy #NB65_TFTP_DIRECTORY_LISTING
|
||||
bne :+
|
||||
jsr set_tftp_params
|
||||
jsr tftp_directory_listing
|
||||
|
||||
@after_tftp_call: ;write the current load address back to the param buffer (so if $0000 was passed in, the caller can find out the actual value used)
|
||||
bcs @tftp_error
|
||||
ldax old_ax
|
||||
stax nb65_params
|
||||
|
||||
ldy #NB65_TFTP_POINTER
|
||||
lda tftp_load_address
|
||||
sta (nb65_params),y
|
||||
iny
|
||||
lda tftp_load_address+1
|
||||
sta (nb65_params),y
|
||||
|
||||
clc
|
||||
@tftp_error:
|
||||
@dns_error:
|
||||
rts
|
||||
:
|
||||
|
||||
cpy #NB65_TFTP_DOWNLOAD
|
||||
bne :+
|
||||
jsr set_tftp_params
|
||||
jsr tftp_download
|
||||
jmp @after_tftp_call
|
||||
:
|
||||
|
||||
cpy #NB65_DNS_RESOLVE
|
||||
bne :+
|
||||
ldy #NB65_DNS_HOSTNAME+1
|
||||
@ -171,7 +140,7 @@ irq_handler_installed:
|
||||
dey
|
||||
lda (nb65_params),y
|
||||
jsr dns_set_hostname
|
||||
bcs @dns_error
|
||||
bcc @dns_error
|
||||
jsr dns_resolve
|
||||
bcs @dns_error
|
||||
ldy #NB65_DNS_HOSTNAME_IP
|
||||
@ -182,7 +151,9 @@ irq_handler_installed:
|
||||
iny
|
||||
dex
|
||||
bne @copy_dns_ip
|
||||
@dns_error:
|
||||
rts
|
||||
|
||||
:
|
||||
|
||||
cpy #NB65_UDP_ADD_LISTENER
|
||||
@ -299,11 +270,52 @@ irq_handler_installed:
|
||||
rts
|
||||
:
|
||||
|
||||
|
||||
cpy #NB65_TFTP_DIRECTORY_LISTING
|
||||
bne :+
|
||||
phax
|
||||
jsr set_tftp_params
|
||||
jsr tftp_directory_listing
|
||||
|
||||
@after_tftp_call: ;write the current load address back to the param buffer (so if $0000 was passed in, the caller can find out the actual value used)
|
||||
plax
|
||||
bcs @tftp_error
|
||||
stax nb65_params
|
||||
|
||||
ldy #NB65_TFTP_POINTER
|
||||
lda tftp_load_address
|
||||
sta (nb65_params),y
|
||||
iny
|
||||
lda tftp_load_address+1
|
||||
sta (nb65_params),y
|
||||
|
||||
ldy #NB65_TFTP_FILESIZE
|
||||
lda tftp_filesize
|
||||
sta (nb65_params),y
|
||||
iny
|
||||
lda tftp_filesize+1
|
||||
sta (nb65_params),y
|
||||
clc
|
||||
@tftp_error:
|
||||
rts
|
||||
:
|
||||
|
||||
cpy #NB65_TFTP_DOWNLOAD
|
||||
bne :+
|
||||
phax
|
||||
jsr set_tftp_params
|
||||
jsr tftp_download
|
||||
jmp @after_tftp_call
|
||||
:
|
||||
|
||||
|
||||
cpy #NB65_TFTP_CALLBACK_DOWNLOAD
|
||||
bne :+
|
||||
phax
|
||||
jsr set_tftp_params
|
||||
jsr set_tftp_callback_vector
|
||||
jmp tftp_download
|
||||
jsr tftp_download
|
||||
jmp @after_tftp_call
|
||||
:
|
||||
|
||||
cpy #NB65_TFTP_CALLBACK_UPLOAD
|
||||
|
@ -21,6 +21,7 @@
|
||||
.export tftp_set_callback_vector
|
||||
.export tftp_data_block_length
|
||||
.export tftp_clear_callbacks
|
||||
.export tftp_filesize
|
||||
|
||||
.import ip65_process
|
||||
.import ip65_error
|
||||
@ -91,15 +92,16 @@ tftp_actual_server_ip: .res 4 ;this is read from the reply - it may not be t
|
||||
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_filesize: .res 2 ;will be set by tftp_download, needs to be set before calling tftp_upload_from_memory
|
||||
|
||||
.code
|
||||
|
||||
;uploads a file to a tftp server
|
||||
;uploads a file to a tftp server with data retrieved from specified memory location
|
||||
; inputs:
|
||||
; tftp_ip: ip address of host to download from (set to 255.255.255.255 for broadcast)
|
||||
; tftp_filename: pointer to null terminated name of file to download
|
||||
; of file should be loaded into (e.g. if downloading a C64 'prg' file)
|
||||
; a callback vector should have been set with tftp_set_callback_vector
|
||||
; tftp_ip: ip address of host to send file to (set to 255.255.255.255 for broadcast)
|
||||
; tftp_filename: pointer to null terminated name of file to upload
|
||||
; tftp_load_address: starting address of data to be sent
|
||||
; tftp_filesize: length of data to send
|
||||
; outputs: carry flag is set if there was an error
|
||||
; if a callback vector has been set with tftp_set_callback_vector
|
||||
; then the specified routine will be called once for each 512 byte packet
|
||||
@ -109,6 +111,18 @@ tftp_opcode: .res 2 ; will be set to 4 if we are doing a RRQ, or 7 if we are doi
|
||||
; with file downloaded.
|
||||
; tftp_load_address: will be set to the actual address loaded into (NB - this field is
|
||||
; ignored if a callback vector has been set with tftp_set_callback_vector)
|
||||
tftp_upload_from_memory:
|
||||
ldax #copy_ram_to_tftp_block
|
||||
jsr tftp_set_callback_vector
|
||||
|
||||
;uploads a file to a tftp server with data retrieved from user supplied routine
|
||||
; inputs:
|
||||
; tftp_ip: ip address of host to send file to (set to 255.255.255.255 for broadcast)
|
||||
; tftp_filename: pointer to null terminated name of file to upload
|
||||
; a callback vector should have been set with tftp_set_callback_vector
|
||||
; outputs: carry flag is set if there was an error
|
||||
; the specified routine will be called once for each 512 byte packet
|
||||
; to be sent from the tftp server.
|
||||
tftp_upload:
|
||||
ldax #$0200 ;opcode 02 = WRQ
|
||||
jmp set_tftp_opcode
|
||||
@ -153,7 +167,10 @@ tftp_directory_listing:
|
||||
; tftp_load_address: will be set to the actual address loaded into (NB - this field is
|
||||
; ignored if a callback vector has been set with tftp_set_callback_vector)
|
||||
tftp_download:
|
||||
ldax #$0100 ;opcode 01 = RRQ
|
||||
lda #00
|
||||
sta tftp_filesize
|
||||
sta tftp_filesize+1
|
||||
ldx #$01 ;opcode 01 = RRQ (A should already be zero from having just reset file length)
|
||||
set_tftp_opcode:
|
||||
stax tftp_opcode
|
||||
lda #tftp_initializing
|
||||
@ -503,6 +520,10 @@ copy_tftp_block_to_ram:
|
||||
sta tftp_current_memloc+1
|
||||
rts
|
||||
|
||||
;default handler for uploading a file
|
||||
copy_ram_to_tftp_block:
|
||||
rts
|
||||
|
||||
;set up vector of routine to be called when each 512 packet arrives from tftp server
|
||||
;when downloading OR for routine to be called when ready to send new block
|
||||
;when uploading.
|
||||
|
@ -174,8 +174,15 @@ init:
|
||||
stax nb65_param_buffer+NB65_TFTP_POINTER
|
||||
ldax #nb65_param_buffer
|
||||
call #NB65_TFTP_CALLBACK_DOWNLOAD
|
||||
|
||||
|
||||
lda #'$'
|
||||
jsr print_a
|
||||
lda nb65_param_buffer+NB65_TFTP_FILESIZE+1
|
||||
jsr print_hex
|
||||
lda nb65_param_buffer+NB65_TFTP_FILESIZE
|
||||
jsr print_hex
|
||||
print #bytes_download
|
||||
print_cr
|
||||
|
||||
;udp callback test
|
||||
|
||||
ldax #64 ;listen on port 64
|
||||
@ -409,6 +416,8 @@ ok:
|
||||
dns_lookup_failed_msg:
|
||||
.byte "DNS LOOKUP FAILED", 0
|
||||
|
||||
bytes_download: .byte "BYTES DOWNLOADED",13,0
|
||||
|
||||
reply_message:
|
||||
.byte "PONG!"
|
||||
reply_message_end:
|
||||
|
Binary file not shown.
Loading…
Reference in New Issue
Block a user