With Stars in Our Eyes!

With Stars in Our Eyes!

Recently, at the end of a trolling ceremony during which I launched the demo DSC#4, I ended my incantation with a "We miss Overflow!" to summon a forgotten legend.

Poof! What joy to see appearing in my living room someone who had often proudly carried the colors of group Logon System:

Poof!

As a warm-up, and to see what was left of his legendary neurons, we crossed swords on the friendly Christmas challenge by Logiker, which consists of displaying a chosen pattern made up of several 'star' characters with code taking up as few bytes as possible. In 2023, it was diamonds:

🞜 Vintage Computing Christmas Challenge (VC³) 2023 🞜 - Logiker
🞜 Vintage Computing Christmas Challenge (VC³) 2023 🞜. Vintage Computing - Textart - Compos

The challenge is open to all machines (from the oldest to the most recent).

Obviously, some platforms are more advantaged than others for the exercise, but the goal is mainly to participate !

...

Wow! He's far from having lost his touch with Z80A, the legendary beast! I had to struggle to reach his score but I couldn't let him show me up like that with his bold score!

The exercise is interesting insofar as one can find many solutions to solve a given problem. Some solutions can end up at a dead end as soon as it seems impossible to optimize the code further, and then you have to put the subject back on the table several times and try varied, even eccentric approaches.

One of the difficulties of the exercise for me was switching from reasoning in "CPU-only" mode (in terms of execution speed) to "SIZE-only" mode (in terms of space). When there's no speed compromise to make, you can shamelessly use CPU-intensive but byte-short instructions, and even display the same character 256 times if it helps simplify a test.

I thought, before we exchanged our solutions, that we had come up with the same code. Yet our solutions were ultimately quite different. A good reminder to stay humble before a CALL #BB5A.

However, each of us had gone with our own little barbaric tricks that don't respect the Geneva Convention. I publish below the 2 solutions (well, I don't even understand anymore what I wrote).

From there, we worked together to get the best out of both solutions in order to proudly scratch 1 miserable byte.

Longshot / Overflow

Finally, the best score on CPC was achieved by... Nesu, who managed to get 27 bytes.

Big cheers to him! (note: make this post in English!)

While studying the winner's code on CPC, we noticed that it is allowed by the rules to launch the demo via a "load " followed by a "call ".

🖥️
On CPC, when an executable is launched via the "run" instruction, as we had done, the program cannot return to BASIC with a simple "ret" in Z80A without crashing the CPC. A "ret" returns control cleanly when called with the BASIC instruction "call". With a "run" the code must "loop" when it finishes its job, or "restart" drawing the pattern infinitely, which is costly in size. A "call" offers a second non-negligible advantage, because its argument (the address to call) then becomes available in two 8-bit registers of the Z80A. It's a way to pass a "parameter" to the code, and thus save space. It is thus possible to retrieve the ASCII code of the "*" character by putting its ASCII code as the least (or most) significant byte of the address. This possibility was indicated in the fine print of the rules...

This is good to know for those who try the exercise for Christmas 2024. This little precision allows us to bring our joint solution down to 25 bytes:

The Vintage Computing Christmas Challenge 2023 - Page 3
The Vintage Computing Christmas Challenge 2023 - Page 3

So there is hope that the CPC can approach the podium against this damned ZX SPECTRUM (Bravo to Art Top !!).

Even if....what matters, of course, is participating.

Longshot / Logon System

 

🇫🇷 Version française