From 71d8767ef9c0b99eae775806a0cf62608ada8378 Mon Sep 17 00:00:00 2001 From: jonnosan Date: Wed, 15 Apr 2009 12:39:43 +0000 Subject: [PATCH] git-svn-id: http://svn.code.sf.net/p/netboot65/code@103 93682198-c243-4bdb-bd91-e943c89aac3b --- client/nb65/Makefile | 68 +++++ client/nb65/bootmenu.s | 145 +++++++++ client/nb65/fix_cart.rb | 26 ++ client/nb65/hello | Bin 0 -> 256 bytes client/nb65/nb65_c64.s | 490 ++++++++++++++++++++++++++++++ client/nb65/nb65_c64_ram_header.s | 73 +++++ client/nb65/utherboot.s | 297 ++++++++++++++++++ 7 files changed, 1099 insertions(+) create mode 100644 client/nb65/Makefile create mode 100644 client/nb65/bootmenu.s create mode 100644 client/nb65/fix_cart.rb create mode 100644 client/nb65/hello create mode 100644 client/nb65/nb65_c64.s create mode 100644 client/nb65/nb65_c64_ram_header.s create mode 100644 client/nb65/utherboot.s diff --git a/client/nb65/Makefile b/client/nb65/Makefile new file mode 100644 index 0000000..fdd0233 --- /dev/null +++ b/client/nb65/Makefile @@ -0,0 +1,68 @@ +AS=ca65 +LD=ld65 +CFLAGS=-Oirs -t $(TARGET) +AFLAGS= + +INCFILES=\ + ../inc/common.i\ + ../inc/commonprint.i\ + ../inc/net.i\ + ../inc/menu.i\ + ../inc/nb65_constants.i\ + +IP65LIB=../ip65/ip65.lib + +C64PROGLIB=../drivers/c64prog.lib +C64NB65LIB=../drivers/c64nb65.lib +APPLE2PROGLIB=../drivers/apple2prog.lib + +BOOTA2.PG2=../../server/boot/BOOTA2.PG2 + +all: utherboot.dsk $(BOOTA2.PG2) nb65_rrnet.bin nb65_std_cart.bin nb65_c64_ram.prg c64boot.d64 + +nb65_c64_ram.o: nb65_c64.s $(INCFILES) + $(AS) -DBANKSWITCH_SUPPORT=0 $(AFLAGS) -o $@ $< + +nb65_std_cart.o: nb65_c64.s $(INCFILES) + $(AS) -DBANKSWITCH_SUPPORT=1 $(AFLAGS) -o $@ $< + +nb65_rrnet.o: nb65_c64.s $(INCFILES) + $(AS) -DBANKSWITCH_SUPPORT=2 $(AFLAGS) -o $@ $< + +%.o: %.s $(INCFILES) + $(AS) $(AFLAGS) $< + +nb65_c64_ram_header.bin: nb65_c64_ram_header.o ../cfg/c64prg.cfg + $(LD) -C ../cfg/c64prg.cfg -o $@ nb65_c64_ram_header.o + +nb65_c64_ram.prg: nb65_c64_ram_header.bin nb65_c64_ram.o $(IP65LIB) $(C64NB65LIB) $(INCFILES) ../cfg/rrbin.cfg + $(LD) -m nb65_c64_ram.map -vm -C ../cfg/rrbin.cfg -o nb65_c64_ram.bin nb65_c64_ram.o $(IP65LIB) $(C64NB65LIB) + cat nb65_c64_ram_header.bin nb65_c64_ram.bin> nb65_c64_ram.prg + +nb65_std_cart.bin: nb65_std_cart.o $(IP65LIB) $(C64NB65LIB) $(INCFILES) ../cfg/rrbin.cfg + $(LD) -m nb65_std_cart.map -vm -C ../cfg/rrbin.cfg -o $@ $< $(IP65LIB) $(C64NB65LIB) + ruby fix_cart.rb $@ 8192 + +nb65_rrnet.bin: nb65_rrnet.o $(IP65LIB) $(C64NB65LIB) $(INCFILES) ../cfg/rrbin.cfg + $(LD) -m nb65_rrnet.map -vm -C ../cfg/rrbin.cfg -o $@ $< $(IP65LIB) $(C64NB65LIB) + ruby fix_cart.rb $@ 8193 + +utherboot.pg2: utherboot.o $(IP65LIB) $(APPLE2PROGLIB) $(INCFILES) ../cfg/a2language_card.cfg + $(LD) -m utherboot.map -C ../cfg/a2language_card.cfg -o $@ $< $(IP65LIB) $(APPLE2PROGLIB) + +utherboot.dsk: utherboot.pg2 + ripxplore.rb --init AppleDos utherboot.dsk -a utherboot.pg2 -t AppleBinary + ripxplore.rb utherboot.dsk -a hello -t Applesoft + +c64boot.d64: nb65_c64_ram.prg + ripxplore.rb --init CbmDos $@ -a nb65_c64_ram.prg + +$(BOOTA2.PG2): bootmenu.o $(IP65LIB) $(APPLE2PROGLIB) $(INCFILES) ../cfg/a2language_card.cfg + $(LD) -m bootmenu.map -C ../cfg/a2language_card.cfg -o $(BOOTA2.PG2) $< $(IP65LIB) $(APPLE2PROGLIB) + +clean: + rm -f *.o *.bin *.map *.prg *.pg2 *.dsk *.d64 + rm -f $(BOOTA2.PG2) + +distclean: clean + rm -f *~ diff --git a/client/nb65/bootmenu.s b/client/nb65/bootmenu.s new file mode 100644 index 0000000..a54c934 --- /dev/null +++ b/client/nb65/bootmenu.s @@ -0,0 +1,145 @@ +;############# +; +; This program looks for a TNDP server on the network, presents a catalog of volumes on that server, and allows a volume to be attached +; +; jonno@jamtronix.com - January 2009 +; + + .include "../inc/common.i" + .include "../inc/commonprint.i" + .include "../inc/net.i" + .import cls + + .import exit_to_basic + + .import copymem + .importzp copy_src + .importzp copy_dest + + .import __STARTUP_LOAD__ + .import __STARTUP_SIZE__ + .import __BSS_LOAD__ + .import __DATA_LOAD__ + .import __DATA_RUN__ + .import __DATA_SIZE__ + .import __RODATA_LOAD__ + .import __RODATA_RUN__ + .import __RODATA_SIZE__ + .import __CODE_LOAD__ + .import __CODE_RUN__ + .import __CODE_SIZE__ + +.segment "PAGE3" + +disable_language_card: .res 3 +bin_file_jmp: .res 3 + +; ------------------------------------------------------------------------ + + .segment "EXEHDR" + + .addr __STARTUP_LOAD__ ; Start address + .word __STARTUP_SIZE__+__CODE_SIZE__+__RODATA_SIZE__+__DATA_SIZE__+4 ; Size + +; ------------------------------------------------------------------------ + + +.segment "STARTUP" + + + lda $c089 ;enable language : card read ROM, write RAM, BANK 1 + + ;copy the monitor rom on to the language card + ldax #$f800 + stax copy_src + stax copy_dest + ldax #$0800 + jsr startup_copymem + + + lda $c08b ;enable language : card read RAM, write RAM, BANK 1 + lda $c08b ;this soft switch needs to be read twice + + + ;relocate the CODE segment + ldax #__CODE_LOAD__ + stax copy_src + ldax #__CODE_RUN__ + stax copy_dest + ldax #__CODE_SIZE__ + jsr startup_copymem + + + ;relocate the RODATA segment + ldax #__RODATA_LOAD__ + stax copy_src + ldax #__RODATA_RUN__ + stax copy_dest + ldax #__RODATA_SIZE__ + jsr startup_copymem + + ;relocate the DATA segment + ldax #__DATA_LOAD__ + stax copy_src + ldax #__DATA_RUN__ + stax copy_dest + ldax #__DATA_SIZE__ + jsr startup_copymem + + jmp init + +; copy memory +; set copy_src and copy_dest, length in A/X + + +end: .res 1 + +startup_copymem: + sta end + ldy #0 + + cpx #0 + beq @tail + +: lda (copy_src),y + sta (copy_dest),y + iny + bne :- + inc copy_src+1 ;next page + inc copy_dest+1 ;next page + dex + bne :- + +@tail: + lda end + beq @done + +: lda (copy_src),y + sta (copy_dest),y + iny + cpy end + bne :- + +@done: + rts + +.code + + +init: + + jsr cls + + ldax #startup_msg + jsr print + jsr print_cr + + jmp exit_to_basic + + .rodata +startup_msg: .byte "NETBOOT65 FOR APPLE 2 V0.1",13 +.byte "SEE README.TXT FOR MORE INFO (INCLUDING",13 +.byte "HOW TO RUN SOMETHING MORE INTERESTING)",13 +.byte 0 + + diff --git a/client/nb65/fix_cart.rb b/client/nb65/fix_cart.rb new file mode 100644 index 0000000..2aca81d --- /dev/null +++ b/client/nb65/fix_cart.rb @@ -0,0 +1,26 @@ +# +# Vice will treat a cartridge bin file that is of an even length as if the first 2 bytes in the file are a load address to be skipped over +# so we want to make sure the bin file is an odd length - specifically 8193 bytes +# + + +PAD_BYTE=0xff.chr +filename=ARGV[0] + +if filename.nil? then + puts "no filename specified" + exit +end + +if ARGV[1].nil? then + puts "no padding length specified" + exit +end +file_length=ARGV[1].to_i + +infile=File.open(filename,"rb").read +puts "fixing length of #{filename} from #{infile.length} to #{file_length} bytes" +outfile=File.open(filename,"wb") +outfile<