;Club 100 Library - 415/939-1246 BBS,    937-5039 NEWSLETTER, 932-8856 VOICE

;ASYNC.DOC (a version of ASYNC.ASM)

        ;Written and (C) Copyright Don Corbitt
        ;For personal use only
        ;ASYNCHRONOUS SOUND COMMAND

;modified 1/19/85 by Rick Perry

RST75   EQU     @H0F5FF.
RST751  EQU     @H0F600.

        rel

nowait  push    psw
        di
        call    @       reset
        ei
        jmp     @       sound

wait    PUSH    PSW
S1      LDA     @       RST75
        CPI     #       H0C9.
        JNZ     @       S1      ;WAIT FOR READY

sound   POP     PSW
        STA     @       LENGTH  ;SOUND LENGTH
        mvi     a,#     5.
        sta     @       pulse   ;counter
        MOV     A,L
        OUT     #       H0BC.   ;see ROM 72C6-72D8
        MOV     A,H
        ORI     #       H40.
        OUT     #       H0BD.
        MVI     A,#     H0C3.
        OUT     #       H0B8.
        IN      #       H0BA.
        ANI     #       H0F8.
        ORI     #       H20.
        OUT     #       H0BA.
        LXI     H,@     INTVEC
        SHLD    @       RST751
        MVI     A,#     H0C3.   ;JMP
        STA     @       RST75
        RET

INTVEC  PUSH    PSW
        PUSH    H
        lxi     h,@     endint
        push    h               ;stack return address
        LXI     H,@     PULSE
        DCR     M
        rnz
        MVI     M,#     5.
        INX     H       ;COUNT
        DCR     M
        rnz

reset   MVI     A,#     H0C9.   ;RET
        STA     @       RST75
        IN      #       H0BA.   ;see ROM 72F9-72FF
        ORI     #       4.
        OUT     #       H0BA.
        CALL    @       H6E83.  ;RESET SOUND
        ret

ENDINT  POP     H
        POP     PSW
        RET

PULSE   def     #5.     ;COUNTER
LENGTH  def     #0.     ;LENGTH OF SOUND


ASYNC   Sun  01/20/85  19:12:48

origin:     0   0000 R
end:       94   005E R

RST75   62975   F5FF
RST751  62976   F600
NOWAIT      0   0000 R
WAIT        9   0009 R
S1         10   000A R
SOUND      18   0012 R
INTVEC     59   003B R
RESET      75   004B R
ENDINT     90   005A R
PULSE      93   005D R
LENGTH     94   005E R
