nurpax / c64jasm

C64 6502 assembler in TypeScript
51 stars 14 forks source link

support decimal numbers with leading zeros #55

Closed neochrome closed 5 years ago

neochrome commented 5 years ago

Specifying decimal numbers with a leading zero gives a syntax error:

Syntax error: Expected "!=", "%", "&", "&&", "(", "*", "+", "-", ".", "/", ";", "<", "<<", "<=", "==", ">", ">=", ">>", "[", "\n", "^", "e", "|", "||", or end of input but "1" found.

While binary and hexadecimal allows it. Mininal example:

sta #%01
sta #$01
sta #0
sta #01 ; <--- this gives the error
nurpax commented 5 years ago

I’d prefer not to support this as leading zeros before decimals in C are the octal number syntax. I don’t plan on supporting these and thought better reject them in syntax.

neochrome commented 5 years ago

ahh, cool. Thought I should mention it in case it was unintentional :)

nurpax commented 5 years ago

Cool.. My disassembler may actually confusingly generate these.. there is a bug in it that immediate fields like "LDA #01" are missing the $ sign, should be "LDA #$01"