git-svn-id: http://svn.code.sf.net/p/netboot65/code@106 93682198-c243-4bdb-bd91-e943c89aac3b

This commit is contained in:
jonnosan 2009-04-15 21:39:33 +00:00
parent ecca9f8b0e
commit bc23bcc3fd
5 changed files with 75 additions and 8 deletions

View File

@ -34,7 +34,7 @@ NB65_UDP_ADD_LISTENER EQU $06 ;inputs: AX points to a UDP listener para
NB65_GET_INPUT_PACKET_INFO EQU $07 ;inputs: AX points to a UDP packet parameter structure, outputs: UDP packet structure filled in NB65_GET_INPUT_PACKET_INFO EQU $07 ;inputs: AX points to a UDP packet parameter structure, outputs: UDP packet structure filled in
NB65_SEND_UDP_PACKET EQU $08 ;inputs: AX points to a UDP packet parameter structure, outputs: none packet is sent NB65_SEND_UDP_PACKET EQU $08 ;inputs: AX points to a UDP packet parameter structure, outputs: none packet is sent
NB65_DEACTIVATE EQU $09 ;inputs: none, outputs: none (removes call to NB65_VBL_VECTOR on IRQ chain) NB65_DEACTIVATE EQU $09 ;inputs: none, outputs: none (removes call to NB65_VBL_VECTOR on IRQ chain)
NB65_TFTP_CALLBACK_DOWNLOAD EQU $0A ;inputs: AX points to a TFTP parameter structure, outputs: none
NB65_PRINT_ASCIIZ EQU $80 ;inputs: AX=pointer to null terminated string to be printed to screen, outputs: none NB65_PRINT_ASCIIZ EQU $80 ;inputs: AX=pointer to null terminated string to be printed to screen, outputs: none
NB65_PRINT_HEX EQU $81 ;inputs: A=byte digit to be displayed on screen as (zero padded) hex digit, outputs: none NB65_PRINT_HEX EQU $81 ;inputs: A=byte digit to be displayed on screen as (zero padded) hex digit, outputs: none
NB65_PRINT_DOTTED_QUAD EQU $82 ;inputs: AX=pointer to 4 bytes that will be displayed as a decimal dotted quad (e.g. 192.168.1.1) NB65_PRINT_DOTTED_QUAD EQU $82 ;inputs: AX=pointer to 4 bytes that will be displayed as a decimal dotted quad (e.g. 192.168.1.1)
@ -56,7 +56,7 @@ NB65_DRIVER_NAME EQU $1A ;2 byte pointer to name of driver
;offsets in TFTP parameter structure (used by NB65_TFTP_DIRECTORY_LISTING & NB65_TFTP_DOWNLOAD) ;offsets in TFTP parameter structure (used by NB65_TFTP_DIRECTORY_LISTING & NB65_TFTP_DOWNLOAD)
NB65_TFTP_IP EQU $00 ;4 byte IP address of TFTP server 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_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 NB65_TFTP_POINTER EQU $06 ;2 byte pointer to memory location data to be stored in OR address of callback function
;offsets in DNS parameter structure (used by NB65_DNS_RESOLVE) ;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) NB65_DNS_HOSTNAME EQU $00 ;2 byte pointer to asciiz hostname to resolve (can also be a dotted quad string)

View File

@ -21,6 +21,7 @@
.import ip65_error .import ip65_error
.import tftp_clear_callbacks .import tftp_clear_callbacks
.import tftp_download .import tftp_download
.import tftp_set_download_callback
.import dns_ip .import dns_ip
.import dns_resolve .import dns_resolve
.import dns_set_hostname .import dns_set_hostname
@ -88,7 +89,6 @@ set_tftp_params:
jsr tftp_clear_callbacks jsr tftp_clear_callbacks
clc
rts rts
nb65_dispatcher: nb65_dispatcher:
@ -151,7 +151,6 @@ irq_handler_installed:
cpy #NB65_TFTP_DOWNLOAD cpy #NB65_TFTP_DOWNLOAD
bne :+ bne :+
jsr set_tftp_params jsr set_tftp_params
bcs @tftp_error
jsr tftp_download jsr tftp_download
jmp @after_tftp_call jmp @after_tftp_call
: :
@ -292,6 +291,19 @@ irq_handler_installed:
rts rts
: :
cpy #NB65_TFTP_CALLBACK_DOWNLOAD
bne :+
jsr set_tftp_params
ldy #NB65_TFTP_POINTER+1
lda (nb65_params),y
tax
dey
lda (nb65_params),y
jsr tftp_set_download_callback
jmp tftp_download
:
cpy #NB65_PRINT_ASCIIZ cpy #NB65_PRINT_ASCIIZ
bne :+ bne :+
jsr print jsr print

View File

@ -56,6 +56,7 @@ utherboot.dsk: utherboot.pg2
c64boot.d64: nb65_c64_ram.prg c64boot.d64: nb65_c64_ram.prg
ripxplore.rb --init CbmDos $@ -a nb65_c64_ram.prg ripxplore.rb --init CbmDos $@ -a nb65_c64_ram.prg
ripxplore.rb $@ -a ..\test\test_cart_api.prg
$(BOOTA2.PG2): bootmenu.o $(IP65LIB) $(APPLE2PROGLIB) $(INCFILES) ../cfg/a2language_card.cfg $(BOOTA2.PG2): bootmenu.o $(IP65LIB) $(APPLE2PROGLIB) $(INCFILES) ../cfg/a2language_card.cfg
$(LD) -m bootmenu.map -C ../cfg/a2language_card.cfg -o $(BOOTA2.PG2) $< $(IP65LIB) $(APPLE2PROGLIB) $(LD) -m bootmenu.map -C ../cfg/a2language_card.cfg -o $(BOOTA2.PG2) $< $(IP65LIB) $(APPLE2PROGLIB)

View File

@ -33,6 +33,7 @@ print_a = $ffd2
.bss .bss
nb65_param_buffer: .res $20 nb65_param_buffer: .res $20
block_number: .res $0
.segment "STARTUP" ;this is what gets put at the start of the file on the C64 .segment "STARTUP" ;this is what gets put at the start of the file on the C64
@ -136,7 +137,24 @@ init:
call #NB65_PRINT_DOTTED_QUAD call #NB65_PRINT_DOTTED_QUAD
print_cr print_cr
;callback test ;tftp callback test
lda #0
sta block_number
lda #$FF
ldx #$03
:
sta nb65_param_buffer,x ;set TFTP server as broadcast address
dex
bpl :-
ldax #test_file
stax nb65_param_buffer+NB65_TFTP_FILENAME
ldax #tftp_callback
stax nb65_param_buffer+NB65_TFTP_POINTER
ldax #nb65_param_buffer
call #NB65_TFTP_CALLBACK_DOWNLOAD
;udp callback test
ldax #64 ;listen on port 64 ldax #64 ;listen on port 64
stax nb65_param_buffer+NB65_UDP_LISTENER_PORT stax nb65_param_buffer+NB65_UDP_LISTENER_PORT
@ -157,6 +175,15 @@ init:
jsr NB65_PERIODIC_PROCESSING_VECTOR jsr NB65_PERIODIC_PROCESSING_VECTOR
jmp @loop_forever jmp @loop_forever
tftp_callback:
inc block_number
print #block_no
lda block_number
jsr print_hex
print_cr
rts
udp_callback: udp_callback:
ldax #nb65_param_buffer ldax #nb65_param_buffer
@ -260,7 +287,28 @@ get_key:
beq get_key beq get_key
rts rts
print_hex:
pha
pha
lsr
lsr
lsr
lsr
tax
lda hexdigits,x
jsr print_a
pla
and #$0F
tax
lda hexdigits,x
jsr print_a
pla
rts
.rodata .rodata
hexdigits:
.byte "0123456789ABCDEF"
test_hostname: test_hostname:
.byte "RETROHACKERS.COM",0 ;this should be an A record .byte "RETROHACKERS.COM",0 ;this should be an A record
@ -287,6 +335,9 @@ length:
data: data:
.byte "DATA: ",0 .byte "DATA: ",0
block_no:
.byte "BLOCK: $",0
error_code: error_code:
.asciiz "ERROR CODE: $" .asciiz "ERROR CODE: $"
press_a_key_to_continue: press_a_key_to_continue:
@ -309,5 +360,8 @@ reply_message:
reply_message_end: reply_message_end:
reply_message_length=reply_message_end-reply_message reply_message_length=reply_message_end-reply_message
test_file:
.byte "BOOTA2.PG2",0
nb65_signature: nb65_signature:
.byte $4E,$42,$36,$35 ; "NB65" - API signature .byte $4E,$42,$36,$35 ; "NB65" - API signature

Binary file not shown.