A brilliant demonstration of how deep architectural knowledge can turn hardware limitations into creative advantages through precise timing. This is low-level optimization at its finest, proving that constraints are often the best fuel for technical innovation.
Deep Dive
Prerequisite Knowledge
- No data available.
Where to go next
- No data available.
Deep Dive
C64 Demo - Hexed - Element54
Added:Welcome back to my Commodore 64 memories videos. [music] This is where I look at old Commodore 64 software and some of the technical details behind them. Today, we have Hext by Element 54.
I had a few messages asking me to have a look at the first few parts, especially [music] on the first disk of this demo.
So, let's have a little look at this first in the normal emulator and I'll try and give my thoughts about how things are done and then we'll look at it in the debugger and see how much I got right or wrong.
This is the first time me seeing this demo, so this is just a raw capture from Vice.
So, let's see what we get.
And I'm just dropping on the first disk image here.
So, it starts with load starting Commodore 1 and we got this little uh texty thing at the beginning.
Okay-dokey.
So, apparently this first part is meant to have an impossible horizontal split.
It's meant to impossibly horizontally split on bad lines.
Don't know how they're doing that, but I doubt there's any split going on within a bad line cuz the CPU is stunned. There's nothing much you can do about that, but let's have a look.
So, it's scrolling off in the corner.
Huh.
Okay, so there's a multi-color bitmap, but the text to the left and to the right is still higher resolution.
Intriguing.
So, I wonder how that one was done.
Well, the standard Commodore 64 character set has a blank line on most of the characters.
So, that blank line could be exploited, [music] I suppose, if you scroll the screen vertically by one pixel, so that the what were blank lines of pixels at the bottom of the character set then appear at the up, then that would coincide with the blank lines. So, then you don't need to have any horizontal split between multicolor and high-res bitmap. The rest of the lines that don't have bad line timing group of difficulties would be split horizontally between high-res and multicolor bitmap mode.
Uh now, this is an intriguing effect, isn't it? So, this is Aha, okay. So, this reminds me of a multi-character set scroll like I saw in the Exile scrolling video.
Uh so, I'll try and dig out the Exile video and link it in the video description below.
But, if there are several horizontal bands, say three or four characters high on each band, you could have enough characters in each horizontal band to fill a character set with possibly several horizontal scales for the versions of the graphics that you want to display.
But, then you could have each band using a different character set and then just scroll that up. Uh there's probably a repeating character set pattern which is being scrolled up the screen, and then there there are horizontal um raster effects to flip between the different character sets as the different graphics get displayed in each horizontal band. But, yeah, I think there's probably just about enough um charac- individual characters there for most of the levels of horizontal horizontal scaling.
Yeah, okay. So, there is this last part on the first disk. And this is the flip disk part.
And the Okay, so the size of this wibbly rotating and inverted commas um effect in the middle, that looks like it's a sprite sheet, right? And there's probably lots of different sprite frames. And the sprites are maybe possibly being moved left and right as well while uh swapping the sprite frames. But yes, it's a nice effect, right? You've got this apparently uh uh squishy scrolling rotating thing in the middle, but it's not. It's just using lots of sprite frames, I think, and a sprite grid.
Um and optionally moving the sprites as well.
So, it's probably an 8x8 sprite grid.
Uh so, that's all the parts I wanted to have a look at in the demo. I think this other part is really nice, too. It's really nicely uh It's got really nice graphics, and it's a really nice simple scrolling thing as well. But yeah, let's look at the first disk in the debugger, and let's see uh what I got right or wrong.
So, here we are now back in C64 debug GUI, and we'll run it from the start again.
And we get the normal text screen at the beginning with this message.
So, when I was looking at this previously from the VICE run right just now, uh we thought or I thought rather that it was definitely not doing a split horizontally during the bad line, of course, because that's impossible.
Um it's going into multicolor bitmap mode with just a regular horizontal split, but also there was probably shifting the screen vertically uh by one pixel at least to avoid or to move the the mostly empty character lines to the bad line.
So, let's just pause it here and we'll zoom in.
And if I move the cursor up and down, I can see uh already that the display is switching between multi-color mode and high-res mode depending on if there's any high-res text needed at that particular position.
So, it looks like and it and there's no splitting going on.
Yep. There's no split going on there when it's a bad line. So, when there's a bad line, it looks like everything is multi-color mode.
And on the rest of the lines where there are no bad lines, where the CPU is free to do stuff, then there is a horizontal split between multi-color mode and high-res mode. And it's Yep, it's all a bit map mode.
Uh so, we can see here there's a store Y and this store Y D016 is precisely timed to yeah, to flip between high-res mode and multi-color mode. If I turn on the the scroll display, you can see look, the screen has been shifted by one pixel as well vertically.
Which I thought would be the case because it moves the bad line uh into a mostly blank character [clears throat] line, so you don't have to deal with uh deal with all of the variations of the high-resolution pixels in the character set. In the default ROM character set anyway. So, as I move the targeting cursor left and right, you can see that this store Y is precisely timed.
There's some JSRs there and load X and knots and stuff like that which just basically alter the timing.
So, you're free on on lines that aren't a bad line, so all of the other lines, seven out of eight of the pixel rows you're free to do uh cycle level timing, which is eight high resolution pixels horizontally.
But now yeah, we can see now, look. Now I've included the scroll debug.
Yeah, you can see, look.
>> [laughter] >> Okay, so you can see there that as I move the um oh the targeting cursor isn't unlocked.
Let's unlock the targeting cursor. There we go. Now go back to the debug.
There we are. You can see as I move the cursor up and down the screen, you can see now that the bad line has because it the screen scroll is taken into account. The bad line coincides with mostly empty character rows.
Not every single character has an empty pixel row.
But most characters do.
And a lot of the default high resolution text do.
So yeah.
That's very well timed though on on seven out of eight of the pixel uh yeah, pixel rows of the characters uh there is a nice stable cycle stable split there by the looks of it, switching between multi-color and high-res mode.
But yeah, as I thought that there's no horizontal split on the bad lines. It's just using the one pixel vertical scroll to uh abuse the fact that most of the characters don't have don't have data on one of the pixel rows on [snorts] the default character set.
So, let's reset that. You can see now if I reset it that the Y scroll value is three.
If we restart the demo again, so at the moment it's still displaying a high-res text screen and the Y scroll is still at three.
But, when the demo goes into starting to display the multi-color bitmap image, you'll see that it changes from text to bitmap mode and also note that the Y scroll register will change from a three to a two, indicating that, you know, as I thought, that the multi-color bitmap screen or the bitmap screen, which has high-res high-res and multi-color split horizontally on everything but bad lines. Yeah, there we go. You can see you can see now that the Y scroll register has changed from a three to a two.
So, yeah, that's kind of like the little trick behind this is that they just uh pixel scroll the screen to move the mostly empty lines of the character set data onto the bad line.
So, I just had a thought. There are some uh some very rare character default character ROM definitions which do have uh high-resolution single pixels.
And of course, that's not going to be able to be displayed by the multi-color uh uh bitmap mode on the bad lines where it is consistently multi-color bitmap mode.
So, if we have a look for it, yes, it's 5F and DF there in screen code terms, anyway.
So, you can see here it's this uh half diagonal line.
So, if we fill the first 256 bytes with a repeating pattern containing 5F and DF, and then we'll also alternate 5F and DF a few times as well, just to get a nice kind of like herringbone pattern.
If I change that to the uppercase ROM character set, there we go.
And now if I let's load start make one.
Oh, let's turn off uh turn off the CRT emulation so that we get a cleaner screen grab. I'm going to do a screenshot of this. So, this is before. This is the before screenshot.
And this is what we can compare it to when we're running the opening part of the demo, right? So, I'll edit that in Paint.
So, there it is.
You can see here that there's nice uniform uh high-resolution pixels. I've just zoomed in to the screen.
Uh if I start the demo again, and then we let it run, and we just wait for this to to start. Oh, it doesn't auto start.
There we go.
Of course, now it's started the demo.
It's doing this, you know, I'm faking it typing thing. I'm just warping through this part.
And how Well, there we go. Straight away. Let's let's pause that, and then let's do a screen grab.
And I can see the difference already, but I will zoom in just to just to really show. And on the left is the before. So, that's the high-resolution text screen.
Okay.
And we can see that we've got nice high-resolution pixel lines there.
Whoops.
Let's uh edit this one in Paint. This is the after view now when the demo is running. On the right, so the right-hand side is the after view when it's multicolor bitmap mode in the demo. And this is on the left, it's before, which is the high-resolution text mode. And there we go. It's it's a lot easier to see when I zoom in.
But you can see there are um eight pixel steps there, right? Eight steps that you would see. And those Yeah. And on the right, we've got a fewer number of high-resolution uh line changes there. And you can see that at the top here where it meets the border, it's a nice smooth diagonal line. And whoops, wrong color. There we go. On the after one when it's when the demo is actually running and it's multicolor [clears throat] bitmap mode, you can see that there's two lines there which are vertical and they don't have a horizontal uh offset.
A high-res horizontal offset in terms of the the diagonal line there.
So, yes, it's it's pretty obvious that it's trying to exploit the the empty character row. But of course, with this default character set, there are some characters that don't have empty character rows. So, you can see there Look, there's two lines two rows of empty pixel data, whereas the other one has one row of empty pixel data up at the top.
Uh there's this step here on the right when it's when the demo is running compared to no step there on the left when it's just a high resolution text screen mode.
So, yeah. Uh that makes it pretty obvious, right? Is that you know, as you would expect, uh quite legitimately, uh the routine there is no high resolution horizontal split on the bad line.
It's just kind of like using smoke and mirrors and faking it. Obviously, you know, you can't you can't uh circumvent the hardware limitation where the CPU is just completely stunned uh during the bad line because the VIC chip needs to fetch character data uh from the memory. And so, the so the CPU has to be stunned during that period.
Well, the screen character data, right?
The indexes into each character. If I zoom out a little bit, you can see there, look, there's that step in the demo version on the right and the high resolution text screen on the left.
There is no step. It's a nice smooth as far as high resolution pixels are concerned, it's a nice smooth line.
>> [snorts] >> So, yeah, just to recap, let's have a look. Yes, it's exploiting the blank bank blank line in default character set. Yes, it's scrolling the screen bad line into blank character set line. And the rest of the lines are split horizontally.
So, let's get through to the next parts of the demo now.
It was the wavy character sets. There we go. Okay, so yeah, moving the targeting cursor around, we'll see when we we'll pause it first so that we're not seeing an animating screen. But if I move the targeting cursor up and down now, uh we can see how many character sets it's using. Yes, okay, so it's using multiple character sets vertically down the screen.
Uh there are What is it? Uh six, seven character sets?
Uh one, yeah. I think it was seven.
So, there's quite a few character sets.
We can see there We can see that the character set changes as I move the cursor up and down the screen.
Uh that confirms what we were just seeing there in the VIC debug view.
And the screen pointer stays the same.
It's just the character set pointer that changes within that VIC bank.
So, [snorts] basically it's a it's a screen plus tons of character sets.
We can see that the X scroll is not changing. It's just the Y pixel level scroll, which is changing.
And yeah, the the horizontal uh horizontal scroll uh is is using the same character set.
It's just um looks like it's updating just the characters which are being rendered in into each line.
Uh we can verify that. We can check it in VICE in a minute. We can see what it looks like in terms of default uh character set, right? So, let's open up ICU the 64 debugger.
And we'll go back uh to that part in the demo.
So, if I just open up the the text screen view, um and we'll look at the last four screens. Okay, we'll just leave that there.
And let's also open up the character set view as well, and we'll zoom that in so we can uh look at the zoomed in character set data in the last VIC bank.
Let's just zoom through these demo parts and then we'll get to the demo part that we're discussing.
So, the horizontal wiggle vertical scroll thing. Okay, yeah. So, it's basically Yeah, it's almost a repeating text repeating character pattern in the screen.
Uh but of course, depending on the on the horizontal zoom level, if you like, in inverted commas, it seems to be using subtly different characters. But yeah, it's it's an almost repeating um pattern.
Uh 1 2 3 4 four character rows per section of the screen roughly, uh possibly, and you can see as I step it from frame to frame that each frame uh doesn't look as as great as you thought it did when it was moving. Um and that's to be expected because the multiple different horizontal zoom levels need to get squished into one character set for each approximately four character rows, right? And you can see there, look, as more data is scrolled into the screen, then more data is presented into all of those character sets which are laid out in the VIC bank there.
So, yeah.
That that's pretty conclusive. There, that's how this demo effect works. And we can see there it's doing quite a lot of reads from earlier part of memory there in green and then doing an awful lot of yellow right into the character set um area of memory as well.
So, yes, just to recap, yes, there were several character sets for each horizontal section.
Uh several characters high, yes, five or six character sets. Yep. And it's a bit like the XL Exile game scroll.
Which it kind of is.
Especially with the vertical scroll there.
Updating the character screen with the with the repeating character rows for it.
So, here we go into the last section now, which is the flip disk section with this rather nice Yeah, look, it's a sprite sheet.
Um as as I thought.
And yep, the sprites move uh horizontally as well.
Following, you know, kind of like the wave pattern.
With the uh raster debug view here, we can see that Oh, yeah. Okay.
So, we can see that the uh the sprite frame pointers are changing. So, there's quite a few sprite frames there being presented.
And also let's see, it's six, seven, one, two, three, four, five, six, seven. Ah, so you can see that actually the sprites are vertically expanded. I didn't expect that.
Um that probably cuts down on the number of sprite frames being used.
Um also if if I Okay, well, that's intriguing. Look.
If I move the targeting cursor up and down, you can just see how many sprite rows there are.
And ah, well, that's intriguing. The the element 54 logo down at the bottom, it's using horizontally expanded sprites, but there seems to be uh some of the sprites there which are wiggling left and right.
Ah, yeah, which which gives the bottom logo um an apparent higher resolution. So, even though it's horizontal using horizontally expanded sprites with double with a double overlay, if you like. Uh that horizontal pixel wiggle uh wobble, rather, on on on a per line basis gives you apparently higher resolution pixels. And if I pause it here, you can see on each Yeah, on each raster line, um one or more sprites, the X position is also being updated.
Yeah, that's great. I didn't expect that, but yeah, that's a nice little addition.
Um the Yes, the the horizontal pixel positions for the twisty turny wibbly logo uh sprite sheet there, they're also being updated on a per line basis, which also gives it a smoother um a apparently higher higher resolution um pixel offset uh for even though it's using multicolor mode, um it it gives it a nice uh smoother transition, smoother um bend, if you like, on a per line basis. So, that's a nice little addition there.
So, yeah, updating pixel horizontal uh pixel positions for sprites on a per line basis um is a really great way of giving you apparently higher resolution sprites.
Uh basically mostly predicted, Um, apart from there's that nice addition of per line horizontal pixel position.
Uh, so yes, that's all of the sections of the demo that I wanted to have a look at in this video.
So yes, if you like these kind of technical deep dive videos, then please do consider liking or subscribing to this channel or sending me a super thanks. They are always very [music] much appreciated. I have an itch project page where you can download my software and optionally send me a nice donation, which is always appreciated. Take care.
Have a great day, evening, or night wherever you are.
Related Videos
LBF101 Creating an XML Changelog
liquibase7511
3K views•2026-06-15
Alta Labs Cloud Dashboard Real time Network & Xnet Insights!
ShinyTechThings
158 views•2026-06-17
Wait... Group Policy Not Applying? Check This First!
keeplearning_iT
144 views•2026-06-15
Leetcode Weekly Contest 506 | Life's boring these days
Pudeesht
2K views•2026-06-14
microJAM: MAKING A MICRO GAME FOR A GAME JAM IN CLOJURESCRIPT AND TOTALLY NOT C
janetacarr
156 views•2026-06-18
Partitioning vs Bucketing vs Clustering: How to Make Queries 100x Faster
thedataandaiguy
194 views•2026-06-16
Design Claude Code Like a Senior Engineer
hayk.simonyan
344 views•2026-06-19
Linus Torvalds: AI Won’t Replace Understanding Code
SavvyNik
140 views•2026-06-19











