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.
That is their syntactic point -- the idea is to make assembly language a bit more like a high-level language.
Not sure what you're saying here. You mean "the idea [of bracket-and-comma] is..." or "The idea [of all-alphabetic] is..."? If the latter, then reducing mnemonics to a simple label for an opcode byte (and a width specifier for the following operand) pushes the assembly language closer to machine code. As evidenced by the Forth examples quoted earlier.
Therefore, I must be talking about the former.
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.
But this particular problem
is not what is being discussed. Look at the subject of the message: LDA 5 versus LDA #5. We're specifically addressing the issue where you have ambiguity.
Quote:
And the mnemonics aren't such great mnemonics any more. Some people work better with brackets and commas.
This is a "what I learned first stays with me" issue. You only think this because you learned the current syntax first.
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+".)
Wait, what? I'm thoroughly confused by your proposition. Why bother with @ at all, if you already have A: and Z:?
Code:
LDY const ; give warning
LDY @const ; opcode AC or A4
You mean I have to actually work to decipher these opcodes? Uugh. I've offered a correction to the table, with published interpretations of various prefixes (published by WDC, I might add):
Code:
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
Even this table is pretty doggone confusing to me. What's needed is a distinguishing between types of access, and mathematical operators:
Code:
; 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)
So, with this, we can be far more precise:
Code:
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.
I have to giggle at this, because if we assume future assembler syntax takes this route, and to eliminate further ambiguities between (long-)absolute and direct page modes, then you end up with a system of prefixes that fundamentally aren't any different than one opcode, one mnemonic.
Quote:
We'll see, I suppose, which syntax wins out.
Nothing will change of course; WDC's syntax has defined the assembler syntax for decades.
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.