Nerd content and
cringe since 1999
Alexander Grupe

B.S.I. – Byte Scene Investigation

Warning: This intro is not for the faint of heart, it’s scary and there’s blood… coming from a poor old 3½-inch floppy disk! :)

Also, it’s very short, but we’re talking 512 bytes here! It got second place at Nordlicht 2024’s 512-byte competition – check out the awesome trophies the Nordlicht orgas made!

My ideas for this one were:

  • Include more graphics than in the last 512 byte intro!
  • Use the system’s polygon drawing functions for that (like in Brutalist Love)
  • No full music track, but at least some sound
  • Make something that fits the party theme: crime, detectives, tatnord-licht…

Tricks and tools

The starting point was a nifty code snippet I saw in the Amiga Code Facebook group. Member Russ McNulty posted a little XOR-based pixel effect, crediting gigabates for the idea. While I’m not setting any individual pixels in this intro, I used idea of grabbing the current screen’s RastPort for painting:

move.l  G_INTUITION(a2),a6      ; a2 = BCPL globals, see libhdr.i
move.l  ib_ActiveScreen(a6),a6  ; IntuitionBase->ActiveScreen
lea     sc_RastPort(a6),a3      ; a3 = RastPort
lea     sc_ViewPort(a6),a4      ; a4 = ViewPort (for LoadRGB4)

move.l  4.w,a6
move.l  IVBLIT(a6),a6           ; ExecBase.IVBLIT.IV_DATA = gfxbase

; With gfxbase, RastPort and ViewPort, we can now call
; InitTmpRas, InitArea, LoadRGB4, SetAPen, AreaMove, AreaDraw, AreaEnd

Other tricks in this intro:

  • Use the palette for fade effects and to hide the mouse cursor (with LoadRGB4)
  • Do not initialize the audio registers completely – assume they initially point to location $0 and use that (like in hypotrain)
  • Compress everything with salvador/zx0
  • Extra space for the decompression area is allocated via the HUNK header’s code size field
  • Repeat whole chunks of data instead of being clever with a compact format (usually compresses better)
  • Export the uncompressed data and look for good hex values I can re-use as palette colors

For the polygon/drawing data format, I re-used the vector tool from Brutalist Love to draw everything:

The output has this format:

 dc.w _LVOSetAPen,  1,0     ; second parameter is ignored/unused
 dc.w _LVOAreaMove, 372,64  ; start polygon
 dc.w _LVOAreaDraw, 88,88   ; add points
 dc.w _LVOAreaDraw, 220,218
 dc.w _LVOAreaDraw, 260,224
 dc.w _LVOAreaDraw, 588,146
 dc.w _LVOAreaEnd,  0,0     ; fill polygon (both parameters unused)
 dc.w 0                     ; end marker

With a drawing loop like this:

.drw    move.w  (a2)+,d5        ; a2 = current object
        beq.b   .drwn
        move.w  (a2)+,d0
        move.w  (a2)+,d1
        move.l  a3,a1           ; RastPort
        jsr     (a6,d5.w)
        bra.b   .drw
.drwn   ; ...

This works nicely because the graphics.library calls we use expect their parameters in a1/d0/d1:

AreaMove( a1:rp, d0:x,  d1:y )
AreDraw ( a1:rp, d0:x,  d1:y )
SetAPen ( a1:rp, d0:pen      )
AreaEnd ( a1:rp              )

The search for re-usable palette colors in the uncompressed intro data involved me squinting and looking at this for hours:

Well, maybe not hours, but I did find a good blood color and some nice blue shades for the disk.

Unexplored tricks

I reached a state of “good enough” at the party on Friday morning, shortly before the deadline. With more time, I could have explored some more things:

  • Check each of the drawing functions if the RastPort argument in a1 is left intact and can be re-used
  • Play with the order of data blocks to find a better-compressing arrangement
  • Same thing for the script format (word pairs of current object offset and sound frequency)
  • Make space for manual waits to make this run on other Kickstart versions than 1.3 (apparently, WaitTOF does not behave like I think it does)
  • Optimize the relative buffer offsets for better compression (TmpRas buffer, AreInfo buffer, vector buffer)

Even with only 512 bytes, there are always so many options and paths to investigate. (Ha! And we’re in sync with the party theme again!)

Pleasing sound frequencies and better pacing would have been nice, but I already fiddled around with those a lot in the night before the deadline.

Download and links

previous next close