cc65 / cc65

cc65 - a freeware C compiler for 6502 based systems

Home Page:https://cc65.github.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

generic macpack contains invalid code

pm100 opened this issue · comments

; add - Add without carry
.macro  add     Arg1, Arg2
        clc
        .if .paramcount = 2
                adc     Arg1, Arg2
        .else
                adc     Arg1
        .endif
.endmacro

add a,b tries to assemble adc a,b which is not valid code

same is true for the sub macro

the docs do not mention the 2 arg version of add and sub but its very misleading to have this here (I was reading the .mac files in order to work out how to write macros)

valid for one of the weird 6502 variants perhaps?

Oh the solution is even easier - this is needed to support the indexed instructions. Ie it lets you write add $1234,y