skilldrick / easy6502

http://skilldrick.github.com/easy6502/
1.24k stars 253 forks source link

Syntax error not thrown when using improper addressing mode #40

Open microaeris opened 5 years ago

microaeris commented 5 years ago

Love your emulator; it's the perfect learning tool for 6502. On the note of learning, I managed to write some impossible 6502 and the assembler didn't throw a syntax error. :^)

  LDA #$01
  LDX #$01
  LDY #$00
loop:
  EOR X         ; Nope
  STA $0200,Y
  INY
  CPY #$10
  BNE loop

Assembled output:

0600: a9 01 a2 01 a0 00 4d ff ff 99 00 02 c8 c0 10 d0 
0610: f5 

Expected output: An error message calling me silly names for writing that.

BigEd commented 5 years ago

I think the assembler will have taken X to be a label (or variable) - it has no defined value, but we don't detect unassigned variables, because they will always be there in the first pass. Perhaps we need to make the second pass more careful.

Thanks for the kind words... I'll keep this issue open, perhaps some day will have a proper look at the code. It's been a while.