Introduction:
After taking a month out of my sparetime schedule to work on Atari ST productions for the last two years (releasing intros at both Sommarhack and SillyVenture Summer parties), I just didn't have the time to do the same this year (having just finished a 3 month project (Dash, Atari XE/XL), a two month project (Trepaan's Wondere Wereld) and a one month project (Origins by Rivals) back to back.
Therefore I decided to change my focus for this year to releasing a single Atari ST project. A small 128 Byte Intro for the Silly Venture Winter 2024.
Galaktyka (128 Bytes, Atari ST):
The inspiration for this project started back in 2023 at Lovebyte Tiny Code Christmas, where folks were toying around with starfields, snow and universe implementations. Here mrs.beanbag showed that just taking a predictable pseudo-random-generator would give you a nice starfield that didn't require storing any star positions and that you could manipulate.
Visuals:
With this insight, I was able to simplify the approach a bit and build a quick prototype. For a moment I was thinking if I should target 8-bit CPU's but then quickly decided to focus on 68000 because of the 3D Projection that was needed for the effect.
Given that good ideas for a 128-byte ST Intro that don't look like garbage are far and between, I was hoping this technique could potentially work as a small implementation suitable for something around the 128 byte sizelimit, or rather 96 bytes as the TOS header is 32 bytes on the Atari ST. But after reviewing the first implementation on 68000 I was a little dissapointed by the amount of code that was still required for setting the color pallette. video syncing, clearing the screen, calculating, projecting, clipping and drawing the star positions.
From here it was still a bit of a struggle to get the whole effect down to a 96-byte sizebudget. I had to cut down on things like syncing and do a lot of register juggling to make it all fit the size budget.
Here is the code for the base version:
; init supervisor. needed on Atari ST to access memory
move.w #$20,-(sp)
trap #1
; Init A000 routines
dc.w $A000
movem.l (a0),a1-a4
sf -6(A0)
updateloop:
; clear the screen
move.l ($44e),a0 ; get screen address
move.w #200*80,d7 ; clear counter
.cls
move.w #$ffff,(a0)+ ; black background color is color #15 on ST
dbra d7,.cls
moveq #79,d4 ; Init star PRNG
moveq #64,d6 ; Num. Stars (can be anything 64..127 to best match anti-flicker timing)
moveq #127,d7 ; Constant value that we will need later
starloop:
; d4 = PRNG used for signed star coordinates d3=d4, d4=((d4*5)&127)-64
move d4,d3
muls #5,d4
and d7,d4
sub.w #64,d4
; d5 = Z-value = (((d6*2)-t)&127)
move d6,d5
add d6,d5
sub.l $466.w,d5
and d7,d5
; 3D project X -> d1 = x * 127 / z + 160
move.w d3,d1
muls d7,d1
divs d5,d1
add.w #160,d1
; 3D project Y -> d2 = y * 127 / z + 127
move.w d4,d2
muls d7,d2
divs d5,d2
add.w d7,d2
; clipping plot vertically
cmp.w #196,d2
bhi.s skipplot
; plot pixel
movem.w d1/d2,(a4) ; a4=x,y
clr.w (a3) ; color 0 = white
dc.w $A001 ; plot pixel
skipplot:
dbra d6,starloop
bra.s updateloop
Once I had the base version locked in, it was time start adding some stuff back in for the compo version, which doesn't include the TOS header in its size calculation. I'm not a fan of this Atari-scene exclusive practice, so I just use this space to add some extra fluff whilst also providing a true 128 byte version.
Audio:
Fortunately, even after things like palette-generation and stuff were added, there was still enough room left to add some minimal MIDI/MT-32 audio to the header-excluded version. Nothing fancy, just a one off droning note to add some atmosphere.
Amiga version:
As with Matka Natura the previous year, I also wanted to include an Amiga port of the same intro in the package using the intuition graphics functions. During the porting there was one issue that i hadn't encountered on the Atari ST. A division by zero in the 3D projection will crash the program on Amiga, but won't on the Atari ST. I'm assuming this is not done on CPU level but rather on Amiga Intuition level. In either case it was quickly fixed by simply adding one to the Z-value calculation.
Conclusion:
Given that 2024 was quite a busy year for me, I'm happy that I was still able to release a production for the Atari ST towards the end of the year. And as with Matka Natura, an Amiga OCS port is also included in the package. I'm glad the audience liked it as well as the intro won the 128 byte intro compo at Silly Venture 2024 WE.
For more information, you can check out the intros at demozoo: Galaktyka (2024)