BBS: Inland Empire Archive Date: 11-30-92 (21:16) Number: 376 From: RICH GELDREICH Refer#: NONE To: ALL Recvd: NO Subj: Mod Player/4 Conf: (2) Quik_Bas
'<<Part 4 Starts Here>> 'Initialize the assembly buffer player. SetBuffers VARSEG(SampleBuffer(0)), VARPTR(SampleBuffer(0)), _ VARPTR(SampleBuffer(512)), IntsPerClick * 2 'Set int 8 to our asm routine CPU.ax = &H2508:CPU.ds = GetCS:CPU.dx = GetOF CALL interruptx(&H21, CPU, CPU) 'Reprogram the 8255's timer to the specified sample rate. SetInt8Rate &H1234DE \ IntRate 'Turn speaker on, and play the MOD. SpeakerOn DO 'Wait for sync signal from the assembly buffer player... DO: LOOP UNTIL CheckDoneFlag 'Mix another buffer. GOSUB DoMix A$=INKEY$ IF A$<>"" THEN 'Process any keystrokes. K=ASC(RIGHT$(A$,1)) SELECT CASE K CASE 49 TO 52 ChannelOn(K-49) = NOT ChannelOn(K-49) CASE 27 Exit do CASE &H4b 'Left T.Pos=T.Pos-1 IF T.Pos<0 THEN T.Pos=T.Length-1 GOSUB StartNewPattern CASE &H4d 'Right T.Pos=T.Pos+1 IF T.Pos=>T.Length THEN T.Pos=0 GOSUB StartNewPattern END SELECT END IF LOOP 'Turn off speaker. SpeakerOff 'Set int 8 rate to normal (18.2 hz) SetInt8Rate 0 'restore old int 8 handler CPU.ax = &H2508:CPU.ds = Old8.Segment:CPU.dx = Old8.Offset CALL interruptx(&H21, CPU, CPU) LOCATE ,1:PRINT SPACE$(40); END '===================================================================== 'Processes 1 line(4 channels) of a pattern. DoLine: DEF SEG = PatternSegment FOR A = 0 TO 3 C = PEEK(T.Offset): T.Offset = T.Offset + 1 IF C <> 0 THEN 'Process a new sample, if any. C = C - 1 C.Segment(A) = S.Segment(C) C.Volume(A) = S.Volume(C) C.RepStart(A) = S.RepStart(C) C.RepLength(A) = S.RepLength(C) C.Length(A) = S.Length(C) C.LoopEnd(A) = C.Length(A) END IF C = PEEK(T.Offset) * 256 + PEEK(T.Offset + 1) T.Offset = T.Offset + 2 IF C <> 0 THEN 'Process a new period, if any. IF PEEK(T.Offset) <> 3 THEN C.Period(A) = C C.HighStep(A) = PeriodHigh(C) 'Lookup the step rate of C.LowStep(A) = PeriodLow(C) 'the new period. C.Offset(A) = 0 C.LoopEnd(A) = C.Length(A) C.Remainder(A) = -256 C.InactiveFlag(A) = False END IF END IF C.Command(A) = 0 M = PEEK(T.Offset) IF M<>0 THEN 'Process a command, if any. o = PEEK(T.Offset + 1) SELECT CASE M CASE 12 'Volume C.Volume(A) = o CASE 15 'Tempo T.Tempo = o '<<-Continued On Next Message->> --- MsgToss 2.0b * Origin: Computer Co-Op - Voorhees, NJ | Ted Hare (1:266/29)
Books at Amazon:
Back to BASIC: The History, Corruption, and Future of the Language
Hackers: Heroes of the Computer Revolution (including Tiny BASIC)
Go to: The Story of the Math Majors, Bridge Players, Engineers, Chess Wizards, Scientists and Iconoclasts who were the Hero Programmers of the Software Revolution
The Advent of the Algorithm: The Idea that Rules the World
Moths in the Machine: The Power and Perils of Programming
Mastering Visual Basic .NET