nurpax / c64jasm

C64 6502 assembler in TypeScript
51 stars 14 forks source link

Unsupported operator ! does not report line number #87

Open micheldebree opened 1 year ago

micheldebree commented 1 year ago

I try to use a "fake" boolean variable, and apply the ! (not) operator. This is not supported. The following gives a message that is quite clear, but doesn't report the line number. It is hard to find the error without the line number.

I would expect the line number to be reported so I can find the error.

Nice to have would be to support the ! operator, or support real booleans

!let debugging = 1

!if (!debugging) {
  lda #0
}

Gives

|| /Users/michel/Commodore64/Dev/xmastree/node_modules/c64jasm/dist/src/asm.js:1399
||                 throw err;
||                 ^
|| 
|| Error: Unhandled unary operator !
||     at Assembler.evalExpr (/Users/michel/Commodore64/Dev/xmastree/node_modules/c64jasm/dist/src/asm.js:639:31)
||     at Assembler.checkDirectives (/Users/michel/Commodore64/Dev/xmastree/node_modules/c64jasm/dist/src/asm.js:1083:44)
||     at Assembler.assembleLine (/Users/michel/Commodore64/Dev/xmastree/node_modules/c64jasm/dist/src/asm.js:1318:18)
||     at assemble (/Users/michel/Commodore64/Dev/xmastree/node_modules/c64jasm/dist/src/asm.js:1259:22)
||     at Assembler.assembleLines (/Users/michel/Commodore64/Dev/xmastree/node_modules/c64jasm/dist/src/asm.js:1283:16)
||     at Assembler.assemble (/Users/michel/Commodore64/Dev/xmastree/node_modules/c64jasm/dist/src/asm.js:1388:22)
||     at Object.assemble (/Users/michel/Commodore64/Dev/xmastree/node_modules/c64jasm/dist/src/asm.js:1474:13)
||     at compile (/Users/michel/Commodore64/Dev/xmastree/node_modules/c64jasm/dist/src/cli.js:60:26)
||     at Object.<anonymous> (/Users/michel/Commodore64/Dev/xmastree/node_modules/c64jasm/dist/src/cli.js:187:12)
||     at Module._compile (node:internal/modules/cjs/loader:1165:14)