// ATTester.bcpl
// Test Program for Diablo port audio interface
// L. Stewart last modified: December 29, 1979 9:00 PM
// To compile:
// Bcpl/F ATTester.bcpl
// To Load:
// BLDR ATTester ATmc LoadRam Template
manifest
[
PortIn = #177030
PortOut = #177016
ResetMask = #000000 // set to 0 to reset
]
external //Incoming Procedures
[
LoadRam //LoadRam package
Gets //OS
StartIO
Allocate
GetFixed
PutTemplate //Template package
]
external //Statics
[
sysZone //OS
keys
dsp
RamImage //default Packed Ram Image
]
static
[
buflen = 8000
buf
iAcb
oAcb
iLen = 8000
oLen = 8000
AudioOn = false
InputOn = true
]
structure ACB: [
flagword
nextword
ptrword
lenword
]
let Main() be
[
let kw = nil
if LoadRam(RamImage,false) ne 0 do
[
PutTemplate(dsp, "LoadRam Failed!")
finish
]
iAcb = Allocate(sysZone, 4, false, true)
oAcb = Allocate(sysZone, 4, false, true)
buf = GetFixed(buflen)
PutTemplate(dsp, "Diablo port audio terminal test*n")
Command()
]
and let Command() be
[
let c = nil
[
c = Gets(keys)
switchon c into
[
case $a: ToggleAudio()
endcase
case $q: Quit()
endcase
case $i: ToggleInput()
endcase
case $?: Help()
endcase
]
] repeat
]
and let ToggleAudio() be
[
PutTemplate(dsp, "Audio is ")
AudioOn = not AudioOn
PutTemplate(dsp, AudioOn ? "On*n" , "Off*n")
test AudioOn
ifnot TurnOffAudio()
ifso TurnOnAudio()
]
and let Help() be
[
PutTemplate(dsp, "a(udio on/off), i(nput on/off), ?( help), q(uit)*n")
]
and let ToggleInput() be
[
PutTemplate(dsp, "Input is ")
InputOn = not InputOn
PutTemplate(dsp, InputOn ? "On*n" , "Off*n")
]
and let Quit() be
[
PutTemplate(dsp, "Quit!*n")
TurnOffAudio()
finish
]
and let TurnOnAudio() be
[
let inp = nil
iAcb>>ACB.flag = 0
iAcb>>ACB.next = iAcb
iAcb>>ACB.ptr = buf
iAcb>>ACB.len = iLen
oAcb>>ACB.flag = 0
oAcb>>ACB.next = oAcb
oAcb>>ACB.ptr = buf
oAcb>>ACB.len = oLen
inp = InputOn ? iAcb , 0
Reset()
SetBLV(RamImage!0)
AudioInit()
StartIO(#100000)
AudioStart(inp, oAcb)
]
and let TurnOffAudio() be
[
AudioStart(0, 0)
SetBLV(#177776)
StartIO(#100000)
Reset()
]
and let Reset() be
[
@PortOut = ResetMask
]
and SetBLV(blv) = JmpRam(blv, #20)
and AudioInit() = JmpRam(0, #21)
and AudioStart(iacb, oacb) = JmpRam2(iacb, #22, oacb)
and AudioEnqueue(new, old) = JmpRam2(new, #23, old)
and JmpRam(value, adr) =
//[ JMPRAM; JMP 1,3 ]
( table [ #61010; #1401 ] )(value, adr)
and JmpRam2(value, adr, val2) =
//[ STA 3,.+5; LDA 3,3,2; JMPRAM; LDA 3,.+2; JMP 1,3; 0 ]
( table [ #54405;#35003; #61010; #34402;#1401; 0 ] )(value, adr, val2)