Nine – seemingly impossible C64 demo
linusakesson.net
linusakesson.net
Across an entire scanline I think you normally get something like 63 6510 cpu cycles to do 'work' in, but only 23 if you hit a badline - keeping in mind that some instructions take multiple cycles to execute. This probably makes the timing difficult or impossible to manage with the characters turned on.
During a badline it's simply impossible write to the VIC-II's registers during the left border. Though, this seems to indicate it's still possible to open the right border during a bad line, but it's a 1 cycle window (maybe 2).
[1] https://nurpax.github.io/posts/2018-06-19-bintris-on-c64-par...
Thia is .... Something else!
This demo actually shows 9 "sprites" on the same raster line using some clever tricks like low-res stretched sprites combined with custom characters. It all makes sense once you know the tricks, but the really impressive thing is how smooth it is. Which I guess is why it features a magician.
https://www.linusakesson.net/scene/lunatico/misc.php
Great article.
It's been a while, but I recall that you had to do some fancy interrupt timing stuff for that. To find where that was in the code, the same procedure applied that we used to find the handler for background in the code of games: search for 0x78 (SEI), which temporarily blocked interrupts so background stuff could be installed ("pseudo-multitasking").
We used to purchase a tape or 5 1/4" floppy disk with a game per month and instead of playing the game, we competed who could remove the music from the game the fastest (so that it could play in the background alone, e.g. while writing code). In the end that was a matter of just seconds for previously unseen machine code using a hex monitor/disassembler. The advantage of such a "teenage sports" is you will never forget that "169 = A9 = load accumulator" and the rest of the MOS 6510 opcode table, even after not using it for 40 years.
I wonder what today's kids will remember? (They seem to have to Google each Python keyword, and they can't do anything if WiFi is down for an hour, which worries me.)
I worked with a younger guy on a pre-existing, large project written in C. He saw me use the man command and asked why I would do that - was I expecting to be offline? But I don't think of man pages that way, I still think of them as primary documentation. They're also specific to the software versions on the system I'm logged into, unlike whatever comes up when I Google `man 2 unshare`.
I like how the title really invites you to pun it as "a mind is blown", because mine sure was when I first watched it.
For better understanding: The demo starts with a magician character drawn in the center of the screen, announcing the trick in text (some of this is big text achieved by overlaying sprites). Then, 9 sprites, each in the form of a colored number from 1 to 9, exit the magician's hat to rotate around him (in the notes screen #1), then, the screen gradually widens horizontally beyond the usual borders and the circle of the 9 apparent sprites spreads out over the entire screen (screen #2). (At this point, the display of the magician, which was clearly drawn by PETSCII characters, before, shouldn't be viable anymore.) The swirling numbers transition to a narrow ellipse near the top of the screen (screen #3), which then transition to the very top of the screen, above the normal display area, a zone, which is available for sprites only, showing the sprites in a linear rotation (screen #4). Meaning, these must be sprites and these 9 apparent sprites are drawn at the same scan-lines. (So there is no way this could have been achieved by conventional, vertical multiplexing. This is the highlight, the big trick of the magician's show.) At the end, the sprites return to their initial circling motion and vanish, one by one, into the magician's hat.
The demo is a combination of various tricks and artful timing, which enables perfect transitions between them.
> the last two Sprites there are multicolored mode; (...) we have a different number of of high res mode Sprites and multicolored Sprites and expanded Sprites; and those high res and multicolor and some horizontally expanded Sprites are all munged together and then the apparent view with animation of the Sprite data as well the Sprite frames (...) gives an apparent view of having nine independent Sprites; but we know it's not, we know that it's a great big blob of eight Sprites all grouped together horizontally (...)
via youtubetranscript: https://youtubetranscript.com/?v=Ik1vsMM2EuY
edit for further detail: This would be used for one of the numbers, with the other 8 using sprites.
I did the scan line frequency calculations, and my though of changing the border color would not work. In one cycle the scanline advances 8 pixels, so toggling the border color would be a minimum of 32 pixels in width.
At that point we go "Ah."
(It's very normal in illusionism: the practitioner states something that puts you in the relaxed mood of participation to a game you know - then actually surprises you.)
But I'm not sure about the end of the demo where they are all rotating on the same line. I guess it could be done with interrupts occurring partway through the horizontal scanline, but I didn't think they could be that precise?
the secret is to pretend you have a 9th sprite by emulating it with characters that look exactly like one of the sprites would.
The borders are open when you can still do the normal multiplexing, because there's lots of vertical separation between the sprites.
Later, when they put the sprites together on the same line, the borders are closed.
Typical HN comment minimising the immense effort required to do %thing% due to their own arrogance.