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 > Loading, packing and linking on crossdev
2011-07-17 07:13
Trap

Registered: Jul 2010
Posts: 223
Loading, packing and linking on crossdev

Hi all,

I've spent some time coding some stuff and now I'm at a point where I need to look at putting the whole thing together. Packing, linking, adding a loader for the parts etc.

I'm using KickAss.

How do you manage files in a crossdev environment? Do I need a D64-editor of some sort to put it all together?

What (IRQ-)loaders and packers are you using these days? .... a lot has happened since SledgeHammer, so please bear with me :)

Trap
 
... 19 posts hidden. Click here to view all posts....
 
2011-09-06 06:32
MagerValp

Registered: Dec 2001
Posts: 1078
Quoting Trap
is there an entirely different clever way to do this?


I suspect there are as many clever ways as there are C64 coders.
2011-09-06 06:46
Oswald

Registered: Apr 2002
Posts: 5094
here's what you'd want to keep in memory at all times:

$0200 - $0400 loader & depacker & one permanent raster irq 2 play music
$0400 - ~$1600 music
$1600 - $ffff anything else
2011-09-06 07:18
ready.

Registered: Feb 2003
Posts: 441
I don't know about makefile, I assemble each demo part individually then link "by hand".

About the loader, it depends a lot on how the demopart is coded.
If the main effect is running in the irq and the background program is not used, you can do "jsr loader" in the baground program, then the loader will return with an rts once all the data has been loaded.
Here:
Aurora 100%
I had the problem that both irq and background programs were used in several parts and I wanted to load inside the parts. I assigned a certain number of processor cylces to the loader, so the demo part can still run, even if a bit slower, but if the cycles stolen are few nobody cares.
To do this I start a single shot CIA2 timer in the IRQ and jump to the loader. After the CIA2 delay an NMI takes care of getting back from the loader to the IRQ and saves the loader location, so that the IRQ can jmp to it the next frame. You can easily decide how much resources the loader can use by setting the CIA2 delay.

And what Oswald said unless you have particular needs. For example in the last part of the Aurora 100% (upscroller) the music is played in the main program.
2012-08-30 10:26
ready.

Registered: Feb 2003
Posts: 441
once again I'm on packing and linking.
Usually I need to split the file I have to load into parts which are packed individually, so after compiling the file with 64tass, I load it in VICE monitor and save each part of the file separately.
Example in VICe monitor:
l"prg"0 (range $2000-$bfff)
s"prg0"0 2000 9fff
s"prg1"0 a000 bfff

then I pass the files prg0 and prg1 to Exomizer. Is there a way to split the prg file into subfiles from command line instead of using VICE?
2012-08-30 11:43
Mr. SID

Registered: Jan 2003
Posts: 424
You can use dd to split files. If you're on Unix, you already have it, on Windows you can download one of the many ports, like this one: http://www.chrysocome.net/dd

Then do:

dd if=prg of=prg0 bs=4096 count=8
dd if=prg of=prg1 bs=4096 skip=8 count=2

But I guess you'll also need start addresses in your files? In this case this will not work.
2012-08-30 14:02
ruk

Registered: Jan 2012
Posts: 43
You can in fact crunch plain files with exomizer by the <filename>@<adress> syntax.

F.ex.
exomizer mem -c -l none part.bin@0x2000 -o part.exo


2012-08-30 14:28
Mr. SID

Registered: Jan 2003
Posts: 424
Ah, good to know!
2012-08-31 08:18
Perplex

Registered: Feb 2009
Posts: 255
Quoting Mr. SID

dd if=prg of=prg0 bs=4096 count=8
dd if=prg of=prg1 bs=4096 skip=8 count=2

But I guess you'll also need start addresses in your files? In this case this will not work.


echo -ne "\x00\xa0" > prg1
dd if=prg of=prg1 bs=4096 skip=8 count=2 conv=notrunc oflag=append
2012-09-14 15:59
ready.

Registered: Feb 2003
Posts: 441
reading VICE docs:
6.10.1 Monitor command-line options

-moncommand FILENAME
Execute the commands from the file FILENAME in the monitor after starting up. This command line switch is mainly thought to load labels and to set breakpoints. Not all other commands are useful to be executed in this way, some may even lead to strange effects.

this comand could be useful to drive the monitor via command line, but most commands crash if executed this way :(
2012-11-06 13:39
ready.

Registered: Feb 2003
Posts: 441
Finally I found a solution which solved my problem of extracting certain areas of a binary file without using VICE monitor, but an automated command line process. Googling I found this for coping part of a binary:
http://stahlworks.com/dev/index.php?tool=partcopy
and this to assign a load address, modifing the first 2 bytes (it's a command line hex editor):
http://sourceforge.net/projects/hexciting/

So, here is an extract of a batch file used for preparing the files to load taken from Ninfa/Level64:

64tass --m6502 m.txt -o 040exp

sfk165 partcopy 040exp -fromto 0x6100 0x8402 a0.part1 -yes 
sfk165 partcopy 040exp -fromto 0x8802 0xb002 a0.part3 -yes
sfk165 partcopy entangled -fromto 0x0002 0x0402 a0.part2 -yes
copy /b a0.part1+a0.part2+a0.part3 041exp

sfk165 partcopy 040exp -fromto 0x8400 0x8802 046exp -yes

sfk165 partcopy 040exp -fromto 0xb000 0xda03 042exp -yes
sfk165 partcopy 040exp -fromto 0x0400 0x4002 043exp -yes
sfk165 partcopy 040exp -fromto 0x0000 0x0402 044exp -yes
sfk165 partcopy 040exp -fromto 0x4000 0x6102 045exp -yes


hexciting -v -a -r 0 2 041exp 0x00 0x00
hexciting -v -o -r 0 2 041exp 0x00 0x81
hexciting -v -a -r 0 2 042exp 0x00 0x00
hexciting -v -o -r 0 2 042exp 0x00 0xd0
hexciting -v -a -r 0 2 043exp 0x00 0x00
hexciting -v -o -r 0 2 043exp 0x00 0x24
hexciting -v -a -r 0 2 044exp 0x00 0x00
hexciting -v -o -r 0 2 044exp 0x00 0x20
hexciting -v -a -r 0 2 045exp 0x00 0x00
hexciting -v -o -r 0 2 045exp 0x00 0x60
hexciting -v -a -r 0 2 046exp 0x00 0x00
hexciting -v -o -r 0 2 046exp 0x00 0xa4

exomizer mem -c -l$e000 041exp -o 041 
exomizer mem -c -l$2000 042exp -o 042 
exomizer mem -c -l$2000 043exp -o 043 
exomizer mem -c -l$fe00 044exp -o 044 
exomizer mem -c -l$e000 045exp -o 045
exomizer mem -c -l$fd00 046exp -o 046

041, ....,046 are the compressed files to load from disk. This really boosted my work during the last months prior to X'2012, when bug fixing the linked demo disk.
Previous - 1 | 2 | 3 - 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
Andy/AEG
DeMOSic/MS^LSD^ONS
theK/ATL
Mike
Guests online: 99
Top Demos
1 Next Level  (9.7)
2 13:37  (9.7)
3 Mojo  (9.7)
4 Coma Light 13  (9.6)
5 Edge of Disgrace  (9.6)
6 What Is The Matrix 2  (9.6)
7 The Demo Coder  (9.6)
8 Uncensored  (9.6)
9 Comaland 100%  (9.6)
10 Wonderland XIV  (9.6)
Top onefile Demos
1 No Listen  (9.6)
2 Layers  (9.6)
3 Cubic Dream  (9.6)
4 Party Elk 2  (9.6)
5 Copper Booze  (9.6)
6 Dawnfall V1.1  (9.5)
7 Rainbow Connection  (9.5)
8 Onscreen 5k  (9.5)
9 Morph  (9.5)
10 Libertongo  (9.5)
Top Groups
1 Performers  (9.3)
2 Booze Design  (9.3)
3 Oxyron  (9.3)
4 Censor Design  (9.3)
5 Triad  (9.3)
Top Webmasters
1 Slaygon  (9.6)
2 Perff  (9.6)
3 Sabbi  (9.5)
4 Morpheus  (9.4)
5 CreaMD  (9.1)

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