Home
Admin | Edit

Dreamelt - Dreamcast 128 bytes

link

A 128-byte intro for the Sega Dreamcast video game console, released at Lovebyte 2025.

This started as a last minute (~4 days before deadline) filler to participate in the Byte-athlon compo but ended up being something of its own.

First steps was to port my ArchiSmall Acorn Archimedes intro just to see how the code ended up on the SH4, it was then repurposed as a filler.

Algorithm is still the integer circle algorithm (32 bit range with a downscale pass) and show some kind of drifting Apollonian net that dissolve into the background.

Original idea was to do the same thing as ArchiSmall but "modernized" (better resolution etc.), after some prototypes i ended up using some sort of persistence on the net structure (by adding up colors + having a background subtract pass just after) but i failed to downsize it as it required saturation arithmetic, i ended up with a dissolving background / net as a "happy accident" (just kept the background subtract pass), it looked cool so i fiddled with parameters until i got something worthwhile.

No background clear to save bytes, it shows whatever the BIOS show before running the binary (Sega copyright bitmap in this case), this ended up fine !

There is perhaps some nice ideas to do later through manipulation of the BIOS bitmap data. (which reside in RAM; same for the Dreamcast logo animation although i don't yet know where it is stored and the format)

p5js sources (note : without bitmap)

function setup() {
  createCanvas(640, 480)
  background(0)
}

let x = 1 << 31
let y = 1 << 31

let cr = 1
let cg = 2
let cb = 3

function draw() {
  let f = frameCount

  loadPixels()
  for (let l = 0; l < 4e4; l += 1) {
    x -= y >> 2
    y += x
    x -= y >> 2

    x += (frameCount << 19)

    let px = x >>> 23
    let py = (y >> 23) * 85 >> 7
    let index = (((height >> 1) * width) + 64 + px + py * width) * 4

    pixels[index + 0] = 0
    pixels[index + 1] = 0
    pixels[index + 2] = 0
  }

  for (let i = 0; i < 640 * 480 * 4; i += 4) {
    if ((pixels[i + 0] - cr) < 0) pixels[i + 0] = 255
    pixels[i + 0] -= cr
    if ((pixels[i + 1] - cg) < 0) pixels[i + 1] = 255
    pixels[i + 1] -= cg
    if ((pixels[i + 2] - cb) < 0) pixels[i + 2] = 255
    pixels[i + 2] -= cb
  }

  updatePixels()
}

dc sources

mov #0x80,r2
shll16 r2
shll8 r2
mov r2,r3

l:
    mov.l VIDEO_BASE,r0
    mov.l OFFSET,r1
    add r1,r0

    mov r0,r1
    shlr16 r1
    i:
        mov r3,r4
        shar r4
        shar r4
        sub r4,r2
        add r2,r3
        mov r3,r4
        shar r4
        shar r4
        sub r4,r2

        mov r9,r8
        mov #20,r7
        shld r7,r8
        add r8,r2 ! x += (f << 19)

        mov r2,r6
        mov #-23,r7
        shld r7,r6
        mov r3,r5
        shad r7,r5
        mov #85,r7
        mul.l r5,r7
        sts MACL,r7
        mov #-7,r8
        shad r8,r7
        mov #40,r8
        shll2 r8
        shll2 r8
        mul.l r7,r8
        sts macl,r8
        add r8,r6
        shll2 r6
        mov.l r12,@(r0,r6)
        dt r1
        bf i
    
    mov.l C,r11
    mov.l VIDEO_BASE,r0
    mov.l SS,r10
    s:
        mov.l @(r0,r10),r7
        add r11,r7
        mov.l r7,@(r0,r10)
        add #-3,r10
        dt r10
        bf s
        nop
    bra l
    add #1,r9

.align 2
    VIDEO_BASE: .long 0xa5200000
    OFFSET: .long 0x96100
    C: .long 0x00030201
    F: .long 0xffffff
    SS: .long 0x12C000

back to topLicence Creative Commons