mirror of
https://github.com/bobbimanners/emailler.git
synced 2025-03-03 07:29:58 +00:00
Removed Ethernet driver I/O base.
So far the base address of the Ethernet chip was a general property of all Ethernet drivers. It served two purposes: 1. Allowing to use a single Ethernet driver for a certain Ethernet chip, no matter what machine was connected to the chip. 2. Allowing use an Ethernet card in all Apple II slots. However, we now use customized Ethernet drivers for the individual machines so 1.) isn't relevant anymore. In fact one wants to omit the overhead of a runtime-adjustable base address where it isn't needed. So only the Apple II slots are left. But this should rather be a driver-internal approach then. We should just hand the driver the slot number the user wants to use and have the driver do its thing. Independently from the aspect if the driver parameter is a base address or a slot number the parameter handling was changed too. For asm programs there was so far a specific init function to be called prior to the main init function if it was desired to chnage the parameter default. This was done to keep the main init function backward compatible. But now that the parameter (now the slot number) is only used on the Apple II anyhow it seems reasonable to drop the specific init function again and just provide the parameter to the main init function. All C64-only user code can stay as-is. Only Apple II user code needs to by adjusted. Please note that this change only affects asm programs, C programs always used a single init function with the Apple II slot number as parameter.
This commit is contained in:
parent
6f0e4a97b1
commit
4577c2ab19
@ -50,7 +50,7 @@ void confirm_exit(void)
|
||||
|
||||
void main(void)
|
||||
{
|
||||
uint8_t drv_init = DRV_INIT_DEFAULT;
|
||||
uint8_t eth_init = ETH_INIT_DEFAULT;
|
||||
uint32_t server;
|
||||
struct timespec time;
|
||||
|
||||
@ -71,16 +71,16 @@ void main(void)
|
||||
file = open("ethernet.slot", O_RDONLY);
|
||||
if (file != -1)
|
||||
{
|
||||
read(file, &drv_init, 1);
|
||||
read(file, ð_init, 1);
|
||||
close(file);
|
||||
drv_init &= ~'0';
|
||||
eth_init &= ~'0';
|
||||
}
|
||||
printf("- %d\n", drv_init);
|
||||
printf("- %d\n", eth_init);
|
||||
}
|
||||
#endif
|
||||
|
||||
printf("\nInitializing ");
|
||||
if (ip65_init(drv_init))
|
||||
if (ip65_init(eth_init))
|
||||
{
|
||||
error_exit();
|
||||
}
|
||||
|
10
apps/hfs65.c
10
apps/hfs65.c
@ -301,7 +301,7 @@ void error_exit(void)
|
||||
void main(void)
|
||||
{
|
||||
char cwd[FILENAME_MAX];
|
||||
unsigned char drv_init = DRV_INIT_DEFAULT;
|
||||
unsigned char eth_init = ETH_INIT_DEFAULT;
|
||||
|
||||
getcwd(cwd, sizeof(cwd));
|
||||
|
||||
@ -320,16 +320,16 @@ void main(void)
|
||||
file = open("ethernet.slot", O_RDONLY);
|
||||
if (file != -1)
|
||||
{
|
||||
read(file, &drv_init, 1);
|
||||
read(file, ð_init, 1);
|
||||
close(file);
|
||||
drv_init &= ~'0';
|
||||
eth_init &= ~'0';
|
||||
}
|
||||
printf("- %d", drv_init);
|
||||
printf("- %d", eth_init);
|
||||
}
|
||||
#endif
|
||||
|
||||
printf("\n\nInitializing ");
|
||||
if (ip65_init(drv_init))
|
||||
if (ip65_init(eth_init))
|
||||
{
|
||||
error_exit();
|
||||
}
|
||||
|
@ -10,8 +10,7 @@
|
||||
.import abort_key
|
||||
.importzp abort_key_default
|
||||
.importzp abort_key_disable
|
||||
.import drv_init
|
||||
.importzp drv_init_default
|
||||
.importzp eth_init_default
|
||||
.import get_filtered_input
|
||||
.import get_key
|
||||
.import get_key_if_available
|
||||
@ -58,8 +57,8 @@ buffer_ptr = sreg
|
||||
.segment "STARTUP"
|
||||
|
||||
jmp start
|
||||
drv_init_value:
|
||||
.byte drv_init_default
|
||||
eth_init_value:
|
||||
.byte eth_init_default
|
||||
|
||||
|
||||
.code
|
||||
@ -74,23 +73,15 @@ start:
|
||||
jsr print_vt100
|
||||
ldax #initializing
|
||||
jsr print_ascii_as_native
|
||||
lda drv_init_value
|
||||
jsr drv_init
|
||||
lda eth_init_value
|
||||
jsr ip65_init
|
||||
bcc :+
|
||||
ldax #device_not_found
|
||||
jsr print_ascii_as_native
|
||||
jmp error_exit
|
||||
: ldax #eth_driver_name
|
||||
jsr print_ascii_as_native
|
||||
ldax #io_base_prefix
|
||||
jsr print_ascii_as_native
|
||||
lda eth_driver_io_base+1
|
||||
jsr print_hex
|
||||
lda eth_driver_io_base
|
||||
jsr print_hex
|
||||
ldax #io_base_postfix
|
||||
: ldax #eth_name
|
||||
jsr print_ascii_as_native
|
||||
jsr print_cr
|
||||
|
||||
; get IP addr
|
||||
ldax #obtaining
|
||||
@ -507,8 +498,6 @@ initializing: .byte 10,"Initializing ",0
|
||||
obtaining: .byte "Obtaining IP address ",0
|
||||
resolving: .byte 10,"Resolving to address ",0
|
||||
connecting: .byte 10,"Connecting to ",0
|
||||
io_base_prefix: .byte " ($",0
|
||||
io_base_postfix: .byte ")",10,0
|
||||
ok: .byte "Ok",10,10,0
|
||||
device_not_found: .byte "- Device not found",10,0
|
||||
abort: .byte "- User abort",10,0
|
||||
@ -524,13 +513,13 @@ welcome_1: .byte 27,")0"
|
||||
.byte 15,13,10
|
||||
.byte 14,"x x"
|
||||
.byte 15,13,10
|
||||
.byte 14,"x",15,27,"[1m","Telnet65 v1.2",27,"[0m"," based on: ",14,"x"
|
||||
.byte 14,"x",15," ",27,"[1m","Telnet65 v1.2",27,"[0m"," based on: ",14,"x"
|
||||
.byte 15,13,10
|
||||
.byte 14,"x x"
|
||||
.byte 15,13,10,0
|
||||
welcome_2: .byte 14,"x",15,"- IP65 (oliverschmidt.github.io/ip65) ",14,"x"
|
||||
welcome_2: .byte 14,"x",15," - IP65 (github.com/cc65/ip65) ",14,"x"
|
||||
.byte 15,13,10
|
||||
.byte 14,"x",15,"- CaTer (www.opppf.de/Cater) ",14,"x"
|
||||
.byte 14,"x",15," - CaTer (www.opppf.de/Cater) ",14,"x"
|
||||
.byte 15,13,10
|
||||
.byte 14,"x x"
|
||||
.byte 15,13,10
|
||||
|
@ -114,7 +114,7 @@ void input(char* str, unsigned int max, const char* tag)
|
||||
void main()
|
||||
{
|
||||
int retval;
|
||||
uint8_t drv_init = DRV_INIT_DEFAULT;
|
||||
uint8_t eth_init = ETH_INIT_DEFAULT;
|
||||
|
||||
if (doesclrscrafterexit())
|
||||
{
|
||||
@ -169,16 +169,16 @@ void main()
|
||||
file = open("ethernet.slot", O_RDONLY);
|
||||
if (file != -1)
|
||||
{
|
||||
read(file, &drv_init, 1);
|
||||
read(file, ð_init, 1);
|
||||
close(file);
|
||||
drv_init &= ~'0';
|
||||
eth_init &= ~'0';
|
||||
}
|
||||
printf("- %d\n", drv_init);
|
||||
printf("- %d\n", eth_init);
|
||||
}
|
||||
#endif
|
||||
|
||||
printf("\nInitializing ");
|
||||
if (ip65_init(drv_init))
|
||||
if (ip65_init(eth_init))
|
||||
{
|
||||
error_exit();
|
||||
}
|
||||
|
10
apps/w5100.c
10
apps/w5100.c
@ -114,12 +114,12 @@ static void set_quad(uint16_t addr, uint32_t data)
|
||||
}
|
||||
}
|
||||
|
||||
void w5100_config(void)
|
||||
void w5100_config(uint8_t eth_init)
|
||||
{
|
||||
w5100_mode = eth_driver_io_base;
|
||||
w5100_addr_hi = eth_driver_io_base + 1;
|
||||
w5100_addr_lo = eth_driver_io_base + 2;
|
||||
w5100_data = eth_driver_io_base + 3;
|
||||
w5100_mode = (uint8_t*)(eth_init << 4 | 0xC084);
|
||||
w5100_addr_hi = w5100_mode + 1;
|
||||
w5100_addr_lo = w5100_mode + 2;
|
||||
w5100_data = w5100_mode + 3;
|
||||
|
||||
// Source IP Address Register
|
||||
set_quad(0x000F, cfg_ip);
|
||||
|
@ -48,7 +48,7 @@ extern volatile uint8_t* w5100_data;
|
||||
|
||||
// Configure W5100 Ethernet controller with additional information from IP65
|
||||
// after the IP65 TCP/IP stack has been configured.
|
||||
void w5100_config(void);
|
||||
void w5100_config(uint8_t eth_init);
|
||||
|
||||
// Connect to server with IP address <server_addr> on TCP port <server_port>.
|
||||
// Return true if the connection is established, return false otherwise.
|
||||
|
@ -472,7 +472,7 @@ int main(int, char *argv[])
|
||||
uint16_t i;
|
||||
char *arg;
|
||||
char device;
|
||||
uint8_t drv_init = DRV_INIT_DEFAULT;
|
||||
uint8_t eth_init = ETH_INIT_DEFAULT;
|
||||
|
||||
if (doesclrscrafterexit())
|
||||
{
|
||||
@ -503,14 +503,14 @@ int main(int, char *argv[])
|
||||
file = open(self_path("ethernet.slot"), O_RDONLY);
|
||||
if (file != -1)
|
||||
{
|
||||
read(file, &drv_init, 1);
|
||||
read(file, ð_init, 1);
|
||||
close(file);
|
||||
drv_init &= ~'0';
|
||||
eth_init &= ~'0';
|
||||
}
|
||||
}
|
||||
|
||||
printf("- %d\n\nInitializing ", drv_init);
|
||||
if (ip65_init(drv_init))
|
||||
printf("- %d\n\nInitializing ", eth_init);
|
||||
if (ip65_init(eth_init))
|
||||
{
|
||||
ip65_error_exit(true);
|
||||
}
|
||||
@ -526,7 +526,7 @@ int main(int, char *argv[])
|
||||
printf("- Ok\n\n");
|
||||
|
||||
// Copy IP config from IP65 to W5100
|
||||
w5100_config();
|
||||
w5100_config(eth_init);
|
||||
|
||||
load_argument("wget.urls");
|
||||
while (true)
|
||||
|
@ -110,33 +110,33 @@ W5100OBJS=\
|
||||
w5100driver.o \
|
||||
ethernet.o
|
||||
|
||||
c64rrnet.lib: c64init.o rr-net.o $(CS8900AOBJS) $(C64OBJS)
|
||||
c64rrnet.lib: rr-net.o $(CS8900AOBJS) c64init.o $(C64OBJS)
|
||||
|
||||
c64eth64.lib: c64init.o eth64.o $(LAN91C96OBJS) $(C64OBJS)
|
||||
c64eth64.lib: eth64.o $(LAN91C96OBJS) c64init.o $(C64OBJS)
|
||||
|
||||
c64combo.lib: c64init.o rr-net.o eth64.o c64combo.o $(C64OBJS)
|
||||
c64combo.lib: rr-net.o eth64.o c64combo.o c64init.o $(C64OBJS)
|
||||
|
||||
ip65_c64.lib: c64init.o rr-net.o eth64.o c64combo.o $(C64_OBJS)
|
||||
ip65_c64.lib: rr-net.o eth64.o c64combo.o c64init.o $(C64_OBJS)
|
||||
|
||||
a2uther.lib: a2init.o uthernet.o $(CS8900AOBJS) $(A2OBJS)
|
||||
a2uther.lib: uthernet.o $(CS8900AOBJS) a2init.o $(A2OBJS)
|
||||
|
||||
a2lancegs.lib: a2init.o lancegs.o $(LAN91C96OBJS) $(A2OBJS)
|
||||
a2lancegs.lib: lancegs.o $(LAN91C96OBJS) a2init.o $(A2OBJS)
|
||||
|
||||
a2uther2.lib: a2init.o uthernet2.o $(W5100OBJS) $(A2OBJS)
|
||||
a2uther2.lib: uthernet2.o $(W5100OBJS) a2init.o $(A2OBJS)
|
||||
|
||||
a2combo.lib: a2initcombo.o uthernet.o lancegs.o uthernet2.o a2combo.o $(A2OBJS)
|
||||
a2combo.lib: uthernet.o lancegs.o uthernet2.o a2combo.o a2init.o $(A2OBJS)
|
||||
|
||||
ip65_apple2.lib: a2initcombo.o uthernet.o lancegs.o uthernet2.o a2combo.o $(A2_OBJS)
|
||||
ip65_apple2.lib: uthernet.o lancegs.o uthernet2.o a2combo.o a2init.o $(A2_OBJS)
|
||||
|
||||
ip65_apple2_uther2.lib: a2init.o uthernet2.o $(W5100OBJS) $(A2_OBJS)
|
||||
ip65_apple2_uther2.lib: uthernet2.o $(W5100OBJS) a2init.o $(A2_OBJS)
|
||||
|
||||
atrdragon.lib: atrinit.o dragoncart.o $(CS8900AOBJS) $(ATROBJS)
|
||||
atrdragon.lib: dragoncart.o $(CS8900AOBJS) atrinit.o $(ATROBJS)
|
||||
|
||||
ip65_atari.lib: atrinit.o dragoncart.o $(CS8900AOBJS) $(ATR_OBJS)
|
||||
ip65_atari.lib: dragoncart.o $(CS8900AOBJS) atrinit.o $(ATR_OBJS)
|
||||
|
||||
ip65_atarixl.lib: atrinit.o dragoncart.o $(CS8900AOBJS) $(ATRXL_OBJS)
|
||||
ip65_atarixl.lib: dragoncart.o $(CS8900AOBJS) atrinit.o $(ATRXL_OBJS)
|
||||
|
||||
vic20rrnet.lib: vic20init.o vic20-rr-net.o $(CS8900AOBJS) $(VIC20OBJS)
|
||||
vic20rrnet.lib: vic20-rr-net.o $(CS8900AOBJS) vic20init.o $(VIC20OBJS)
|
||||
|
||||
clean:
|
||||
-rm -f *.o
|
||||
|
@ -1,48 +1 @@
|
||||
.include "zeropage.inc"
|
||||
|
||||
.export drv_init
|
||||
.exportzp drv_init_default = 3 ; Apple 2 default slot
|
||||
|
||||
.import eth_driver_io_base
|
||||
|
||||
|
||||
.code
|
||||
|
||||
; set Apple 2 ethernet adaptor slot
|
||||
; inputs:
|
||||
; A: slot number (1-7)
|
||||
; outputs:
|
||||
; none
|
||||
drv_init:
|
||||
asl
|
||||
asl
|
||||
asl
|
||||
asl
|
||||
sta tmp1
|
||||
|
||||
lda eth_driver_io_base
|
||||
and #%10001111
|
||||
ora tmp1
|
||||
sta eth_driver_io_base
|
||||
rts
|
||||
|
||||
|
||||
|
||||
; -- LICENSE FOR a2init.s --
|
||||
; The contents of this file are subject to the Mozilla Public License
|
||||
; Version 1.1 (the "License"); you may not use this file except in
|
||||
; compliance with the License. You may obtain a copy of the License at
|
||||
; http://www.mozilla.org/MPL/
|
||||
;
|
||||
; Software distributed under the License is distributed on an "AS IS"
|
||||
; basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
|
||||
; License for the specific language governing rights and limitations
|
||||
; under the License.
|
||||
;
|
||||
; The Original Code is ip65.
|
||||
;
|
||||
; The Initial Developer of the Original Code is Jonno Downes,
|
||||
; jonno@jamtronix.com.
|
||||
; Portions created by the Initial Developer are Copyright (C) 2009
|
||||
; Jonno Downes. All Rights Reserved.
|
||||
; -- LICENSE END --
|
||||
.exportzp eth_init_default = 3 ; Apple 2 default slot
|
||||
|
@ -1,60 +0,0 @@
|
||||
.include "zeropage.inc"
|
||||
|
||||
.export drv_init
|
||||
.exportzp drv_init_default = 3 ; Apple 2 default slot
|
||||
|
||||
.import _w5100_driver_io_base
|
||||
.import _cs8900a_driver_io_base
|
||||
.import _lan91c96_driver_io_base
|
||||
|
||||
|
||||
.code
|
||||
|
||||
; set Apple 2 ethernet adaptor slot
|
||||
; inputs:
|
||||
; A: slot number (1-7)
|
||||
; outputs:
|
||||
; none
|
||||
drv_init:
|
||||
asl
|
||||
asl
|
||||
asl
|
||||
asl
|
||||
sta tmp1
|
||||
|
||||
lda _w5100_driver_io_base
|
||||
and #%10001111
|
||||
ora tmp1
|
||||
sta _w5100_driver_io_base
|
||||
|
||||
lda _cs8900a_driver_io_base
|
||||
and #%10001111
|
||||
ora tmp1
|
||||
sta _cs8900a_driver_io_base
|
||||
|
||||
lda _lan91c96_driver_io_base
|
||||
and #%10001111
|
||||
ora tmp1
|
||||
sta _lan91c96_driver_io_base
|
||||
rts
|
||||
|
||||
|
||||
|
||||
; -- LICENSE FOR a2initcombo.s --
|
||||
; The contents of this file are subject to the Mozilla Public License
|
||||
; Version 1.1 (the "License"); you may not use this file except in
|
||||
; compliance with the License. You may obtain a copy of the License at
|
||||
; http://www.mozilla.org/MPL/
|
||||
;
|
||||
; Software distributed under the License is distributed on an "AS IS"
|
||||
; basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
|
||||
; License for the specific language governing rights and limitations
|
||||
; under the License.
|
||||
;
|
||||
; The Original Code is ip65.
|
||||
;
|
||||
; The Initial Developer of the Original Code is Jonno Downes,
|
||||
; jonno@jamtronix.com.
|
||||
; Portions created by the Initial Developer are Copyright (C) 2009
|
||||
; Jonno Downes. All Rights Reserved.
|
||||
; -- LICENSE END --
|
@ -1,8 +1 @@
|
||||
.export drv_init
|
||||
.exportzp drv_init_default = 0
|
||||
|
||||
|
||||
.code
|
||||
|
||||
drv_init:
|
||||
rts
|
||||
.exportzp eth_init_default = 0
|
||||
|
@ -1,8 +1 @@
|
||||
.export drv_init
|
||||
.exportzp drv_init_default = 0
|
||||
|
||||
|
||||
.code
|
||||
|
||||
drv_init:
|
||||
rts
|
||||
.exportzp eth_init_default = 0
|
||||
|
@ -128,22 +128,25 @@ fixups = * - fixup
|
||||
|
||||
;---------------------------------------------------------------------
|
||||
|
||||
; 3 most significant nibbles are fixed up at runtime
|
||||
rxtxreg := $FFF0
|
||||
txcmd := $FFF4
|
||||
txlen := $FFF6
|
||||
isq := $FFF8
|
||||
packetpp := $FFFA
|
||||
ppdata := $FFFC
|
||||
; The addresses are fixed up at runtime
|
||||
rxtxreg := $C080
|
||||
txcmd := $C084
|
||||
txlen := $C086
|
||||
isq := $C088
|
||||
packetpp := $C08A
|
||||
ppdata := $C08C
|
||||
|
||||
;---------------------------------------------------------------------
|
||||
|
||||
.data
|
||||
|
||||
init:
|
||||
; Save address of rxtxreg
|
||||
; Convert slot number to slot I/O offset
|
||||
asl
|
||||
asl
|
||||
asl
|
||||
asl
|
||||
sta reg
|
||||
stx reg+1
|
||||
|
||||
; Start with first fixup location
|
||||
lda #<(fixup01+1)
|
||||
@ -155,13 +158,9 @@ init:
|
||||
|
||||
; Fixup address at location
|
||||
: lda (ptr),y
|
||||
and #$0F
|
||||
and #%10001111 ; Allow for re-init
|
||||
ora reg
|
||||
sta (ptr),y
|
||||
iny
|
||||
lda reg+1
|
||||
sta (ptr),y
|
||||
dey
|
||||
|
||||
; Advance to next fixup location
|
||||
inx
|
||||
|
@ -1,12 +1,10 @@
|
||||
; Cirrus Logic CS8900A driver
|
||||
|
||||
.import _cs8900a
|
||||
.import _cs8900a_driver_name
|
||||
.import _cs8900a_driver_io_base
|
||||
.import _cs8900a_name
|
||||
|
||||
.export eth = _cs8900a
|
||||
.export eth_driver_name = _cs8900a_driver_name
|
||||
.export eth_driver_io_base = _cs8900a_driver_io_base
|
||||
.export eth = _cs8900a
|
||||
.export eth_name = _cs8900a_name
|
||||
|
||||
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
; Dragon Cart driver
|
||||
|
||||
.export _cs8900a_driver_name
|
||||
.export _cs8900a_driver_io_base
|
||||
.export _cs8900a_name
|
||||
|
||||
|
||||
__ATARI__ = 1
|
||||
@ -12,16 +11,10 @@ DYN_DRV = 0
|
||||
|
||||
.rodata
|
||||
|
||||
_cs8900a_driver_name:
|
||||
_cs8900a_name:
|
||||
.byte "Dragon Cart",0
|
||||
|
||||
|
||||
.data
|
||||
|
||||
_cs8900a_driver_io_base:
|
||||
.word $d500
|
||||
|
||||
|
||||
|
||||
; -- LICENSE FOR dragoncart.s --
|
||||
; The contents of this file are subject to the Mozilla Public License
|
||||
|
@ -1,7 +1,6 @@
|
||||
; ETH64 driver
|
||||
|
||||
.export _lan91c96_driver_name
|
||||
.export _lan91c96_driver_io_base
|
||||
.export _lan91c96_name
|
||||
|
||||
|
||||
__C64__ = 1
|
||||
@ -12,16 +11,10 @@ DYN_DRV = 0
|
||||
|
||||
.rodata
|
||||
|
||||
_lan91c96_driver_name:
|
||||
_lan91c96_name:
|
||||
.byte "ETH64",0
|
||||
|
||||
|
||||
.data
|
||||
|
||||
_lan91c96_driver_io_base:
|
||||
.word $de00
|
||||
|
||||
|
||||
|
||||
; -- LICENSE FOR eth64.s --
|
||||
; The contents of this file are subject to the Mozilla Public License
|
||||
|
@ -12,7 +12,6 @@
|
||||
.import eth_outp_len
|
||||
|
||||
.import eth
|
||||
.import eth_driver_io_base
|
||||
|
||||
.import cfg_mac
|
||||
|
||||
@ -32,10 +31,9 @@
|
||||
.code
|
||||
|
||||
; initialize the ethernet adaptor
|
||||
; inputs: none
|
||||
; inputs: A = adaptor specific initialisation value or 'eth_init_default'
|
||||
; outputs: carry flag is set if there was an error, clear otherwise
|
||||
eth_init:
|
||||
ldax eth_driver_io_base
|
||||
jsr eth+driver::init
|
||||
ldx #5
|
||||
: lda eth+driver::mac,x
|
||||
|
@ -6,8 +6,7 @@
|
||||
.export eth_init
|
||||
.export eth_rx
|
||||
.export eth_tx
|
||||
.export eth_driver_name
|
||||
.export eth_driver_io_base
|
||||
.export eth_name
|
||||
|
||||
.import eth_inp
|
||||
.import eth_inp_len
|
||||
@ -15,16 +14,13 @@
|
||||
.import eth_outp_len
|
||||
|
||||
.import _w5100
|
||||
.import _w5100_driver_name
|
||||
.import _w5100_driver_io_base
|
||||
.import _w5100_name
|
||||
|
||||
.import _cs8900a
|
||||
.import _cs8900a_driver_name
|
||||
.import _cs8900a_driver_io_base
|
||||
.import _cs8900a_name
|
||||
|
||||
.import _lan91c96
|
||||
.import _lan91c96_driver_name
|
||||
.import _lan91c96_driver_io_base
|
||||
.import _lan91c96_name
|
||||
|
||||
.import cfg_mac
|
||||
|
||||
@ -45,8 +41,8 @@ eth = ptr1
|
||||
|
||||
.bss
|
||||
|
||||
eth_driver_name: .res 20
|
||||
eth_driver_io_base: .res 2
|
||||
eth_name: .res 20
|
||||
eth_init_value: .res 1
|
||||
|
||||
|
||||
.code
|
||||
@ -125,39 +121,37 @@ set_name:
|
||||
stax ptr1
|
||||
ldy #18 ; sizeof(eth_driver_name)-2
|
||||
: lda (ptr1),y
|
||||
sta eth_driver_name,y
|
||||
sta eth_name,y
|
||||
dey
|
||||
bpl :-
|
||||
rts
|
||||
|
||||
; initialize one of the known ethernet adaptors
|
||||
; inputs: none
|
||||
; inputs: A = adaptor specific initialisation value or 'eth_init_default'
|
||||
; outputs: carry flag is set if there was an error, clear otherwise
|
||||
eth_init:
|
||||
sta eth_init_value
|
||||
|
||||
.ifdef __APPLE2__
|
||||
ldax #_w5100
|
||||
jsr patch_wrapper
|
||||
ldax #_w5100_driver_name
|
||||
ldax #_w5100_name
|
||||
jsr set_name
|
||||
ldax _w5100_driver_io_base
|
||||
jsr init_adaptor
|
||||
bcc @done
|
||||
.endif
|
||||
|
||||
ldax #_cs8900a
|
||||
jsr patch_wrapper
|
||||
ldax #_cs8900a_driver_name
|
||||
ldax #_cs8900a_name
|
||||
jsr set_name
|
||||
ldax _cs8900a_driver_io_base
|
||||
jsr init_adaptor
|
||||
bcc @done
|
||||
|
||||
ldax #_lan91c96
|
||||
jsr patch_wrapper
|
||||
ldax #_lan91c96_driver_name
|
||||
ldax #_lan91c96_name
|
||||
jsr set_name
|
||||
ldax _lan91c96_driver_io_base
|
||||
jsr init_adaptor
|
||||
@done:
|
||||
rts
|
||||
@ -166,10 +160,10 @@ eth_init:
|
||||
.data
|
||||
|
||||
; initialize the ethernet adaptor
|
||||
; inputs: ethernet adaptor i/o base addr
|
||||
; inputs: none
|
||||
; outputs: carry flag is set if there was an error, clear otherwise
|
||||
init_adaptor:
|
||||
stax eth_driver_io_base
|
||||
lda eth_init_value
|
||||
patch_init:
|
||||
jsr $ffff ; temporary vector - gets filled in later
|
||||
ldx #5
|
||||
|
@ -144,50 +144,53 @@ fixups = * - fixup
|
||||
|
||||
;---------------------------------------------------------------------
|
||||
|
||||
; 3 most significant nibbles are fixed up at runtime
|
||||
ethbsr := $FFFE ; Bank select register R/W (2B)
|
||||
; The addresses are fixed up at runtime
|
||||
ethbsr := $C08E ; Bank select register R/W (2B)
|
||||
|
||||
; Register bank 0
|
||||
ethtcr := $FFF0 ; Transmition control register R/W (2B)
|
||||
ethephsr := $FFF2 ; EPH status register R/O (2B)
|
||||
ethrcr := $FFF4 ; Receive control register R/W (2B)
|
||||
ethecr := $FFF6 ; Counter register R/O (2B)
|
||||
ethmir := $FFF8 ; Memory information register R/O (2B)
|
||||
ethmcr := $FFFA ; Memory Config. reg. +0 R/W +1 R/O (2B)
|
||||
ethtcr := $C080 ; Transmition control register R/W (2B)
|
||||
ethephsr := $C082 ; EPH status register R/O (2B)
|
||||
ethrcr := $C084 ; Receive control register R/W (2B)
|
||||
ethecr := $C086 ; Counter register R/O (2B)
|
||||
ethmir := $C088 ; Memory information register R/O (2B)
|
||||
ethmcr := $C08A ; Memory Config. reg. +0 R/W +1 R/O (2B)
|
||||
|
||||
; Register bank 1
|
||||
ethcr := $FFF0 ; Configuration register R/W (2B)
|
||||
ethbar := $FFF2 ; Base address register R/W (2B)
|
||||
ethiar := $FFF4 ; Individual address register R/W (6B)
|
||||
ethgpr := $FFFA ; General address register R/W (2B)
|
||||
ethctr := $FFFC ; Control register R/W (2B)
|
||||
ethcr := $C080 ; Configuration register R/W (2B)
|
||||
ethbar := $C082 ; Base address register R/W (2B)
|
||||
ethiar := $C084 ; Individual address register R/W (6B)
|
||||
ethgpr := $C08A ; General address register R/W (2B)
|
||||
ethctr := $C08C ; Control register R/W (2B)
|
||||
|
||||
; Register bank 2
|
||||
ethmmucr := $FFF0 ; MMU command register W/O (1B)
|
||||
ethautotx := $FFF1 ; AUTO TX start register R/W (1B)
|
||||
ethpnr := $FFF2 ; Packet number register R/W (1B)
|
||||
etharr := $FFF3 ; Allocation result register R/O (1B)
|
||||
ethfifo := $FFF4 ; FIFO ports register R/O (2B)
|
||||
ethptr := $FFF6 ; Pointer register R/W (2B)
|
||||
ethdata := $FFF8 ; Data register R/W (4B)
|
||||
ethist := $FFFC ; Interrupt status register R/O (1B)
|
||||
ethack := $FFFC ; Interrupt acknowledge register W/O (1B)
|
||||
ethmsk := $FFFD ; Interrupt mask register R/W (1B)
|
||||
ethmmucr := $C080 ; MMU command register W/O (1B)
|
||||
ethautotx := $C081 ; AUTO TX start register R/W (1B)
|
||||
ethpnr := $C082 ; Packet number register R/W (1B)
|
||||
etharr := $C083 ; Allocation result register R/O (1B)
|
||||
ethfifo := $C084 ; FIFO ports register R/O (2B)
|
||||
ethptr := $C086 ; Pointer register R/W (2B)
|
||||
ethdata := $C088 ; Data register R/W (4B)
|
||||
ethist := $C08C ; Interrupt status register R/O (1B)
|
||||
ethack := $C08C ; Interrupt acknowledge register W/O (1B)
|
||||
ethmsk := $C08D ; Interrupt mask register R/W (1B)
|
||||
|
||||
; Register bank 3
|
||||
ethmt := $FFF0 ; Multicast table R/W (8B)
|
||||
ethmgmt := $FFF8 ; Management interface R/W (2B)
|
||||
ethrev := $FFFA ; Revision register R/W (2B)
|
||||
ethercv := $FFFC ; Early RCV register R/W (2B)
|
||||
|
||||
.data
|
||||
ethmt := $C080 ; Multicast table R/W (8B)
|
||||
ethmgmt := $C088 ; Management interface R/W (2B)
|
||||
ethrev := $C08A ; Revision register R/W (2B)
|
||||
ethercv := $C08C ; Early RCV register R/W (2B)
|
||||
|
||||
;---------------------------------------------------------------------
|
||||
|
||||
.data
|
||||
|
||||
init:
|
||||
; Save address of register base
|
||||
; Convert slot number to slot I/O offset
|
||||
asl
|
||||
asl
|
||||
asl
|
||||
asl
|
||||
sta reg
|
||||
stx reg+1
|
||||
|
||||
; Start with first fixup location
|
||||
lda #<(fixup01+1)
|
||||
@ -199,13 +202,9 @@ init:
|
||||
|
||||
; Fixup address at location
|
||||
: lda (ptr),y
|
||||
and #$0F
|
||||
and #%10001111 ; Allow for re-init
|
||||
ora reg
|
||||
sta (ptr),y
|
||||
iny
|
||||
lda reg+1
|
||||
sta (ptr),y
|
||||
dey
|
||||
|
||||
; Advance to next fixup location
|
||||
inx
|
||||
|
@ -1,12 +1,10 @@
|
||||
; Standard Microsystems LAN91C96 driver
|
||||
|
||||
.import _lan91c96
|
||||
.import _lan91c96_driver_name
|
||||
.import _lan91c96_driver_io_base
|
||||
.import _lan91c96_name
|
||||
|
||||
.export eth = _lan91c96
|
||||
.export eth_driver_name = _lan91c96_driver_name
|
||||
.export eth_driver_io_base = _lan91c96_driver_io_base
|
||||
.export eth = _lan91c96
|
||||
.export eth_name = _lan91c96_name
|
||||
|
||||
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
; LANceGS driver
|
||||
|
||||
.export _lan91c96_driver_name
|
||||
.export _lan91c96_driver_io_base
|
||||
.export _lan91c96_name
|
||||
|
||||
|
||||
__APPLE2__ = 1
|
||||
@ -12,16 +11,10 @@ DYN_DRV = 0
|
||||
|
||||
.rodata
|
||||
|
||||
_lan91c96_driver_name:
|
||||
_lan91c96_name:
|
||||
.byte "LANceGS",0
|
||||
|
||||
|
||||
.data
|
||||
|
||||
_lan91c96_driver_io_base:
|
||||
.word $c0b0
|
||||
|
||||
|
||||
|
||||
; -- LICENSE FOR lancegs.s --
|
||||
; The contents of this file are subject to the Mozilla Public License
|
||||
|
@ -1,7 +1,6 @@
|
||||
; RR-Net driver
|
||||
|
||||
.export _cs8900a_driver_name
|
||||
.export _cs8900a_driver_io_base
|
||||
.export _cs8900a_name
|
||||
|
||||
|
||||
__CBM__ = 1
|
||||
@ -13,16 +12,10 @@ DYN_DRV = 0
|
||||
|
||||
.rodata
|
||||
|
||||
_cs8900a_driver_name:
|
||||
_cs8900a_name:
|
||||
.byte "RR-Net",0
|
||||
|
||||
|
||||
.data
|
||||
|
||||
_cs8900a_driver_io_base:
|
||||
.word $de08
|
||||
|
||||
|
||||
|
||||
; -- LICENSE FOR rr-net.s --
|
||||
; The contents of this file are subject to the Mozilla Public License
|
||||
|
@ -1,7 +1,6 @@
|
||||
; Uthernet driver
|
||||
|
||||
.export _cs8900a_driver_name
|
||||
.export _cs8900a_driver_io_base
|
||||
.export _cs8900a_name
|
||||
|
||||
|
||||
__APPLE2__ = 1
|
||||
@ -12,16 +11,10 @@ DYN_DRV = 0
|
||||
|
||||
.rodata
|
||||
|
||||
_cs8900a_driver_name:
|
||||
_cs8900a_name:
|
||||
.byte "Uthernet",0
|
||||
|
||||
|
||||
.data
|
||||
|
||||
_cs8900a_driver_io_base:
|
||||
.word $c0b0
|
||||
|
||||
|
||||
|
||||
; -- LICENSE FOR uthernet.s --
|
||||
; The contents of this file are subject to the Mozilla Public License
|
||||
|
@ -1,7 +1,6 @@
|
||||
; Uthernet II driver
|
||||
|
||||
.export _w5100_driver_name
|
||||
.export _w5100_driver_io_base
|
||||
.export _w5100_name
|
||||
|
||||
|
||||
__APPLE2__ = 1
|
||||
@ -12,16 +11,10 @@ DYN_DRV = 0
|
||||
|
||||
.rodata
|
||||
|
||||
_w5100_driver_name:
|
||||
_w5100_name:
|
||||
.byte "Uthernet II",0
|
||||
|
||||
|
||||
.data
|
||||
|
||||
_w5100_driver_io_base:
|
||||
.word $c0b4
|
||||
|
||||
|
||||
|
||||
; -- LICENSE FOR uthernet2.s --
|
||||
; The contents of this file are subject to the Mozilla Public License
|
||||
|
@ -1,7 +1,6 @@
|
||||
; RR-Net driver, as seen on a VIC-20 (i.e. using a Masquerade adapter)
|
||||
|
||||
.export _cs8900a_driver_name
|
||||
.export _cs8900a_driver_io_base
|
||||
.export _cs8900a_name
|
||||
|
||||
|
||||
__CBM__ = 1
|
||||
@ -13,16 +12,10 @@ DYN_DRV = 0
|
||||
|
||||
.rodata
|
||||
|
||||
_cs8900a_driver_name:
|
||||
_cs8900a_name:
|
||||
.asciiz "VIC20 RR-Net"
|
||||
|
||||
|
||||
.data
|
||||
|
||||
_cs8900a_driver_io_base:
|
||||
.word $9808
|
||||
|
||||
|
||||
|
||||
; -- LICENSE FOR vic20-rr-net.s --
|
||||
; The contents of this file are subject to the Mozilla Public License
|
||||
|
@ -1,8 +1 @@
|
||||
.export drv_init
|
||||
.exportzp drv_init_default = 0
|
||||
|
||||
|
||||
.code
|
||||
|
||||
drv_init:
|
||||
rts
|
||||
.exportzp eth_init_default = 0
|
||||
|
@ -104,19 +104,22 @@ fixups = * - fixup
|
||||
|
||||
;---------------------------------------------------------------------
|
||||
|
||||
; 14 most significant bits are fixed up at runtime
|
||||
mode := $FFFC|0
|
||||
addr := $FFFC|1
|
||||
data := $FFFC|3
|
||||
|
||||
.data
|
||||
; The addresses are fixed up at runtime
|
||||
mode := $C084
|
||||
addr := $C085
|
||||
data := $C087
|
||||
|
||||
;---------------------------------------------------------------------
|
||||
|
||||
.data
|
||||
|
||||
init:
|
||||
; Save address of register base
|
||||
; Convert slot number to slot I/O offset
|
||||
asl
|
||||
asl
|
||||
asl
|
||||
asl
|
||||
sta reg
|
||||
stx reg+1
|
||||
|
||||
; Start with first fixup location
|
||||
lda #<(fixup01+1)
|
||||
@ -128,13 +131,9 @@ init:
|
||||
|
||||
; Fixup address at location
|
||||
: lda (ptr),y
|
||||
and #$03
|
||||
and #%10001111 ; Allow for re-init
|
||||
ora reg
|
||||
sta (ptr),y
|
||||
iny
|
||||
lda reg+1
|
||||
sta (ptr),y
|
||||
dey
|
||||
|
||||
; Advance to next fixup location
|
||||
inx
|
||||
@ -147,9 +146,9 @@ init:
|
||||
bcc :-
|
||||
inc ptr+1
|
||||
bcs :- ; Always
|
||||
:
|
||||
|
||||
; Indirect Bus I/F mode, Address Auto-Increment
|
||||
:
|
||||
fixup01:lda mode
|
||||
ora #$03
|
||||
fixup02:sta mode
|
||||
|
@ -1,12 +1,10 @@
|
||||
; WIZnet W5100 driver
|
||||
|
||||
.import _w5100
|
||||
.import _w5100_driver_name
|
||||
.import _w5100_driver_io_base
|
||||
.import _w5100_name
|
||||
|
||||
.export eth = _w5100
|
||||
.export eth_driver_name = _w5100_driver_name
|
||||
.export eth_driver_io_base = _w5100_driver_io_base
|
||||
.export eth = _w5100
|
||||
.export eth_name = _w5100_name
|
||||
|
||||
|
||||
|
||||
|
@ -26,8 +26,7 @@
|
||||
|
||||
.import ascii_to_native
|
||||
|
||||
.import eth_driver_name
|
||||
.import eth_driver_io_base
|
||||
.import eth_name
|
||||
.importzp copy_src
|
||||
.import cfg_mac
|
||||
.import cfg_ip
|
||||
@ -57,18 +56,8 @@ temp_ptr: .res 2
|
||||
.endmacro
|
||||
|
||||
.macro print_driver_init
|
||||
ldax #eth_driver_name
|
||||
ldax #eth_name
|
||||
jsr print_ascii_as_native
|
||||
lda #'('
|
||||
jsr print_a
|
||||
lda #'$'
|
||||
jsr print_a
|
||||
lda eth_driver_io_base+1
|
||||
jsr print_hex
|
||||
lda eth_driver_io_base
|
||||
jsr print_hex
|
||||
lda #')'
|
||||
jsr print_a
|
||||
ldax #init_msg
|
||||
jsr print_ascii_as_native
|
||||
.endmacro
|
||||
@ -97,13 +86,13 @@ temp_ptr: .res 2
|
||||
|
||||
.import print_a
|
||||
.import print_cr
|
||||
.import eth_driver_name
|
||||
.import eth_name
|
||||
|
||||
print_ip_config:
|
||||
ldax #interface_type
|
||||
jsr print_ascii_as_native
|
||||
|
||||
ldax #eth_driver_name
|
||||
ldax #eth_name
|
||||
jsr print_ascii_as_native
|
||||
jsr print_cr
|
||||
|
||||
|
17
inc/ip65.h
17
inc/ip65.h
@ -23,12 +23,12 @@
|
||||
//
|
||||
extern uint8_t ip65_error;
|
||||
|
||||
// Driver initialization parameter values
|
||||
// Ethernet driver initialization parameter values
|
||||
//
|
||||
#ifdef __APPLE2__
|
||||
#define DRV_INIT_DEFAULT 3 // Apple II slot number
|
||||
#define ETH_INIT_DEFAULT 3 // Apple II slot number
|
||||
#else
|
||||
#define DRV_INIT_DEFAULT 0 // Unused
|
||||
#define ETH_INIT_DEFAULT 0 // Unused
|
||||
#endif
|
||||
|
||||
// Initialize the IP stack
|
||||
@ -38,18 +38,17 @@ extern uint8_t ip65_error;
|
||||
// except for dhcp_init which must also be called if the application
|
||||
// is using DHCP rather than hardcoded IP configuration.
|
||||
//
|
||||
// Inputs: drv_init: Driver initialization parameter
|
||||
// Inputs: eth_init: Ethernet driver initialization parameter
|
||||
// Output: true if there was an error, false otherwise
|
||||
//
|
||||
bool __fastcall__ ip65_init(uint8_t drv_init);
|
||||
bool __fastcall__ ip65_init(uint8_t eth_init);
|
||||
|
||||
// Access to Ethernet configuration
|
||||
//
|
||||
// Access to the three items below is only valid after ip65_init returned false.
|
||||
// Access to the two items below is only valid after ip65_init returned false.
|
||||
//
|
||||
extern uint8_t cfg_mac[6]; // MAC address of local machine
|
||||
extern char eth_driver_name[]; // Zero terminated string containing driver name
|
||||
extern uint8_t* eth_driver_io_base; // Ethernet chip I/O base address used by driver
|
||||
extern uint8_t cfg_mac[6]; // MAC address of local machine
|
||||
extern char eth_name[]; // Zero terminated string containing Ethernet driver name
|
||||
|
||||
// Main IP polling loop
|
||||
//
|
||||
|
@ -11,15 +11,12 @@
|
||||
.import dhcp_init
|
||||
.import dhcp_server
|
||||
|
||||
.ifdef A2_SLOT_SCAN
|
||||
.import drv_init
|
||||
.endif
|
||||
.importzp eth_init_default
|
||||
|
||||
.macro init_ip_via_dhcp
|
||||
.ifdef A2_SLOT_SCAN
|
||||
lda #1
|
||||
: pha
|
||||
jsr drv_init
|
||||
jsr ip65_init
|
||||
pla
|
||||
bcc :+
|
||||
@ -28,6 +25,7 @@
|
||||
bcc :-
|
||||
:
|
||||
.else
|
||||
lda #eth_init_default
|
||||
jsr ip65_init
|
||||
.endif
|
||||
php
|
||||
|
@ -23,8 +23,8 @@ IP65OBJS=\
|
||||
dottedquad_c.o \
|
||||
download.o \
|
||||
download_c.o \
|
||||
driver_c.o \
|
||||
eth.o \
|
||||
eth_c.o \
|
||||
http.o \
|
||||
http_c.o \
|
||||
httpd.o \
|
||||
|
@ -1,11 +0,0 @@
|
||||
.include "../inc/common.inc"
|
||||
|
||||
.export _eth_driver_name
|
||||
.export _eth_driver_io_base
|
||||
|
||||
.import eth_driver_name
|
||||
.import eth_driver_io_base
|
||||
|
||||
_eth_driver_name := eth_driver_name
|
||||
|
||||
_eth_driver_io_base := eth_driver_io_base
|
7
ip65/eth_c.s
Normal file
7
ip65/eth_c.s
Normal file
@ -0,0 +1,7 @@
|
||||
.include "../inc/common.inc"
|
||||
|
||||
.export _eth_name
|
||||
|
||||
.import eth_name
|
||||
|
||||
_eth_name := eth_name
|
@ -68,7 +68,7 @@ ip65_random_word:
|
||||
; the only *_init routine that must be called by a user application,
|
||||
; except for dhcp_init which must also be called if the application
|
||||
; is using dhcp rather than hardcoded ip configuration
|
||||
; inputs: none
|
||||
; inputs: A = adaptor specific initialisation value or 'eth_init_default'
|
||||
; outputs: carry flag is set if there was an error, clear otherwise
|
||||
ip65_init:
|
||||
jsr eth_init ; initialize ethernet driver
|
||||
|
@ -9,10 +9,8 @@
|
||||
.import ip65_process
|
||||
.import ip65_random_word
|
||||
.import ip65_error
|
||||
.import drv_init
|
||||
|
||||
_ip65_init:
|
||||
jsr drv_init
|
||||
jsr ip65_init
|
||||
ldx #$00
|
||||
txa
|
||||
|
@ -48,7 +48,7 @@ void main(void)
|
||||
}
|
||||
|
||||
printf("Init\n");
|
||||
if (ip65_init(DRV_INIT_DEFAULT))
|
||||
if (ip65_init(ETH_INIT_DEFAULT))
|
||||
{
|
||||
error_exit();
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ void main(void)
|
||||
}
|
||||
|
||||
printf("Init\n");
|
||||
if (ip65_init(DRV_INIT_DEFAULT))
|
||||
if (ip65_init(ETH_INIT_DEFAULT))
|
||||
{
|
||||
error_exit();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user