Log inRegister an accountBrowse CSDbHelp & documentationFacts & StatisticsThe forumsAvailable RSS-feeds on CSDbSupport CSDb Commodore 64 Scene Database
 Welcome to our latest new user Hairdog ! (Registered 2020-07-13) You are not logged in 
CSDb User Forums

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

Registered: Apr 2004
Posts: 106
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
... 59 posts hidden. Click here to view all posts....
2020-07-01 10:24

Registered: Dec 2001
Posts: 9327
one reason: to do that, you must know all and every keyword that you will ever use in advance, our your sources will randomly break in the future. it also makes the parser much easier and less messy to do. and its more consistent too.
2020-07-01 13:44

Registered: Apr 2004
Posts: 106
I can add a '--dot-meta' option that would

* Change prefix of meta to dot
* Require that you not put any meta commands or opcodes in the first column
* Require that you _do_ put assignments in the first column

.local_symbol = 3
    .print .local_symbol
    lda #.local_symbol
    beq .skip

... but I don't really like it :)
2020-07-01 19:12

Registered: Apr 2004
Posts: 106
This is how it's starting to work now. Needs tweaking for sure but will give a lot of possibilities.

!section "ZP", start=$00, size=$100, flags=NoStore
!section "RAM", start=$801, size=$9f00-$0801, flags=NoStore
;!section "HIRAM", start=$a000, size=$2000, NoStore
!memory "HIRAM",$a000,$2000

!section "DATA", in="RAM", flags=NoStore

!section "main", in="RAM", flags=First {
    !section "ZP" {
        var0: !ds 1
    !section "sine" in="DATA" {
        sine: !rept 256 { !byte sin(i) }
    lda sine,x
    sta var0

; Put pointer to given string or array in XY
!macro xyptr(a) {
    !section "DATA" {
        !fill a
    ldx #>.local
    ldy #<.local

!section "extra", in="HIRAM" {


!section "other", in="HIRAM" {



!section <args...> [ { <statements> } ]

Arguments can be positional or named. The arguments are in order:

name - Name of the section to open up or create
start - Start address of the section (load address)
pc - Initial Program counter for this section (runtime address)
flags - Flags for the section
in - Parent section for this section
size - Fixed size of this section
fill - Fill char for this section if not filled up to _size_

If _name_ is not provided, an anonymous section is created.

If _start_ is provided, this creates a new section. It is an error
if a section with this name already exists.

If _start_ is not provided, _name_ must exist or this must be a child

if _pc_ is not provided, it defaults to _start_.

NoStore: means this section will not be saved.
ReadOnly: means it will be located in ROM
First: means this section should come first in its parent

if _in_ is specified, this section is a child section.

A child section can not be reopened, and does not need to be named.

A child section will start at it's parents start, and will increase
it's parent pc to it's size.

A parent section should not have a different load and runtime address

The parent of a child section _must_ be a NoStore section.

Opening up an existing section and creating a child section is similar,
except in the latter case a new section is created.

`!memory <name> <start> <size>`

Short hand to create a NoStore section that can be the parent of other sections
2020-07-01 19:38

Registered: Jun 2002
Posts: 1685
Yeah, that feels like a nice approach. With that you could also include the section definitions externally and thus have a structure similar to ca65's link-files.
2020-07-02 13:56

Registered: Apr 2004
Posts: 106
Ok now this:

Sections form a tree. Only leaf sections may contain data.

You can not "open up" sections, only add a section to a
parent section.

Root sections usually have fixed size and fixed start.

After an assembly pass, go through the tree and place all sections sequentially in their parent.
Now all sections will have a fixed start address.

If any section was moved, we need to do another pass.

; Root sections
!section "RAM" start=$0000 size=64*1024 NoStore
!section "ZP" start=$00 size=256 NoStore

; Non-leaf section
!section "text" in="RAM" NoStore Last

; Leaf section
!section "code" in="RAM", start=$801 {
    ; Basic start and such
    ; Another leaf section, defined recursively
    !section in="text" {
        name: !text "name"
    lda name,x

2020-07-02 14:41

Registered: Jun 2002
Posts: 1685
What does NoStore mean in a parent section actually?
2020-07-02 14:57

Registered: Apr 2004
Posts: 106
Well NoStore should be implied in any non-leaf section now.

It means it will not be any data in the section.
2020-07-03 08:53

Registered: Jun 2002
Posts: 1685
Quote: Well NoStore should be implied in any non-leaf section now.

It means it will not be any data in the section.

Yup, I guessed as much. You really need output directives to root sections also, i.e. to what file they should be emitted.
2020-07-03 11:03

Registered: Apr 2004
Posts: 106
Sure, that already works. Although I need to allow file ouput section to overlap I guess.
2020-07-03 12:10

Registered: Apr 2004
Posts: 106
Here is the new Section documentation (and other meta commands):

Previous - 1 | 2 | 3 | 4 | 5 | 6 | 7 - 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
Users Online
Guests online: 97
Top Demos
1 Comaland 100%  (9.7)
2 Uncensored  (9.7)
3 Edge of Disgrace  (9.7)
4 Coma Light 13  (9.6)
5 Unboxed  (9.6)
6 The Shores of Reflec..  (9.6)
7 Lunatico  (9.5)
8 Remains  (9.5)
9 NGC 1277 100%  (9.5)
10 C=Bit 18  (9.4)
Top onefile Demos
1 Listen to Your Eyes  (9.6)
2 MD202006 - Get Well ..  (9.6)
3 The Tuneful Eight [u..  (9.5)
4 Smile to the Sky  (9.5)
5 Crystal Gazer  (9.5)
6 Dawnfall V1.1  (9.5)
7 Instinct  (9.5)
8 Coro(l)na Nuthouse  (9.5)
9 Rewind  (9.5)
10 Bad Boy  (9.5)
Top Groups
1 PriorArt  (9.6)
2 Performers  (9.5)
3 Booze Design  (9.4)
4 Fossil  (9.4)
5 Censor Design  (9.4)
Top Coders
1 Bjørn Røstøen  (9.9)
2 Sparta  (9.8)
3 Axis  (9.8)
4 Graham  (9.8)
5 ZeroPaige  (9.8)

Home - Disclaimer
Copyright © No Name 2001-2020
Page generated in: 0.058 sec.