dasm-assembler / dasm

Macro assembler with support for several 8-bit microprocessors

Home Page:https://dasm-assembler.github.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Do you support custom opcodes?

GZYangKui opened this issue · comments

I am implementing an emulator and would like to customize some exclusive operation codes for the emulator. Do you currently support custom operation codes?

Define Constant Byte doesn't work for you?

I have defined a constant with a value equal to $55 in my emulator, which is a debugging instruction. Then, when I embed this constant into the program and compile using dasm, the following error will occur:

BMAN. s (8): error: Unknown Mnemonic 'DEBUG'
BMAN. s (18): error: Unknown Mnemonic 'DEBUG'

DEBUG EQU $ff
RESET:
SEI; Reset PPU Disable NMI, turn off background and sprites
LDA # 0
STA PPU_ CTRL_ REG2
STA PPU_ CTRL_ REG1
CLD; The NES 6502 CPU has no BCD mode, reset the flag just in case
LDX # $FF; Set the stack pointer to the initial position
TXS
DEBUG

A macro is nice and clean, but you shouldn't need it for one line. Just use the equate and make sure the DC.B is not in coilumn 1.

DEBUG EQU is not the same and DC.B.

Assuming DEBUG isn't a reserved word

DEBUG EQU $FF

DC.B DEBUG

would also work. Whichever you prefer.