From 09c718b74f5aac548df799321be1451285c1b8e2 Mon Sep 17 00:00:00 2001 From: Oliver Schmidt Date: Sun, 27 Apr 2014 19:17:48 +0200 Subject: [PATCH] Removed explicit copying of defaults. It's the very purpose of the DATA segment to consolidate all items that potentially need to be copied from ROM to RAM. So there's no need to / point in doing that on a per-item-base. --- cfg/a2bin.cfg | 1 - cfg/c64prg.cfg | 1 - cfg/vic20prg.cfg | 1 - drivers/w5100.s | 2 -- ip65/config.s | 56 ++++++++++---------------------------------- ip65/ip65.s | 3 --- libnet/c64libnet.cfg | 1 - libnet/libnet.s | 5 ---- 8 files changed, 13 insertions(+), 57 deletions(-) diff --git a/cfg/a2bin.cfg b/cfg/a2bin.cfg index 1528af9..0d8c631 100644 --- a/cfg/a2bin.cfg +++ b/cfg/a2bin.cfg @@ -17,6 +17,5 @@ SEGMENTS { CODE: load = RAM, type = ro; RODATA: load = RAM, type = ro; DATA: load = RAM, type = rw; - IP65_DEFAULTS: load = RAM, type = rw; BSS: load = RAM, type = bss, define = yes; } diff --git a/cfg/c64prg.cfg b/cfg/c64prg.cfg index 461b322..6b3eaf5 100644 --- a/cfg/c64prg.cfg +++ b/cfg/c64prg.cfg @@ -18,6 +18,5 @@ SEGMENTS { CODE: load = RAM, type = ro; RODATA: load = RAM, type = ro, optional = yes; DATA: load = RAM, type = rw; - IP65_DEFAULTS: load = RAM, type = rw, optional = yes; BSS: load = RAM, type = bss; } diff --git a/cfg/vic20prg.cfg b/cfg/vic20prg.cfg index 43c38b7..156ed02 100644 --- a/cfg/vic20prg.cfg +++ b/cfg/vic20prg.cfg @@ -19,6 +19,5 @@ SEGMENTS { CODE: load = RAM, type = ro; RODATA: load = RAM, type = ro, optional = yes; DATA: load = RAM, type = rw; - IP65_DEFAULTS: load = RAM, type = rw, optional = yes; BSS: load = RAM, type = bss; } diff --git a/drivers/w5100.s b/drivers/w5100.s index 78c88b9..4db0782 100644 --- a/drivers/w5100.s +++ b/drivers/w5100.s @@ -32,7 +32,6 @@ WIZNET_DATA_REG = WIZNET_BASE+3 .import arp_init .import ip_init -.import cfg_init .importzp eth_dest .importzp eth_src @@ -168,7 +167,6 @@ eth_init: ; inputs: none ; outputs: carry flag is set if there was an error, clear otherwise w5100_ip65_init: - jsr cfg_init ; copy default values (including MAC address) to RAM jsr eth_init bcc @ok diff --git a/ip65/config.s b/ip65/config.s index fd9d193..8e989bc 100644 --- a/ip65/config.s +++ b/ip65/config.s @@ -4,16 +4,12 @@ .include "../inc/common.i" .export cfg_mac -.export cfg_mac_default .export cfg_ip .export cfg_netmask .export cfg_gateway .export cfg_dns .export cfg_tftp_server .export cfg_get_configuration_ptr -.export cfg_init -.export cfg_default_drive -.export cfg_size .export dhcp_server .import copymem @@ -21,6 +17,19 @@ .importzp copy_dest +.data + +cfg_mac: .byte $00, $80, $10, $00, $51, $00 ; mac address to be assigned to local machine +cfg_ip: .byte 192, 168, 1, 64 ; ip address of local machine (will be overwritten if dhcp_init is called) +; cfg_ip: .byte 0, 0, 0, 0 ; ip address of local machine (will be overwritten if dhcp_init is called) +cfg_netmask: .byte 255, 255, 255, 0 ; netmask of local network (will be overwritten if dhcp_init is called) +; cfg_gateway: .byte 0, 0, 0, 0 ; ip address of router on local network (will be overwritten if dhcp_init is called) +cfg_gateway: .byte 192, 168, 1, 1 ; ip address of router on local network (will be overwritten if dhcp_init is called) +cfg_dns: .byte 0, 0, 0, 0 ; ip address of dns server to use (will be overwritten if dhcp_init is called) +dhcp_server: .byte 0, 0, 0, 0 ; will be set address of dhcp server that configuration was obtained from +cfg_tftp_server: .byte $ff, $ff, $ff, $ff ; ip address of server to send tftp requests to (can be a broadcast address) + + .code ; return a pointer to where the IP configuration is kept @@ -35,45 +44,6 @@ cfg_get_configuration_ptr: clc rts -; copy the IP stack defaults (probably stored in ROM) to the running values in RAM -; inputs: none -; outputs: AX = pointer to IP configuration. -cfg_init: - ldax #cfg_mac_default - stax copy_src - ldax #cfg_mac - stax copy_dest - ldax #cfg_size - jmp copymem - - -.segment "IP65_DEFAULTS" - -cfg_mac_default: .byte $00, $80, $10, $00, $51, $00 ; 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_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_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: .byte 0, 0, 0, 0 ; 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) -cfg_default_drive_default: .byte 8 -cfg_end_defaults: -cfg_size=cfg_end_defaults-cfg_mac_default+1 - - -.bss - -cfg_mac: .res 6 ; mac address to be assigned to local machine -cfg_ip: .res 4 ; ip address of local machine (will be overwritten if dhcp_init is called) -cfg_netmask: .res 4 ; netmask of local network (will be overwritten if dhcp_init is called) -cfg_gateway: .res 4 ; ip address of router on local network (will be overwritten if dhcp_init is called) -cfg_dns: .res 4 ; ip address of dns server to use (will be overwritten if dhcp_init is called) -dhcp_server: .res 4 ; will be set address of dhcp server that configuration was obtained from -cfg_tftp_server: .res 4 ; ip address of server to send tftp requests to (can be a broadcast address) -cfg_default_drive: .res 1 - ; -- LICENSE FOR config.s -- diff --git a/ip65/ip65.s b/ip65/ip65.s index 0570b7c..348a89f 100644 --- a/ip65/ip65.s +++ b/ip65/ip65.s @@ -16,8 +16,6 @@ .export ip65_error -.import cfg_init - .import eth_init .import timer_init .import arp_init @@ -77,7 +75,6 @@ ip65_random_word: ; inputs: none ; outputs: none ip65_init: - jsr cfg_init ; copy default values (including MAC address) to RAM jsr eth_init ; initialize ethernet driver bcc @ok diff --git a/libnet/c64libnet.cfg b/libnet/c64libnet.cfg index 3d0d3a6..f32fdda 100644 --- a/libnet/c64libnet.cfg +++ b/libnet/c64libnet.cfg @@ -11,7 +11,6 @@ SEGMENTS { CODE: load = RAM, type = ro; RODATA: load = RAM, type = ro; DATA: load = RAM, type = rw; - IP65_DEFAULTS: load = RAM, type = rw,define = yes, optional=yes; BSS: load = RAM, type = bss, define = yes; HEAP: load = RAM, type = bss, optional = yes; # must sit just below stack ZPSAVE: load = RAM, type = bss; diff --git a/libnet/libnet.s b/libnet/libnet.s index 146bcf9..1771ace 100644 --- a/libnet/libnet.s +++ b/libnet/libnet.s @@ -1,6 +1,5 @@ .export _libnet_init .export _libnet_get_config -.export _libnet_MAC .import cfg_init .import cfg_ip @@ -8,11 +7,7 @@ .import ip65_init .import dhcp_init .import ip65_error -.import cfg_mac_default .import cfg_mac -.import cfg_size - -_libnet_MAC = cfg_mac_default ; load A/X macro .macro ldax arg