home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CD-ROM Aktief 1995 #3
/
CDA3.iso
/
sound
/
tnypl211.zip
/
MODPL16.ASM
< prev
next >
Wrap
Assembly Source File
|
1994-06-21
|
63KB
|
2,116 lines
;▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
; 16-bit Tiny MOD Player for Borland C++ 3.1 C compiler
; Version 2.11a June 15th, 1994
;
; Copyright 1993,94 Carlos Hasan
;▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
ideal
model large,c
p386
smart
;▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
; EQUATES AND PUBLICS
;▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
MAXVOICES = 8 ; number of voices
DMABUFLEN = 1024 ; DMA buffer length (multiple of 64)
VOLBUFLEN = 66*256 ; volume table length
MIXBUFLEN = DMABUFLEN+2048 ; mixing/boosting buffer length
TIMERRATE = 17000 ; timer interrupt rate in ticks
global MODPlayModule:proc
global MODStopModule:proc
global MODPlaySample:proc
global MODStopSample:proc
global MODSetPeriod:proc
global MODSetVolume:proc
global MODSetMusicVolume:proc
global MODSetSampleVolume:proc
global MODDetectCard:proc
global MODPoll:proc
;▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
; STRUCTURES
;▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
struc module ; module structure
numtracks dw ? ; number of tracks
orderlen dw ? ; order length
orders db 128 dup (?) ; order list
patterns dd 128 dup (?) ; pattern addresses
sampptr dd 32 dup (?) ; sample start addresses
sampend dd 32 dup (?) ; sample end addresses
samploop dd 32 dup (?) ; sample loop point addresses
sampvolume db 32 dup (?) ; sample default volumes
ends module
struc sample ; sample structure
period dw ? ; default period
volume dw ? ; default volume
datalen dd ? ; sample data length
dataptr dd ? ; sample data address
ends sample
struc track ; track structure
note dw ? ; note index
period dw ? ; period value
inst db ? ; instrument
volume db ? ; volume
effect dw ? ; effect
destperiod dw ? ; toneporta wanted period
tonespeed db ? ; toneporta speed
vibparm db ? ; vibrato depth/rate
vibpos db ? ; vibrato wave position
tremparm db ? ; tremolo depth/rate
trempos db ? ; tremolo wave position
db ? ; alignment
arptable dw 3 dup (?) ; arpeggio periods
ends track
;▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
; DATA
;▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
;░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒
; Module Player data
;░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒
udataseg
moduleptr dd ? ; current module address
pattptr dd ? ; current playing pattern address
orderpos db ? ; order position
orderlen db ? ; order length
pattrow db ? ; pattern row
tempo db ? ; tempo
tempocount db ? ; tempo counter
bpm db ? ; beats per minute
musicvolume db ? ; music channels volume
samplevolume db ? ; sample channels volume
numtracks dw ? ; number of tracks
tracks track MAXVOICES dup (?)
pitchtable dd 3425 dup (?) ; period to pitch table
; Amiga period table
dataseg
periodtable dw 0
dw 3424,3232,3048,2880,2712,2560,2416,2280,2152,2032,1920,1812
dw 1712,1616,1524,1440,1356,1280,1208,1140,1076,1016,960,906
dw 856,808,762,720,678,640,604,570,538,508,480,453
dw 428,404,381,360,339,320,302,285,269,254,240,226
dw 214,202,190,180,170,160,151,143,135,127,120,113
dw 107,101,95,90,85,80,75,71,67,63,60,56
dw 53,50,47,45,42,40,37,35,33,31,30,28
; Sinus wave table
sintable db 0,25,50,74,98,120,142,162,180,197,212,225
db 236,244,250,254,255,254,250,244,236,225
db 212,197,180,162,142,120,98,74,50,25
;░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒
; Sound Blaster driver data
;░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒
udataseg
; Voices programmable parameters
voicepos dd MAXVOICES dup (?)
voiceend dd MAXVOICES dup (?)
voiceloop dd MAXVOICES dup (?)
voicefrac dd MAXVOICES dup (?)
voicepitch dd MAXVOICES dup (?)
voicevolume dd MAXVOICES dup (?)
; Internal driver data
dataseg
mixbuffer dw ? ; mixing buffer address
boosttable dw ? ; boosting table address
voltable dw ? ; volume table address
numvoices dw ? ; number of active voices
mixfreq dw ? ; playback frequency
ioaddr dw ? ; card I/O port address
irqnum db ? ; card IRQ level
drqnum db ? ; card DMA channel
timerproc dw ? ; timer callback address
timeracc dw ? ; timer callback accumulator
timerspeed dw ? ; timer callback speed
bufsel dw ? ; DOS memory block selector
bufptr dw ? ; DMA buffer address
bufoff dw ? ; double buffer offset
oldirqoff dw ? ; old IRQ vector address
oldirqsel dw ?
oldtimeroff dw ? ; old timer IRQ0 vector address
oldtimersel dw ?
oldtimeracc dw ? ; old timer accumulator
manualmode db ? ; timer/manual polling mode
playing db 0 ; playing/stopped status
ufardata fardataseg
db DMABUFLEN+VOLBUFLEN+MIXBUFLEN+15 dup (?)
;▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
; CODE
;▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
codeseg
;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
; Copyright Strings
;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
db '16-bit Tiny MOD Player V2.11 Copyright 1993,94 Carlos Hasan',0
db 'Compiled on: ',??date,' ',??time,0
;░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒
; Module Player stuff
;░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒
;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
; MODPlayModule - start playing a music module
; In:
; Song = module address
; Chans = number of channels
; Rate = playback rate
; Port = port address
; irq = irq number
; dma = dma channel
; mode = polling mode
;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
proc MODPlayModule Song:dword,Chans:byte,Rate:word,Port:word,IRQ:byte,DRQ:byte,Mode:byte
pushad
push es
; setup the music module address