pouët.net

Go to bottom

Some things I've been doing on MSX

category: code [glöplog]
 
So I haven't released a demo in 4 years, but I have been doing adjacent things on the MSX platform some of which might even be considered demoish:


Pallo, a game for MSX2. This has a custom music player I made in Z80 with a custom format, though the music itself is all converted from public domain MIDI files. It uses the FM-PAC expansion for audio, which contains a YM2413 chip (also known as OPLL). The most demoish part is the rippling reflection effect in the intermission screens. Changing things in H-blank is tricky on this platform due to indirect access to video registers but I managed to change one scroll register and one palette entry every 2 scanlines to create that effect. The laserline cube effect shown on the password entry screen is also demoish.
BB Image


An interactive 3D demo (it's not a raycaster so I don't really know what to call it) using the V9990 chip expansion, which works on all MSXes. The walls are drawn with single blitter copy commands (the ramps are pre-rendered), and hidden surface removal is done by decomposing the maze into convex cells and portals. By the way, this expansion was also available for Amstrad CPC which also uses a Z80 for its CPU so this engine might also run on Amstrad CPC without much trouble.
BB Image


An MSX1 version of the above which doesn't require any expansions. It uses TMS9918 text mode in which character patterns are 6x8 pixels instead of 8x8 pixels. Here I used 2x2 blocks of pixels grouped into fat pixels so each pattern represents a tile of 3x4 pixels in a virtual framebuffer. That's 2^12=4096 possible configurations but not all of them are required to render the walls - each required pattern consists of 3 columns of pixels which can be 0, 1, 2, 3 or 4 pixels high. So the required number of patterns if 2(5^3)=250, which fits into the budget of 256 patterns.
BB Image


An interactive 3D object renderer using the V9990 expansion and the TurboR MSX model (essentially the same computer but with a CPU which can run 8x faster than the other models and has a multiply instruction - although I don't use it here). The calculations for vertex transformation are mostly done in log space, and the polygons are again drawn with blitter copy commands from pre-rendered pieces.
BB Image


A port of Another World to MSX TurboR which also uses the V9990 expansion, and the OPL4 expansion so it can play all the same sound effects and music that the original Amiga version played. I wrote a custom module player in Z80 for this in addition to re-implementing the whole engine in Z80.
BB Image


Also a boing ball clone but it's not very good or accurate. I think a perfect recreation of the original is possible.
BB Image
added on the 2026-02-07 20:09:22 by fizzer fizzer
Very nice!
added on the 2026-02-07 20:45:15 by leGend leGend
Great
added on the 2026-02-08 19:52:39 by Frequent Frequent
Cool projects! What is the log space transformations you mention?
added on the 2026-02-09 13:39:01 by rloaderro rloaderro
Cool stuff!
added on the 2026-02-09 14:05:36 by Optimus Optimus
Cool stuff indeed!

Quote:
What is the log space transformations you mention?

Probably log/exp-tables for faster multiplications:
Code: a * b = e^(log(a) + log(b)) = eTable[ logTable[a] + logTable[b] ]
added on the 2026-02-09 14:18:54 by hfr hfr
Lovely work mate!
added on the 2026-02-09 16:47:42 by Fell Fell
Thanks @hfr that makes sense! Now this seems pretty useful! I wonder if it is common on Amiga500 as well? I never heard about it even after 30 years of demo scening!
added on the 2026-02-09 19:26:21 by rloaderro rloaderro
Quote:
What is the log space transformations you mention?

It's exactly what Hellfire described. Lookup tables for trigonometric functions are also expressed as logarithms. Something I've wanted to experiment with is using max() to approximate addition in log space, which might work well-enough in some cases.

One of the tables in the portal-based renderer encodes values of the h() function from this article to save on the cycle cost of mapping from log to linear and back again, which is a kind of softmax function.
added on the 2026-02-09 19:26:28 by fizzer fizzer
Quote:
Thanks @hfr that makes sense! Now this seems pretty useful! I wonder if it is common on Amiga500 as well? I never heard about it even after 30 years of demo scening!

The main reason I'm using it here is that the CPU either doesn't have a multiply instruction (in the case of Z80) or does have a multiply instruction but it kinda sucks (in the case of the R800).
added on the 2026-02-09 19:28:12 by fizzer fizzer
Quote:
I wonder if it is common on Amiga500 as well?
I never heard about it even after 30 years of demo scening!

I'm not sure how "common" it actually is but it's used on 68000 for sure - I guess I first read about it from kalms or blueberry (like most useful 68k tricks I know of).
The method has some limits when mixing positive and negative values but it's quite practical if you move your mesh into positive coordinates and translate it back within the transformation matrix. Then you end up with 3 adds and a table lookup for a dot3 - much faster than ~100 cycles for 3 muls.
added on the 2026-02-09 19:54:48 by hfr hfr
I used it for calculating the division for perspective projection too, and I XOR'd the sign bits explicitly. The resulting signs are computed separately actually.
added on the 2026-02-09 20:16:39 by fizzer fizzer
@hfr Probably great for single object effects in any case!

Accellerating division, as Fizzer mentions, is perhaps even more interesting as that remains a slow operation on any 68K processor
added on the 2026-02-12 01:15:54 by rloaderro rloaderro

login

Go to top