Sjasm 0.4 beta 6

van wolf_ op 11-11-2008, 00:07
Onderwerp: Development
Talen:

A new version of XL2s' cross assembler Sjasm has just been released! New in this version:

  • Fixed: 'unexpected' ascmap error
  • Fixed: error reports without list file
  • Fixed: more small bugs
  • Added: page range to PAGE command
  • Added: incbin.list, jr., djnz. and jp

Relevant link: XL2s

Reacties (13)

Van ARTRAG

Enlighted (6932)

afbeelding van ARTRAG

11-11-2008, 12:47

page range to PAGE command ?
Are you going to be a true MSX assembler ?
Wink
still I cannot see how sjasm can manage
roms, and in particular data to be allocated in RAM
you should try to get inspired by asMSX...

About RAM data, IMHO you should define segments for not initialized data
and segments for data that are initialized at boot time.

As sjasm now does a sort of linking and page management, sjasm should gather
data belonging to the two kinds of segments in the whole code and prepare accordingly the rom and ram.

I particular all the initial values are to be gathered and stored in a single ROM page, declaring ad hoc labels telling where they are.
You should also add a small standard boot code able to set to zero the not initialized variables and init the latter variables.
(very easy when you gather them in adjacent areas).

Van Guillian

Prophet (3516)

afbeelding van Guillian

11-11-2008, 14:30

I love this assembler Smile

ARTRAG, you can define RAM variables in this way:
MAP #C000
Var1: #1 ; 1 byte
Var2: #4 ; 4 bytes
Var3: #2 ; 2 bytes

Var1 = #c000, Var2 = #C001, Var3 = #C005

Van ARTRAG

Enlighted (6932)

afbeelding van ARTRAG

11-11-2008, 17:14

is map documented?
ok it is
http://home.wanadoo.nl/smastijn/sjasmman3.html#s4
I missed totally the use of this command...
BTW my propsal seems nicer ;)

Van sjoerd

Hero (609)

afbeelding van sjoerd

11-11-2008, 18:07

The page command only specifies in which page the code should be assembled. It does not automatically insert page switching code or something like that. I thought about it, and about inserting some start-up code, but I decided against it. I do not think an assembler should generate code by itself.

Sjasm did have more kinds of segments (maybe data even still works, just like code), but it didn’t really treat them differently.

So, Sjasm does not manage roms, defpage and page (and code) only help to put your code in the right place in the file. The programmer has to do all slot switching and initializations himself.

I think ARTRAG’s proposal makes it too easy to program roms. Programming in assembler should be hard Tongue

Van ARTRAG

Enlighted (6932)

afbeelding van ARTRAG

12-11-2008, 14:34

but if you want thake care of page mapping, why not evolve sjasm toward something that is very close to a linker.

Define segments and add attribute to them
Gather data and code for each segment in all files
Displace them in the pages according to their dipendences
Manage apart RAM segments of initialized and uninitialized data...

Van Edwin

Paragon (1182)

afbeelding van Edwin

12-01-2009, 01:03

In case the right party reads this Wink

There is a highly annoying bug in the "page" system where:

defpage 2, $8000, 8192
defpage 3, *, 8192

together with a

page 2..3

will give an out of space error, but will work just fine if you change it to

defpage 2, $8000, 16384

page 2

Of course the second one is not what I want because I can't get the right bank number automatically. Any change of hunting this down?

[edit] Note that the same thing happens for "page 2, 3"

Van sjoerd

Hero (609)

afbeelding van sjoerd

13-01-2009, 14:34

No, that is probably not a bug. It might be annoying though Tongue

Code that starts in one page cannot continue in another.

Maybe something like this works for you:

defpage 0, 4000h, 16384
defpage 2, 8000h, 16384
defpage 4, 8000h, 16384

Van Edwin

Paragon (1182)

afbeelding van Edwin

13-01-2009, 17:51

It's not code, but data. INCBIN's mainly.

And your suggestion doesn't really help because I want to identify the correct 8kb block with a :LABEL.

But if code/data can't cross page boundaries, then what on earth is the "page 0..3" syntax for?

Van sjoerd

Hero (609)

afbeelding van sjoerd

13-01-2009, 21:37

It's not code, but data. INCBIN's mainly.

But you do use the code command as follows, don’t you:

  code
label
  incbin blabla

  code
label
  incbin blabla
; and so on
 

Of course, if the data you include is larger than the page size, it will not fit.

And your suggestion doesn't really help because I want to identify the correct 8kb block with a :LABEL.

How do you identify the correct block if the data is in two pages?

But if code/data can't cross page boundaries, then what on earth is the "page 0..3" syntax for?

page 0..3 is just short for page 0,1,2,3. The following code or data could end up in any of the pages.

Van Edwin

Paragon (1182)

afbeelding van Edwin

14-01-2009, 01:10

I don't really use the "code" keyword.

What I'm doing is making rom data pages like this:

Data:
    db :dat1
    dw dat1 & $1FFF
    db :dat2
    dw dat2 & $1FFF
    db :dat3
    dw dat3 & $1FFF

dat1: incbin "a"
dat2: incbin "b"
dat3: incbin "c"

That way I can store large chunks of data and not waste space. Incidentally, this way I also kill the use of any memory rom loader. Wink

Van sjoerd

Hero (609)

afbeelding van sjoerd

23-01-2009, 12:21

You could make one large page at the end of the rom (or any other place) to put all data. Of course, you still can't use :label.

Anyway, I will put it on the nice to have list, along with ARTRAG's suggestions.

Van Edwin

Paragon (1182)

afbeelding van Edwin

24-01-2009, 23:54

Thanks! That would be nice. Maybe as some option to the code command.

I have by now used the function in a way that you probably intended it for. Letting sjasm sort out where to place data blocks and building a table to find them. Works nicely! However, the other method is still valid for large data blocks.

Van Huey

Prophet (2694)

afbeelding van Huey

26-09-2010, 10:16

Sorry for bumping, but I just found out that you need to have some space(s) or tab(s) before the defpage instruction.

It kept me busy for an hour or so......EvilCrying