From 33689df9d306dc7bdef67dc6f8cee044bd1da084 Mon Sep 17 00:00:00 2001 From: jonnosan Date: Fri, 17 Apr 2009 13:02:02 +0000 Subject: [PATCH] git-svn-id: http://svn.code.sf.net/p/netboot65/code@120 93682198-c243-4bdb-bd91-e943c89aac3b --- client/ip65/config.s | 8 ++++---- client/ip65/function_dispatcher.s | 14 +++++++++----- client/ip65/tftp.s | 13 +++++++++++-- 3 files changed, 24 insertions(+), 11 deletions(-) diff --git a/client/ip65/config.s b/client/ip65/config.s index 16f9f6b..0abafbb 100644 --- a/client/ip65/config.s +++ b/client/ip65/config.s @@ -42,11 +42,11 @@ cfg_init: .segment "IP65_DEFAULTS" cfg_mac_default: .byte $00, $80, $10, $6d, $76, $30 ;mac address to be assigned to local machine -cfg_ip_default: .byte 192, 168, 1, 64 ;ip address of local machine (will be overwritten if dhcp_init is called) -;cfg_ip_default: .byte 0,0,0,0 ;ip address of local machine (will be overwritten if dhcp_init is called) +;cfg_ip_default: .byte 192, 168, 1, 64 ;ip address of local machine (will be overwritten if dhcp_init is called) +cfg_ip_default: .byte 0,0,0,0 ;ip address of local machine (will be overwritten if dhcp_init is called) cfg_netmask_default: .byte 255, 255, 255, 0; netmask of local network (will be overwritten if dhcp_init is called) -;cfg_gateway_default: .byte 0, 0, 0, 0 ;ip address of router on local network (will be overwritten if dhcp_init is called) -cfg_gateway_default: .byte 192, 168, 1, 1 ;ip address of router on local network (will be overwritten if dhcp_init is called) +cfg_gateway_default: .byte 0, 0, 0, 0 ;ip address of router on local network (will be overwritten if dhcp_init is called) +;cfg_gateway_default: .byte 192, 168, 1, 1 ;ip address of router on local network (will be overwritten if dhcp_init is called) cfg_dns_default: .byte 0, 0, 0, 0; ip address of dns server to use (will be overwritten if dhcp_init is called) dhcp_server_default: .res 4 ;will be set address of dhcp server that configuration was obtained from cfg_tftp_server_default: .byte $ff,$ff,$ff,$ff ; ip address of server to send tftp requests to (can be a broadcast address) diff --git a/client/ip65/function_dispatcher.s b/client/ip65/function_dispatcher.s index 373ae63..b97fea8 100644 --- a/client/ip65/function_dispatcher.s +++ b/client/ip65/function_dispatcher.s @@ -111,10 +111,6 @@ nb65_dispatcher: bne irq_handler_installed jsr ip65_init bcs init_failed - jsr dhcp_init - bcc dhcp_ok - jmp ip65_init ;if DHCP failed, then reinite the IP stack (which will reset IP address etc to cartridge default values) -dhcp_ok: ;install our IRQ handler ldax $314 ;previous IRQ handler stax jmp_old_irq+1 @@ -123,6 +119,10 @@ dhcp_ok: stax $314 ;previous IRQ handler sta irq_handler_installed_flag cli + jsr dhcp_init + bcc dhcp_ok + jsr ip65_init ;if DHCP failed, then reinit the IP stack (which will reset IP address etc to cartridge default values) +dhcp_ok: irq_handler_installed: clc init_failed: @@ -138,6 +138,7 @@ init_failed: cpy #NB65_DNS_RESOLVE bne :+ + phax ldy #NB65_DNS_HOSTNAME+1 lda (nb65_params),y tax @@ -150,13 +151,17 @@ init_failed: ldy #NB65_DNS_HOSTNAME_IP ldx #4 + plax + stax nb65_params @copy_dns_ip: lda dns_ip,y sta (nb65_params),y iny dex bne @copy_dns_ip + rts @dns_error: + plax rts : @@ -300,7 +305,6 @@ init_failed: iny lda tftp_filesize+1 sta (nb65_params),y - .byte $92 clc @tftp_error: rts diff --git a/client/ip65/tftp.s b/client/ip65/tftp.s index b8af3b3..f1dc1e4 100644 --- a/client/ip65/tftp.s +++ b/client/ip65/tftp.s @@ -341,7 +341,6 @@ send_tftp_packet: ;TFTP block should be created in tftp_outp, we just add the UD stax udp_send_len ldax #tftp_outp -; .byte $92 jsr udp_send rts @@ -454,7 +453,7 @@ tftp_in: lda udp_inp+5 cmp #$0c bne @last_block - + beq @not_last_block @not_data_block: cmp #4 ;ACK is opcode 4 beq :+ @@ -487,11 +486,21 @@ tftp_in: lda tftp_data_block_length+1 ;get length of data we just sent (high byte) cmp #2 bne @last_block +@not_last_block: + inc tftp_filesize+1 ;add $200 to file size + inc tftp_filesize+1 ;add $200 to file size + @not_ack: @not_expected_block_number: rts @last_block: + lda tftp_data_block_length + sta tftp_filesize; this must be the first block that is not a multiple of 512, hence till now the low byte in tftp_filesize is still $00 + lda tftp_data_block_length+1 ;this can only be 0 or 1 + beq :+ + inc tftp_filesize+1 +: lda #tftp_complete sta tftp_state rts