| |
GI-Joe
Registered: Sep 2015 Posts: 21 |
exomizer: assembler fragments with loops
Howdee!
Is it possible to use
exomizer sfx 0x0a00 -s '....'
with assembler fragments that have a small loop ?
If so, what is the syntax for i.e. 'bpl *-4' here?
I always got syntax errors in all kinds of attempts :(
It would also be good to know in general with which syntax these fragments run ? Syntax from a c64(vice?)-monitor or from acme or from which assembler ?
Or would it be possible to inject these code fragments as bytecode?
That would already be a solution that could be worked with.
thanxx |
|
| |
Mixer
Registered: Apr 2008 Posts: 454 |
Do you mean that you wish to pack noncompiled ascii assembler code? And then want to compile and execute it runtime?
I do not think that this is a use case for Exomizer or bit packer in general, but one could do some jvm like apparatus that executes bytecode, like the basic language interpreter... |
| |
Gordian
Registered: May 2022 Posts: 87 |
I think, GI-Joe asks how to put branch with relative addressing (which is part of a loop) into custom assembler fragment executed at start of crunching. |
| |
Gordian
Registered: May 2022 Posts: 87 |
I did some tests on two different sizes files.
I put "bpl -4", but it generates wrong offset, so I put just "bpl 0" which gives "value -292 out of range for op ...".
I don't know where this offset comes from, but it means if you want to get offset -4 just put "bpl 288". |
| |
Digger
Registered: Mar 2005 Posts: 438 |
Would it not slow down the depacker though? |
| |
Gordian
Registered: May 2022 Posts: 87 |
Oh, I'm sorry!
I've tested with -x flag which gives value -292. But before branch instruction exists "lda #$f sta $d020 sta $d021".
-x option with branch at start gives -284 value,
-s option gives -2063 value with branch at start,
-f gives -439.
So it must be chosen on the basis of tests.
@Digger, according to the manual custom fragment is executed "when decruncher starts", so shouldn't slow it down. |
| |
GI-Joe
Registered: Sep 2015 Posts: 21 |
Quote: I think, GI-Joe asks how to put branch with relative addressing (which is part of a loop) into custom assembler fragment executed at start of crunching.
that's what i mean :) |
| |
GI-Joe
Registered: Sep 2015 Posts: 21 |
Quote: Oh, I'm sorry!
I've tested with -x flag which gives value -292. But before branch instruction exists "lda #$f sta $d020 sta $d021".
-x option with branch at start gives -284 value,
-s option gives -2063 value with branch at start,
-f gives -439.
So it must be chosen on the basis of tests.
@Digger, according to the manual custom fragment is executed "when decruncher starts", so shouldn't slow it down.
Gordian, you didn't get any "syntax errors" and crashes while chrunching ?
I use Exomizer v3.1.2 on Arch Linux here.
It's weird and probably these are random values that change with every new version of exomizer.
This is not "good news" for my buildchain.
Who knows where such values come from, but may be some things were not defined and/or documented in the exomizer-code/docs for the assembly fragments section.
Gordian, thanks for the tips. I'll test it l8ter. |
| |
Gordian
Registered: May 2022 Posts: 87 |
Quoting GI-JoeGordian, you didn't get any "syntax errors" and crashes while chrunching ?
I use Exomizer v3.1.2 on Arch Linux here.
I made tests using some old version.
Now I use version 3.1.2 on Windows, but I get the same "magic" values.
For example:exomizer sfx basic -t64 -s "bne 0" -o z.prg zoom.prg
Gives result:value -2063 out of range for op $D0 @0581c080 |
| |
GI-Joe
Registered: Sep 2015 Posts: 21 |
Quoting Gordian Quoting GI-JoeGordian, you didn't get any "syntax errors" and crashes while chrunching ?
For example:exomizer sfx basic -t64 -s "bne 0" -o z.prg zoom.prg
Gives result:value -2063 out of range for op $D0 @0581c080
ok and then exomizer exits with an error, right ?
i've testet:
exomizer sfx 0x2800 -s 'inx bne 2000' -o chrunched_file.prg main_binary_2800.prg
...produced in the crunched file @ $080d:
.C:080d E8 INX
.C:080e D0 C0 BNE $07D0
So i think i have to give on branching the absolute address like in any monitor program.
ok, i have to try & error my branches in that cases but this is a workaround with a stable condition and better then nothing :)
thanxx |
| |
Gordian
Registered: May 2022 Posts: 87 |
Quoting GI-Joe
ok and then exomizer exits with an error, right ?
Yes. Only the error message "value out of range"
Quoting GI-Joe
i've testet:
exomizer sfx 0x2800 -s 'inx bne 2000' -o chrunched_file.prg main_binary_2800.prg
will produce in the crunched file @ $080d:
.C:080d E8 INX
.C:080e D0 C0 BNE $07D0
You get proper code.
Because of INX your "magic" value starts at -2064 (-2063-1).
-(-2064)-64=2000
-64 is the $C0 (signed 8-bit value). |
... 5 posts hidden. Click here to view all posts.... |
Previous - 1 | 2 - Next |