8BIT wrote:
What does everyone prefer?
I don't use the Kowalski simulator, so I have no opinion on which way to go, but I will suggest that it might be worth allowing the user to select which behavior it uses. Code wraps at a bank boundary, but data does not. When X is nonzero or the m flag is 0, LDA $12FFFF,X accesses bank $13 not bank $12; furthermore, the cycle count of LDA long,X does not depend on whether or not a bank (or page) boundary was crossed, so unlike the 6502 and 65C02, there isn't much incentive to align things like tables or buffers to a page or bank boundary. (If you're counting them as data, then the direct page and stack are exceptions, as both do wrap at the bank 0 boundary.)
When assembling code it makes sense to catch bank boundary crossings, and when assembling data it makes sense to ignore bank boundary crossings (after all, <64k of code with >64k of data isn't a crazy scenario). However, it's not so easy for the assembler to figure out which is being assembled.
Code:
ENABLE
SEP #$40
.byte $50 ; BVC, skip CLV
DISABLE
CLV
In the above example .byte $50 is code, not data, but how would the assembler figure out that it should be detecting a bank boundary crossing?
There are also routines like PRIMM that use inline data.
Code:
.org $12FFF8
JSL PRIMM
.string "nvmxdizc e"
.byte 0
There is a further complication that, even if the assembler is somehow able to figure out that .string is inline data, how would the assembler know whether PRIMM returns to bank $12 or to bank $13? And should it even be making such an assumption?
It'll likely be a lot simpler to pick a reasonable default behavior and let the user tell you if and when to use a different behavior, perhaps even via an assembler directive. I can imagine use cases where the desired behavior is:
- If bank boundary crossing occurs, wrap, issue error and halt immediately
- If bank boundary crossing occurs, wrap, issue warning and continue
- If bank boundary crossing occurs, wrap, continue without issuing a warning or error
- If bank boundary crossing occurs, increment bank, continue without issuing a warning or error
- If bank boundary crossing occurs, increment bank, issue warning
There may be additional cases that haven't occurred to me. Furthermore, it might be helpful to have an independent setting that switches between cases 1 and 2. Example, user A publishes source code and prefers behavior 1. User B would prefer behavior 2 while adapting, extending, or otherwise updating the source. It might be nice if User B only had to make a change in one place to switch between those behaviors.
Again, be careful about placing too much weight on the thoughts of someone who isn't (and in the foreseeable future isn't likely to be) using the simulator, but be aware there are subtle ways in which the 65C816 is more complicated than the 6502 and 65C02.
Good luck.