-
Notifications
You must be signed in to change notification settings - Fork 53
Description
-
The use of the Illegal Opcode LXA #0 appears not to work in Stella 7.0. I noticed the prior thread here discussing the stability of this op-code when CLEAN_START was modified to include it in 2020. While this issue is due to Stella not implementing this Illegal opcode correctly (and I'm reporting that separately), I think that including illegal opcodes in Macros by default is a poor choice. Better to opt in rather than opt out. Possibly difficult to change that without breaking other peoples code though, so I suggest removing the conditional compilation of LXA from CLEAN_START as the code isn't time critical. The workaround is to always define NO_ILLEGAL_OPCODES equ 1 (or wait and see if it gets fixed in Stella).
-
There is a spurious TAY instruction in CLEAN_START which is probably left over from an earlier implementation which didn't use the SP to implement the memory clear. I think this can be removed.
Edit: On second thoughts, I think this is on purpose to set Y to zero on existing CLEAN_START.
Note that if CLEAN_START is executed immediately after Reset, then Register A is likely to be zero and the code clears the TIA and RAM correctly in Stella. Mine had extra banking switching code before CLEAN_START resulting in $FF in the register A, and the Stella bug resulted in all the TIA registers and RAM being set to $FF. Thus many people will not have seen this issue.
macro.h
MAC CLEAN_START
sei
cld
IFNCONST NO_ILLEGAL_OPCODES
**lxa #0**
ELSE
ldx #0
txa
ENDIF
**tay**
.CLEAR_STACK dex
txs
pha
bne .CLEAR_STACK ; SP=$FF, X = A = Y = 0
ENDM