debounce wrote:
kc5tja wrote:
debounce wrote:
FWIW I prefer the old syntax, and not just for inertia's sake. Addressing modes are an 'intellectual convenience' I'd like to keep, as they are a mnemonic in themselves.
Quote:
INC abs,Y is an illegal instruction (the only one that's bitten me.) It's just as easy to assume INCAY abs exists.
Quote:
And the mnemonics aren't such great mnemonics any more. Some people work better with brackets and commas.
Compare: Folks who program the 68000 series of CPUs find Intel's native syntax to be retarded. Also, folks who grew up coding on Zilog or Intel machines first find Motorola syntax to be gobsmackingly stupid. You find religious wars over whether Unix assemblers should continue to use such "AT&T-syntax" (which is basically Motorola syntax) to this day.
Quote:
The @ prefixes an otherwise bare operand of an instruction to indicate it is intended as an absolute address. Any addressing mode notation # () [] , A: Z: is enough to show the intention (or non-intention) and @ is forbidden. Where @ is allowed and the assembler does not generate a warning (depending on the sophistication of its heuristics), @ is optional. @ has nothing to do with ADDR notation, but there's no reason why the two couldn't be used in conjunction (though I'd rather there was a shorter and less shouty symbol than "ADDR+".)
Code: Select all
LDY const ; give warning
LDY @const ; opcode AC or A4
Code: Select all
LDY const ; give warning
LDY @const ; LDY abs or LDY dp??
LDA <addr ; ditto here; LDA abs or LDA dp??
LDA @<addr ; LDA abs ; <N is NOT (N & 0xFF) on 65816. See LDA # below.
LDA A:addr ; LDA abs (for ca65 only)
LDA #<addr ; LDA #nn(nn) -- note that LDA #>01020304 will load $0203 into A!!
STA const ; AMBIGUOUS; STA A:$000F and STA Z:$0F are *NOT* the same thing on 65816!!
STA @const ; STA abs
Code: Select all
; new operators
HIBYTE x = (x & 0xFF00) >> 8
LOBYTE x = (x & 0x00FF)
HIWORD x = (x & 0xFFFF0000) >> 16
LOWORD x = (x & 0x0000FFFF)
; for WDC compatibility:
^ x = HIWORD x
> x = LOWORD (x >> 8)
< x = LOWORD x
; typecasts:
@ x = (make x an absolute address)
# x = (make x an immediate value)
& x = (make x a long-absolute address)
* x = (make x a direct-page address)
Code: Select all
LDY const ; give warning
LDY *const ; LDA dp
LDY @const ; LDY abs
LDA <addr ; warning: LDA abs or LDA dp??
LDA @<addr ; LDA abs
LDA *<addr ; LDA dp
LDA #<addr ; LDA #nn(nn) -- note that LDA #>01020304 will load $0203 into A!!
STA const ; for sake of typing consistency, this would be a warning.
STA *const ; STA dp
STA @const ; STA abs
Quote:
@ notation is appropriate when the problem is framed as "# being left off instructions." ADDR notation is an appropriate response to "constants being used as addresses" (in which case STA const should give a warning.) I prefer @ notation as ADDR doesn't cover the case of an address being used as an address when it should have been used as a constant.
Quote:
We'll see, I suppose, which syntax wins out.
So, with that in mind, this will be my final post on the topic. I think my opinion on this matter is already very well known, and we're flogging a dead horse.