From 4598709a7d89d8551e85f39cb8eaf93ef5d7d523 Mon Sep 17 00:00:00 2001 From: kris Date: Sat, 9 Mar 2019 22:35:56 +0000 Subject: [PATCH] Add custom cc65 config that makes space for a LOWCODE segment from 0x800-0x2000 Place some of the tick opcodes there. This gives enough room for all but 2 of the op_tick_*_page_n opcodes! It may be possible to fit the remaining ones into unused RAM in the language card, but this will require some finesse to get the code in there. Or maybe I can optimize enough bytes... 0x300 is used by the loader.system, but there is also still 0x400..0x800 if I don't mind messing up the text page, and 0x200 if I can get away with using the keyboard buffer. Something is broken with RESET now though, maybe the reset vector is pointing somewhere orphaned. --- audiotest/audiotest/Makefile | 6 +++--- audiotest/audiotest/apple2-asm-hgr.cfg | 24 ++++++++++++++++++++++++ audiotest/audiotest/main.s | 20 +++++++++++++------- audiotest/audiotest/make/tail.mk | 2 +- 4 files changed, 41 insertions(+), 11 deletions(-) create mode 100644 audiotest/audiotest/apple2-asm-hgr.cfg diff --git a/audiotest/audiotest/Makefile b/audiotest/audiotest/Makefile index dd00f47..b2c0c77 100644 --- a/audiotest/audiotest/Makefile +++ b/audiotest/audiotest/Makefile @@ -22,12 +22,12 @@ PGM=audio # MACHINE = apple2 # MACHINE = apple2-dos33 # MACHINE = apple2-system -# MACHINE = apple2-loader + MACHINE = apple2-loader # MACHINE = apple2-reboot # MACHINE = apple2enh # MACHINE = apple2enh-dos33 # MACHINE = apple2enh-system - MACHINE = apple2enh-loader +# MACHINE = apple2enh-loader # MACHINE = apple2enh-reboot # Uncomment the appropriate project type. If your entry point is @@ -39,7 +39,7 @@ PROJECT_TYPE = ca65 # Uncomment and set this to your starting address in Apple II memory # if necessary: - START_ADDR = 4000 + START_ADDR = 800 # Set the default CPU to assemble for. You can change this in the # body of a .s file using control commands like ".PC02". Uncomment diff --git a/audiotest/audiotest/apple2-asm-hgr.cfg b/audiotest/audiotest/apple2-asm-hgr.cfg new file mode 100644 index 0000000..2e49bfe --- /dev/null +++ b/audiotest/audiotest/apple2-asm-hgr.cfg @@ -0,0 +1,24 @@ +# Configuration for assembler programs which don't need a special setup + +FEATURES { + STARTADDRESS: default = $0800; +} +SYMBOLS { + __FILETYPE__: type = weak, value = $0006; # ProDOS file type +} +MEMORY { + ZP: file = "", start = $0000, size = $00FF; + HEADER: file = %O, start = %S - $003A, size = $003A; + MAIN: file = %O, define = yes, start = %S, size = $C000 - %S; + BSS: file = "", start = __MAIN_LAST__, size = $C000 - __MAIN_LAST__; +} +SEGMENTS { + ZEROPAGE: load = ZP, type = zp, optional = yes; + EXEHDR: load = HEADER, type = ro, optional = yes; + LOWCODE: load = MAIN, type = ro, optional = yes; + HGR: load = MAIN, type = rw, optional = yes, start = $2000; + CODE: load = MAIN, type = rw start = $4000; + RODATA: load = MAIN, type = ro, optional = yes; + DATA: load = MAIN, type = rw, optional = yes; + BSS: load = BSS, type = bss, optional = yes, define = yes; +} diff --git a/audiotest/audiotest/main.s b/audiotest/audiotest/main.s index a6416e7..fa93b4a 100644 --- a/audiotest/audiotest/main.s +++ b/audiotest/audiotest/main.s @@ -8,7 +8,6 @@ .include "apple2.inc" -.org $4000 .proc main TICK = $c030 @@ -115,6 +114,10 @@ FADDR: .byte $C0,$A8,$01,15 ; 192.168.2.1 FOREIGN IP FPORT: .byte $4E,$20 ; 20000 FOREIGN PORT MAC: .byte $00,$08,$DC,$01,$02,$03 ; W5100 MAC ADDRESS +.segment "LOWCODE" + JMP RESET + +.segment "CODE" RESET: LDA #$80 ; reset STA WMODE @@ -861,7 +864,7 @@ tickident page, 8 LDA WDATA ; 4 NOP ; 2 BIT tick ; 4 - + JMP .ident(.concat("_op_tick_page_", .string(page), "_tail_16")) .endmacro @@ -1128,11 +1131,14 @@ op_tick_64 page op_tick_66 page .endmacro +.segment "LOWCODE" op_tick 32 op_tick 33 op_tick 34 op_tick 35 op_tick 36 + +.segment "CODE" op_tick 37 op_tick 38 op_tick 39 @@ -1153,11 +1159,11 @@ op_tick 53 op_tick 54 op_tick 55 op_tick 56 -;op_tick 57 -;op_tick 58 -;op_tick 59 -;op_tick 60 -;op_tick 61 +op_tick 57 +op_tick 58 +op_tick 59 +op_tick 60 +op_tick 61 ;op_tick 62 ;op_tick 63 diff --git a/audiotest/audiotest/make/tail.mk b/audiotest/audiotest/make/tail.mk index fd961e5..89c1aab 100644 --- a/audiotest/audiotest/make/tail.mk +++ b/audiotest/audiotest/make/tail.mk @@ -56,7 +56,7 @@ ifeq ($(BUILD_TYPE),cc65) MACHCONFIG += -C $(BASE_MACHINE)-system.cfg else ifeq ($(PROJECT_TYPE),ca65) - MACHCONFIG += -C $(BASE_MACHINE)-asm.cfg + MACHCONFIG += -C $(BASE_MACHINE)-asm-hgr.cfg LDFLAGS += -u __EXEHDR__ else MACHCONFIG += -C $(BASE_MACHINE).cfg