git-svn-id: http://svn.code.sf.net/p/netboot65/code@290 93682198-c243-4bdb-bd91-e943c89aac3b

This commit is contained in:
jonnosan 2010-12-15 08:08:47 +00:00
parent 0732315db8
commit ac4ee5bc92
12 changed files with 1825 additions and 55 deletions

Binary file not shown.

Binary file not shown.

View File

@ -17,7 +17,7 @@ IP65TCPLIB=../ip65/ip65_tcp.lib
C64RRNETLIB=../drivers/c64rrnet.lib
all: kipperkart.bin kipperkart_rr.bin netboot.bin kipperterm.bin kipperkart.prg kipperterm.prg kipperterm_rr.bin kippergo.bin kipperkart.prg kippergo.prg kippergo_rr.bin kipperdisk.d64
all: bobcart.bin kipperkart.bin kipperkart_rr.bin netboot.bin kipperterm.bin kipperkart.prg kipperterm.prg kipperterm_rr.bin kippergo.bin kipperkart.prg kippergo.prg kippergo_rr.bin kipperdisk.d64
kipperkart.o: kipperkart.s $(INCFILES) ../inc/ping.i ../inc/disk_transfer.i ../inc/sidplay.i ../inc/config_menu.i
$(AS) $(AFLAGS) -o $@ $<
@ -84,6 +84,11 @@ kipperdisk.d64: kipperkart.prg kipperterm.prg kipperkart.prg kippergo.prg
ripxplore.rb $@ -a kipperterm.prg
ripxplore.rb $@ -a kippergo.prg
cp $@ ../../server/boot/
bobcart.bin: bobcart.o $(IP65TCPLIB) $(C64RRNETLIB) $(INCFILES) ../cfg/c64_8kcart.cfg
$(LD) -m bobcart.map -vm -C ../cfg/c64_8kcart.cfg -o $@ $< $(IP65TCPLIB) $(C64RRNETLIB)
ruby fix_cart.rb $@ 8192
d64_upload.d64: d64_upload.prg
cp d64_upload.prg ../../server/boot/

1661
client/carts/bobcart.s Normal file

File diff suppressed because it is too large Load Diff

View File

@ -7,6 +7,9 @@ MEMORY {
DEFAULTS: start = $8009, size = $1F, file = %O;
ROM: start = $8028, size = $1FC9, define = yes, file = %O;
RAM: start = $C010, size = $0fE0, define = yes;
RAM2: start = $0334, size = $CB, define = yes; #extra scratch area - Tape I/O buffer
RAM3: start = $0200, size = $58, define = yes; #extra scratch area - Tape I/O buffer
RAM4: start = $6000, size = $3FC9, define = yes; #scratch area for apps embedded in cart to use
}
@ -14,8 +17,18 @@ SEGMENTS {
CARTRIDGE_HEADER: load = HEADER, type = ro;
IP65_DEFAULTS: load = DEFAULTS, type = ro;
CODE: load = ROM, type = ro;
RODATA: load = ROM, run=ROM, type = ro;
DATA: load = ROM, run = RAM, type = rw, define = yes;
BSS: load = RAM, type = bss;
IP65ZP: load = IP65ZP, type = zp;
}
SELF_MODIFIED_CODE: load = ROM, run = RAM2, type = rw, define = yes;
APP_SCRATCH: load = RAM4, type = bss;
TCP_VARS: load = RAM4, type = bss;
HTTP_VARS: load=ROM, run = RAM3, type = rw,define = yes;
}

View File

@ -26,7 +26,7 @@ apple2prog.lib: a2print.o uthernet.o a2timer.o a2kernal.o a2input.o a2charconv.o
c64rrnet.lib: c64print.o rr-net.o c64timer.o c64kernal.o c64inputs.o c64_disk_access.o c64charconv.o c64_vt100.o cs8900a.o
ar65 a $@ $^
c64wiznet.lib: w5100.o c64print.o c64timer.o c64kernal.o c64inputs.o c64_disk_access.o c64charconv.o c64_vt100.o
c64wiznet.lib: w5100.o c64print.o c64timer.o c64kernal.o c64inputs.o c64_disk_access.o c64charconv.o c64_vt100.o w5100_udp.o
ar65 a $@ $^

View File

@ -10,10 +10,13 @@
.include "w5100.i"
DEFAULT_W5100_BASE = $DF20
.export eth_init
.export eth_rx
.export eth_tx
.export eth_driver_name
.import eth_inp
.import eth_inp_len
.import eth_outp
@ -24,21 +27,24 @@
.importzp eth_type
.importzp eth_data
.export w5100_init
.export w5100_read_reg
.export w5100_write_reg
.import cfg_mac
.import cfg_ip
.import cfg_netmask
.import cfg_gateway
.export icmp_ping
.export icmp_echo_ip
.export ip_init
.export ip_process
.import ip65_error
.segment "IP65ZP" : zeropage
W5100_BASE = $DF20
W5100_ADDR_HI = W5100_BASE+1
W5100_ADDR_LO = W5100_BASE+2
W5100_DATA = W5100_BASE+3
.code
@ -46,45 +52,74 @@ W5100_DATA = W5100_BASE+3
;initialize the ethernet adaptor
;inputs: none
;outputs: carry flag is set if there was an error, clear otherwise
;this implementation uses a default address for the w5100, and can be
;called as a 'generic' eth driver init function
;w5100 aware apps can use w5100_init and pass in a different
;base address
eth_init:
ldax #DEFAULT_W5100_BASE
;initialize the w5100 ethernet adaptor
;inputs: AX=base address for w5100 i/o
;outputs: carry flag is set if there was an error, clear otherwise
w5100_init:
stx set_hi+2
stx set_lo+2
stx read_data_reg+2
stx write_data_reg+2
stx read_mode_reg+2
stx write_mode_reg+2
tax
stx read_mode_reg+1
stx write_mode_reg+1
inx
stx set_hi+1
inx
stx set_lo+1
inx
stx read_data_reg+1
stx write_data_reg+1
lda #$80 ;reset
sta W5100_BASE
lda W5100_BASE
jsr write_mode_reg
jsr read_mode_reg
bne @error ;writing a byte to the MODE register with bit 7 set should reset.
;after a reset, mode register is zero
;therefore, if there is a real W5100 at the specified address,
;we should be able to write a $80 and read back a $00
lda #$03 ;set indirect + autoincrement
sta W5100_BASE
lda W5100_BASE
jsr write_mode_reg
jsr read_mode_reg
cmp #$03
bne @error ;make sure if we write to mode register without bit 7 set,
;the value persists.
lda #$00
sta W5100_ADDR_HI
lda #$16
sta W5100_ADDR_LO
ldax #$0016
jsr set_register_address
ldx #$00 ;start writing to reg $0016 - Interrupt Mask Register
@loop:
lda w5100_config_data,x
sta W5100_DATA
lda w5100_config_data,x
jsr write_data_reg
inx
cpx #$06
bne @loop
lda #$09
sta W5100_ADDR_LO
jsr set_lo
ldx #$00 ;start writing to reg $0009 - MAC address
@mac_loop:
lda cfg_mac,x
sta W5100_DATA
jsr write_data_reg
inx
cpx #$06
bne @mac_loop
jsr set_ip_params
;set up socket 0 for MAC RAW mode
ldax #W5100_S0_MR
ldy #W5100_MODE_MAC_RAW
ldy #W5100_MODE_IP_RAW
jsr w5100_write_reg
;open socket 0
@ -116,32 +151,65 @@ eth_rx:
; if there was an error sending the packet then carry flag is set
; otherwise carry flag is cleared
eth_tx:
inc $d020
sec
rts
; read one of the W5100 registers
; inputs: AX = register number to read
; outputs: A = value of nominated register
; y is overwritten
w5100_read_reg:
stx W5100_ADDR_HI
sta W5100_ADDR_LO
lda W5100_DATA
rts
jsr set_register_address
jmp read_data_reg
; write to one of the W5100 registers
; inputs: AX = register number to read
; Y = value to write to register
; outputs: none
w5100_write_reg:
stx W5100_ADDR_HI
sta W5100_ADDR_LO
sty W5100_DATA
w5100_write_reg:
jsr set_register_address
tya
jmp write_data_reg
set_ip_params:
ldax #W5100_GAR0
jsr set_register_address
ldx #0
@gateway_loop:
lda cfg_gateway,x
jsr write_data_reg
inx
cpx #$04
bne @gateway_loop
ldx #0
@netmask_loop:
lda cfg_netmask,x
jsr write_data_reg
inx
cpx #$04
bne @netmask_loop
ldax #W5100_SIPR0
jsr set_register_address
ldx #0
@ip_loop:
lda cfg_ip,x
jsr write_data_reg
inx
cpx #$04
bne @ip_loop
rts
icmp_ping:
ip_init:
ip_process:
rts
.rodata
eth_driver_name:
.asciiz "W5100 5100"
.asciiz "WIZNET 5100"
w5100_config_data:
.byte $00 ;no interrupts
.byte $0f ;400ms retry (default)
@ -149,7 +217,32 @@ w5100_config_data:
.byte $08 ;# of timeouts
.byte $55 ;4 sockets @2K each, tx/rx
.byte $55
.segment "SELF_MODIFIED_CODE"
set_register_address:
set_hi:
stx $FFFF ;WIZNET_ADDR_HI
set_lo:
sta $FFFF ;WIZNET_ADDR_LO
rts
read_data_reg:
lda $FFFF ;WIZNET_DATA
rts
write_data_reg:
sta $FFFF ;WIZNET_DATA
rts
read_mode_reg:
lda $FFFF ;WIZNET_BASE
rts
write_mode_reg:
sta $FFFF ;WIZNET_BASE
rts
.bss
temp: .res 1
icmp_echo_ip:
;-- LICENSE FOR w5100a.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

View File

@ -16,7 +16,6 @@ ETHOBJS= \
timer.o \
eth.o \
arp.o \
udp.o \
ip65.o \
printf.o \
debug.o \
@ -36,25 +35,29 @@ ETHOBJS= \
arithmetic.o\
all: ip65.lib ip65_tcp.lib
all: ip65.lib ip65_tcp.lib ip65_wiznet.lib
ip65.lib: $(ETHOBJS) function_dispatcher.s ip.s icmp.s
ip65.lib: $(ETHOBJS) function_dispatcher.s ip.s icmp.s udp.o
$(AS) $(AFLAGS) function_dispatcher.s
$(AS) $(AFLAGS) ip.s
$(AS) $(AFLAGS) icmp.s
ar65 a ip65.lib $(ETHOBJS) function_dispatcher.o ip.o icmp.o
ar65 a ip65.lib $(ETHOBJS) function_dispatcher.o ip.o icmp.o udp.o
ip65_tcp.lib: tcp.o $(ETHOBJS) function_dispatcher.s ip.s tcp.s icmp.s
ip65_tcp.lib: tcp.o $(ETHOBJS) function_dispatcher.s ip.s tcp.s icmp.s udp.o
$(AS) $(AFLAGS) function_dispatcher.s -DTCP -DAPI_VERSION=2
$(AS) $(AFLAGS) ip.s -DTCP
$(AS) $(AFLAGS) icmp.s -DTCP
ar65 a ip65_tcp.lib $(ETHOBJS) function_dispatcher.o ip.o tcp.o icmp.o
ar65 a ip65_tcp.lib $(ETHOBJS) function_dispatcher.o ip.o tcp.o icmp.o udp.o
ip65_wiznet.lib: $(ETHOBJS) function_dispatcher.s
$(AS) $(AFLAGS) function_dispatcher.s
ar65 a ip65_wiznet.lib $(ETHOBJS) function_dispatcher.o
clean:
rm -f *.o
rm -f ip65.lib
rm -f ip65_tcp.lib
rm -f ip65_wiznet.lib
distclean: clean

View File

@ -43,7 +43,7 @@ cfg_init:
jmp copymem
.segment "IP65_DEFAULTS"
cfg_mac_default: .byte $00, $80, $10, $6d, $76, $30 ;mac address to be assigned to local machine
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)

View File

@ -357,7 +357,7 @@ icmp_send_echo:
;outputs:
; carry flag - set if no response, otherwise AX is time (in miliseconds) for host to respond
icmp_ping:
lda #0 ;reset the "packet sent" counter
sta icmp_echo_cnt
@send_one_message:
@ -377,7 +377,7 @@ icmp_ping:
:
jsr timer_timeout
bcs @loop_during_arp_lookup
bcs @loop_during_arp_lookup
jsr icmp_send_echo
bcc @message_sent_ok
;still can't send? then give up

View File

@ -7,16 +7,12 @@ AFLAGS=
IP65LIB=../ip65/ip65.lib
IP65WIZNETLIB=../ip65/ip65_wiznet.lib
IP65TCPLIB=../ip65/ip65_tcp.lib
C64RRNETLIB=../drivers/c64rrnet.lib
C64WIZNETLIB=../drivers/c64wiznet.lib
APPLE2PROGLIB=../drivers/apple2prog.lib
INCFILES=\
../inc/common.i\
../inc/commonprint.i\
@ -82,8 +78,8 @@ test_get_url.prg: test_get_url.o $(IP65TCPLIB) $(C64RRNETLIB) $(INCFILES) ../cfg
test_ping.prg: test_ping.o $(IP65TCPLIB) $(C64RRNETLIB) $(INCFILES) ../cfg/c64prg.cfg
$(LD) -m test_ping.map -vm -C ../cfg/c64prg.cfg -o test_ping.prg $(AFLAGS) $< $(IP65TCPLIB) $(C64RRNETLIB)
test_wiznet.prg: test_wiznet.o $(C64WIZNETLIB) $(IP65TCPLIB) $(INCFILES) ../cfg/c64prg.cfg
$(LD) -m test_wiznet.map -vm -C ../cfg/c64prg.cfg -o test_wiznet.prg $(AFLAGS) $< $(IP65TCPLIB) $(C64WIZNETLIB)
test_wiznet.prg: test_wiznet.o $(C64WIZNETLIB) $(IP65WIZNETLIB) $(INCFILES) ../cfg/c64prg.cfg
$(LD) -m test_wiznet.map -vm -C ../cfg/c64prg.cfg -o test_wiznet.prg $(AFLAGS) $< $(IP65WIZNETLIB) $(C64WIZNETLIB)
cp test_wiznet.prg ../../server/boot/autoexec.prg

View File

@ -8,7 +8,6 @@
.import copymem
.importzp copy_src
.importzp copy_dest
.import icmp_echo_ip
.import icmp_ping
.import get_key
@ -37,10 +36,11 @@ basicstub:
.code
init:
jsr print_cr
init_ip_via_dhcp
jsr print_ip_config
; jsr print_ip_config
jsr print_cr
lda #0
sta register_page
jsr dump_wiznet_register_page
@ -110,7 +110,6 @@ dump_wiznet_register_page:
jmp @one_row
@done:
jsr print_cr
jsr wait_for_keypress
rts
wait_for_keypress: