easy6502 icon indicating copy to clipboard operation
easy6502 copied to clipboard

Syntax error not thrown when using improper addressing mode

Open microaeris opened this issue 5 years ago • 1 comments

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.

microaeris avatar Mar 19 '19 07:03 microaeris

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.

BigEd avatar Aug 09 '19 12:08 BigEd