| |
Raistlin
Registered: Mar 2007 Posts: 554 |
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... |
|
| |
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
:) |
| |
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? |
| |
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. |
| |
Raistlin
Registered: Mar 2007 Posts: 554 |
@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... |
| |
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.
|
| |
Raistlin
Registered: Mar 2007 Posts: 554 |
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 ;-) |
| |
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. |
| |
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? |
| |
Raistlin
Registered: Mar 2007 Posts: 554 |
Yeah, that could be a way to do it. Id rather KA let me do it more cleanly - but that would definitely work. Thanks :-) |
| |
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 |