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 > exomizer: assembler fragments with loops
2024-12-28 02:44
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
2024-12-28 06:43
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...
2024-12-28 09:11
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.
2024-12-28 11:12
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".
2024-12-28 11:23
Digger

Registered: Mar 2005
Posts: 438
Would it not slow down the depacker though?
2024-12-28 11:43
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.
2024-12-28 15:48
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 :)
2024-12-28 16:13
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.
2024-12-28 16:27
Gordian

Registered: May 2022
Posts: 87
Quoting GI-Joe
Gordian, 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
2024-12-28 18:05
GI-Joe

Registered: Sep 2015
Posts: 21
Quoting Gordian
Quoting GI-Joe
Gordian, 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
2024-12-28 18:20
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
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
CA$H/TRiAD
syntaxerror
iAN CooG/HVSC
map/Plush
Airwolf/F4CG
Guests online: 145
Top Demos
1 Next Level  (9.7)
2 13:37  (9.7)
3 Coma Light 13  (9.6)
4 Edge of Disgrace  (9.6)
5 Mojo  (9.6)
6 Uncensored  (9.6)
7 The Demo Coder  (9.6)
8 Comaland 100%  (9.6)
9 Wonderland XIV  (9.6)
10 What Is The Matrix 2  (9.6)
Top onefile Demos
1 Layers  (9.7)
2 Cubic Dream  (9.6)
3 Party Elk 2  (9.6)
4 Copper Booze  (9.6)
5 Rainbow Connection  (9.5)
6 Morph  (9.5)
7 Dawnfall V1.1  (9.5)
8 Libertongo  (9.5)
9 Katzen-Video.mp4  (9.5)
10 Onscreen 5k  (9.5)
Top Groups
1 Booze Design  (9.3)
2 Oxyron  (9.3)
3 Performers  (9.3)
4 Fairlight  (9.3)
5 Triad  (9.3)
Top Diskmag Editors
1 Magic  (10)
2 Jazzcat  (9.5)
3 hedning  (9.5)
4 Elwix  (9.1)
5 Remix  (9.1)

Home - Disclaimer
Copyright © No Name 2001-2025
Page generated in: 0.038 sec.