Login
Back to forumReply to this topicGo to last reply

Posted By

Murphy
on 2023-10-25
14:20:22
 Questionmark

Title:Questionmark
Category:Demo/Trackmo
Release Date:2003-10-25
Language:English
Size:64K
Device Req.:Disk only (1 side)
Machine:PAL Only
Code Type:Machine code
Distribution:Freeware
Questionmark Screenshot


Posted By

Murphy
on 2023-10-25
14:20:22
 Re: Questionmark

Digi music in a demo based on raster effects.
Still hard to believe that this is possible.

Posted By

BSZ
on 2023-10-25
18:05:49
 Re: Questionmark

@Murphy: I think I'm not telling you any big secret: all timing is connected to everything else. grin

Posted By

gerliczer
on 2023-10-26
06:16:57
 Re: Questionmark

We demand a detailed description of all technical challenges and nuances. Or, as it is called in the scenes related to your activities, a BSZ novel. grin

Posted By

Murphy
on 2023-10-26
15:15:10
 Re: Questionmark

@BSZ For an effect this can be done with a bit of work, but for a whole demo it's very hardcore code. happy

Posted By

BSZ
on 2023-10-28
04:18:38
 Re: Questionmark

@Murphy: There is perhaps so much simplification that these effects were designed for this demo. I didn't need to modify ready-made effects. happy

@gerliczer: I could write a whole book about this, not a novel. grin

For me, this was the first project that I created entirely with cross-platform tools. There is source code, the compile was done with assembler, run on pc. (One advantage of this is that you know at least roughly when I started coding: the source files have a modification date. grin ) At that time there was no good emulator available, so the tests were done on a real machine: the pc and the plus/4 were connected by a parallel cable, and the resulting binaries could be "transferred" from the pc to the plus/4 with the appropriate programs. (This setup was so good that I have used the logic ever since, although the hardware has changed in the meantime.)

However, the very first content of the demo is earlier than the first code: it's the digi music itself. (The first codes were write in June 1997.) But this music mix was not actually made for this demo. (The original plan never got beyond brainstorming.) In fact, the music was originally digitized at twice that sampling rate. happy I was also planning to load the "other half" of the digitization at the end of the demo and switch to double frequency playback. grin But I didn't get that far.

Perhaps one of the interesting parts of the demo is the music playback. Before that time, the team had made a lot of digi-mixes, which - approximately - playing in the following way: sound samples are typically 4-bit, two of which fit into a BYTE. An interrupt is set, the frequency of which is given by a timer, this is the sampling frequency. This interrupt routine does the following: it reads the BYTE of the next sound sample, decides which 4 bits required, reads the TED register value for this 4 bits from a table, and writes it in to the TED register. It then steps the pointer to the next sound sample. In the meantime, it checks whether the given part of the music has ended. When if finished, it reads the start/length of the next music snippet from the mixing table and sets it. It also sets the sampling frequency of the new music snippet from the same table. (Also, my previous request for the music was that the sampling frequency should not change during the whole music mix. For this reason, frequency switching will not be necessary for this music.) This is complex enough to be included with a raster effect in this form, so a different solution is needed.

All related #1: The sampling frequency of music is not random. It has been selected to be in sync with the machine's display. We've seen music playback where the border color register is changed when the sound register is written: colored rasterlines bounce across the screen. In the synchronized case, you would see the rasterlines blink, but their position on the screen would not change. This is a big help, but the above task running in interrupt is too much. The solution is to take the above interrupt routine out of the interrupt with some modification: the sample-handling code does not write the corresponding register of the TED, but saves the "calculated" register value in a buffer. This "next sample" part of the program must be called as many times in a cycle as there is space in the buffer. The "real" sample-playing interrupt routine can thus be very simple: it reads a BYTE from the buffer, writes it to the TED register, and then increments the buffer pointer. When the end of the buffer is reached, it signals that the next batch of data is required. Double buffering is useful here: when the buffer reaches its end, it switches to the other buffer. And the empty buffer is fillable.

All releated #2: The buffer size is not random. The "round size" (2^n) would be the simplest, but it is not appropriate here. Here, the buffer holds exactly as many sound samples as are needed during one screen display. Thus, the positions at which the sound samples are written to the TED register do not change, and the buffer is always flushed at the same screen position. When the buffer is empty, a routine can be called at any time to reload the empty buffer in one go. (Funnily enough, there is also a "classic raster time" for playing digital music. grin )

As I remember, the "empty buffer" is currently timed to the top of the screen. The interrupt system is such that it switches the empty buffer to another previously filled one, and then re-enables interrupts (after the appropriate state saving). Here you will call the desired subroutines, including the buffer reloads. This way the whole system runs under interrupt, while the main program can do its own thing, such as loading the next part.

All releated #3: The "buffer empty" is not where it is by random. If there is some effect in the screen, this starts immediately after the "buffer empty" event. In this case, the effect's raster routine is called after the "buffer change". The raster routine then incorporates reading the sample from the buffer and writing the TED register. At the bottom of the screen, call the routines for the effect and the music playback (buffer fill) as above.

That's about the music. In short. grin



Back to topReply to this topic


Copyright © Plus/4 World Team, 2001-2024