Introduction:
After my first visit to Lisbon in 2022, I wanted to return to Inercia demoparty this year. And ofcourse I didn't want to come empty handed, so I prepared a few entries for the Size Coding Showcase.
Singen68k v1.2 (Tool, Atari ST/Amiga OCS/Sinclair QL/Sharp X68000):
This is the third version of my sine generator for the Motorola 68000, this time in only 14 bytes instead of 16. Since I don't think this will get any smaller I've focused on including practical examples for all the different platforms like Atari ST, Amiga OCS, Sharp X68000 and Spectrum QL, so people can use this to help get started on any of these platforms.
since a screenshot of a sine wasn't that interesting, and I felt that 68000 coders didn't pickup on earlier versions, I've added a launch trailer:
The sine generator is basically writing two paraboles simultaniously from the front and back. The backend bit is subtracted from (empty) memory so make sure you are pointing to an empty piece of memory. The 14 byte version also requires one of the registers to be initialised at zero on startup, which is the case for all systems i've tested it on.
; ---------------------------------------------------------------------
; Sine generator (14 bytes) by superogue/marquee design
; Requires any A-register to point or be set to empty memory at startup
; Requires d3 or any replacement reg to be zero at startup
; ---------------------------------------------------------------------
moveq #127,d2 ; 2b
singen:
subq.l #2,d2 ; 2b
move.w d3,(a4)+ ; 2b
sub.w d3,(SIZE-4,a4) ; 4b
add.l d2,d3 ; 2b
bne.b singen ; 2b
PS> I'm aware that this singen has a tiny plateau in the very middle where the two halves connect because of the the use of the moveq instruction for D2. Its been fine for all the cases i've used it for, but If you don't want that, spend 2 more bytes to use the move.w instruction instead to set it to a slightly higher starting value or lower the overall amplitude of the curve to match.
Get Ready (64 Bytes, Atari ST/Amiga OCS/Sinclair QL/Sharp X68000):
After watching Sedma's entry Game Over on Demozoo, where he was able to make a static raycaster executable graphics for the Atari ST in 128 bytes (header excluded), I wanted to set myself the challenge of doing something similar in half the size: 64 bytes.
Visuals:
Small sized raycasters have been fairly common place on machines with lots of cycles and very small instructions like DOS, but doing one on the 68000 with a fairly large instruction set might proof to be a lot more challenging.
Basic Raycasting:
So with raycasting you are stepping through 3D space with a fixed sized step for each pixel on the screen, something like:
X=(zstep*u) >> 8
Y=(zstep*v) >> 8
Z=zstep
And then for each step check if there is a hit with some simple geometry (often defined by logical operations like XOR / OR / AND) or if a maximum depth is reached. Once we have a hit we need to calculate a 'texture color'.
Prototyping:
I started my journey by making a super basic raycaster prototype just to see the exact shape and know that my integer math checks out, it looks something like this:
for y = height,0,-1 do
for x = width,0,-1 do
zray = 1
repeat
xray = ((x-xcenter) * zray) / 256
yray = ((y * zray) / 256
hit = (((xray AND zray) OR yray) & 32) > 0
zray = zray + 1
until (zray > 255 or hit)
texturecolor = (xray XOR yray OR zray)
end end
The hit calculation gives us a nice hallway with some side entraces and the texturecolor calculation gives a XOR-pattern for the flat/view-facing surface and a different pattern for the side surfaces so that you can better make out the shape.
Atari ST version:
Since I didn't have to care about it being realtime, converting the prototype to 68000 assembler was fairly easy and soon i had some visuals to work with in just under 100 bytes. Not bad for a first attempt and already a fair bit under the 128 byte limit.
The first and most easy optimisation was removing any palette gen and work with the stock Atari ST TOS palette. However this wasn't the huge savings I was hoping for as the Atari ST stock palette definition is utter shite, so that ment that I still had to spend a good amount of instructions to carefully select passable colors for the final image.
However still about 10 bytes in total were saved. Next up was trying to use the Line-A adress registers directly as much as possible instead of passing D-registers in a seperate pass as well as using a register to 'correct' the x-center for the xray, in this case the register used for zray, which will give it that nice curved look.
Final optimisations:
Final polish and optimisation came in the form of simplifying the hit-check by not using a seperate BTST/CMP instruction as well as elliminating the max-depth check entirely, since our curved space will make sure that there will always be a hit with the 3D space itself, and boom finally the 64 byte limit was reached!
Challenge completed.
Expressionista (32 Bytes, IBM PC/CGA):
This intro is also from back in 2022, but never had a great opportunity to release it, so I decided to add it to the Inercia 2025 releases as well. It consists of a random-walk algorithms that just steps into one of 4 directions and plots there. The limited 4-color CGA palette helps to make it look cohesive and plots many pixels at a time so that it looks more like paint blots.
Datastorm (32 Byte Intro, DOS):
This was an older intro that I had initially selected as part of a third DOS intro album, but since I did not have a lot of other new stuff to fill the album, I decided to make it a solo release for Inercia 2025. The effect is a simple automaton with PC Speaker sound that uses AND 128 for its black and blue color scheme.
68000 Port Extravaganza:
Technically not released at Inercia 2025, but I've worked the entire trip at porting over my old 64/128 Byte intros for the Atari ST to other 68000 platforms like the Amiga OCS, Sharp X68000 and Sinclair QL, trying to match the original binary size where possible. Only the backbuffered Amiga effects like Phased and Shattered did not make the 128 byte code limit. You can find all these ports on demozoo in the updated archives on the Marquee Design website and/or scene.org.
Gorski (2025)
Shattered (2025)
Phased (2025)
Galaktyka (2024)
Matka Natura (2023)
Mossery (2022)
Are now available on Atari ST, Amiga OCS, Sharp X68000 and Sinclair QL.
Conclusion:
Inercia 2025 was a great experience. I met up with a lot of nice people and was able to combine demoparty-ing with visiting the many sightseeing options of Lisbon. Its been great getting some of these productions out as well as having the focus to finish the various ports and this writeup you are reading right now.
For more information about all the Inercia 2025 releases, you can find them at demozoo
- Enjoy!