Post by oompa loompa on May 4, 2004 2:50:56 GMT -5
ok ok, i can add subs and functions. but they're most likely going to look like "sub_SUBNAME <PARAM 1>,<PARAM 2>........" and "a=fn_FUNCTIONNAME(<PARAM 1>,............)". because the compiler compiler compiled straight, from top to bottem, there'd be no checking to see whether these user defined subs/functions exist. in addition, parameters will have to be forced onto the heap, if you forget to place a non-optional parameter into the sub/function call, its gonna screw lots of things up. but it all compensates for the run-time speed and all =D
How about for the Sega-CD support you add a feature that lets you play video files. That way we could make a new generation of FMV games! XD
I will receive this next week a complete segacd dev kit. IF there isn't any videos compressors (avi2scd) and any .asm source code for the player in this kit, i will do that:
I designed a special video format which is the merge between gif(for the pixel clones) and mpeg(for the frame layering). Decoding with the segacd is ok but creating a avi2scd.exe is a crazy challange (i never used msdos fonctionalities).
PS: Devster, for the summer show, will you create a crazy demo?
"Si Maello à 2 L, c'est pour mieux pouvoir s'envoler" DN.
Post by oompa loompa on May 26, 2004 2:25:49 GMT -5
fmv movies on the sega cd are hard, and its not gonna happen with basiegaxorz. i barely know how to code for the sega cd anyways. the cd player in the sega cd is slow, i mean it was something like 80k per sec.
what about a dac and a dacvol command for playing dac samples
I have a document on the YM2612(part of Saxman's Sonic 2 hacking guide) it is on FM voices, the compression, the 8bit YM2612 commands, the DAC sample format, the drum rolls, ...
maybe these could be a possibility: loadvoice voicenumber(0 - 127), label fmvoice fmchannel(0 - 5), voicenumber(0 - 127) fm fmchannel(0 - 5), data fmvol fmchannel(0 - 5), volume(0 - 7) fmpan fmchannel, pan(-1 = left, 0 = center, 1 = right) fma fmchannel(0 - 5), amssensitivity(0 - 3) fmf fmchannel(0 - 5), fmssensitivity(0 - 7) dac data dacvol volume (0 - 7)
Now, here are some things you should know for editing music. 00-7F - Note duration 80-DF - Notes (80 is a rest) E0-FF - Cordination flags Whenever you need to change the duration of a note, you simply type a number ranging from 00 to 7F. These define how many beats the note will be held for. So, for example, one note with a duration of 06 is the same as 6 notes with a duration of 01. Not all the cordination flags are known yet, but here are the ones I do know of. E0xx - panning, AMS, FMS E6xx - subtract xx from channel volume E8xx - set note fill amount to xx E9xx - add xx to channel key EAxx - set music tempo to xx EFxx - set voice selection to xx F6yyyy - jump to position yyyy F7aaxxyyyy - repeat xx times at position yyyy before moving on F8yyyy - jump to position yyyy (keep previous position in memory for returning) F9 - return If aa is 1, it will reset the repeat values (never-ending loop) E0xx can be tricky since it is handled at bit-level. So, here is the format for 'xx' within the 'E0' cordination flag. 8-bits - L R A A x F F F FFF - This value controls the FMS (frequency modulation sensitivity). The following is a listing of all the values and the results they produce 0 - 0 1 - add/sub 3.4% 2 - add/sub 6.7% 3 - add/sub 10% 4 - add/sub 14% 5 - add/sub 20% 6 - add/sub 40% 7 - add/sub 80% AA - This value controls the AMS (amplitude modulation sensitivity). The following is a listing of all the values and the results they produce 0 - 0dB 1 - 1.4dB 2 - 5.9dB 3 - 11.8dB R - When this bit is turned on, right stereo is enabled for the channel. L - When this bit is turned on, left stereo is enabled for the channel.
DAC samples are the drum beats you hear in the music. The format is very simple and easy to understand. Each set of 4-bits represents a pitch. All pitches are played in the piano C key. 'F' represents the highest pitched C you can have, and '1' represents the lowest. Zero is a null, which means that it won't play a note. Here are the locations to the samples I know of so far.
If you want to modify voices, it's not too difficult. As long as you understand how FM synthesis works, you should be fine. If you don't know anything about FM synthesis, you're probably going to have some trouble modifying voices. A voice is simply an FM 'instrument'. You can create up to 256 different voices. That's more than enough for a song. Most songs only need about 4 or 5. Each voice is 25 bytes in size. There isn't a header for voices. They're simply listed one after the other. FORMAT: #1 - #25 1 - Feedback (next 3 bits) / Algorithm (lower 3 bits) 2 - Detune of operator 4 (nybble 1) / Coarse-frequency of operator 4 (nybble 2) 3 - Detune of operator 3 (nybble 1) / Coarse-frequency of operator 3 (nybble 2) 4 - Detune of operator 2 (nybble 1) / Coarse-frequency of operator 2 (nybble 2) 5 - Detune of operator 1 (nybble 1) / Coarse-frequency of operator 1 (nybble 2) 6 - [RS] of operator 4 (upper 2 bits) / Attack rate [AR] of operator 4 (lower 5 bits) 7 - [RS] of operator 3 (upper 2 bits) / Attack rate [AR] of operator 3 (lower 5 bits) 8 - [RS] of operator 2 (upper 2 bits) / Attack rate [AR] of operator 2 (lower 5 bits) 9 - [RS] of operator 1 (upper 2 bits) / Attack rate [AR] of operator 1 (lower 5 bits) 10 - [AM] of operator 4 / First decay rate [D1R] of operator 4 (lower 5 bits) 11 - [AM] of operator 3 / First decay rate [D1R] of operator 3 (lower 5 bits) 12 - [AM] of operator 2 / First decay rate [D1R] of operator 2 (lower 5 bits) 13 - [AM] of operator 1 / First decay rate [D1R] of operator 1 (lower 5 bits) 14 - Second decay rate [D2R] of operator 4 (00-14) 15 - Second decay rate [D2R] of operator 3 (00-14) 16 - Second decay rate [D2R] of operator 2 (00-14) 17 - Second decay rate [D2R] of operator 1 (00-14) 18 - First decay level [D1L] of operator 4 (nybble 1) / Release rate [RR] of operator 4 (nybble 2) 19 - First decay level [D1L] of operator 3 (nybble 1) / Release rate [RR] of operator 3 (nybble 2) 20 - First decay level [D1L] of operator 2 (nybble 1) / Release rate [RR] of operator 2 (nybble 2) 21 - First decay level [D1L] of operator 1 (nybble 1) / Release rate [RR] of operator 1 (nybble 2) 22 - Output level of operator 4 23 - Output level of operator 3 24 - Output level of operator 2 25 - Output level of operator 1 Use only odd numbers for velocity. Also, detune 0-7 is negative, and detune 8-F is positive. The YM2612 algorithms are very specific. There's 8 algorithms total. In fact, they're identical to the algorithms on the Yamaha TX81Z.
If you're interested in putting music into Sonic 2 without copying the sound driver information from the beta version, you'll need to know the format of the compression. Here's how the compression works. There's a compression byte at the beginning of a song. To understand how it functions, you need to examine it at a bit-level. So, lets take '2B' for example. 2B - 00101011 Bits are read from right to left. A '1' means that there's no special copy instructions applied. The byte is read 'as-is'. A '0' is a flag. A flag tells the game to read bytes from a given location. So, using compression byte '2B', we can have something like the following. 2B 00 01 (24 00) 05 (53 00) 09 (21 00) (3A 00) A flag is handled by 2 bytes. 24 00 for example means that the game will grab 3 bytes from address 24 and read those before it continues. If you make the '00' into a '01', it will read 4 bytes from the address; '02' will read 5 bytes, etc. Flag addresses recognize the address 001E from the beginning of the song as address 00. After the jobs of all 8 bits from the compression byte have been performed, the very next byte will be a compression byte that will have the same functions. Also, something important to keep in mind -- whenever you need to make jumps, the beginning of the song is recognized as address 1380 (starting from the first non-compression byte). Finally, at the very beginning of the song, there is a little-endian word (2 bytes) that defines the total size of the song. Although, whatever it reads will actually represent 2 bytes more than shown. So, if the word is C102 (02C1 bytes), it actually represents 02C3 bytes in the song.
Post by oompa loompa on Jun 2, 2004 2:44:48 GMT -5
what about a dac and a dacvol command for playing dac samples
I have a document on the YM2612(part of Saxman's Sonic 2 hacking guide) it is on FM voices, the compression, the .............................
that's some good info, but mostly applies to sonic 2 =D. sonic 2's music interpretter keeps reloading music into the z80's ram, so it wouldn't be really idealistic to pause the 68k to load music into the z80 in the middle of a basic program. i want to minimize the use of interruptions for the basic program =D
Post by Tulio Adriano on Jan 6, 2005 21:02:25 GMT -5
Yep, of course the Sub and Function are a need!
Another thing I (at least I) need is an Option Explicit to require variable declarations. I die because of lost variables created by mistypeing. I prefer 1000 times to get an error message when compiling than get a strange behaviour and then discover that it was caused by a mistyped variable.
Post by oompa loompa on Jan 11, 2005 19:47:47 GMT -5
okay, this is how i implemented the sub/function thing. there are no such thing as local variables (this is because of the addressing mode - too hard to change at this stage), all variables are global. that mean when you want to use a function, all you're doing is copying expressions to variables, then using gosub, then returning a value in the returner value thingermabob (has a name: D0 =P). i dunno if its worth it =D, but it works =P, and makes code look pretty