Mod Player/7

 BBS: Inland Empire Archive
Date: 11-30-92 (21:19)             Number: 379
From: RICH GELDREICH               Refer#: NONE
  To: ALL                           Recvd: NO  
Subj: Mod Player/7                   Conf: (2) Quik_Bas
'<<Part 7 Starts Here>>
                    C.Volume(A)=64
                    C.Command(A)=0
                END IF
            CASE 2                      'Port down
                C.Period(A) = C.Period(A) - C.PortSpeed(A)
                IF C.Period(A)<113 THEN
                    C.Period(A)  = 113
                    C.Command(A) = 0
                END IF
                C.HighStep(A)   = PeriodHigh(C.Period(A))
                C.LowStep(A)    = PeriodLow(C.Period(A))
            CASE 3                      'Port up
                C.Period(A) = C.Period(A) + C.PortSpeed(A)
                IF C.Period(A)>1023 THEN
                    C.Period(A) = 1023
                    C.Command(A) = 0
                END IF
                C.HighStep(A)   = PeriodHigh(C.Period(A))
                C.LowStep(A)    = PeriodLow(C.Period(A))
            CASE 4                      'Port to Note Down
                C.Period(A) = C.Period(A) - C.PortSpeed(A)
                IF C.Period(A) <= C.PortDest(A) THEN
                    C.Period(A) = C.PortDest(A)
                    C.Command(A) = 0
                END IF
                C.HighStep(A)   = PeriodHigh(C.Period(A))
                C.LowStep(A)    = PeriodLow(C.Period(A))
            CASE 5                      'Port to Note Up
                C.Period(A) = C.Period(A) + C.PortSpeed(A)
                IF C.Period(A) >= C.PortDest(A) THEN
                    C.Period(A) = C.PortDest(A)
                    C.Command(A) = 0
                END IF
                C.HighStep(A)   = PeriodHigh(C.Period(A))
                C.LowStep(A)    = PeriodLow(C.Period(A))
            END SELECT
        END IF
    NEXT
RETURN
'=====================================================================
'Allocates memory from DOS.
FUNCTION Alloc (A)
    CPU.ax = &H4800
    CPU.bx = A
    CALL interruptx(&H21, CPU, CPU)
    IF (CPU.Flags AND 1) THEN ExitWithError "Out of Memory"
    Alloc = CPU.ax
END FUNCTION
'=====================================================================
SUB ExitWithError (A$)
    IF POS(0) <> 1 THEN PRINT
    PRINT A$: END
END SUB
'=====================================================================
'Extracts a Motorola word from a string, and multiples it by 2.
FUNCTION Extract% (A$, offset)
    v& = (512&*ASC(MID$(A$,offset,1))+ASC(MID$(A$,offset+1, 1)) * 2&)
    IF v& > 65535 THEN ExitWithError "Sample Too Large"
    IF v& > 32767 THEN v& = v& - 65536
    Extract% = v&
END FUNCTION
'=====================================================================
'Reprograms the 8255 timer so it hits an int 8 at a different rate.
SUB SetInt8Rate (A&)
    OUT &H42, 2 + 4 + 16 + 32
    OUT &H40, CINT(A&) AND 255
    OUT &H40, A& \ 256
END SUB
'=====================================================================
SUB SpeakerOff
    OUT &H61, INP(&H61) AND 252
END SUB
'=====================================================================
SUB SpeakerOn
    OUT &H61,INP(&H61) OR 3:OUT &H43,128+32+16:OUT &H42,0
    OUT &H42,0:OUT &H43,128+16
END SUB
'=====================================================================
ErrorHandler:
    SELECT CASE ERR
    CASE 7
        ExitWithError "Out of Memory Error"
    CASE 52, 53, 68
        ExitWithError "Bad File Name/File not found"
    CASE ELSE
        ExitWithError "Fatal Error"+STR$(ERR)+" has occured!"
    END SELECT
'END OF QBMP15.BAS====================================================
'<<-Cut Here->>

Continued!

--- MsgToss 2.0b
 * Origin: Computer Co-Op - Voorhees, NJ | Ted Hare (1:266/29)
Outer Court
Echo Basic Postings

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