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


Forums > C64 Coding > Kick Assembler: Creating Binary Header
2018-03-20 09:58
Raistlin

Registered: Mar 2007
Posts: 14
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...
 
... 1 post hidden. Click here to view all posts....
 
2018-03-20 15:07
lft

Registered: Jul 2007
Posts: 352
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 16:20
TWW

Registered: Jul 2009
Posts: 433
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 16:59
Raistlin

Registered: Mar 2007
Posts: 14
@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 17:12
Scan

Registered: Dec 2015
Posts: 63
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 17:27
Raistlin

Registered: Mar 2007
Posts: 14
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 18:08
Cruzer

Registered: Dec 2001
Posts: 959
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 18:20
TWW

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

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

Registered: Jul 2009
Posts: 433
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
2018-03-20 22:50
Raistlin

Registered: Mar 2007
Posts: 14
I don't believe fixed size will work .. the header includes an "information stream" at the end of variable size.. and the "actual" machine code must follow directly after that.

Sorry to trouble everyone .. I think, for now, appending the binary data outside of Kick Ass, for now, is probably the best solution...

Either that or I modify the Spindle source code to use a fixed size header instead (I can just make that fixed size larger than I'll ever need)...
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
Moloch/TRIAD
Elder0010/Onslaught
Dymo/G★P
saimo
skull
Britelite/Dekadence
Guests online: 41
Top Demos
1 Uncensored  (9.7)
2 Edge of Disgrace  (9.7)
3 Coma Light 13  (9.6)
4 The Shores of Reflec..  (9.6)
5 Comaland 100%  (9.6)
6 We Come in Peace  (9.6)
7 Lunatico  (9.6)
8 Incoherent Nightmare  (9.5)
9 Wonderland XII  (9.5)
10 Wonderland XIII  (9.5)
Top onefile Demos
1 Dawnfall V1.1  (9.5)
2 Synthesis  (9.5)
3 FMX Music Demo  (9.5)
4 Pandemoniac Part 2 o..  (9.5)
5 Daah, Those Acid Pil..  (9.5)
6 Treu Love [reu]  (9.5)
7 Merry Xmas 2017  (9.4)
8 Dawnfall  (9.4)
9 Gubbdata 2017 Invite  (9.3)
10 SidRok  (9.3)
Top Groups
1 Oxyron  (9.4)
2 Booze Design  (9.4)
3 Censor Design  (9.4)
4 Finnish Gold  (9.4)
5 Crest  (9.3)
Top Swappers
1 Derbyshire Ram  (10)
2 Splatterhead  (9.8)
3 Zyron  (9.8)
4 Acidchild  (9.8)
5 Walker  (9.7)

Home - Disclaimer
Copyright © No Name 2001-2018
Page generated in: 0.219 sec.