mirror of
https://github.com/bobbimanners/emailler.git
synced 2024-08-21 09:29:42 +00:00
NB65_GET_INPUT_PACKET_INFO is not quite working yet
git-svn-id: http://svn.code.sf.net/p/netboot65/code@86 93682198-c243-4bdb-bd91-e943c89aac3b
This commit is contained in:
parent
5b5469cb13
commit
641453ffe9
@ -302,7 +302,7 @@ download: ;AX should point at filename to download
|
||||
rts
|
||||
|
||||
cfg_get_configuration_ptr:
|
||||
ldy #NB65_GET_IP_CONFIG_PTR
|
||||
ldy #NB65_GET_IP_CONFIG
|
||||
ldax #nb65_param_buffer
|
||||
jmp NB65_DISPATCH_VECTOR
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
.export failed_msg
|
||||
.export init_msg
|
||||
.export print
|
||||
|
||||
.export print_decimal
|
||||
.zeropage
|
||||
pptr: .res 2
|
||||
.bss
|
||||
|
@ -49,8 +49,10 @@ NB65_PAYLOAD_POINTER =$0A ;2 byte pointer to payload of
|
||||
; 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 parameter buffer they were called with.
|
||||
; any register not specified in outputs will have an undefined value on exit
|
||||
|
||||
NB65_GET_DRIVER_NAME =$01 ;no inputs, outputs AX=pointer to asciiz driver name
|
||||
NB65_GET_IP_CONFIG_PTR =$02 ;AX=pointer to buffer where IP configuration structure written, outputs AX=points to same buffer, which has now been written to
|
||||
NB65_GET_IP_CONFIG =$02 ;AX=pointer to buffer where IP configuration structure written, outputs AX=points to same buffer, which has now been written to
|
||||
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
|
||||
@ -63,9 +65,9 @@ NB65_GET_INPUT_PACKET_INFO =$09 ;inputs: AX points to a UDP packet parameter
|
||||
NB65_UNHOOK_VBL_IRQ =$0A ;inputs: none, outputs: none (removes call to NB65_VBL_VECTOR on IRQ chain)
|
||||
|
||||
NB65_PRINT_ASCIIZ =$80 ;inputs: AX= pointer to null terminated string to be printed to screen, outputs: none
|
||||
NB65_PRINT_HEX_DIGIT =$81 ;inputs: A = hex digit to be printed (to screen)
|
||||
NB65_PRINT_HEX =$81 ;inputs: A = byte digit to be displayed on screen as (zero padded) hex digit, outputs: none
|
||||
NB65_PRINT_DOTTED_QUAD =$82 ;inputs: AX= pointer to 4 bytes that will be displayed as a decimal dotted quad (e.g. 192.168.1.1)
|
||||
NB65_PRINT_IP_CONFIG =$83 ;no inputs, no outputs, prints (to screen) current IP configuration
|
||||
NB65_PRINT_IP_CONFIG =$83 ;no inputs, no outputs, prints to screen current IP configuration
|
||||
|
||||
|
||||
NB65_GET_LAST_ERROR =$FF ;no inputs, outputs A = error code (from last function that set the global error value, not necessarily the
|
||||
|
@ -25,6 +25,7 @@
|
||||
.import udp_callback
|
||||
.import udp_add_listener
|
||||
.import ip_inp
|
||||
.import udp_inp
|
||||
|
||||
.import copymem
|
||||
.import cfg_mac
|
||||
@ -92,7 +93,7 @@ nb65_dispatcher:
|
||||
rts
|
||||
:
|
||||
|
||||
cpy #NB65_GET_IP_CONFIG_PTR
|
||||
cpy #NB65_GET_IP_CONFIG
|
||||
bne :+
|
||||
stax copy_dest
|
||||
ldax #cfg_mac
|
||||
@ -192,10 +193,47 @@ irq_handler_installed:
|
||||
jmp udp_add_listener
|
||||
:
|
||||
|
||||
|
||||
cpy #NB65_GET_INPUT_PACKET_INFO
|
||||
bne :+
|
||||
fixme:
|
||||
ldy #3
|
||||
@copy_src_ip:
|
||||
lda ip_inp+12,y ;src IP
|
||||
sta (nb65_params),y
|
||||
dey
|
||||
bpl @copy_src_ip
|
||||
|
||||
ldy #NB65_REMOTE_PORT
|
||||
lda udp_inp+1 ;src port (lo byte)
|
||||
sta (nb65_params),y
|
||||
iny
|
||||
lda udp_inp+0 ;src port (high byte)
|
||||
sta (nb65_params),y
|
||||
iny
|
||||
lda udp_inp+3 ;dest port (lo byte)
|
||||
sta (nb65_params),y
|
||||
iny
|
||||
lda udp_inp+2 ;dest port (high byte)
|
||||
sta (nb65_params),y
|
||||
|
||||
iny
|
||||
sec
|
||||
lda udp_inp+5 ;payload length (lo byte)
|
||||
sbc #8 ;to remove length of header
|
||||
sta (nb65_params),y
|
||||
|
||||
iny
|
||||
lda udp_inp+4 ;payload length (hi byte)
|
||||
sbc #0 ;in case there was a carry from the lo byte
|
||||
sta (nb65_params),y
|
||||
|
||||
iny
|
||||
lda #<udp_inp+8 ;payload ptr (lo byte)
|
||||
sta (nb65_params),y
|
||||
|
||||
iny
|
||||
lda #>udp_inp+8 ;payload ptr (hi byte)
|
||||
sta (nb65_params),y
|
||||
|
||||
clc
|
||||
rts
|
||||
:
|
||||
@ -218,7 +256,7 @@ fixme:
|
||||
rts
|
||||
:
|
||||
|
||||
cpy #NB65_PRINT_HEX_DIGIT
|
||||
cpy #NB65_PRINT_HEX
|
||||
bne :+
|
||||
jsr print_hex
|
||||
clc
|
||||
@ -240,7 +278,6 @@ fixme:
|
||||
:
|
||||
|
||||
|
||||
|
||||
cpy #NB65_GET_LAST_ERROR
|
||||
bne :+
|
||||
lda ip65_error
|
||||
|
@ -2,7 +2,6 @@
|
||||
.include "../inc/nb65_constants.i"
|
||||
|
||||
|
||||
|
||||
; load A/X macro
|
||||
.macro ldax arg
|
||||
.if (.match (.left (1, arg), #)) ; immediate mode
|
||||
@ -23,11 +22,12 @@
|
||||
|
||||
print_a = $ffd2
|
||||
|
||||
.bss
|
||||
nb65_param_buffer: .res $10
|
||||
|
||||
.zeropage
|
||||
buffer_ptr: .res 2
|
||||
temp_ptr: .res 2
|
||||
|
||||
.bss
|
||||
nb65_param_buffer: .res $20
|
||||
|
||||
|
||||
.segment "STARTUP" ;this is what gets put at the start of the file on the C64
|
||||
|
||||
@ -71,10 +71,6 @@ init:
|
||||
lda #$01
|
||||
sta $de00 ;turns on RR cartridge (since it will have been banked out when exiting to BASIC)
|
||||
|
||||
print_cr
|
||||
ldy #NB65_PRINT_IP_CONFIG
|
||||
jsr NB65_DISPATCH_VECTOR
|
||||
|
||||
ldy #NB65_INIT_IP
|
||||
jsr NB65_DISPATCH_VECTOR
|
||||
bcc :+
|
||||
@ -83,6 +79,18 @@ init:
|
||||
jmp bad_boot
|
||||
:
|
||||
|
||||
ldy #NB65_GET_DRIVER_NAME
|
||||
jsr NB65_DISPATCH_VECTOR
|
||||
|
||||
ldy #NB65_PRINT_ASCIIZ
|
||||
jsr NB65_DISPATCH_VECTOR
|
||||
|
||||
ldax #initialized
|
||||
ldy #NB65_PRINT_ASCIIZ
|
||||
jsr NB65_DISPATCH_VECTOR
|
||||
|
||||
print_cr
|
||||
|
||||
ldy #NB65_INIT_DHCP
|
||||
jsr NB65_DISPATCH_VECTOR
|
||||
|
||||
@ -95,8 +103,7 @@ init:
|
||||
ldy #NB65_PRINT_IP_CONFIG
|
||||
jsr NB65_DISPATCH_VECTOR
|
||||
|
||||
|
||||
;jmp callback_test
|
||||
jmp callback_test
|
||||
|
||||
ldax #hostname_1
|
||||
jsr do_dns_query
|
||||
@ -117,8 +124,6 @@ init:
|
||||
jsr do_dns_query
|
||||
|
||||
|
||||
|
||||
|
||||
callback_test:
|
||||
|
||||
ldax #64
|
||||
@ -145,16 +150,78 @@ callback_test:
|
||||
jmp $a7ae ;exit to basic
|
||||
|
||||
udp_callback:
|
||||
|
||||
ldax #nb65_param_buffer
|
||||
ldy #NB65_GET_INPUT_PACKET_INFO
|
||||
jsr NB65_DISPATCH_VECTOR
|
||||
|
||||
ldax #port
|
||||
ldy #NB65_PRINT_ASCIIZ
|
||||
jsr NB65_DISPATCH_VECTOR
|
||||
|
||||
lda nb65_param_buffer+NB65_LOCAL_PORT+1
|
||||
ldy #NB65_PRINT_HEX
|
||||
jsr NB65_DISPATCH_VECTOR
|
||||
|
||||
lda nb65_param_buffer+NB65_LOCAL_PORT
|
||||
ldy #NB65_PRINT_HEX
|
||||
jsr NB65_DISPATCH_VECTOR
|
||||
|
||||
print_cr
|
||||
|
||||
ldax #recv_from
|
||||
ldy #NB65_PRINT_ASCIIZ
|
||||
jsr NB65_DISPATCH_VECTOR
|
||||
ldy #NB65_GET_INPUT_PACKET_INFO
|
||||
|
||||
ldax #nb65_param_buffer+NB65_REMOTE_IP
|
||||
ldy #NB65_PRINT_DOTTED_QUAD
|
||||
jsr NB65_DISPATCH_VECTOR
|
||||
stax buffer_ptr
|
||||
|
||||
lda #' '
|
||||
jsr print_a
|
||||
ldax #port
|
||||
ldy #NB65_PRINT_ASCIIZ
|
||||
jsr NB65_DISPATCH_VECTOR
|
||||
|
||||
lda nb65_param_buffer+NB65_REMOTE_PORT+1
|
||||
ldy #NB65_PRINT_HEX
|
||||
jsr NB65_DISPATCH_VECTOR
|
||||
lda nb65_param_buffer+NB65_REMOTE_PORT
|
||||
ldy #NB65_PRINT_HEX
|
||||
jsr NB65_DISPATCH_VECTOR
|
||||
|
||||
print_cr
|
||||
|
||||
ldax #length
|
||||
ldy #NB65_PRINT_ASCIIZ
|
||||
jsr NB65_DISPATCH_VECTOR
|
||||
|
||||
lda nb65_param_buffer+NB65_PAYLOAD_LENGTH+1
|
||||
ldy #NB65_PRINT_HEX
|
||||
jsr NB65_DISPATCH_VECTOR
|
||||
lda nb65_param_buffer+NB65_PAYLOAD_LENGTH
|
||||
ldy #NB65_PRINT_HEX
|
||||
jsr NB65_DISPATCH_VECTOR
|
||||
|
||||
ldax #data
|
||||
ldy #NB65_PRINT_ASCIIZ
|
||||
jsr NB65_DISPATCH_VECTOR
|
||||
|
||||
ldax nb65_param_buffer+NB65_PAYLOAD_POINTER
|
||||
stax temp_ptr
|
||||
ldx nb65_param_buffer+NB65_PAYLOAD_LENGTH ;assumes length is < 255
|
||||
ldy #0
|
||||
:
|
||||
lda (temp_ptr),y
|
||||
jsr print_a
|
||||
iny
|
||||
dex
|
||||
bne :-
|
||||
|
||||
print_cr
|
||||
|
||||
rts
|
||||
|
||||
|
||||
do_dns_query: ;AX points at the hostname on entry
|
||||
stax nb65_param_buffer+NB65_DNS_HOSTNAME
|
||||
|
||||
@ -197,7 +264,7 @@ print_errorcode:
|
||||
jsr NB65_DISPATCH_VECTOR
|
||||
ldy #NB65_GET_LAST_ERROR
|
||||
jsr NB65_DISPATCH_VECTOR
|
||||
ldy #NB65_PRINT_HEX_DIGIT
|
||||
ldy #NB65_PRINT_HEX
|
||||
jsr NB65_DISPATCH_VECTOR
|
||||
print_cr
|
||||
rts
|
||||
@ -242,6 +309,18 @@ recv_from:
|
||||
listening:
|
||||
.byte "LISTENING.",13,0
|
||||
|
||||
|
||||
initialized:
|
||||
.byte " INITIALIZED.",13,0
|
||||
|
||||
port:
|
||||
.byte "PORT: ",0
|
||||
|
||||
length:
|
||||
.byte "LENGTH: ",0
|
||||
data:
|
||||
.byte "DATA: ",0
|
||||
|
||||
error_code:
|
||||
.asciiz "ERROR CODE: "
|
||||
press_a_key_to_continue:
|
||||
|
Loading…
Reference in New Issue
Block a user