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 > Kick Assembler: Creating Binary Header
2018-03-20 08:58
Raistlin

Registered: Mar 2007
Posts: 553
Kick Assembler: Creating Binary Header

Does anyone know if there's an easy way to append a binary-format header to a Kick Assembler generated file..?

At the top of my ASM, I have:-

// efo header
.byte 'E','F','O','2' // fileformat magic:4
.byte 0,0
.byte <Entry, >Entry
.. more data ..

*= $0200 "MainEntry"
Entry:
lda #$3e
.. rest of code


However .... unless I put "*= $01e4" at the top of the file, the binary header ends up defaulting to $1000 .. and goes -after- my code block in the binary file.

I use the "-binfile" option in KickAssembler to generate a binary file - all that this does, of course, is to strip the 2-byte header from the PRG:-

java -jar KickAss.jar SourceCode\Main.asm -odir ..\Intermediate -o Intermediate\main.efo -binfile

It "sort of" works to do the *=$01e4 thing .. but it just feels like a huge unnecessary hack...
2018-03-20 13:44
Cruzer

Registered: Dec 2001
Posts: 1048
Don't think you can generate some data without specifying where to put it.

All I can help with is to reduce this line:
.byte <Entry, >Entry
To this:
.word Entry
:)
2018-03-20 14:07
lft

Registered: Jul 2007
Posts: 369
I haven't tried KickAss myself, so I don't know to achieve that. I'm sure it's possible somehow.

But, at least for the time being, does your part really have to start at $200? Is it a problem if it starts one EFO-header's worth of bytes later?
2018-03-20 15:20
TWW

Registered: Jul 2009
Posts: 541
Uncertain if this helps, but I use kickass to generate cartridge headers and bank headers. Look at the easyflash topic for info if relevant.
2018-03-20 15:59
Raistlin

Registered: Mar 2007
Posts: 553
@LFT: yeah, that's what I'm doing now... it just feels like KickAss should be able to do this - but I can't see from the docs that it can...

@TWW: I took a look. Some nice work there - but it doesn't look quite the same...
2018-03-20 16:12
Scan

Registered: Dec 2015
Posts: 110
Quote: @LFT: yeah, that's what I'm doing now... it just feels like KickAss should be able to do this - but I can't see from the docs that it can...

@TWW: I took a look. Some nice work there - but it doesn't look quite the same...


It should work, are you using the most recent version of Kick Assembler? Here it compiles without problem to $01e4 when I put *= $01e4 in front of it.

If you need to use -binary option you can just put this on top of your source:
.word $01e4
, so the first 2 bytes of the binary will point to the offset where you want the header to be loaded.

2018-03-20 16:27
Raistlin

Registered: Mar 2007
Posts: 553
Yep. The problem is, though, that the EFO Header is of a variable size and needs to lie exactly before the code so that Spindle (LFT's IRQ Loader) can handle it. As your example has $01ec-$01ff unused, ie. blank space in the resultant file, it won't work with Spindle currently.

Plus, as I add more files to the project, I always need to think about the size of the header I'm using and the start address of the code..

-if- Kick Assembler could output something to the output file, ignoring .pc completely, then that would be fantastic .. or if Spindle could cope with this otherwise somehow.

The alternative is that I switch assembler to use XA, which Spindle uses, but I've already switched assembler twice in the last month and have grown quite fond of Kick Assembler now ;-)
2018-03-20 17:08
Cruzer

Registered: Dec 2001
Posts: 1048
Is generating the header as a separate file and appending the two binaries together with a script an option? Otherwise, I would sugges asking in the Facebook group Retro Assembler, as that's where Slammer hangs out these days.
2018-03-20 17:20
TWW

Registered: Jul 2009
Posts: 541
Can't you calculate the size of the header file by subtracting Label_end - Label_start and pad if necessary?
2018-03-20 17:21
Raistlin

Registered: Mar 2007
Posts: 553
Yeah, that could be a way to do it. I’d rather KA let me do it more cleanly - but that would definitely work. Thanks :-)
2018-03-20 20:18
TWW

Registered: Jul 2009
Posts: 541
Here's one way to create a fixed size header/binary:

    .const FillByte    = $00
    .const BinarySize  = $20
    .const TextString  = "BlaBlaBla"

    .text TextString
    .fill BinarySize - textstring.size(),FillByte
 
... 3 posts hidden. Click here to view all posts....
 
Previous - 1 | 2 - 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
Freddie
Scooby/G★P/Light
Matt
Guests online: 167
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 The Ghost  (9.6)
9 Wonderland XIV  (9.6)
10 Bromance  (9.6)
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 Rainbow Connection  (9.5)
6 TRSAC, Gabber & Pebe..  (9.5)
7 Onscreen 5k  (9.5)
8 Wafer Demo  (9.5)
9 Dawnfall V1.1  (9.5)
10 Quadrants  (9.5)
Top Groups
1 Oxyron  (9.3)
2 Nostalgia  (9.3)
3 Booze Design  (9.3)
4 Censor Design  (9.3)
5 Crest  (9.3)
Top Graphicians
1 Sulevi  (10)
2 Mirage  (9.8)
3 Lobo  (9.7)
4 Mikael  (9.7)
5 Archmage  (9.7)

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