260 lines
9.7 KiB
Plaintext
260 lines
9.7 KiB
Plaintext
|
{{ ---------------------------------------------------------------------------------------------------------
|
|||
|
|
|||
|
Hive-Computer-Projekt: Boulder Dash - Hive-Version
|
|||
|
|
|||
|
http://hive-project.de
|
|||
|
|
|||
|
Basierend auf dem Fanprojekt diverser Propellerk<72>pfe:
|
|||
|
|
|||
|
http://forums.parallax.com/forums/default.aspx?f=33&m=263404
|
|||
|
|
|||
|
Besonderer Dank an Pex "Mahoney" Tufvesson f<>r die coole Musik!:
|
|||
|
|
|||
|
http://mahoney.c64.org
|
|||
|
http://www.livet.se/visa
|
|||
|
|
|||
|
|
|||
|
Tasten:
|
|||
|
|
|||
|
ESC Stop Button A
|
|||
|
Space Pause Button B
|
|||
|
LShift Start
|
|||
|
LCTRL Select
|
|||
|
Cursor
|
|||
|
|
|||
|
Anpassungen f<>r den Hive
|
|||
|
|
|||
|
09-01-2010 - Entfernung der Hardwareerkennung
|
|||
|
- Anpassung Konfiguration an Hive/Bellatrix
|
|||
|
- Gamecontr. entfernt
|
|||
|
- Auskommentierung Sound
|
|||
|
12-01-2010 - Soundadapter optimiert
|
|||
|
- Scrolltext im Titelbildschirm eingef<65>gt
|
|||
|
|
|||
|
Zur Hive-Version: Das Game an sich - also der urspr<70>ngliche Basiscode aus dem Parallax-Forum - l<>uft
|
|||
|
auf einem einzigen Propellerchip! Was war zu tun um diese Version an den Hive anzupassen:
|
|||
|
|
|||
|
1. Der Code kann im wesentlichen fast ausschlie<69>lich auf Bellatrix laufen. Daf<61>r m<>ssen die entsprechenden
|
|||
|
Belegungen der IO-Pins f<>r Video und Keyboard angepasst werden.
|
|||
|
2. Da Bellatrix keinen Sound ausgeben kann, sondern diese Aufgabe im Hive Administra <20>bernimmt, mu<6D> die
|
|||
|
Soundausgabe angepasst werden. Im Originalcode <20>bernimmt das Objekt "sound.spin" diese Aufgabe - welches
|
|||
|
wieder den SIDemu in einer getrennten Cog startet. Hier zeigt sich die St<53>rke der SPIN-Objekte: F<>r die
|
|||
|
Anpassung brauchte ich einfach nur ein neues Objekt gleicher Struktur definieren, ohne das Hauptprogramm
|
|||
|
zu <20>ndern. Dieses neue Soundobjekt startet ebenfalls eine Cog, welche einzig die Aufgabe hat die Kommunikation
|
|||
|
zu Regnatix/Administra zu realisieren.
|
|||
|
3. Regnatix-Code: Tja, die K<>nigin kann bei der ganzen Sache D<>umchen drehen, denn sie hat nur folgend Aufgaben
|
|||
|
in einer einzigen Cog zu bew<65>ltigen:
|
|||
|
- Bellatrix-Code laden
|
|||
|
- SFX-Slots in Administra initialisieren
|
|||
|
- Warten bis Bellatrix einen Ton von sich geben m<>chte und <20>bermittlung dieser
|
|||
|
Tonesequenz an Administra
|
|||
|
|
|||
|
Damit werden nat<61>rlich auf der einen Seite massig Ressourcen in Bellatrix gegen<65>ber dem urspr<70>nglichen Code frei
|
|||
|
und es sind durch die Verwendung von HSS/SFX + Waveplayer + SDCard mehr M<>glichkeiten gegeben.
|
|||
|
|
|||
|
Bellatrix-Code : 20,5 KByte
|
|||
|
Regnatix-Code : 3,2 KByte
|
|||
|
|
|||
|
Bei diesen Werten ist zu beachten, dass der Regnatix das blanke IOS mit 2,6 KByte eingebunden hat - ohne Optimierung,
|
|||
|
denn ein Gro<72>teil der IOS-Routinen sind in diesem Fall ungenutzt.
|
|||
|
|
|||
|
Zeitaufwand : ca. 3 nette Abende ;)
|
|||
|
|
|||
|
drohne235
|
|||
|
|
|||
|
--------------------------------------------------------------------------------------------------------- }}
|
|||
|
|
|||
|
|
|||
|
OBJ
|
|||
|
ios: "ios"
|
|||
|
|
|||
|
CON
|
|||
|
|
|||
|
_CLKMODE = XTAL1 + PLL16X
|
|||
|
_XINFREQ = 5_000_000
|
|||
|
|
|||
|
CON
|
|||
|
|
|||
|
_music_on = 1
|
|||
|
_music_off = 2
|
|||
|
_moving_sound1 = 3
|
|||
|
_moving_sound2 = 4
|
|||
|
_boulder_sound = 5
|
|||
|
_diamond_sound = 6
|
|||
|
_pick_sound = 7
|
|||
|
_explosion_sound = 8
|
|||
|
_crack_sound = 9
|
|||
|
_magic_wall_sound_on = 10
|
|||
|
_magic_wall_sound_off = 11
|
|||
|
_amoeba_sound_on = 12
|
|||
|
_amoeba_sound_off = 13
|
|||
|
_time_ending_sound = 14
|
|||
|
_bonus_point_sound = 15
|
|||
|
_cover_sound = 16
|
|||
|
|
|||
|
VAR
|
|||
|
|
|||
|
byte parastr[64]
|
|||
|
|
|||
|
PUB main | a,b,c
|
|||
|
|
|||
|
'initialisierung
|
|||
|
ios.start 'ios initialisieren
|
|||
|
' ios.startram 'code f<>r test im ram, sollte bei bin-datei auskommentiert werden
|
|||
|
ios.admsetsyssnd(0) 'systemsounds abschalten
|
|||
|
ios.sddmact(ios#DM_USER) 'wieder in userverzeichnis wechseln
|
|||
|
ios.print(string("Boulder Dash - Loading..."))
|
|||
|
waitcnt(clkfreq*3+cnt)
|
|||
|
|
|||
|
'bellatrix-code laden
|
|||
|
ios.parastart
|
|||
|
parastr[0] := 0
|
|||
|
ios.paranext(@parastr)
|
|||
|
|
|||
|
case parastr[0]
|
|||
|
"n":
|
|||
|
waitcnt(cnt + 200_000_000) 'warte bis bel fertig ist
|
|||
|
ios.belload(@beln) 'grafiktreiber ntsc laden
|
|||
|
other:
|
|||
|
waitcnt(cnt + 200_000_000) 'warte bis bel fertig ist
|
|||
|
ios.belload(@belp) 'grafiktreiber pal laden
|
|||
|
|
|||
|
'sfx-slots setzen
|
|||
|
ios.sfx_setslot2(@fx_moving_sound1, 0)
|
|||
|
ios.sfx_setslot2(@fx_moving_sound2, 1)
|
|||
|
ios.sfx_setslot2(@fx_boulder_sound,2)
|
|||
|
ios.sfx_setslot2(@fx_diamond_sound,3)
|
|||
|
ios.sfx_setslot2(@fx_pick_sound,4)
|
|||
|
ios.sfx_setslot2(@fx_explosion_sound,5)
|
|||
|
ios.sfx_setslot2(@fx_crack_sound,6)
|
|||
|
ios.sfx_setslot2(@fx_magic_sound,7)
|
|||
|
ios.sfx_setslot2(@fx_amoeba_sound,8)
|
|||
|
ios.sfx_setslot2(@fx_time_sound,9)
|
|||
|
ios.sfx_setslot2(@fx_bonus_sound,10)
|
|||
|
ios.sfx_setslot2(@fx_cover_sound,11)
|
|||
|
|
|||
|
'soundadapter
|
|||
|
repeat
|
|||
|
ios.bus_putchar2($1) 'kommando: sound abfragen
|
|||
|
a := ios.bus_getchar2 'soundcode einlesen
|
|||
|
case a
|
|||
|
_music_on: 'titelmusik
|
|||
|
ios.wav_play(@wav1)
|
|||
|
_music_off:
|
|||
|
ios.wav_stop
|
|||
|
_moving_sound1:
|
|||
|
ios.sfx_fire(0,1)
|
|||
|
_moving_sound2:
|
|||
|
ios.sfx_fire(1,1)
|
|||
|
_boulder_sound:
|
|||
|
ios.sfx_fire(2,1)
|
|||
|
waitcnt(clkfreq / 30 + cnt)
|
|||
|
_diamond_sound:
|
|||
|
b?
|
|||
|
b := b & $FF
|
|||
|
byte[@fx_diamond_sound+2] := b
|
|||
|
ios.sfx_setslot2(@fx_diamond_sound,3)
|
|||
|
ios.sfx_fire(3,1)
|
|||
|
waitcnt(clkfreq / 30 + cnt)
|
|||
|
_pick_sound:
|
|||
|
ios.sfx_fire(4,2)
|
|||
|
waitcnt(clkfreq / 3 + cnt)
|
|||
|
_explosion_sound:
|
|||
|
ios.wav_play(@wav3) 'explosion
|
|||
|
waitcnt(clkfreq * 2 + cnt)
|
|||
|
ios.wav_stop
|
|||
|
_crack_sound:
|
|||
|
ios.wav_play(@wav4) 'eingang
|
|||
|
waitcnt(clkfreq * 1 + cnt)
|
|||
|
ios.wav_stop
|
|||
|
_magic_wall_sound_on:
|
|||
|
_magic_wall_sound_off:
|
|||
|
_amoeba_sound_on:
|
|||
|
_amoeba_sound_off:
|
|||
|
_time_ending_sound:
|
|||
|
ios.sfx_fire(9,2)
|
|||
|
_bonus_point_sound:
|
|||
|
ios.wav_play(@wav2) 'bonus
|
|||
|
waitcnt(clkfreq * 2 + cnt)
|
|||
|
ios.wav_stop
|
|||
|
_cover_sound:
|
|||
|
b?
|
|||
|
b := b & $FF
|
|||
|
byte[@fx_cover_sound+2] := b
|
|||
|
ios.sfx_setslot2(@fx_cover_sound,15)
|
|||
|
ios.sfx_fire(15,1)
|
|||
|
waitcnt(clkfreq / 30 + cnt)
|
|||
|
|
|||
|
|
|||
|
|
|||
|
DAT
|
|||
|
|
|||
|
wav1 byte "bd2.wav",0 ' titelmusik
|
|||
|
wav2 byte "bd3.wav",0 ' bonus
|
|||
|
wav3 byte "bd4.wav",0 ' boom
|
|||
|
wav4 byte "bd5.wav",0 ' eingang
|
|||
|
|
|||
|
beln byte "bd_ntsc.bel",0 ' bella-code, ntsc-version
|
|||
|
belp byte "bd_pal.bel",0
|
|||
|
|
|||
|
'basisschwingung modulation h<>llkurve
|
|||
|
'Wav Len Fre Vol LFO LFW FMa AMa Att Dec Sus Rel
|
|||
|
fx_moving_sound1 byte $06, $02, $01, $08, $00, $00, $00, $00, $FF, $00, $00, $D0
|
|||
|
fx_moving_sound2 byte $06, $02, $01, $0F, $00, $00, $00, $00, $FF, $00, $00, $D0
|
|||
|
fx_boulder_sound byte $06, $01, $FF, $0F, $01, $03, $01, $00, $FF, $00, $00, $80
|
|||
|
fx_diamond_sound byte $01, $01, $E0, $0F, $00, $00, $00, $00, $FF, $00, $00, $80
|
|||
|
fx_pick_sound byte $01, $01, $E0, $0F, $00, $00, $00, $00, $FF, $00, $00, $80
|
|||
|
fx_explosion_sound byte $01, $01, $E0, $0F, $00, $00, $00, $00, $FF, $00, $00, $80
|
|||
|
fx_crack_sound byte $06, $02, $10, $0F, $00, $00, $00, $00, $FF, $00, $00, $D0
|
|||
|
fx_magic_sound byte $01, $01, $80, $0F, $00, $00, $00, $00, $FF, $00, $00, $80
|
|||
|
fx_amoeba_sound byte $01, $01, $80, $0F, $00, $00, $00, $00, $FF, $00, $00, $80
|
|||
|
fx_time_sound byte $02, $05, $FF, $0F, $10, $00, $01, $00, $FF, $00, $00, $40
|
|||
|
fx_bonus_sound byte $01, $01, $80, $0F, $00, $00, $00, $00, $FF, $00, $00, $80
|
|||
|
fx_cover_sound byte $01, $01, $80, $0F, $00, $00, $00, $00, $FF, $00, $00, $80
|
|||
|
|
|||
|
|
|||
|
DAT
|
|||
|
{
|
|||
|
|
|||
|
sfx-struktur:
|
|||
|
|
|||
|
wav len freq vol grundschwingung
|
|||
|
lfo lfw fma ama modulation
|
|||
|
att dec sus rel h<>llkurve
|
|||
|
seq (optional)
|
|||
|
|
|||
|
wav wellenform
|
|||
|
0 sinus (0..500hz)
|
|||
|
1 schneller sinus (0..1khz)
|
|||
|
2 dreieck (0..500hz)
|
|||
|
3 rechteck (0..1khz)
|
|||
|
4 schnelles rechteck (0..4khz)
|
|||
|
5 impulse (0..1,333hz)
|
|||
|
6 rauschen
|
|||
|
len tonl<6E>nge $0..$fe, $ff endlos
|
|||
|
freq frequenz $00..$ff
|
|||
|
vol lautst<73>rke $00..$0f
|
|||
|
|
|||
|
lfo low frequency oscillator $ff..$01
|
|||
|
lfw low frequency waveform
|
|||
|
$00 sinus (0..8hz)
|
|||
|
$01 fast sine (0..16hz)
|
|||
|
$02 ramp up (0..8hz)
|
|||
|
$03 ramp down (0..8hz)
|
|||
|
$04 square (0..32hz)
|
|||
|
$05 random
|
|||
|
$ff sequencer data
|
|||
|
fma frequency modulation amount
|
|||
|
$00 no modulation
|
|||
|
$01..$ff
|
|||
|
ama amplitude modulation amount
|
|||
|
$00 no modulation
|
|||
|
$01..$ff
|
|||
|
att attack $00..$ff
|
|||
|
dec decay $00..$ff
|
|||
|
sus sustain $00..$ff
|
|||
|
rel release $00..$ff
|
|||
|
|
|||
|
|
|||
|
|
|||
|
}
|