Tool for Master System

VersionDateByDownload
1.0127 Mar 2020sverxVU-SMS-1.01.zip (6KB) (includes source)

Discuss this

There is a forum topic for VU

Competition Entry

This was a competition entry in 2020

Old Versions

file namesize (bytes)
total 1 file43K
VU-SMS-1.00.zip 43K
Version
1.01
Platform
SMS
Type
Tool
Released
20200327
By
sverx
Screenshots
1
Source
included
ShowOldVersions
true

:ForumTopic:17869

(preamble) This has been quite rushed at the end as I didn't find enough time to improve it, but improvement is surely possible.

So here's *VU*: a standalone PSG player with VU meter display. Uses PSGlib of course. Source code included too.

The interesting part of the code is surely the routine that draws the 4 needles on screen using sprites.

This is done using the Integer Line Algorithm to calculate which of 8 possible pre-loaded sprites should be used for each 8-pixel tall segment of the line, and the current implementation works only for those lines going from y0<y1 (going down on the screen) and with sharp angle only - that is, when the line will need at most one pixel per horizontal line.

As the current algorithm doesn't take into account on which lines the x position of the pixel should be incremented but only how many times we need to do that, the line isn't always drawn perfectly, but it's close enough after all. Another limit is that the line might be drawn 'past' the destination point (x1,y1) as all the sprites contain line segments that are 8 pixels tall, so I had to mask that part of the line that I didn't want to show using black sprites strategically placed. Hey, it's a hack, of course!

From the VU perspective, for each channel the algorithm adds the volume of the last 17 samples (because 17*15=255 so I can always sum 17 values into a byte) and the resulting value is then shown by the needle (which has only 68 possible positions anyway, so it's scaled down of course).

17 samples at 60 fps take 283 ms which is almost 300 ms, the rise time expected by real VU meters, so the effect should look quite accurate too (18 samples would make that perfect, but would require ints instead of chars...)

Compiling the code creates a 16 KB ROM (complete with correct SEGA ROM signature). At this point, you can concatenate your PSG file to this ROM and send it to who you want (the PSG file limit is 32 KB).

on Windows: copy VU.sms+YourTune.psg YourROM.sms

on Linux: cat VU.SMS YourTune.psg > YourROM.SMS

VU.SMS is also provided, you don't need to recompile it if you're not planning any change.

Finally, two *GREAT* tunes ROM are included for your enjoyment:

Also, for those using a Master EverDrive, the OS *should* load the file correctly from SD card even if the file size isn't rounded to any particular multiple/power size, as it's less than 64 KB, so you shouldn't need to pad your file. I can't test this myself at the moment, unfortunately.

I hope you'll enjoy this! See you later :)

sverx

https://youtu.be/NrYHwUntLMU



Return to top
0.119s