120 lines
4.5 KiB
Plaintext
120 lines
4.5 KiB
Plaintext
|
'' HIVE - Soundadapter zu Regnatix/Administra
|
||
|
|
||
|
|
||
|
CON
|
||
|
|
||
|
'signaldefinitionen bellatrix
|
||
|
|
||
|
#0, D0,D1,D2,D3,D4,D5,D6,D7 'datenbus
|
||
|
#8, BEL_VGABASE 'vga-signale (8pin)
|
||
|
#16, BEL_KEYBC,BEL_KEYBD 'keyboard-signale
|
||
|
#18, BEL_MOUSEC,BEL_MOUSED 'maus-signale
|
||
|
#20, BEL_VIDBASE 'video-signale(3pin)
|
||
|
#23, BEL_SELECT 'belatrix-auswahlsignal
|
||
|
#24, HBEAT 'front-led
|
||
|
BUSCLK 'bustakt
|
||
|
BUS_WR '/wr - schreibsignal
|
||
|
BUS_HS ' '/hs - quittungssignal
|
||
|
|
||
|
VAR
|
||
|
|
||
|
byte sndfx ' Kommando für Administra
|
||
|
byte fcCog ' Flag ob cCog gestartet
|
||
|
long cStack[32] ' Stack für cCog
|
||
|
long hsspeek[4] ' Registerwerte Musikplayer
|
||
|
|
||
|
PUB start: Pass
|
||
|
|
||
|
Pass := (fcCog := cognew(cCog, @cStack)+1) > 0
|
||
|
|
||
|
PUB cCog | cmd,i
|
||
|
|
||
|
bus_init
|
||
|
repeat
|
||
|
repeat
|
||
|
bus_putchar(0)
|
||
|
repeat i from 0 to 3
|
||
|
hsspeek[i] := sub_getlong ' soundregister einlesen
|
||
|
until sndfx > 0 'warte bis fx gesendet werden soll
|
||
|
bus_putchar(sndfx~) 'sndfx-Kommando senden und löschen
|
||
|
repeat i from 0 to 3
|
||
|
hsspeek[i] := sub_getlong ' soundregister einlesen
|
||
|
|
||
|
CON 'BUS-Routinen
|
||
|
'
|
||
|
' hbeat --------+
|
||
|
' clk -------+|
|
||
|
' /wr ------+||
|
||
|
' /hs -----+||| +------------------------- /cs
|
||
|
' |||| | -------- d0..d7
|
||
|
DB_IN = %00001001_00000000_00000000_00000000 'maske: dbus-eingabe
|
||
|
DB_OUT = %00001001_00000000_00000000_11111111 'maske: dbus-ausgabe
|
||
|
|
||
|
M1 = %00000010_00000000_00000000_00000000
|
||
|
M2 = %00000010_10000000_00000000_00000000 'busclk=1? & /cs=0?
|
||
|
|
||
|
M3 = %00000000_00000000_00000000_00000000
|
||
|
M4 = %00000010_00000000_00000000_00000000 'busclk=0?
|
||
|
|
||
|
|
||
|
PUB bus_putchar(zeichen) 'BUS: Ein Byte ?ber BUS ausgeben
|
||
|
{{ein byte ?ber bus ausgeben Belltrix --> Regnatix}}
|
||
|
waitpeq(M1,M2,0) 'busclk=1? & prop2=0?
|
||
|
dira := db_out 'datenbus auf ausgabe stellen
|
||
|
outa[7..0] := zeichen 'daten ausgeben
|
||
|
outa[bus_hs] := 0 'daten g?ltig
|
||
|
waitpeq(M3,M4,0) 'busclk=0?
|
||
|
dira := db_in 'bus freigeben
|
||
|
outa[bus_hs] := 1 'daten ung?ltig
|
||
|
|
||
|
PUB bus_getchar : zeichen 'BUS: Ein Byte ?ber BUS empfangen
|
||
|
{{ein byte ?ber bus empfangen Regnatix --> Bellatrix}}
|
||
|
waitpeq(M1,M2,0) 'busclk=1? & prop2=0?
|
||
|
zeichen := ina[7..0] 'daten einlesen
|
||
|
outa[bus_hs] := 0 'daten quittieren
|
||
|
outa[bus_hs] := 1
|
||
|
waitpeq(M3,M4,0) 'busclk=0?
|
||
|
|
||
|
PUB bus_init
|
||
|
{{initialisierung des bussystems}}
|
||
|
dira := db_in 'datenbus auf eingabe schalten
|
||
|
outa[bus_hs] := 1 'handshake inaktiv
|
||
|
|
||
|
PUB sub_getlong:wert 'sub: long empfangen
|
||
|
''funktionsgruppe : sub
|
||
|
''funktion : subprotokoll um einen long-wert von regnatix zu empfangen
|
||
|
''eingabe : -
|
||
|
''ausgabe : 32bit-wert der empfangen wurde
|
||
|
''busprotokoll : [get.byte1][get.byte2][get.byte3][get.byte4]
|
||
|
'' : [ hsb ][ ][ ][ lsb ]
|
||
|
|
||
|
wert := bus_getchar << 24 '32 bit empfangen hsb/lsb
|
||
|
wert := wert + bus_getchar << 16
|
||
|
wert := wert + bus_getchar << 8
|
||
|
wert := wert + bus_getchar
|
||
|
|
||
|
CON 'Usersounds
|
||
|
PUB mus1 ' intro-musik
|
||
|
sndfx := 1
|
||
|
|
||
|
PUB mus2 ' ingame-musik
|
||
|
sndfx := 2
|
||
|
|
||
|
PUB sfx1
|
||
|
sndfx := 3
|
||
|
|
||
|
PUB sfx2
|
||
|
sndfx := 4
|
||
|
|
||
|
PUB peek(regnr): wert ' rückgabewert für musikmonitor
|
||
|
wert := hsspeek[regnr]
|
||
|
|
||
|
PUB mus_stop
|
||
|
sndfx := 5
|
||
|
|
||
|
PUB shoot_exit
|
||
|
sndfx := 6
|
||
|
waitcnt(cnt+clkfreq)
|
||
|
reboot
|
||
|
|