sasq64 / bass

Advanced 6502 assembler
23 stars 4 forks source link

image:https://www.travis-ci.com/sasq64/bass.svg?branch=dev["Build (dev)", link="https://www.travis-ci.com/sasq64/bass"]

= The Bass 6502 Assembler

== Building

Project is based on cmake and all dependencies are included.

=== Linux/OSX

=== 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://minnberg.se/bass/

Tutorial: http://minnberg.se/bass/part1.html

Example: http://minnberg.se/bass/example.asm.html

== Example

[source,ca65]

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))