Sakrac / x65

6502 Macro Assembler in a single c++ file using the struse single file text parsing library. Supports most syntaxes.
MIT License
38 stars 7 forks source link

WDC 65816 addressing modes #4

Open Sakrac opened 5 years ago

Sakrac commented 5 years ago

Support WDC addressing mode syntax modifiers: < for Direct (.z) | for Absolute (.a)

for Long (.l)

Sakrac commented 5 years ago

more details: http://datasheets.chipdb.org/Western%20Design/w65c816s.pdf (starting on page 50)

Sakrac commented 5 years ago

This has been updated, I hopefully caught all address mode indications with >, |, ! and <

dwsJason commented 5 years ago

I can confirm >, |, and < appear to work, but ! seems to evaluate to address 0, lst output from the assembler below

$0017 a5 30 lda $30 3+2 lda <$101030 $0019 a5 30 lda $30 3+2 lda <$1030 $001b ad 00 00 lda $0000 4+ lda !$1010 $001e ad 00 00 lda $0000 4+ lda !$101030 $0021 ad 30 10 lda $1030 4+ lda |$101030 asm/waitkey.s(58): $0024 8f 10 c0 e0 sta $e0c010 5+ sta >$e0c010

Sakrac commented 5 years ago

I had to disable ! because it caused a greater syntax conflict. I have some ideas to check the value for other operators to disambiguate but not quite done thinking yet.

dwsJason commented 5 years ago

Could you use the fact that it will always be the first character of the expression?

Sakrac commented 5 years ago

That is valid for both use cases, but I think in this case it would not be the end character or followed by an operator (+, -, etc.).