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: 155
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-24 09:42
Boogaloo

Registered: Aug 2019
Posts: 21
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: 155
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: 155
@Boogaloo Thanks!
2020-07-24 10:12
Sasq

Registered: Apr 2004
Posts: 155
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: 5022
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: 566
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: 155
`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: 155
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()
2020-09-17 22:28
JackAsser

Registered: Jun 2002
Posts: 1989
Quote: 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()


Hehe, awesome!
2020-09-17 22:36
Mr. SID

Registered: Jan 2003
Posts: 421
Yeah, you can do stuff like that with k2asm and Python too. Some of it is useful and other things are masturbatory coding... :)
Previous - 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 - 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
Sumaleth/Pearl
AMB/Level 64
Luca/FIRE
Oswald/Resource
Apollyon/ALD
wbochar
Knut Clausen/SHAPE/F..
macx
Ixon
Guests online: 147
Top Demos
1 Next Level  (9.8)
2 Mojo  (9.7)
3 Coma Light 13  (9.7)
4 Edge of Disgrace  (9.6)
5 Comaland 100%  (9.6)
6 No Bounds  (9.6)
7 Uncensored  (9.6)
8 Wonderland XIV  (9.6)
9 Memento Mori  (9.6)
10 Bromance  (9.5)
Top onefile Demos
1 It's More Fun to Com..  (9.7)
2 Party Elk 2  (9.7)
3 Cubic Dream  (9.6)
4 Copper Booze  (9.5)
5 TRSAC, Gabber & Pebe..  (9.5)
6 Rainbow Connection  (9.5)
7 Wafer Demo  (9.5)
8 Dawnfall V1.1  (9.5)
9 Quadrants  (9.5)
10 Daah, Those Acid Pil..  (9.5)
Top Groups
1 Nostalgia  (9.3)
2 Oxyron  (9.3)
3 Booze Design  (9.3)
4 Censor Design  (9.3)
5 Crest  (9.3)
Top Diskmag Editors
1 Jazzcat  (9.4)
2 Magic  (9.4)
3 hedning  (9.2)
4 Elwix  (9.1)
5 A Life in Hell  (9.1)

Home - Disclaimer
Copyright © No Name 2001-2024
Page generated in: 0.049 sec.