From 79028c849be33863a06d64b66e6839047038fea5 Mon Sep 17 00:00:00 2001
From: Oliver Schmidt
Date: Sun, 29 Dec 2013 23:39:35 +0100
Subject: [PATCH] Allow all test programs to run on the VIC20: - Added
exit_to_basic symbol. - Aligned linker config with C64 linker config. - Made
switch to lower charset compatible.
Allow all test programs to run with LANceGS card.
Aligned C64 input file name.
---
cfg/vic20prg.cfg | 43 ++++++++-------
drivers/Makefile | 30 +++++------
drivers/{c64inputs.s => c64input.s} | 2 +-
drivers/vic20kernal.s | 29 ++++++++++
test/Makefile | 82 ++++++++++++++++++++---------
test/cifs.s | 4 +-
test/dns.s | 4 +-
test/dottedquad.s | 4 +-
test/geturl.s | 4 +-
test/parsequerystring.s | 4 +-
test/parser.s | 4 +-
test/ping.s | 4 +-
test/tcp.s | 4 +-
test/tftp.s | 4 +-
14 files changed, 144 insertions(+), 78 deletions(-)
rename drivers/{c64inputs.s => c64input.s} (99%)
create mode 100644 drivers/vic20kernal.s
diff --git a/cfg/vic20prg.cfg b/cfg/vic20prg.cfg
index 98d6b90..0f142fa 100644
--- a/cfg/vic20prg.cfg
+++ b/cfg/vic20prg.cfg
@@ -1,23 +1,28 @@
-#assumes a fully expanded VIC 20
+# Memory configuration for the VIC20 with 32K RAM Cartridge
+SYMBOLS {
+ __LOADADDR__: type = import;
+ __EXEHDR__: type = import;
+}
MEMORY {
- ZP: start = $02, size = $1A, type = rw ;
- IP65ZP: start = $5f, size = $10, type = rw;
- RAM: start = $11FF, size = $6e00, file = %O;
+ ZP: start = $02, size = $1A;
+ IP65ZP: start = $5F, size = $10;
+ LOADADDR: start = $11FF, size = $02, file = %O;
+ HEADER: start = $1201, size = $0C, file = %O;
+ RAM: start = $120D, size = $6DF3, file = %O;
}
SEGMENTS {
- STARTUP: load = RAM, type = ro ,define = yes, optional=yes;
- CODE: load = RAM, type = ro,define = yes;
- DATA: load = RAM, type = rw,define = yes;
- SELF_MODIFIED_CODE: load = RAM, type = rw,define = yes, optional=yes;
- VIC_DATA: load = RAM, type = rw,align = $800, optional=yes;
- RODATA: load = RAM, type = ro,define = yes, optional=yes;
- IP65_DEFAULTS: load = RAM, type = rw,define = yes, optional=yes;
- BSS: load = RAM, type = bss, optional=yes;
-# SAFE_BSS: load = RAM3000, type = bss, optional=yes;
- APP_SCRATCH: load = RAM, type = bss, optional=yes;
- ZEROPAGE: load = ZP, type = zp, optional=yes;
- IP65ZP: load = IP65ZP, type = zp, optional=yes;
- TCP_VARS: load = RAM, type = bss, optional=yes;
- HTTP_VARS: load = RAM, type = bss, optional=yes;
-
+ ZEROPAGE: load = ZP, type = zp;
+ IP65ZP: load = IP65ZP, type = zp, optional = yes;
+ LOADADDR: load = LOADADDR, type = ro;
+ EXEHDR: load = HEADER, type = ro;
+ STARTUP: load = RAM, type = ro, define = yes;
+ CODE: load = RAM, type = ro;
+ RODATA: load = RAM, type = ro, optional = yes;
+ DATA: load = RAM, type = rw;
+ SELF_MODIFIED_CODE: load = RAM, type = rw, optional = yes;
+ IP65_DEFAULTS: load = RAM, type = rw, optional = yes;
+ BSS: load = RAM, type = bss;
+ APP_SCRATCH: load = RAM, type = bss, optional = yes;
+ TCP_VARS: load = RAM, type = bss, optional = yes;
+ HTTP_VARS: load = RAM, type = bss, optional = yes;
}
diff --git a/drivers/Makefile b/drivers/Makefile
index 5e80d7f..e67c9b6 100644
--- a/drivers/Makefile
+++ b/drivers/Makefile
@@ -1,6 +1,6 @@
-AS=ca65
-LD=ld65
-AFLAGS=
+AS = ca65
+LD = ld65
+AFLAGS =
%.o: %.c
$(CC) -c $(CFLAGS) $<
@@ -8,34 +8,34 @@ AFLAGS=
%.o: %.s
$(AS) $(AFLAGS) $<
-# a2uther.lib : Apple //, with an Uthernet card (cs8900a chipset) in slot #3
-# a2lancegs.lib : Apple //, with a LANceGS card (lan91c96)
-# c64rrnet.lib : C64 with RR-NET or clone at $de0x
-# c64wiznet.lib : C64 with Wiznet W5100 addressed at $df2x
-# vic20rrnet.lib : C64 with RR-NET or clone at $980x
+# c64rrnet.lib : C64 with RR-NET or clone at $de0x
+# c64wiznet.lib : C64 with Wiznet W5100 addressed at $df2x
+# a2uther.lib : Apple ][ with Uthernet in slot #3
+# a2lancegs.lib : Apple ][ with LANceGS
+# vic20rrnet.lib : VIC20 with RR-NET or clone at $980x
DRIVERS=\
- a2uther.lib \
- a2lancegs.lib \
c64rrnet.lib \
c64wiznet.lib \
+ a2uther.lib \
+ a2lancegs.lib \
vic20rrnet.lib
all: $(DRIVERS)
-a2lancegs.lib: a2print.o lan91c96.o a2timer.o a2kernal.o a2input.o a2charconv.o a2_zero_page.o
+c64rrnet.lib: rr-net.o cs8900a.o c64print.o c64timer.o c64kernal.o c64input.o petscii_charconv.o generic_zero_page.o
ar65 a $@ $^
-a2uther.lib: a2print.o uthernet.o a2timer.o a2kernal.o a2input.o a2charconv.o cs8900a.o a2_zero_page.o
+c64wiznet.lib: w5100.o c64print.o c64timer.o c64kernal.o c64input.o petscii_charconv.o generic_zero_page.o
ar65 a $@ $^
-c64rrnet.lib: c64print.o rr-net.o c64timer.o c64kernal.o c64inputs.o petscii_charconv.o cs8900a.o generic_zero_page.o
+a2lancegs.lib: lan91c96.o a2print.o a2timer.o a2kernal.o a2input.o a2charconv.o a2_zero_page.o
ar65 a $@ $^
-c64wiznet.lib: w5100.o c64print.o c64timer.o c64kernal.o c64inputs.o petscii_charconv.o generic_zero_page.o
+a2uther.lib: uthernet.o cs8900a.o a2print.o a2timer.o a2kernal.o a2input.o a2charconv.o a2_zero_page.o
ar65 a $@ $^
-vic20rrnet.lib: vic20print.o vic20-rr-net.o vic20timer.o vic20input.o petscii_charconv.o cs8900a.o generic_zero_page.o
+vic20rrnet.lib: vic20-rr-net.o cs8900a.o vic20print.o vic20timer.o vic20kernal.o vic20input.o petscii_charconv.o generic_zero_page.o
ar65 a $@ $^
clean:
diff --git a/drivers/c64inputs.s b/drivers/c64input.s
similarity index 99%
rename from drivers/c64inputs.s
rename to drivers/c64input.s
index a907707..8329b4f 100644
--- a/drivers/c64inputs.s
+++ b/drivers/c64input.s
@@ -179,7 +179,7 @@ GOTINPUT: .res 40
-; -- LICENSE FOR c64inputs.s --
+; -- LICENSE FOR c64input.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
diff --git a/drivers/vic20kernal.s b/drivers/vic20kernal.s
new file mode 100644
index 0000000..6c6d4d1
--- /dev/null
+++ b/drivers/vic20kernal.s
@@ -0,0 +1,29 @@
+.export exit_to_basic
+
+
+.code
+
+; jump to BASIC interpreter loop
+exit_to_basic:
+ jmp $c7ae
+
+
+
+; -- LICENSE FOR vic20kernal.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 --
diff --git a/test/Makefile b/test/Makefile
index be3af99..791279c 100644
--- a/test/Makefile
+++ b/test/Makefile
@@ -1,19 +1,31 @@
-CC=cl65
-AS=ca65
-LD=ld65
-CFLAGS=-Oirs -t $(TARGET)
-AFLAGS=
+# Build for Cirrus Logic CS8900A based devices:
+# make
-IP65LIB=../ip65/ip65.lib
-IP65TCPLIB=../ip65/ip65_tcp.lib
-C64RRNETLIB=../drivers/c64rrnet.lib
-C64WIZNETLIB=../drivers/c64wiznet.lib
-IP65WIZNETLIB=../ip65/ip65_wiznet.lib
-A2UTHERLIB=../drivers/a2uther.lib
-A2LANCEGSLIB=../drivers/a2lancegs.lib
-VIC20RRNETLIB=../drivers/vic20rrnet.lib
+# Build for Standard Microsystems LAN91C96 based devices:
+# make eth=sm
-INCFILES=\
+# Build for WIZnet W5100 based devices:
+# make eth=wn
+
+CC = cl65
+AS = ca65
+LD = ld65
+CFLAGS = -Oirs -t $(TARGET)
+AFLAGS =
+
+ifeq ($(eth),sm)
+ A2DRIVERLIB = ../drivers/a2lancegs.lib
+else ifeq ($(eth),wn)
+else
+ C64DRIVERLIB = ../drivers/c64rrnet.lib
+ A2DRIVERLIB = ../drivers/a2uther.lib
+ VICDRIVERLIB = ../drivers/vic20rrnet.lib
+endif
+
+IP65LIB = ../ip65/ip65.lib
+IP65TCPLIB = ../ip65/ip65_tcp.lib
+
+INCFILES = \
../inc/common.i\
../inc/commonprint.i\
../inc/net.i\
@@ -32,9 +44,7 @@ prg: \
ping_tcp.prg \
sntp.prg \
tcp_tcp.prg \
- tftp.prg \
-# vic20.prg \
- wiznet.prg
+ tftp.prg
bin: \
ip65 \
@@ -50,6 +60,20 @@ bin: \
tcp_tcp.bin \
tftp.bin
+vicprg: \
+ ip65 \
+ drivers \
+ cifs_tcp.vicprg \
+ dns.vicprg \
+ dottedquad.vicprg \
+ geturl_tcp.vicprg \
+ parsequerystring.vicprg \
+ parser_tcp.vicprg \
+ ping_tcp.vicprg \
+ sntp.vicprg \
+ tcp_tcp.vicprg \
+ tftp.vicprg
+
ip65:
make -C ../ip65 all
@@ -63,17 +87,23 @@ dsk: ip65.dsk
%.o: %.s
$(AS) $(AFLAGS) $<
-%.prg: %.o $(IP65LIB) $(C64RRNETLIB) $(INCFILES) ../cfg/c64prg.cfg
- $(LD) -o $*.prg -C ../cfg/c64prg.cfg -m $*.c64.map -vm $< $(IP65LIB) $(C64RRNETLIB) c64.lib
+%.prg: %.o $(IP65LIB) $(C64DRIVERLIB) $(INCFILES) ../cfg/c64prg.cfg
+ $(LD) -o $*.prg -C ../cfg/c64prg.cfg -m $*.c64.map -vm $< $(IP65LIB) $(C64DRIVERLIB) c64.lib
-%_tcp.prg: %.o $(IP65TCPLIB) $(C64RRNETLIB) $(INCFILES) ../cfg/c64prg.cfg
- $(LD) -o $(subst _tcp,,$*).prg -C ../cfg/c64prg.cfg -m $(subst _tcp,,$*).c64.map -vm $< $(IP65TCPLIB) $(C64RRNETLIB) c64.lib
+%_tcp.prg: %.o $(IP65TCPLIB) $(C64DRIVERLIB) $(INCFILES) ../cfg/c64prg.cfg
+ $(LD) -o $(subst _tcp,,$*).prg -C ../cfg/c64prg.cfg -m $(subst _tcp,,$*).c64.map -vm $< $(IP65TCPLIB) $(C64DRIVERLIB) c64.lib
-%.bin: %.o $(IP65LIB) $(A2UTHERLIB) $(INCFILES) ../cfg/a2bin.cfg
- $(LD) -o $*.bin -C ../cfg/a2bin.cfg -m $*.a2.map -vm $< $(IP65LIB) $(A2UTHERLIB) apple2.lib
+%.bin: %.o $(IP65LIB) $(A2DRIVERLIB) $(INCFILES) ../cfg/a2bin.cfg
+ $(LD) -o $*.bin -C ../cfg/a2bin.cfg -m $*.a2.map -vm $< $(IP65LIB) $(A2DRIVERLIB) apple2.lib
-%_tcp.bin: %.o $(IP65TCPLIB) $(A2UTHERLIB) $(INCFILES) ../cfg/a2bin.cfg
- $(LD) -o $(subst _tcp,,$*).bin -C ../cfg/a2bin.cfg -m $(subst _tcp,,$*).a2.map -vm $< $(IP65TCPLIB) $(A2UTHERLIB) apple2.lib
+%_tcp.bin: %.o $(IP65TCPLIB) $(A2DRIVERLIB) $(INCFILES) ../cfg/a2bin.cfg
+ $(LD) -o $(subst _tcp,,$*).bin -C ../cfg/a2bin.cfg -m $(subst _tcp,,$*).a2.map -vm $< $(IP65TCPLIB) $(A2DRIVERLIB) apple2.lib
+
+%.vicprg: %.o $(IP65LIB) $(VICDRIVERLIB) $(INCFILES) ../cfg/vic20prg.cfg
+ $(LD) -o $*.vicprg -C ../cfg/vic20prg.cfg -m $*.vic.map -vm $< $(IP65LIB) $(VICDRIVERLIB) vic20.lib
+
+%_tcp.vicprg: %.o $(IP65TCPLIB) $(VICDRIVERLIB) $(INCFILES) ../cfg/vic20prg.cfg
+ $(LD) -o $(subst _tcp,,$*).vicprg -C ../cfg/vic20prg.cfg -m $(subst _tcp,,$*).vic.map -vm $< $(IP65TCPLIB) $(VICDRIVERLIB) vic20.lib
ip65.d64: prg
$(C1541) -format ip65,00 d64 $@
@@ -98,7 +128,7 @@ ip65.dsk: bin
java -jar $(AC) -cc65 $@ tftp bin 0 < tftp.bin
clean:
- -rm -f *.o *.bin *.prg *.map
+ -rm -f *.o *.prg *.bin *.vicprg *.map
-rm -f ip65.d64 ip65.dsk
distclean: clean
diff --git a/test/cifs.s b/test/cifs.s
index 9b6d448..9e9275f 100644
--- a/test/cifs.s
+++ b/test/cifs.s
@@ -12,8 +12,10 @@
.segment "STARTUP"
- lda #$0E ; change to lower case
+ ; switch to lower case charset
+ lda #14
jsr print_a
+
jsr print_cr
init_ip_via_dhcp
diff --git a/test/dns.s b/test/dns.s
index aca50ce..b3000fe 100644
--- a/test/dns.s
+++ b/test/dns.s
@@ -14,8 +14,8 @@
.segment "STARTUP"
; switch to lower case charset
- lda #23
- sta $d018
+ lda #14
+ jsr print_a
jsr print_cr
jsr print_ip_config
diff --git a/test/dottedquad.s b/test/dottedquad.s
index 62a29ef..73b0fc6 100644
--- a/test/dottedquad.s
+++ b/test/dottedquad.s
@@ -11,8 +11,8 @@
.segment "STARTUP"
; switch to lower case charset
- lda #23
- sta $d018
+ lda #14
+ jsr print_a
jsr print_cr
diff --git a/test/geturl.s b/test/geturl.s
index 27cb0bb..efdb3ad 100644
--- a/test/geturl.s
+++ b/test/geturl.s
@@ -25,8 +25,8 @@ temp_buff = copy_dest
.segment "STARTUP"
; switch to lower case charset
- lda #23
- sta $d018
+ lda #14
+ jsr print_a
init_ip_via_dhcp
jsr print_ip_config
diff --git a/test/parsequerystring.s b/test/parsequerystring.s
index e7800d7..0e779b7 100644
--- a/test/parsequerystring.s
+++ b/test/parsequerystring.s
@@ -14,8 +14,8 @@
.segment "STARTUP"
; switch to lower case charset
- lda #23
- sta $d018
+ lda #14
+ jsr print_a
ldax #query_1
jsr test_querystring
diff --git a/test/parser.s b/test/parser.s
index 4cd0694..0839d98 100644
--- a/test/parser.s
+++ b/test/parser.s
@@ -22,8 +22,8 @@ temp_buff = copy_dest
.segment "STARTUP"
; switch to lower case charset
- lda #23
- sta $d018
+ lda #14
+ jsr print_a
init_ip_via_dhcp
jsr print_ip_config
diff --git a/test/ping.s b/test/ping.s
index ffa7240..31eb1e0 100644
--- a/test/ping.s
+++ b/test/ping.s
@@ -16,8 +16,8 @@
.segment "STARTUP"
; switch to lower case charset
- lda #23
- sta $d018
+ lda #14
+ jsr print_a
jsr print_cr
init_ip_via_dhcp
diff --git a/test/tcp.s b/test/tcp.s
index 078961b..97de0e5 100644
--- a/test/tcp.s
+++ b/test/tcp.s
@@ -37,8 +37,8 @@
.segment "STARTUP"
; switch to lower case charset
- lda #23
- sta $d018
+ lda #14
+ jsr print_a
ldax #$1234
stax acc16
diff --git a/test/tftp.s b/test/tftp.s
index 89e3120..d0a4b3e 100644
--- a/test/tftp.s
+++ b/test/tftp.s
@@ -20,8 +20,8 @@
.segment "STARTUP"
; switch to lower case charset
- lda #23
- sta $d018
+ lda #14
+ jsr print_a
jsr print_cr
init_ip_via_dhcp