Created
September 3, 2024 20:33
-
-
Save ssg/cabc12bb4fb1202f748053fa11ca20bb to your computer and use it in GitHub Desktop.
Some VOC processing code I wrote in the 90's
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
Name : X/VOC 1.00a | |
Purpose : Sound Blaster interface routines | |
Date : 29th May 94 | |
Time : 19:18 | |
} | |
unit XVoc; | |
interface | |
const | |
{VOC Block types} | |
MaxBlocks = 8; | |
vbTerminator = 0; | |
vbVoiceData = 1; | |
vbVoiceCont = 2; | |
vbSilence = 3; | |
vbMarker = 4; | |
vbText = 5; | |
vbRepeat = 6; | |
vbUntil = 7; | |
vbExtended = 8; | |
VOCBlock : array[0..8] of string[10] = | |
('Terminator', | |
'VoiceData ', | |
'VoiceCont ', | |
'Silence ', | |
'Marker ', | |
'Text ', | |
'Repeat ', | |
'Until ', | |
'Extended '); | |
MaxPacks = 3; | |
ptNone = 0; | |
pt4bit = 1; | |
pt26bit = 2; | |
pt2bit = 3; | |
PackStr : array[0..3] of string[8] = | |
('None ', | |
'4-bits ', | |
'2.6-bits', | |
'2-bits '); | |
type | |
TVOCHeader = record | |
Desc : array[1..19] of char; | |
EOF : byte; | |
DataOffs : word; | |
Version : word; | |
Checksum : word; {version+checksum must be equal to 1234h} | |
end; | |
PVOCBlock = ^TVOCBlock; | |
TVOCBlock = object | |
Len : word; | |
Temp : byte; | |
end; | |
PVoiceData = ^TVoiceData; | |
TVoiceData = object(TVOCBlock) | |
KHz : byte; | |
Pack : byte; {voice length=len-2} | |
Data : record end; | |
end; | |
PVoiceCont = ^TVoiceCont; | |
TVoiceCont = object(TVOCBlock) | |
Data : record end; | |
end; | |
PSilence = ^TSilence; | |
TSilence = object(TVOCBlock) | |
Period : word; | |
KHz : byte; | |
end; | |
PMarker = ^TMarker; | |
TMarker = object(TVOCBlock) | |
Marker : word; | |
end; | |
PRepeat = ^TRepeat; | |
TRepeat = object(TVOCBlock) | |
Count : word; | |
end; | |
PUntil = ^TUntil; | |
TUntil = TVOCHeader; | |
PExtVoice = ^TExtVoice; | |
TExtVoice = object(TVOCBlock) | |
XKHz : word; | |
Pack : byte; | |
Mode : byte; | |
end; | |
function ValidVOCHdr(var H:TVOCHeader):boolean; | |
function TC2KHz(tc:byte):word; | |
implementation | |
function TC2Khz; | |
begin | |
TC2KHz := (tc-256)*1000000; | |
end; | |
function ValidVOCHdr;assembler; | |
asm | |
les di,H | |
mov dx,word ptr es:[di].TVOCHeader.Version | |
mov bx,word ptr es:[di].TVOCHeader.CheckSum | |
mov cx,1234h | |
add dx,bx | |
xor al,al | |
cmp dx,cx | |
je @Exit | |
inc al | |
@Exit: | |
end; | |
end. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment