| |
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! |
|
... 4 posts hidden. Click here to view all posts.... |
| |
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? |
| |
Burglar
Registered: Dec 2004 Posts: 1101 |
his penis.bin was acting cocky |
| |
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! |
| |
chatGPZ
Registered: Dec 2001 Posts: 11386 |
just remove the -v3 from the acme command line, problem solved. |
| |
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. |
| |
chatGPZ
Registered: Dec 2001 Posts: 11386 |
acme can do it just fine =D |
| |
Krill
Registered: Apr 2002 Posts: 2980 |
Acme has a built-in Turing-complete programming language like KickAss? That's news to me.
But if you meant the solution for this specific problem, then it sucks. Opening a file, seeking to some position, extracting one single byte, closing the file again and then repeating this for a thousand times doesn't sound very efficient, to put it mildly. |
| |
chatGPZ
Registered: Dec 2001 Posts: 11386 |
obviously i was referring to the specific problem (what else really?)
and who cares if its efficient if it completes within practically zero time. seriously. (likely it will still be faster than a script in kickass =P)
if you look at the initial post (and the posted screenshots) then its pretty obvious that its all about removing the useless -v3 option. no more no less. |
| |
Krill
Registered: Apr 2002 Posts: 2980 |
Until a more complex problem pops up which cannot be handled with acme alone. And of course i've seen that the specific problem can be solved with that -v3 option. |
| |
chatGPZ
Registered: Dec 2001 Posts: 11386 |
obviously more complex stuff needs a different solution.... but including some bytes? come on :) |
Previous - 1 | 2 - Next |