diff --git a/CONFIG.md b/CONFIG.md index 8310b8d8..48451cd6 100644 --- a/CONFIG.md +++ b/CONFIG.md @@ -48,8 +48,15 @@ If unsure - select this one. Choose if your CPU supports the Western Design Center 65C02 instruction set, like: * WDC 65C02 - used in the Turbo Master accelerator + +It enables some speed/size code optimizations. + +### `CONFIG_CPU_CSG_65CE02` + +Choose if your CPU supports the Commodore Semiconductor Group 65CE02 instruction set, like: + * CSG 65CE02 -* CSG 4510 - used in the Commodore 65 prototypes +* CSG 4510 - microcontroller used in the Commodore 65 prototypes It enables some speed/size code optimizations. diff --git a/Makefile b/Makefile index d73f87c5..c5eb20c9 100644 --- a/Makefile +++ b/Makefile @@ -192,16 +192,22 @@ build/newc65.rom: build/kernal_mega65.rom build/basic_mega65.rom build/chargen.r # Rules - tests -.PHONY: test test_generic test_mega65 test_ultimate64 test_hybrid test_m65 test_xemu testremote testsimilarity +.PHONY: test test_generic test_generic_x128 test_mega65 test_mega65_xemu test_ultimate64 test_hybrid test_m65 testremote testsimilarity test: test_generic test_generic: build/kernal_generic.rom build/basic_generic.rom build/symbols_generic.vs x64 -kernal build/kernal_generic.rom -basic build/basic_generic.rom -moncommands build/symbols_generic.vs -8 empty.d64 +test_generic_x128: build/kernal_generic.rom build/basic_generic.rom build/symbols_generic.vs + x128 -go64 -kernal64 build/kernal_generic.rom -basic64 build/basic_generic.rom -moncommands build/symbols_generic.vs -8 empty.d64 + test_mega65: build/kernal_mega65.rom build/basic_mega65.rom build/symbols_mega65.vs x64 -kernal build/kernal_mega65.rom -basic build/basic_mega65.rom -moncommands build/symbols_mega65.vs -8 empty.d64 +test_mega65_xemu: build/newc65.rom + ../xemu/build/bin/xc65.native -dmarev 2 -rom build/newc65.rom + test_ultimate64: build/kernal_ultimate64.rom build/basic_ultimate64.rom build/symbols_ultimate64.vs x64 -kernal build/kernal_ultimate64.rom -basic build/basic_ultimate64.rom -moncommands build/symbols_ultimate64.vs -8 empty.d64 @@ -217,9 +223,6 @@ test_hybrid: build/kernal_hybrid.rom build/symbols_hybrid.vs test_m65: build/newc65.rom m65 -b ../mega65-core/bin/mega65r1.bit -k ../mega65-core/bin/KICKUP.M65 -R build/newc65.rom -4 -test_xemu: build/newc65.rom - ../xemu/build/bin/xc65.native -dmarev 2 -rom build/newc65.rom - testremote: build/kernal_generic.rom build/basic_generic.rom build/symbols_generic.vs x64 -kernal build/kernal_generic.rom -basic build/basic_generic.rom -moncommands build/symbols_generic.vs -remotemonitor diff --git a/STATUS.md b/STATUS.md index 4d338117..73dcd39c 100644 --- a/STATUS.md +++ b/STATUS.md @@ -29,7 +29,7 @@ The following ROM features are currently missing: * tape support * RS-232 support * breaking Kernal routines with RUN/STOP key -* NMI andling is incomplete +* NMI handling is incomplete # API status diff --git a/bin/basic_ultimate64.rom b/bin/basic_ultimate64.rom index 5c33e194..1c579875 100644 Binary files a/bin/basic_ultimate64.rom and b/bin/basic_ultimate64.rom differ diff --git a/bin/kernal_generic.rom b/bin/kernal_generic.rom index 16990dec..9e5f655f 100644 Binary files a/bin/kernal_generic.rom and b/bin/kernal_generic.rom differ diff --git a/bin/kernal_mega65.rom b/bin/kernal_mega65.rom index 1dbda167..b108fb6e 100644 Binary files a/bin/kernal_mega65.rom and b/bin/kernal_mega65.rom differ diff --git a/bin/kernal_ultimate64.rom b/bin/kernal_ultimate64.rom index bc015e10..e1f031b5 100644 Binary files a/bin/kernal_ultimate64.rom and b/bin/kernal_ultimate64.rom differ diff --git a/c64/,,config_generic.s b/c64/,,config_generic.s index d8c319e2..f6ffe41c 100644 --- a/c64/,,config_generic.s +++ b/c64/,,config_generic.s @@ -17,6 +17,7 @@ #define CONFIG_CPU_MOS_6502 // #define CONFIG_CPU_WDC_65C02 +// #define CONFIG_CPU_CSG_65CE02 // #define CONFIG_CPU_WDC_65816 diff --git a/c64/,,config_mega65.s b/c64/,,config_mega65.s index fca49f1d..c187323b 100644 --- a/c64/,,config_mega65.s +++ b/c64/,,config_mega65.s @@ -17,6 +17,7 @@ #define CONFIG_CPU_MOS_6502 // #define CONFIG_CPU_WDC_65C02 +// #define CONFIG_CPU_CSG_65CE02 // #define CONFIG_CPU_WDC_65816 diff --git a/c64/,,config_ultimate64.s b/c64/,,config_ultimate64.s index 5631c865..4efd86e3 100644 --- a/c64/,,config_ultimate64.s +++ b/c64/,,config_ultimate64.s @@ -17,6 +17,7 @@ #define CONFIG_CPU_MOS_6502 // #define CONFIG_CPU_WDC_65C02 +// #define CONFIG_CPU_CSG_65CE02 // #define CONFIG_CPU_WDC_65816 diff --git a/c64/aliases/,aliases_config.s b/c64/aliases/,aliases_config.s index ea8a5d0d..afad90ec 100644 --- a/c64/aliases/,aliases_config.s +++ b/c64/aliases/,aliases_config.s @@ -57,6 +57,9 @@ #if CONFIG_CPU_WDC_65C02 .eval selected++ #endif +#if CONFIG_CPU_CSG_65CE02 + .eval selected++ +#endif #if CONFIG_CPU_WDC_65816 .eval selected++ #endif @@ -85,7 +88,7 @@ // Handle processor configuration -#if CONFIG_CPU_WDC_65C02 || CONFIG_CPU_WDC_65816 +#if CONFIG_CPU_WDC_65C02 || CONFIG_CPU_CSG_65CE02 || CONFIG_CPU_WDC_65816 #define HAS_BCD_SAFE_INTERRUPTS #define HAS_BCD_SAFE_RESET diff --git a/c64/aliases/,aliases_cpu.s b/c64/aliases/,aliases_cpu.s index 45f4727b..38d7a572 100644 --- a/c64/aliases/,aliases_cpu.s +++ b/c64/aliases/,aliases_cpu.s @@ -4,9 +4,9 @@ // -.pseudocommand _phx +.pseudocommand phx_trash_a { -#if CONFIG_CPU_WDC_65C02 || CONFIG_CPU_WDC_65816 +#if CONFIG_CPU_WDC_65C02 || CONFIG_CPU_CSG_65CE02 || CONFIG_CPU_WDC_65816 phx #else txa @@ -14,9 +14,9 @@ #endif } -.pseudocommand _phy +.pseudocommand phy_trash_a { -#if CONFIG_CPU_WDC_65C02 || CONFIG_CPU_WDC_65816 +#if CONFIG_CPU_WDC_65C02 || CONFIG_CPU_CSG_65CE02 || CONFIG_CPU_WDC_65816 phy #else tya @@ -24,9 +24,9 @@ #endif } -.pseudocommand _plx +.pseudocommand plx_trash_a { -#if CONFIG_CPU_WDC_65C02 || CONFIG_CPU_WDC_65816 +#if CONFIG_CPU_WDC_65C02 || CONFIG_CPU_CSG_65CE02 || CONFIG_CPU_WDC_65816 plx #else pla @@ -34,9 +34,9 @@ #endif } -.pseudocommand _ply +.pseudocommand ply_trash_a { -#if CONFIG_CPU_WDC_65C02 || CONFIG_CPU_WDC_65816 +#if CONFIG_CPU_WDC_65C02 || CONFIG_CPU_CSG_65CE02 || CONFIG_CPU_WDC_65816 ply #else pla diff --git a/c64/aliases/,aliases_hardware.s b/c64/aliases/,aliases_hardware.s index 5d3dc91b..91a117f1 100644 --- a/c64/aliases/,aliases_hardware.s +++ b/c64/aliases/,aliases_hardware.s @@ -64,6 +64,9 @@ .label VIC_SP5COL = $D02C .label VIC_SP6COL = $D02D .label VIC_SP7COL = $D02E + + .label VIC_XSCAN = $D02F // C128 only + .label VIC_CLKRATE = $D030 // C128 only // SID registers diff --git a/c64/aliases/,aliases_ram_lowmem.s b/c64/aliases/,aliases_ram_lowmem.s index a7fa7f02..b336613e 100644 --- a/c64/aliases/,aliases_ram_lowmem.s +++ b/c64/aliases/,aliases_ram_lowmem.s @@ -104,51 +104,22 @@ .label CNTDN = $A5 // -- NOT IMPLEMENTED -- .label BUFPNT = $A6 // -- NOT IMPLEMENTED -- .label INBIT = $A7 // -- NOT IMPLEMENTED -- - -#if CONFIG_SCNKEY_TWW_CTR - - // Reuse RS232 variables, since they should not be used by other things. - // Carefully avoid $A7 which is used by 64NET - .label KeyQuantity = $A8 // 1 byte - .label BufferNew = $A9 // 3 bytes - -#else +#if !CONFIG_SCNKEY_TWW_CTR .label BITCI = $A8 // -- NOT IMPLEMENTED -- .label RINONE = $A9 // -- NOT IMPLEMENTED -- .label RIDDATA = $AA // -- NOT IMPLEMENTED -- .label RIPRTY = $AB // -- NOT IMPLEMENTED -- - #endif - .label SAL = $AC // $AC-$AD -- NOT IMPLEMENTED -- (implemented screen part) .label EAL = $AE // $AE-$AF -- NOT IMPLEMENTED -- [!] used also by screen editor, for temporary color storage when scrolling .label CMP0 = $B0 // $B0-$B1 temporary tape storage, [!] here used for BRK instruction address .label TAPE1 = $B2 // $B2-$B3 tape buffer pointer - -#if CONFIG_SCNKEY_TWW_CTR - - // Reuse RS232 variables, since they should not be used by other things. - // This one should be initialized in cinit to $FF - .label BufferQuantity = $B4 // 1 byte - -#else - +#if !CONFIG_SCNKEY_TWW_CTR .label BITTS = $B4 // -- NOT IMPLEMENTED -- - #endif - .label NXTBIT = $B5 // -- NOT IMPLEMENTED -- - -#if CONFIG_SCNKEY_TWW_CTR - - // Reuse RS232 variables, since they should not be used by other things. - // Carefully avoiding $A7 which is used by 64NET - .label TempZP = $B6 // 1 byte - -#else - +#if !CONFIG_SCNKEY_TWW_CTR .label RODATA = $B6 // -- NOT IMPLEMENTED -- - #endif .label FNLEN = $B7 // current file name length @@ -200,13 +171,8 @@ .label BUF = $200 // $200-$250, BASIC line editor input buffer (81 bytes) -#if CONFIG_SCNKEY_TWW_CTR - // $250-$258 is the 81st - 88th characters in BASIC input, a carry over from VIC-20 - // and not used on C64, so safe for us to use, probably. - .label ScanResult = $250 // 8 bytes - -#endif + // and not used on C64 - they are used if CONFIG_SCNKEY_TWW_CTR is enabled. // [!] XXX document $251-$258 usage .label LAT = $259 // $259-$262, logical file numbers (table, 10 bytes) @@ -228,25 +194,14 @@ .label KEYLOG = $28F // $28F-$290 routine to setup keyboard decoding .label MODE = $291 // flag, is case switch allowed .label AUTODN = $292 // -- NOT IMPLEMENTED -- screen scroll disable - -#if CONFIG_SCNKEY_TWW_CTR - - // Reuse RS232 variables, since they should not be used by other things. - // This one should be initialized in cinit to $FF - .label BufferOld = $293 // 3 bytes - .label Buffer = $297 // 4 bytes - -#else - +#if !CONFIG_SCNKEY_TWW_CTR .label M51CRT = $293 // -- NOT IMPLEMENTED -- mock 6551 .label M51CDR = $294 // -- NOT IMPLEMENTED -- mock 6551 .label M51AJB = $295 // $295-$296 -- NOT IMPLEMENTED -- mock 6551 .label RSSTAT = $297 // -- NOT IMPLEMENTED -- mock 6551, RS-232 status .label BITNUM = $298 // -- NOT IMPLEMENTED -- .label BAUDOF = $299 // $299-$29A -- NOT IMPLEMENTED -- - #endif - .label RIDBE = $29B // -- NOT IMPLEMENTED -- .label RIDBS = $29C // -- NOT IMPLEMENTED -- .label RODBS = $29D // -- NOT IMPLEMENTED -- @@ -275,7 +230,7 @@ #if SEGMENT_BASIC .label shift_mem_up = tiny_nmi_handler + shift_mem_up_routine - tiny_nmi_handler_routine .label shift_mem_down = tiny_nmi_handler + shift_mem_down_routine - tiny_nmi_handler_routine -#endif // SEGMENT_BASIC +#endif #endif // CONFIG_MEMORY_MODEL_60K diff --git a/c64/basic/ab1e.strout.s b/c64/basic/ab1e.strout.s index 0526a6b1..4ad77a99 100644 --- a/c64/basic/ab1e.strout.s +++ b/c64/basic/ab1e.strout.s @@ -8,7 +8,7 @@ STROUT: sty FRESPC+1 sta FRESPC+0 - _phx + phx_trash_a // Get offset ready ldy #$00 @@ -28,6 +28,6 @@ STROUT: iny bne !- !: - pla // XXX can we use _plx here? + pla // XXX can we use plx_trash_a here? tax rts diff --git a/c64/basic/basic_do_error.s b/c64/basic/basic_do_error.s index 984e71eb..e4525fc6 100644 --- a/c64/basic/basic_do_error.s +++ b/c64/basic/basic_do_error.s @@ -2,7 +2,7 @@ basic_do_error: // Save error number - _phx + phx_trash_a // Print ? at start jsr print_return @@ -10,7 +10,7 @@ basic_do_error: jsr JCHROUT // Print main part of error message - _plx + plx_trash_a jsr print_packed_message // Print ERROR at end diff --git a/c64/basic/cmd_list.s b/c64/basic/cmd_list.s index 190c6ca5..6cf022e5 100644 --- a/c64/basic/cmd_list.s +++ b/c64/basic/cmd_list.s @@ -100,7 +100,7 @@ list_not_quote: // Save registers tax pha - _phy + phy_trash_a // Get pointer to compressed keyword list lda #