diff --git a/CONFIG.md b/CONFIG.md index 5d09de23..8310b8d8 100644 --- a/CONFIG.md +++ b/CONFIG.md @@ -51,7 +51,7 @@ Choose if your CPU supports the Western Design Center 65C02 instruction set, lik * CSG 65CE02 * CSG 4510 - used in the Commodore 65 prototypes -It enables some speed/size code optimizations. Warning - this is untested! +It enables some speed/size code optimizations. ### `CONFIG_CPU_WDC_65816` @@ -60,7 +60,7 @@ Choose if your CPU supports the 16-bit Western Design Center 65816 instruction s * WDC 65C816 - used in the Flash 8 accelerator * WDC 65C816S - used in the SuperCPU accelerator -It enables some speed/size code optimizations. Warning - this is untested! +It enables some speed/size code optimizations. ## Memory model diff --git a/c64/aliases/,aliases_cpu.s b/c64/aliases/,aliases_cpu.s new file mode 100644 index 00000000..45f4727b --- /dev/null +++ b/c64/aliases/,aliases_cpu.s @@ -0,0 +1,45 @@ + +// +// Provide pseudocommands to make CPU optimizations easier +// + + +.pseudocommand _phx +{ +#if CONFIG_CPU_WDC_65C02 || CONFIG_CPU_WDC_65816 + phx +#else + txa + pha +#endif +} + +.pseudocommand _phy +{ +#if CONFIG_CPU_WDC_65C02 || CONFIG_CPU_WDC_65816 + phy +#else + tya + pha +#endif +} + +.pseudocommand _plx +{ +#if CONFIG_CPU_WDC_65C02 || CONFIG_CPU_WDC_65816 + plx +#else + pla + tax +#endif +} + +.pseudocommand _ply +{ +#if CONFIG_CPU_WDC_65C02 || CONFIG_CPU_WDC_65816 + ply +#else + pla + tay +#endif +} diff --git a/c64/basic/ab1e.strout.s b/c64/basic/ab1e.strout.s index 165af8b1..0526a6b1 100644 --- a/c64/basic/ab1e.strout.s +++ b/c64/basic/ab1e.strout.s @@ -7,9 +7,8 @@ STROUT: // Setup pointer sty FRESPC+1 sta FRESPC+0 - - txa - pha + + _phx // Get offset ready ldy #$00 @@ -29,6 +28,6 @@ STROUT: iny bne !- !: - pla + pla // XXX can we use _plx here? tax rts diff --git a/c64/basic/basic_do_error.s b/c64/basic/basic_do_error.s index 6266b0ef..984e71eb 100644 --- a/c64/basic/basic_do_error.s +++ b/c64/basic/basic_do_error.s @@ -2,8 +2,7 @@ basic_do_error: // Save error number - txa - pha + _phx // Print ? at start jsr print_return @@ -11,8 +10,7 @@ basic_do_error: jsr JCHROUT // Print main part of error message - pla - tax + _plx jsr print_packed_message // Print ERROR at end diff --git a/c64/basic/cmd_list.s b/c64/basic/cmd_list.s index 08afa852..190c6ca5 100644 --- a/c64/basic/cmd_list.s +++ b/c64/basic/cmd_list.s @@ -98,15 +98,9 @@ list_not_quote: // Display a token // Save registers -#if CONFIG_CPU_MOS_6502 tax pha - tya - pha -#else - phx - phy -#endif + _phy // Get pointer to compressed keyword list lda #