Search code examples
assembly6502c64commodore

What dialect of C64 6502 assembly is this?


What dialect of 6502 Assembly is this and how do I compile it without translating it into a different 6502 dialect?

*=$0900
    jmp Start

SCRN_START=$0400
Print=$ffd2
Basin=$ffcf

incasm "Character_ASCII_Const.asm"

defm    PrintText
    ldy #>/1             ; Load Hi Byte to Y
    lda #</1             ; Load Lo Byte to Acc.
    jsr String              ; Print The text until hit Zero
endm

Start
    lda #$83
    clc
    sbc #$02
    jsr PrintAccumlator
    rts

I am currently using CC65 as my 6502 assembler.
I compile my code as follows:

$ cl65 -o mycode.prg -u __EXEHDR__ -t c64 -C c64-asm.cfg mycode.asm

But this means that I have had to make edits to the above code so it now looks like this.

jmp Start

SCRN_START=$0400
Print=$ffd2
Basin=$ffcf

.include "Character_ASCII_Const.asm"

.macro PrintText value
    ldy #>value             ; Load Hi Byte to Y
    lda #<value             ; Load Lo Byte to Acc.
    jsr String              ; Print The text until hit Zero
.endmacro

Start:
    lda #$83
    clc
    sbc #$02
    jsr PrintAccumlator
    rts

And this is my c64-asm.cfg

FEATURES {
    STARTADDRESS: default = $0801;
}
SYMBOLS {
    __LOADADDR__: type = import;
}
MEMORY {
    ZP:       file = "", start = $0002,  size = $00FE,      define = yes;
    LOADADDR: file = %O, start = %S - 2, size = $0002;
    MAIN:     file = %O, start = %S,     size = $D000 - %S;
}
SEGMENTS {
    ZEROPAGE: load = ZP,       type = zp,  optional = yes;
    LOADADDR: load = LOADADDR, type = ro;
    EXEHDR:   load = MAIN,     type = ro,  optional = yes;
    CODE:     load = MAIN,     type = rw;
    RODATA:   load = MAIN,     type = ro,  optional = yes;
    DATA:     load = MAIN,     type = rw,  optional = yes;
    BSS:      load = MAIN,     type = bss, optional = yes, define = yes;
}

Solution

  • This is an assembly file for CBM prg studio.

    There's no easy way to use these with other assemblers as far as I know. But some simple search/replace will get you most of the way there.