/bass

Advanced 6502 assembler

Primary LanguageC++

The Bass 6502 Assembler

  • ACME like syntax

  • Aims to be on par with Kickassembler in automation/scriptability, but with less complexity

  • Unit tests through internal emulator

  • Open and easily extendable source

Building

Project is based on cmake and all dependencies are included.

Linux/OSX

  • Just type make. Binary will be placed in builds/debug

Windows

Open folder in Visual Studio (Normal or Code) and build.

If you can’t build yourself, there are windows binaries available from the github releases page.

Invoking

bass -i <source> -o <out.prg> -Dname=val …​

Further Documentation

User manual: http://apone.org/bass/

Example

    VRAM_LO = $9f00
    VRAM_HI = $9f01
    !macro SetVRAM(a) {
        .lo = <a;
        .hi = >a;
        lda #.lo
        sta VRAM_LO
        !if .lo != .hi { lda #.hi }
        sta VRAM_HI
    }

    !section "main", $1000
start:
    ; Clear 1K
    ldx #0
$   !rept 4 { sta $1000+i*256,x }
    dex
    bne -

    SetVRAM(0x1234)
    ldx #end - text
$   lda start,x
    sta $1000,x
    dex
    bne -
    rts

text:
    !byte "Text to copy", 0
end:

    ; --- Generate sine table with and without LUA

    mysin = [x, amp, size ->
        (sin(x * Math.Pi * 2 / size) * 0.5 + 0.5) * amp ]
sin:
    !rept 100 { !byte mysin(i, 255, 100) }

%{ -- LUA code
function make_sin(amp, size)
    res = {}
    for i=0,size-1,1 do
        res[i+1] = (math.sin(i * math.pi * 2/ size) * 0.5 + 0.5) * amp
    end
    return res
end
}%

sin2:
    !fill make_sin(255, 100)

    !assert make_sin(5, 5)[1] == round(mysin(1, 5,5))
    !assert make_sin(5, 5)[3] == round(mysin(3, 5,5))