mirror of
https://github.com/bobbimanners/emailler.git
synced 2024-11-13 20:04:37 +00:00
git-svn-id: http://svn.code.sf.net/p/netboot65/code@77 93682198-c243-4bdb-bd91-e943c89aac3b
This commit is contained in:
parent
823385fc7e
commit
71f9fe4ec7
@ -9,15 +9,11 @@
|
||||
; jonno@jamtronix.com - January 2009
|
||||
;
|
||||
|
||||
NB65_DISPATCH_VECTOR = $800d
|
||||
NB65_PERIODIC_PROCESSING_VECTOR =$8010
|
||||
NB65_VBL_VECTOR =$8013
|
||||
|
||||
.include "../inc/nb65_constants.i"
|
||||
.include "../inc/common.i"
|
||||
.include "../inc/commonprint.i"
|
||||
.include "../inc/menu.i"
|
||||
; .include "../inc/net.i"
|
||||
.include "../inc/c64keycodes.i"
|
||||
|
||||
.import cls
|
||||
@ -27,13 +23,6 @@ NB65_VBL_VECTOR =$8013
|
||||
.import timer_vbl_handler
|
||||
.import nb65_dispatcher
|
||||
.import ip65_process
|
||||
|
||||
; .importzp tftp_filename
|
||||
; .import tftp_load_address
|
||||
; .import tftp_ip
|
||||
; .import tftp_download
|
||||
; .import tftp_directory_listing
|
||||
; .import tftp_set_download_callback
|
||||
|
||||
.import copymem
|
||||
.importzp copy_src
|
||||
@ -54,31 +43,17 @@ tftp_dir_buffer: .res 2000
|
||||
|
||||
.segment "CARTRIDGE_HEADER"
|
||||
.word init ;cold start vector
|
||||
.word init ;warm start vector
|
||||
.word $FE47 ;warm start vector
|
||||
.byte $C3,$C2,$CD,$38,$30 ; "CBM80"
|
||||
.byte "NB65" ;netboot 65 signature
|
||||
jmp nb65_dispatcher ; NB65_DISPATCH_VECTOR : entry point for NB65 functions
|
||||
jmp ip65_process ;NB65_PERIODIC_PROCESSING_VECTOR : routine to be periodically called to check for arrival of ethernet packects
|
||||
jmp timer_vbl_handler ;NB65_VBL_VECTOR : routine to be called during each vertical blank interrupt
|
||||
|
||||
.data
|
||||
jmp_old_irq:
|
||||
jmp $0000
|
||||
|
||||
.code
|
||||
|
||||
|
||||
|
||||
irq_handler:
|
||||
jsr NB65_VBL_VECTOR
|
||||
jmp jmp_old_irq
|
||||
|
||||
remove_irq_handler:
|
||||
ldax jmp_old_irq+1 ;previous IRQ handler
|
||||
sei ;don't want any interrupts while we fiddle with the vector
|
||||
stax $314
|
||||
cli
|
||||
rts
|
||||
|
||||
init:
|
||||
|
||||
@ -103,13 +78,6 @@ init:
|
||||
ldax #__DATA_SIZE__
|
||||
jsr copymem
|
||||
|
||||
;install our IRQ handler
|
||||
ldax $314 ;previous IRQ handler
|
||||
stax jmp_old_irq+1
|
||||
sei ;don't want any interrupts while we fiddle with the vector
|
||||
ldax #irq_handler
|
||||
stax $314 ;previous IRQ handler
|
||||
cli
|
||||
|
||||
ldax #startup_msg
|
||||
jsr print
|
||||
@ -125,7 +93,6 @@ init:
|
||||
jmp @get_key
|
||||
|
||||
@exit_to_basic:
|
||||
jsr remove_irq_handler
|
||||
jmp $fe66 ;do a wam start
|
||||
|
||||
@tftp_boot:
|
||||
@ -220,7 +187,6 @@ init:
|
||||
|
||||
@file_downloaded_ok:
|
||||
|
||||
jsr remove_irq_handler
|
||||
;check whether the file we just downloaded was a BASIC prg
|
||||
lda nb65_param_buffer+NB65_TFTP_POINTER
|
||||
cmp #01
|
||||
@ -257,8 +223,6 @@ print_errorcode:
|
||||
|
||||
|
||||
setup_param_buffer_for_tftp_call:
|
||||
lda #$00 ;'normal' tftp call mode, i.e. TFTP_POINTER is where data should be written to
|
||||
sta nb65_param_buffer+NB65_TFTP_CALL_MODE
|
||||
|
||||
ldx #3
|
||||
lda #$ff ;255.255.255.255 = broadcast address
|
||||
@ -272,7 +236,6 @@ bad_boot:
|
||||
ldax #press_a_key_to_continue
|
||||
jsr print
|
||||
jsr get_key
|
||||
jsr remove_irq_handler
|
||||
jmp $fe66 ;do a wam start
|
||||
|
||||
download: ;AX should point at filename to download
|
||||
@ -303,11 +266,15 @@ download: ;AX should point at filename to download
|
||||
jsr print
|
||||
clc
|
||||
rts
|
||||
|
||||
|
||||
cfg_get_configuration_ptr:
|
||||
ldy #NB65_GET_IP_CONFIG_PTR
|
||||
jmp NB65_DISPATCH_VECTOR
|
||||
|
||||
.rodata
|
||||
|
||||
startup_msg:
|
||||
.byte "NETBOOT65 - C64 NETWORK BOOT CLIENT V0.2",13
|
||||
.byte "NETBOOT65 - C64 NETWORK BOOT CLIENT V0.3",13
|
||||
.byte "F1=TFTP BOOT, F3=BASIC",13
|
||||
.byte 0
|
||||
|
||||
|
@ -40,7 +40,6 @@ temp_bcd: .res 2
|
||||
.import print_a
|
||||
.import print_cr
|
||||
.import cs_driver_name
|
||||
.import cfg_get_configuration_ptr
|
||||
print_ip_config:
|
||||
|
||||
|
||||
|
@ -2,6 +2,10 @@
|
||||
|
||||
NB65_API_VERSION=$0001
|
||||
|
||||
NB65_DISPATCH_VECTOR = $800d
|
||||
NB65_PERIODIC_PROCESSING_VECTOR =$8010
|
||||
NB65_VBL_VECTOR =$8013
|
||||
|
||||
;offsets in NB65 configuration structure
|
||||
NB65_CFG_MAC = $00 ;6 byte MAC address
|
||||
NB65_CFG_IP = $06 ;4 byte local IP address (will be overwritten by DHCP)
|
||||
@ -10,30 +14,38 @@ NB65_CFG_GATEWAY = $0D ;4 byte local gateway (will be overwritten by DHCP
|
||||
NB65_CFG_DNS_SERVER = $12 ;4 byte IP address of DNS server (will be overwritten by DHCP)
|
||||
NB65_CFG_DHCP_SERVER = $16 ;4 byte IP address of DHCP server (will only be set by DHCP initialisation)
|
||||
|
||||
;offsets in TFTP paramater structure
|
||||
NB65_TFTP_CALL_MODE = $00 ;1 byte for 'mode' : $00 means read/write from RAM, (and TFTP_POINTER is address to read from
|
||||
; or write to), any other value means use callbacks (and TFTP_POINTER is the address of a routine
|
||||
;to be called whenever data arrives, or needs to be sent)
|
||||
NB65_TFTP_IP = $01 ;4 byte IP address of TFTP server
|
||||
NB65_TFTP_FILENAME = $05 ;2 byte pointer to asciiz filename (or filemask in case of NB65_TFTP_DIRECTORY_LISTING)
|
||||
NB65_TFTP_POINTER = $07 ;2 byte pointer to memory location data to be stored in OR address of tftp callback
|
||||
;offsets in TFTP parameter structure
|
||||
NB65_TFTP_IP = $00 ;4 byte IP address of TFTP server
|
||||
NB65_TFTP_FILENAME = $04 ;2 byte pointer to asciiz filename (or filemask in case of NB65_TFTP_DIRECTORY_LISTING)
|
||||
NB65_TFTP_POINTER = $06 ;2 byte pointer to memory location data to be stored in OR address of tftp callback
|
||||
|
||||
;offsets in TFTP parameter structure
|
||||
NB65_DNS_HOSTNAME = $00 ;2 byte pointer to asciiz hostname to resolve (can also be a dotted quad string)
|
||||
NB65_DNS_HOSTNAME_IP= $00 ;4 byte IP address (filled in on succesful resolution of hostname)
|
||||
|
||||
;offsets in UDP listener parameter structure
|
||||
NB65_UDP_LISTENER_PORT = $00 ;2 byte port number
|
||||
NB65_UDP_LISTENER_CALLBACK = $02 ;2 byte address of routine to call when UDP packet arrives for specified port
|
||||
|
||||
|
||||
;function numbers
|
||||
;to make a function call:
|
||||
; Y = function number
|
||||
; AX = pointer to paramater buffer (for functions that take paramaters)
|
||||
; AX = pointer to parameter buffer (for functions that take parameters)
|
||||
; then JSR NB65_DISPATCH_VECTOR
|
||||
; on return, carry flag is set if there is an error, or clear otherwise
|
||||
; some functions return results in AX directly, others will update the paramater buffer they were called with.
|
||||
; some functions return results in AX directly, others will update the parameter buffer they were called with.
|
||||
NB65_GET_API_VERSION =$00 ;no inputs, outputs X=major version number, A=minor version number
|
||||
NB65_GET_DRIVER_NAME =$01 ;no inputs, outputs AX=pointer to asciiz driver name
|
||||
NB65_GET_IP_CONFIG_PTR =$02 ;no inputs, outputs AX=pointer to IP configuration structure (which can be modified)
|
||||
NB65_INIT_IP =$03 ;no inputs or outputs
|
||||
NB65_INIT_DHCP =$04 ;no inputs or outputs (NB65_INIT_IP should be called first, and NB65_VBL_VECTOR should be called @ 60hz)
|
||||
NB65_TFTP_DIRECTORY_LISTING =$05 ;inputs: AX points to a TFTP paramater structure, outputs: none
|
||||
NB65_TFTP_DOWNLOAD =$06 ;inputs: AX points to a TFTP paramater structure, outputs: TFTP param structure updated with
|
||||
NB65_INIT_IP =$03 ;no inputs or outputs - also sets IRQ chain to call NB65_VBL_VECTOR at @ 60hz
|
||||
NB65_INIT_DHCP =$04 ;no inputs or outputs (NB65_INIT_IP should be called first
|
||||
NB65_TFTP_DIRECTORY_LISTING =$05 ;inputs: AX points to a TFTP parameter structure, outputs: none
|
||||
NB65_TFTP_DOWNLOAD =$06 ;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_DNS_RESOLVE_HOSTNAME =$07 ;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.
|
||||
NB65_UDP_ADD_LISTENER =$08 ;inputs: AX points to a UDP listener parameter structure, outputs: none
|
||||
|
||||
NB65_GET_LAST_ERROR =$FF ;no inputs, outputs A = error code (from last function that set the global error value, not necessarily the
|
||||
;last function that was called)
|
||||
@ -43,6 +55,7 @@ NB65_ERROR_PORT_IN_USE = $80
|
||||
NB65_ERROR_TIMEOUT_ON_RECEIVE = $81
|
||||
NB65_ERROR_TRANSMIT_FAILED = $82
|
||||
NB65_ERROR_TRANSMISSION_REJECTED_BY_PEER = $83
|
||||
NB65_ERROR_INPUT_TOO_LARGE = $84
|
||||
NB65_ERROR_OPTION_NOT_SUPPORTED = $FE
|
||||
NB65_ERROR_FUNCTION_NOT_SUPPORTED = $FF
|
||||
|
||||
|
@ -11,7 +11,8 @@
|
||||
.import dhcp_init
|
||||
.import dhcp_server
|
||||
|
||||
|
||||
.import cfg_get_configuration_ptr
|
||||
|
||||
.macro init_ip_via_dhcp
|
||||
|
||||
print_driver_init
|
||||
|
@ -33,6 +33,7 @@ ip65test.dsk: testdns.pg2 testdottedquad.pg2
|
||||
all: \
|
||||
ip65test.dsk \
|
||||
testdns.prg \
|
||||
test_cart_api.prg \
|
||||
testdns.pg2 \
|
||||
testdottedquad.pg2 \
|
||||
testdottedquad.prg \
|
||||
|
168
client/test/test_cart_api.s
Normal file
168
client/test/test_cart_api.s
Normal file
@ -0,0 +1,168 @@
|
||||
;test the "NETBOOT65 Cartridge API"
|
||||
.include "../inc/nb65_constants.i"
|
||||
.include "../inc/common.i"
|
||||
.include "../inc/commonprint.i"
|
||||
|
||||
.import get_key
|
||||
.bss
|
||||
nb65_param_buffer: .res $10
|
||||
|
||||
.segment "STARTUP" ;this is what gets put at the start of the file on the C64
|
||||
|
||||
.word basicstub ; load address
|
||||
|
||||
basicstub:
|
||||
.word @nextline
|
||||
.word 2003
|
||||
.byte $9e
|
||||
.byte <(((init / 1000) .mod 10) + $30)
|
||||
.byte <(((init / 100 ) .mod 10) + $30)
|
||||
.byte <(((init / 10 ) .mod 10) + $30)
|
||||
.byte <(((init ) .mod 10) + $30)
|
||||
.byte 0
|
||||
@nextline:
|
||||
.word 0
|
||||
|
||||
init:
|
||||
|
||||
jsr print_cr
|
||||
jsr print_ip_config
|
||||
|
||||
ldy #NB65_INIT_IP
|
||||
jsr NB65_DISPATCH_VECTOR
|
||||
bcc :+
|
||||
print_failed
|
||||
jsr print_errorcode
|
||||
jmp bad_boot
|
||||
:
|
||||
|
||||
ldy #NB65_INIT_DHCP
|
||||
jsr NB65_DISPATCH_VECTOR
|
||||
|
||||
bcc :+
|
||||
print_failed
|
||||
jsr print_errorcode
|
||||
jmp bad_boot
|
||||
:
|
||||
|
||||
jsr print_ip_config
|
||||
|
||||
ldax #hostname_1
|
||||
jsr do_dns_query
|
||||
|
||||
ldax #hostname_2
|
||||
jsr do_dns_query
|
||||
|
||||
ldax #hostname_3
|
||||
jsr do_dns_query
|
||||
|
||||
ldax #hostname_4
|
||||
jsr do_dns_query
|
||||
|
||||
ldax #hostname_5
|
||||
jsr do_dns_query
|
||||
|
||||
ldax #hostname_6
|
||||
jsr do_dns_query
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
ldax #64
|
||||
stax nb65_param_buffer+NB65_UDP_LISTENER_PORT
|
||||
ldax #udp_callback
|
||||
stax nb65_param_buffer+NB65_UDP_LISTENER_CALLBACK
|
||||
ldy #NB65_UDP_ADD_LISTENER
|
||||
jsr NB65_DISPATCH_VECTOR
|
||||
bcc :+
|
||||
print_failed
|
||||
jsr print_errorcode
|
||||
jmp bad_boot
|
||||
:
|
||||
@loop_forever:
|
||||
jsr NB65_PERIODIC_PROCESSING_VECTOR
|
||||
jmp @loop_forever
|
||||
|
||||
jmp $a7ae ;exit to basic
|
||||
|
||||
udp_callback:
|
||||
lda #'*'
|
||||
jmp print_a
|
||||
|
||||
do_dns_query: ;AX points at the hostname on entry
|
||||
stax nb65_param_buffer+NB65_DNS_HOSTNAME
|
||||
|
||||
jsr print
|
||||
|
||||
|
||||
pha
|
||||
jsr print
|
||||
lda #' '
|
||||
jsr print_a
|
||||
lda #':'
|
||||
jsr print_a
|
||||
lda #' '
|
||||
jsr print_a
|
||||
pla
|
||||
ldax #nb65_param_buffer
|
||||
ldy #NB65_DNS_RESOLVE_HOSTNAME
|
||||
jsr NB65_DISPATCH_VECTOR
|
||||
bcc :+
|
||||
ldax #dns_lookup_failed_msg
|
||||
jsr print
|
||||
jsr print_cr
|
||||
jmp print_errorcode
|
||||
:
|
||||
ldax #nb65_param_buffer+NB65_DNS_HOSTNAME_IP
|
||||
jsr print_dotted_quad
|
||||
jsr print_cr
|
||||
rts
|
||||
|
||||
bad_boot:
|
||||
ldax #press_a_key_to_continue
|
||||
jsr print
|
||||
jsr get_key
|
||||
jmp $fe66 ;do a wam start
|
||||
|
||||
|
||||
print_errorcode:
|
||||
ldax #error_code
|
||||
jsr print
|
||||
ldy #NB65_GET_LAST_ERROR
|
||||
jsr NB65_DISPATCH_VECTOR
|
||||
jsr print_hex
|
||||
jmp print_cr
|
||||
|
||||
cfg_get_configuration_ptr:
|
||||
ldy #NB65_GET_IP_CONFIG_PTR
|
||||
jmp NB65_DISPATCH_VECTOR
|
||||
|
||||
.rodata
|
||||
|
||||
buffer1: .res 256
|
||||
hostname_1:
|
||||
.byte "SLASHDOT.ORG",0 ;this should be an A record
|
||||
|
||||
hostname_2:
|
||||
.byte "VICTA.JAMTRONIX.COM",0 ;this should be a CNAME
|
||||
|
||||
hostname_3:
|
||||
.byte "FOO.BAR.BOGUS",0 ;this should fail
|
||||
|
||||
hostname_4: ;this should work (without hitting dns)
|
||||
.byte "111.22.3.4",0
|
||||
|
||||
hostname_5: ;make sure doesn't get treated as a number
|
||||
.byte "3COM.COM",0
|
||||
|
||||
hostname_6:
|
||||
.repeat 200
|
||||
.byte 'X'
|
||||
.endrepeat
|
||||
.byte 0 ;this should generate an error as it is too long
|
||||
|
||||
error_code:
|
||||
.asciiz "ERROR CODE: "
|
||||
press_a_key_to_continue:
|
||||
.byte "PRESS A KEY TO CONTINUE",13,0
|
@ -7,7 +7,9 @@
|
||||
.import dns_set_hostname
|
||||
.import dns_resolve
|
||||
.import dns_ip
|
||||
.import dns_status
|
||||
.import dns_status
|
||||
.import cfg_get_configuration_ptr
|
||||
|
||||
.import __CODE_LOAD__
|
||||
.import __CODE_SIZE__
|
||||
.import __RODATA_SIZE__
|
||||
|
Loading…
Reference in New Issue
Block a user