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 > Including selected bytes from binary files using ACME
2015-01-22 10:04
Mantiz
Account closed

Registered: Apr 2006
Posts: 36
Including selected bytes from binary files using ACME

Looking for the proper way to include every 4th byte from a binary and put all the included bytes next to each other in the memory (Using ACME).

If the binary contains the text "commodore 64 computer", I would like to have this to appear in memory "coe pr".
I am currently doing it with a for-loop using !bin and counters, but the compiler report generates a very long list drowning the important messages in it.

I know I can save the memory range with a monitor to another binary, which then can be included in another assembly run to get rid of the long list, but this must be possible to achieve with a clever macro to just include the file once and then take the desired bytes from it.

Please point me in the right direction and if possible include a bit of code. Thanks!
2015-01-22 11:34
Oswald

Registered: Apr 2002
Posts: 5094
I simply add a _Step 4_ to my VB precalculator in such situations. Ppl want to do everything at compile time these days.
2015-01-22 11:54
chatGPZ

Registered: Dec 2001
Posts: 11386
why not simply put your loop thingy in a seperate asm file, assemble it and then include the resulting binary? i dont think acme can do what you want in a more compact way (and why should it really)
2015-01-22 13:08
Mantiz
Account closed

Registered: Apr 2006
Posts: 36
Thanks for reading and the responses.

I was afraid it would be something like that, but I figured I ask the pros before giving up the idea or reinventing the wheel again. I hoped it would be possible to pre-arrange the data before actually putting it into memory upon include.

I will run a routine on init that will arrange the data as needed instead.
2015-01-22 14:46
Oswald

Registered: Apr 2002
Posts: 5094
Consider KickAss then, maybe it suits your style better.
2015-01-22 15:14
Bitbreaker

Registered: Oct 2002
Posts: 508
!for .x,0,49 {        ;will do 50 runs
        !bin "penis.bin",1,.x * 4
}


Throwing no errors or warnings here and all is fine? So where's the problem?
2015-01-22 17:43
Burglar

Registered: Dec 2004
Posts: 1101
his penis.bin was acting cocky
2015-01-22 18:49
Mantiz
Account closed

Registered: Apr 2006
Posts: 36
Bitbreaker: I am doing a loop like that. The problem is not getting errors, but rather the feedback from the assembler as it includes files. Everytime it includes a byte it will generate a line telling it put a byte in an address. This list becomes very long if you include 1k of data this way.

I have generated two screenshots to explain what I mean, one with the loop and one without.

http://forumbilder.se/EA4BQ/example1.PNG
http://forumbilder.se/EA4BQ/example2.PNG

The only way I have found to avoid it is to either have the binfile already provided to the assembler in the right format, or do like the ostrich and set the verbosity level to 1 for Acme (meaning it won't show the actual addresses for any includes at all).

Anyway, I have prepared the datafile itself now as Groepaz suggested so it can be included with a separate include. Still bothers me somehow to use a workaround like that, but at least it gets the job done.

Thanks!
2015-01-23 07:21
chatGPZ

Registered: Dec 2001
Posts: 11386
just remove the -v3 from the acme command line, problem solved.
2015-01-24 14:41
Krill

Registered: Apr 2002
Posts: 2980
Really, use your favourite scripting language to create an intermediate file and include it with one line.
Sprinkle some Makefile magic on top to avoid unnecessarily rebuilding that file on every compile run.
As Oswald said, why do everything in your source code? If you really need to, use another assembler which was made for that paradigm, like the proposed KickAss.
2015-01-24 15:06
chatGPZ

Registered: Dec 2001
Posts: 11386
acme can do it just fine =D
 
... 4 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
csabanw
goto80/HT
DanPhillips
Peacemaker/CENSOR/Hi..
Holy Moses/Role
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 Triad  (9.3)
5 Censor Design  (9.3)
Top Graphicians
1 Mirage  (9.8)
2 Archmage  (9.7)
3 Pal  (9.6)
4 Carrion  (9.6)
5 Sulevi  (9.6)

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