SCC Musix Dizc 1 2022 - Fuzzy Logic
===================================
  i n   d e m o   w e   t r u s t

In the year 1992 Fuzzy Logic released the first and only "SCC Musix Dizc" (SMD) containing 25 SCC songs created by Hans Cnossen (aka Kid Knoz). Today we celebrate this 30th anniversary with a rerelease of that same disk. Fuzzy Logic present "SCC Music Dizc 1 #2022" for the MSX2 computer system.

Just when we thought we'd never enter the 8-bit scene with new code again, some strange world-wide phenomena occured. This epidemic called Corona, or Covid19, suddenly gave us extra spare time leaving us confused and helpless. What to do with all that extra time! Early 2021 was the (unexpected) kick-off for new coding to happen on the trusty old MSX, but this time on a modern platform. Shadow thought it was time to discover openMSX while he'd been using BlueMSX for years. With openMSX things got serious, this is a solid emulator that changes the whole coding game. And so it happened.


And now, here's Shadow with the weather.

Hi guys, I'll take the lead on this as I am the main demo programmer for SMD. This is my personal journey in revisiting the 8-bit MSX computer system, after a long hiatus. The year 2021 was the start of me getting down to business, starting with our Midas Operating System program. I needed a refresh on things, just like our old source files. With clean code in mind, it was time to update existing technology.

After refactoring the code for the Fuzzy Logic "Midas" OS (aka f-kernel), there was a need to test-drive that new installement. One thing had always been on my mind: making a files-version of SMD. You see, the original 1992 version is a 2DD sector loaded program. While sector loading is fast, quick and easy, it is not hard disk friendly. Besides, the original SMD was not made on Midas and lacked flexible memory management. So, this was a good oppertunity to get a crack at just that.

SMD(1992) Used 128KB and static memory mapping segment usage by loading one .sng file in one 16K. Each song block (screen) of 5 songs would fit in one go, while a next block of songs needed loading again. With Midas, and some more tricks (more on that later), it is possible to fit about 31 songs in memory on a 128K machine. With more memory it's possible to load all 40 tracks beforehand.

Wait! 40 tracks? Yup, the Kid popped out some more tunez.

What more changed with this new SMD version, you might ask. Well, frankly, not much. But here's the gist:
 - files instead of sector
 - added a short splash screen
 - added a streching feature to the intro text-scroller
 - expanded the 8x8 font with lower case characters
 - added 15 more songs, adding up to a total of 40.
 - preload all files beforehand, as much as possible. The whole demo fits in less than 256K.
 - Song selection navigation changed
 - Added an autoplay feature
 - replaced the song loader screen for a faster one
 - added song fade-outs
 - added an exit door

That's what changed on a functional level. The technical change is a whole different story. More on that at the end of this text file.


Navigation
-----------
During the intro demo either press space or ESCape to exit and move to the song selection screen.

In the song selection screen, the following keys can be used: (using keyboard and/or joystick)

 UP, DOWN to select a song
 RIGHT, LEFT to select next or previous block/screen
 Space, Fire to play the selected song
 F1, SELECT to toggle the screen refresh rate 50/60hz
 F2 to toggle 50Hz speed play on/off
 F3 to toggle automatic play on/off
 F4 focus the cursor (back) on the current playing song
 ESC to exit the demo

Use directional keys/stick to traverse the song list. This song list is divided in blocks (screens) of 5 songs. There are 8 blocks, leading up to a total of 40 songs. Press fire to play the song. The current song will be faded out. If the selected song to play is in memory, it will immediatly start to play. Otherwise, a short loading screen will pop-up, and the song file is loaded from disk first. All songs will fit in memory on machines with 256K or more.

When exploring the song list, you can easily return to the current playing song with the focus function on the F4 key. When auto play is on, and the cursor is on the currently playing song, the cursor will follow the autoplayer when moving to the next song. Otherwise, the cursor is unaffected.

The playing speed of a song will be corrected to 50Hz speed when NTSC (a screen refresh of 60Hz) is enabled. You can toggle that feature on/off with the F2 key. It is enabled by default. If yer bored, press ESC and you'll return to BASIC. Jup, that's right. BASIC.

Otherwise, enjoy the show.


Credits
-------
 Hans Cnossen aka Kid Cnoz: all music, the star of the show
 Róman van der Meulen aka Shadow: demo coding, Midas coding, Graphics
 Alex van der Wal aka Savage: Midas coding, but most of all dorment


Thanx
-----
We would like to thank the following people or organizations for their support on this release:
 - John Hassink :: for your overall support
 - Jelle Jelsma (meits) :: testing in depth, text review
 - Simon Vis (Retrofan) :: testing
 - Markus (Hamlet) :: testing and image
 - Francisco Morales Ureña (Frank MSX demos) https://www.youtube.com/c/FRANKMSXDEMOSFORYOUANDME, fkd productions and karakandao :: video footage
 - Arnaud de Klerk (the FileHunter): hosting SMD online at https://www.file-hunter.com/
 - Laurens Holst (Grauw) :: for MSX Assembly Page (MAP) site http://map.grauw.nl/. A great resource if you're old like us and can't remember the difference between RLCA and RRCA.
 - openMSX, https://openmsx.org/ :: trully amazing MSX emulator
 - MRC and its forum members, https://www.msx.org :: a good helping hand whenever you're in need for some good old programming tricks

you rock \m/


FILES
-----
The distribution of SMD12022 consists of the following files:
 - smd12022.txt: this file
 - smd12022.bin: the binairy loader (bload "smd12022.bin",r)
 - smd12022.lib: data file
 - autoexec.bas: optional booter.

This MSX original software package is public domain and may be copied freely.

If anything is out of order, contact us (how? just find out)


Have fun.
www.thefuzz.nl
--------------------------------------------------------------------------------------------




Technical stuff
---------------
And now, for the fun part

The 1992 SMD was very straight forward coding wise, and not that flexible. The thing it was sector-loaded, quick but (again) not that flexible. It needed 128KB of RAM, more RAM wouldn't matter. Song data was in the original SCC Musix format, which was huge and had a lot of white-space. We could get one song in one memory mapper segment of 16KB and that's it. With this new version, THAT changed.. a lot. To fit more than one piece of music in a segment, I had to come up with some tricks besided the obvious data-compression.

The Music Replayer
First thing needed to be done, was refactoring that old music replayer. It was horrible programmed by the original author (Michiel Spoor). That is no shame, back in 1992 we were young and unexperienced. Unlike we are today. Programming a computer was nothing like it is now, using modern computers and tools and all. Back then, I already did some mild changes on the replyer to have multiple songs in memory. But this time, I went all the way. I refactored the replayer a lot to make it (first of all) readible, flexible, faster and more feature rich.

The new SM replayer has the following features added or changed:
 - a new SCC detection function which checks all slots (not just the primairy ones)
 - Songs can be anywhere in memory
 - a global volume (amp)
 - global volume fade in/out/slide
 - 50/60Hz equal play
 - faster than the original
 - Can play a raw .sng file or a truncated (compressed) .smt version

There where practically no functions (subroutines) and every thing was coded in just one lengthy run. Lots of StackPointer fidling too. I also added necessary comments to functions or sub code. It took me quit a bit of time to understand what was going on, the source code wasn't #cleancode at all. The current v2.4 is a much more optimized and readable version. Also fixed some bugs. meh.

Song Data format
That last bullet on the new features list (raw vs truncated), is what really sets this change appart. I made a truncater for the original SM .sng files that will shorten the file by 50% on averige. That's half the size! Here's a list of things that made that possible:
 - remove unused instruments
 - remove instrument names
 - remove unused positions (shortening the position table)
 - remove any unused patterns
 - replaced the 2 byte note value (in Hz) to a 1 byte note (lookup 1-96)
 - added a token for empty step, reducing white space
 - added a token for empty row, reducing white space

This results in a .smt (Scc Musixx Truncate) file which can be used with the new replayer. I've added a little header to the file to seperate it from a raw SM .sng file.

Now, adding some RT compression to that truncated file and have it reduced (again) about 50%. With a netto result of about 12,6% of the original file on everage, this is huge. Did you read that? 12,6%! This means we can fit about 8 songs in one 16K segment! Holy shit. To put that into perspective: the 40 raw .sng files take up 445KB of space, while the truncated and compressed files will add up to about 56KB in total. To be honest, we should reserve about 8KB extra for decompression space as well. So let's say we need (just) 64KB of RAM for all song files! Add some fragmentation and room for code, data and other stuff, we end up with about 150KB or RAM needed in total to have SMD in memory (everything). If songs don't fit in memory, it will just be loaded from disk on the fly.

I love this stuff.

I'm not gonna bother you on the technical stuff I did with SMD itself, just take it as it is. Instead, I like to take the oppertunity to talk a bit about Midas.


Midas
-----
(warning, this is gonna be nerdy)
Okay, then there's the matter of Midas. Or f-Kernel. Our Operating System. This OS is a beast when it comes to data handling (RAM or Files). You've seen Midas in action on our Muzax series and on the Umax games as well. But, in 2021/2022 Midas has been completely refactored and re-coded with clean code in mind. In fact, SMD12022 was meant to test-drive the new kernel. We are at version 2.51 right now.

With Midas we're very flexible when it comes to files and memory. The built-in memory, file, and data managers work in union to have data-handling done in a way that programmers need not to worry about it. It is transparent and fast. This new SMD version is living proof of that; I needed not to worry too much on files, only on demo code. The built-in decompressor (RT) does an excellent job at getting data fast at any desired location. In this case, all SM songs are compressed and loaded into memory using the Midas Resident File System (RFS). Which is comparable to a RAM disk with support for pre-emptive caching. When a songs needs to be replayed, the replayer service picks it up and tells Midas to "just" return the song data. The replayer then initilizes the song (which is "somewhere" in memory) and starts playing it. Simple, fast and worry-free for the programmer.

Besides the RFS, it also has a Library File System (LFS) on board. This is a file system that for container files that contains plain files. You've probably seen these .LIB files in our productions before. You can compare it to a .zip or other modern container file system. Using LFS is transparent, just like RFS, when handling files. In fact, the programmer/user wouldn't even be bothered with file locations. A program just calls common "OPEN", "READ", "CLOSE" functions (or should I say CRUD) to get file data independant of its form or source. Or, it would just ask the Data Retrieval System (DRS) to fetch the file for it, compressed or not. The overal file functions are called Universal File Access (UFA). Having all files compressed in a .LIB file ensures fast file access.

Enough of this kernel talk, let's just say that I'm really happy how SMD works on Midas.

Having said that, I wish you all sunny days.


cheers, Shadow.





