BigDumbDinosaur wrote:
The Kowalski assembler knows nothing about 65C816 modes or register sizes. You tell it to treat 816-unique instructions, e.g., TCD, and addressing modes, e.g., LDA ($05,S),Y, as valid with the pseudo-op .OPT PROC65816 in the first line of your source file. In my source files, I use .OPT PROC65816,CASEINSENSITIVE,SWAPBIN to allow 816 code, remove case-sensitivity for non-quoted strings, and to swap the function of the % and @ operators.
Here is a little more insight into how the program runs.
The Simulator->Options->General tab has 3 choices for Processor. Selecting this sets the default Processor for both the Assembler and the Debugger. If you set this to 65816, the assembler will assemble 65816 opcodes and modes correctly with or without the .OPT PROC65816. However, regardless of what is set in the Simulator->Options->General tab, using a .OPT PROC65xxx directive will override that setting for the Assembler only. It does not affect the Debugger functions. The Debugger will always use the setting from Simulator->Options->General tab.
An easy way to test this is to add this code to a new source document.
Code:
.OPT proc65c02
*= $1000
LDA #$00
NOP
BRA $1000
BRK
Set the Simulator->Options->General tab processor to 6502.
Assemble the file and it will without error, because the proc65c02 overrode the 6502 setting in Simulator->Options->General tab.
Now start the debugger and use step into (F11) to step down to the BRA. You will notice in the 6502 uP Registers & Status window that the Stat message at the bottom says in encountered an illegal byte code. That is because the debugger is running in 6502 mode.
You can switch the Simulator->Options->General tab option to 65C02 and comment out the .OPT line in the source and see that it also assembles without error and that the debugger now accepts the BRA opcode.
That being said, it is a good practice to place the .OPT proc65xxx directive at the top of your source code. This ensures the assembler will process it as intended regardless of the debugger setting.
Be well all!
Daryl
_________________
Please visit my website ->
https://sbc.rictor.org/