Topics

UTTORI ASM · IN DEVELOPMENT

6502 family troubleshooting

Use 6502 family troubleshooting in 6502-family and NES projects, with syntax and limits.

On this page

6502 family behavior

“The output is empty at my org address”

On 65xx.raw, the address is probably below origin. Either org to origin or later, or set origin to the address you actually want at file offset 0.

On 65xx.nes, you probably forgot .segment "CODE" (or whatever segment loads a file = %O region). Without a current load MEMORY, toOutputOffset returns -1 and the write is skipped.

“I got 32 KiB of zeros before my program”

org $8000 with origin 0 is doing exactly what you asked. Set "origin": 32768 or assemble at org $0000.

“My zero-page instruction became absolute”

The equate is $100 or larger, or a forward label that was still 16-bit during sizing. Force lda.b / z:Name for zero page, or lda.w / a:Name for absolute. Zelda-style LDA a:ObjState, Y exists specifically for this.

“Instruction 'SLO' requires architecture '65xx.6502x'”

Documented NMOS (65xx.6502) rejects unofficial ops. Switch with arch 6502x or .setcpu "6502X".

“Instruction 'RMB0' is available on 65xx.65c02, not 65xx.6502”

Same idea: the mnemonic is real, just not on this CPU. Use .setcpu / arch rather than hoping the encoder will pick a cousin chip.

“.segment "OVERLAY" is not defined”

The name must appear in linkerConfig SEGMENTS. The default config only defines CODE.

“.incbin range is outside the file”

ca65 .incbin "file", offset, size is offset-plus-length, not an Asar $start..$end range. Offsets are from the start of the file. Size omitted means through EOF.

“.importzp / .local exploded”

Correct: they are rejected. Use .import for session-global names, and ordinary labels instead of .local. Relocatable zp imports are not in this profile.

“ca65 accepts this file”

If you think it should be working here, and it is not in the compatibility ledger above, please open an issue. Relocatable objects and full ld65 are not on the roadmap.

“My HuC6280 TMA failed with power-of-two”

TMA #imm encodes a bitmask. # $03 is illegal. # $01, # $02, # $04, … # $80 are the legal set. Numbered TMA3 is the same idea with the bit already chosen.