19 March 2010, 23:32 | #21 | ||
gone
Join Date: Apr 2007
Location: completely gone
Posts: 1,596
|
Quote:
Quote:
Got any good advice for things to read for learning how to write my own cruncher...? Always nice to learn new things. |
||
20 March 2010, 00:53 | #22 |
move.w #$4489,$dff07e
Join Date: Sep 2005
Location: Norfolk, UK
Age: 43
Posts: 2,351
|
Unless you have uber skills to come up with something good yourself (not in my case ), it's a case of finding an algorithm you like from a paper or book and modding it so it works for you. I usually get it all working in C first and then just port and optimise the decrunching code to 68K The optimising part is the fun bit - I found I keep coming back to it and spend time shaving off a couple of bytes... or making it a whisker faster each time
|
20 March 2010, 13:28 | #23 |
gone
Join Date: Apr 2007
Location: completely gone
Posts: 1,596
|
Nice one.
Looks like another project added to my list will be my own crunch / decrunch routines at some point then. In the meantime though I think I'll try to make my bb trackloader as small as possible and use something already available for crunching. Load and decrunch is what I need if I want to start thinking about making my own multipart demos. |
20 March 2010, 22:45 | #24 | |
gone
Join Date: Apr 2007
Location: completely gone
Posts: 1,596
|
Shortened version attached.
Now down to a bit more respectable 532 bytes. Quote:
Last edited by pmc; 21 March 2010 at 00:20. |
|
20 March 2010, 23:28 | #25 | |
move.w #$4489,$dff07e
Join Date: Sep 2005
Location: Norfolk, UK
Age: 43
Posts: 2,351
|
Quote:
Code:
.at_trk_0: bsr.s .lower_head move.b #0,d5 ;set track 0 as current track bsr.s .dir_change bsr.s .seek_inwards rts Code:
.at_trk_0: bsr.s .lower_head move.b #0,d5 ;set track 0 as current track bsr.s .dir_change bra.s .seek_inwards |
|
21 March 2010, 00:01 | #26 |
gone
Join Date: Apr 2007
Location: completely gone
Posts: 1,596
|
@ musashi5150 - ah, of course, thanks mate. I'll have a look through the code again.
Meantime, in case it's of any use, attached is the previous version only this time there's the StoneCracker optimised decrunch routine included. With this it totals 884 bytes so it still fits nicely onto a bootblock and can be used to trackload StoneCracker crunched binaries straight off disk. Last edited by pmc; 21 March 2010 at 00:19. |
21 March 2010, 00:24 | #27 |
gone
Join Date: Apr 2007
Location: completely gone
Posts: 1,596
|
Thanks to Sting and musashi5150, the trackloader, including the bootblock header stuff, is now 486 bytes.
Also attached is the shorter decrunch version too which is now 838 bytes. Thanks guys, your advice has been really appreciated. EDIT: Found some more savings - trackloaders are now smaller still as per new byte values. EDIT 2: Found some more savings - trackloaders smaller again, as per new byte values. EDIT 3: Added a version that does some nice old skool $dff180 colours on decrunch - adds 10 bytes to the code, but come on - it's for decrunch colours! \o/ EDIT 4: Found yet another saving - new byte sizes as per above. Source code removed - newer smaller version posted further down this thread... Last edited by pmc; 22 March 2010 at 13:02. |
22 March 2010, 10:05 | #28 |
move.l #$c0ff33,throat
Join Date: Dec 2005
Location: Berlin/Joymoney
Posts: 6,865
|
|
22 March 2010, 10:23 | #29 |
gone
Join Date: Apr 2007
Location: completely gone
Posts: 1,596
|
ROFL!
I knew you'd win! To be fair, without your and musashi5150's advice I wouldn't have got it down to 486 bytes anyway so even if I had made mine shorter it still would've been a joint victory! Regardless, I really enjoyed minimising it and learned loads. Making code more compact is almost as fun as making code in the first place! |
22 March 2010, 10:38 | #30 |
move.l #$c0ff33,throat
Join Date: Dec 2005
Location: Berlin/Joymoney
Posts: 6,865
|
|
22 March 2010, 10:50 | #31 | |
gone
Join Date: Apr 2007
Location: completely gone
Posts: 1,596
|
Quote:
Mind you, I should expect any man who can fit the whole Lotus Espirit Turbo game into 96k to have made a trackloader of 450 bytes or less. Once you finish your uber shrinking of that ultra small trackloader I wouldn't mind having a peek at the source code if you wouldn't mind...? - it'll help me learn even more ways from the master about how to save bytes in code. |
|
22 March 2010, 10:57 | #32 |
68k
Join Date: Sep 2005
Location: Somewhere
Posts: 829
|
There are few obvious SIZE optimizing ( after StingRay correction. Thanks ) in your code, like changing some move.x to moveq. I'm sure you will find it.
Cheers Last edited by Asman; 22 March 2010 at 11:10. |
22 March 2010, 11:04 | #33 | |
move.l #$c0ff33,throat
Join Date: Dec 2005
Location: Berlin/Joymoney
Posts: 6,865
|
Quote:
I can do but I'm sure you can find ways to kill some bytes yourself, it's more fun that way. =) Some hints: - add.l -> add.w - lea $xxxx.l -> lea $xxxx.w - move.l ax,$xx.l -> move.l ax,$xx.w - "chain" your routines, e.g. move.w #val,d7 bra.w .wait_timer ; some other code move.w #val,d7 bra.w .wait_timer ; some other code move.w #val,d7 bra.w .wait_timer can be changed to: move.w #val,d7 bra.b .w_timer ; some other code move.w #val,d7 bra.b .w_timer ; some other code move.w #val,d7 .w_timer bra.w .wait_timer - check the wait_timer routine (absolute cia addresses used there), just noticed that so it would be <450 bytes if I would have time to "fix" that etc Even though this is correct this is about SIZE optimizing, not speed optimizing. And usually, the shorter the code, the slower it is. Last edited by StingRay; 22 March 2010 at 11:26. Reason: some additions |
|
22 March 2010, 11:28 | #34 | |
gone
Join Date: Apr 2007
Location: completely gone
Posts: 1,596
|
Quote:
Since my last post I shaved off another 2 bytes and now, with your extra advice, I'm sure I can shave off some more on my own. @ Asman - thanks for checking my code fella. What Sting said though - never mind speed, I just want to make the shortest possible trackloader that I can make. \o/ |
|
22 March 2010, 11:34 | #35 | |
gone
Join Date: Apr 2007
Location: completely gone
Posts: 1,596
|
Quote:
I'll try to shave it myself! If I can shave it down like you did do you think it might be the world record shortest Amiga trackloader...? What I mean is - surely there must come a point where any routine just *can't* become any smaller...? |
|
22 March 2010, 11:41 | #36 | |
move.l #$c0ff33,throat
Join Date: Dec 2005
Location: Berlin/Joymoney
Posts: 6,865
|
Quote:
Of course there'll be a point where you can't optimize anymore, then it's just a matter to decide if you want to do some "hardcore" optimizing or not, e.g. in this case: it's a bootblock trackloader -> no need to step to track 0 (OS did that already). But then it wouldn't be a "normal" trackloader anymore which is of course a disadvantage. Decisions, decisions. |
|
22 March 2010, 11:53 | #37 | |
gone
Join Date: Apr 2007
Location: completely gone
Posts: 1,596
|
Quote:
By the way - trackloader now currently standing at 470 bytes and counting. |
|
22 March 2010, 12:08 | #38 | |
move.l #$c0ff33,throat
Join Date: Dec 2005
Location: Berlin/Joymoney
Posts: 6,865
|
It's a lot of fun. If you really like the sound of doing hardcore optimizing try to code a bootblock intro.
Quote:
20+ bytes to go. |
|
22 March 2010, 12:18 | #39 |
gone
Join Date: Apr 2007
Location: completely gone
Posts: 1,596
|
Trackloader now 444 bytes.
Still not done any work on the CIA timer routine absolutes as yet... |
22 March 2010, 12:18 | #40 |
move.l #$c0ff33,throat
Join Date: Dec 2005
Location: Berlin/Joymoney
Posts: 6,865
|
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
HD loader example | st! | Coders. General | 4 | 16 October 2012 21:56 |
Game loader stuck on certain track after save state restore | andreas | support.WinUAE | 2 | 26 March 2011 19:59 |
Can't transfer Supaplex cause of CSL track loader ! | Vollldo | support.Games | 4 | 12 March 2011 21:51 |
Hardware File Loader | h0ffman | Coders. General | 9 | 02 December 2010 16:40 |
mfm/custom regs/track loader | snyp | Coders. General | 9 | 06 June 2006 19:42 |
|
|