TOPICS:
NEWS
PRODUCTIONS
MEMBERS
GUESTBOOK
MISC

HOW TO MAKE A 4K INTRO - A REPLY

Author:StingRay
Published:Showtime 16
Year:2001


Well, I've just read the article by Zeeball about making 4k intros in this very issue of your favourite mag. After reading it, I simply had to write my own article about this topic. For those of you who didn't read Zeeballs text yet, here is a short summary of what he wrote. His way of doing 4k's is to pack the 4k data using xpkmaster.library and decrunching it to RAM: at runtime. To get some music he suggested to use player61.library or something similar such as ptreplay.library. For me, this is an extremely bad (not to say lame) way of doing a 4k intro! I for myself wouldn't allow such intros to compete in a 4k compo.

Why, you might ask. Well, that's easy enough to explain. The main definition of a 4k intro is:

  maximum size: 4096 bytes

And there you got the most important point. Now, if we judge Zeballs approch hard (doing a 4k was never meant to be an easy job) we see, that it's IMPOSSIBLE to make a real 4k with it, because we have to add the size of the external libraries to the intro size. That's a lot more than 4096 bytes then. For those of you who will complain, saying that these libraries can be considered as a standard, I have only one thing to say: They simply aren't! I know, they can be found in every serious Amiga users Libs: directory, but try to find 'em on the original Workbench disks, there you won't find one single bit of xpkmaster.library or even a replayer library! Conclusion: They ain't standard. Period.

Due to the aforementioned reasons, I strongly suggest you coders out there not to use this way to make a 4k intro (fortunately it seems that only polish coders use this approach at all). Winners never use drugs errm, non-standard libraries for 4k intros :). Have a look at this years Mekka^Symposium winner 4k which was coded by scicco and a certain StingRay :D to see the proof for this :).

To finish this article, I will give you some hints, how you can optimize your code for a 4k. I won't reveal big secrets here, you have to find out the real hardcore stuff by yourself. Believe me, it's fun :)

  try to use pc-relative code wherever possible, because otherwise relocation entries will be added to the executable. Furthermore you can do other neat tricks (which I won`t explain here), if you do your intro completely, i.e. 100% pc-relative

  avoid any unnecessary code (That was hard to guess, wasn't it? :D) What I'm going to say is, that you often can leave out e.g.`rts` instructions, saving you 2 bytes. Here is an example:         bsr     ImpressTheCrowd         rts can be changed to:         bra     ImpressTheCrowd Sometimes it's even possible to leave out the 'rts' in subroutines if the code below the 'rts' is not time critical (perfect for init routines). Under normal circumstances this would be pretty useless, but for a 4k intro it can make all the difference in the world :) Here`s a small example again, directly snapped from the Boom source:         ..... ; a3: Ptr to c2p routine         lea     44(a5),a1       ; sc_ViewPort         lea     84(a5),a0       ; sc_RastPort         move.l  a1,(a4)+         move.l  a0,(a4)+         move.l  4(a5),(a4)+         move.l  a3,(a4)+         moveq   #1,d0

; following next is an innocent rts, ; killed by the brutal coders :)

;       rts

GetScreen         move.l  RasInfo(pc),a3         lea     BitmapTab(pc),a2         lea     40(a2),a4         .....         rts


The first routine is only called once at the beginning, so it doesn`t matter, that the GetScreen routine below is executed too due to leaving out the 'rts'. Pat yourself on the back, 2 bytes killed again :) Always remember what rts stands for: 'Really Tough Stuff' :)

  try to rearrange your code in a way that you can 'recycle' your registers for different jobs without initializing. For example after a 'dbf' loop you know for sure, that the register used as loop counter contains -1 ($ffff) in the lower word. So if you have a routine which expects to have -1 (or 65535 unsigned) in a register, place it directly below your 'dbf' loop. Here comes a small example again:         moveq   #20-1,d7 .loop   nop                     ; :)         dbf     d7,.loop

; d7.w = $ffff         lea     TEXTURE(pc),a0         lea     BUF(pc),a1 .copy   move.b  (a0)+,(a1)+         dbf     d7,.copy
As you can see, I'm using d7 as loop counter again without initializing it with 256*256-1. (Texture size is 256*256) -> $FFFF = 256*256-1 :)

Well, this is all I can be bothered to write about for the moment, because I have to finish the current Showtime issue (and this is no fun, believe me!). Anyway, I hope I`ll see some nice 4k intros in the future which don`t need ANY external (i.e. non standard) stuff :)

Happy coding!

GREETINGS

ARTICLES

MAKING OF BOOM
INTERVIEW SCICCO
STINGRAY - A RISING STAR (Interview)
HOW 2 MAKE 4K - REPLY
COMPARADE 8 REPORT
SCARAB - WE GAVE OUR MOTIVATION A NAME