Log inRegister an accountBrowse CSDbHelp & documentationFacts & StatisticsThe forumsAvailable RSS-feeds on CSDbSupport CSDb Commodore 64 Scene Database
You are not logged in - nap
CSDb User Forums


Forums > C64 Coding > Badass - New 6502 Assembler
2020-06-28 17:47
Sasq

Registered: Apr 2004
Posts: 157
Badass - New 6502 Assembler

The last couple of months I've created a new 6502 Assembler called bass (or Badass).

The basic idea is for it to be as advanced as Kickassembler, but with a less complex, more unified syntax.

And it also has unit tests in an internal emulator.

You can find it at https://github.com/sasq64/bass

I've started a tutorial here: http://apone.org/bass/part1.html

Here is an example C64 source http://apone.org/bass/example.asm.html
 
... 106 posts hidden. Click here to view all posts....
 
2020-07-23 23:45
Frantic

Registered: Mar 2003
Posts: 1661
Good work there, sir! I didn't manage to build bass on my MacOS 10.13 system though, due to various errors when compiling. Too bad.
2020-07-24 08:53
Sasq

Registered: Apr 2004
Posts: 157
Yes Apples clang still lacks many C++17 features. I'll see what I can do...
2020-07-24 09:42
Boogaloo

Registered: Aug 2019
Posts: 24
I'm following this with great interest. I'll try it out soonish. Great work so far!

(And I agree with JackAsser about the clean C++ code.)
2020-07-24 10:04
Sasq

Registered: Apr 2004
Posts: 157
OK, removed shared_ptr<T[]> which is not supported by OSX yet it seems, should build now.
2020-07-24 10:10
Sasq

Registered: Apr 2004
Posts: 157
@Boogaloo Thanks!
2020-07-24 10:12
Sasq

Registered: Apr 2004
Posts: 157
Here is an example of indexed labels and unit testing, based
on a snippet from Trash that wanted this feature;

; constant D011VALUE == value in d011

D011VALUE = 0

!macro DrawRasterColors(row) {
    !if (row & 7) == (D011VALUE & 7) {
    ; 23 cycle macro
    col[row]:
        lda #0                  ;  2
        sta $d020               ;  6
        sta $d021               ; 10
        !rept 5 { nop }
        bit $ea                 ; 23
    } else {
    ;63 cycle macro
    col[row]:
        lda #0                  ;  2
        sta $d020               ;  6
        sta $d021               ; 10
        !rept 25 { nop }
        bit $ea                 ; 63
    }
}

!section "main", $c000

!rept 6*8 {
    DrawRasterColors(i + $40)
}

!test "bad" {
    DrawRasterColors(0)
}
!assert tests.bad.cycles == 23

!test "good" {
    DrawRasterColors(1)
}
!assert tests.good.cycles == 63

!test "modify" {
    lda #9
    sta col[$40]+1
    lda #8
    sta col[$41]+1
}
!assert tests.modify.ram[$c001] == 9
!assert tests.modify.ram[$c010] == 8
2020-07-25 08:41
Oswald

Registered: Apr 2002
Posts: 5127
indexed labels is nice, lot of guys need that when creating selfmodded speedcode with macros :)
2020-09-16 10:34
Raistlin

Registered: Mar 2007
Posts: 771
I was interested in trying out this assembler .. but .. trying to compile the source, I'm getting some problems..

On Windows, CMake is refusing to generate the compile_commands.json file ....

Anyone know what might be needed to get this compiling on Windows?
2020-09-17 21:12
Sasq

Registered: Apr 2004
Posts: 157
`compile_commands.json` are not needed for building, only for Intellisense features in editors such as Visual Studio Code.
2020-09-17 21:30
Sasq

Registered: Apr 2004
Posts: 157
The `dev` branch is where it's happening BTW.

The following is an example on how you can let the assembler "pre-render" sid register data for faster playback (like the Dane part in Edge of Disgrace):

    !script "../lua/sid.lua"

    data = load("../data/test.sid")
    sid = sid_parse(data)
    
    !section "music", sid.load
music:
    !fill sid.data

%{

    sid_data = nil

    function generate_data()

        map_bank_write(0xd4, 1, function(adr, val)
            if sid_data then
                table.insert(sid_data, adr - 0xd400)
                table.insert(sid_data, val)
            end
        end)

        start_run()
        init = sym("sid.init")
        play = sym("sid.play")
        set_a(0)
        call(init)
        sid_data[#sid_data - 1] = sid_data[#sid_data - 1] | 0x80
        for i=1,15*50 do
            l = #sid_data
            call(play)
            if l ~= #sid_data then
                sid_data[#sid_data - 1] = sid_data[#sid_data - 1] | 0x80
            else
                print("Silent frame")
            end
        end
    end

    function get_sid_data()
        sid_data = {}
        generate_data()
        result = sid_data
        sid_data = nil
        return result
    end
}%

    !text "SID"
sid_data:
    !fill get_sid_data()
Previous - 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 - Next
RefreshSubscribe to this thread:

You need to be logged in to post in the forum.

Search the forum:
Search   for   in  
All times are CET.
Search CSDb
Advanced
Users Online
TheRyk/MYD!
Abynx/Wavefx
csabanw
NthSt4r
Steffan/BOOM!
Guests online: 414
Top Demos
1 Next Level  (9.7)
2 13:37  (9.7)
3 Codeboys & Endians  (9.7)
4 Mojo  (9.6)
5 Coma Light 13  (9.6)
6 Edge of Disgrace  (9.6)
7 Signal Carnival  (9.6)
8 Wonderland XIV  (9.5)
9 Uncensored  (9.5)
10 Comaland 100%  (9.5)
Top onefile Demos
1 Nine  (9.7)
2 Layers  (9.6)
3 Cubic Dream  (9.6)
4 Party Elk 2  (9.6)
5 Copper Booze  (9.5)
6 Scan and Spin  (9.5)
7 Onscreen 5k  (9.5)
8 Grey  (9.5)
9 Dawnfall V1.1  (9.5)
10 Rainbow Connection  (9.5)
Top Groups
1 Artline Designs  (9.3)
2 Booze Design  (9.3)
3 Oxyron  (9.3)
4 Performers  (9.3)
5 Censor Design  (9.3)
Top Diskmag Editors
1 Magic  (10)
2 Jazzcat  (9.5)
3 hedning  (9.2)
4 Elwix  (9.1)
5 Peter  (9.0)

Home - Disclaimer
Copyright © No Name 2001-2025
Page generated in: 0.044 sec.