This commit is contained in:
drohne235 2010-04-15 22:25:58 +00:00
parent 1e16142429
commit 47fac2c8da
58 changed files with 4774 additions and 14 deletions

BIN
bin/system/led.adm Normal file

Binary file not shown.

BIN
bin/system/led.bel Normal file

Binary file not shown.

BIN
doku/entwicklungsstatus.ods Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,104 @@
CON
_CLKMODE = XTAL1 + PLL16X
_XINFREQ = 5_000_000
OBJ
sdfat : "amdflash-fat" 'fatengine
wav : "admflash-wav" 'sd-wave
debugx : "pterm" 'debug
VAR
long leftVolume
long rightVolume
long backgroundPlayCog
long backgroundPlayStack[50]
PUB main
debugx.start(115200) ' Start des Debug-Terminals
sdfat.FATEngine
leftVolume := 50
rightVolume := 50
wav.DACEngine(0)
waitcnt(clkfreq + cnt)
backgroundPlayCog := -1
sdfat.mountPartition(0,0)
sdw_start
repeat
CON ''------------------------------------------------- WAV-FUNKTIONEN
PUB sdw_start | len,j,err ''sdw: startet extra cog mit sdwav-engine
''funktionsgruppe : sdw
''funktion : wav-datei von sd-card abspielen
''eingabe : -
''ausgabe : -
''busprotokoll : [150][sub.getstr][put.err]
'' : err - fehlernummer entspr. liste
' err := \sdfat.openFile(string("test.wav"), "r") 'datei öffnen
' if err == 0
backgroundPlayCog := cognew(programBackgroundPlay, @backgroundPlayStack)
PUB sdw_stop ''sdw: stopt cog mit sdwav-engine
if(backgroundPlayCog => 0)
cogstop(backgroundPlayCog)
wav.stopPlayer
sdfat.closeFile
PRI programBackgroundPlay | n
debugx.str(string("Player gestartet ")) 'debug
debugx.NewLine
dira[24] := 1
sdfat.openFile(string("test2.wav"), "r")
sdfat.setCharacterPosition(22)
n := (sdfat.readCharacter | (sdfat.readCharacter << 8))
debugx.str(string("NumberOfChannels : ")) 'debug
debugx.dec(n)
debugx.NewLine
wav.changeNumberOfChannels(n)
n := sdfat.readCharacter | (sdfat.readCharacter << 8) | (sdfat.readCharacter << 16) | (sdfat.readCharacter << 24)
debugx.str(string("SampleRate : ")) 'debug
debugx.dec(n)
debugx.NewLine
wav.changeSampleRate(n)
sdfat.setCharacterPosition(34)
n := (sdfat.readCharacter | (sdfat.readCharacter << 8))
debugx.str(string("BitsPerSample : ")) 'debug
debugx.dec(n)
debugx.NewLine
wav.changeBitsPerSample(n)
wav.changeSampleSign(n == 16)
wav.changeLeftChannelVolume(leftVolume)
wav.changeRightChannelVolume(rightVolume)
sdfat.setCharacterPosition(40)
wav.startPlayer
repeat ((sdfat.readCharacter | (sdfat.readCharacter << 8) | (sdfat.readCharacter << 16) | (sdfat.readCharacter << 24)) / 512)
sdfat.readData(wav.transferData, 512)
wav.stopPlayer
wav.clearData
sdfat.closeFile
cogstop(cogid)

Binary file not shown.

Binary file not shown.

BIN
system/regnatix/hplay.spin Normal file

Binary file not shown.

11
system/regnatix/hplay.txt Normal file
View File

@ -0,0 +1,11 @@
<dateiname> - hss-datei wird abgespielt
help - diese hilfe
stop - player stopen
pause - player pause
reg - registerwerte anzeigen
intreg - interface-register anzeigen
list - trackerliste anzeigen
rep - alle hss-dateien abspielen
cls - bildschirm löschen
bye - player beenden

Binary file not shown.

BIN
system/regnatix/para.spin Normal file

Binary file not shown.

Binary file not shown.

View File

@ -1,19 +1,22 @@
help - diese hilfe
<dateiname> - bin-datei wird gestartet
<dateiname> - bin/adm/bel-datei wird gestartet
mount - sd-card mounten
dir wbml - verzeichnis anzeigen
type <dateiname> - anzeige einer textdatei
load <dateiname> - startet bin-datei
bload <dateiname> - bellatrix-treiber laden
del <dateiname> - datei löschen
unmount - sd-card abmelden
dir wh - verzeichnis anzeigen
type <fn> - anzeige einer textdatei
aload <fn> - administra-code laden
bload <fn> - bellatrix-treiber laden
rload <fn> - regnatix-code laden
del <fn> - datei löschen
cls - bildschirm löschen
ver - regime Version anzeigen
rbuffer - inhalt des ringpuffers anzeigen
rem -
echo - ausgabe
cogs - zeigt freie/belegte cogs an
color - Textfarbe ändern
free - freier speicher auf sd-card
attrib <fn> ashr - attribute ändern
cd <dir> - verzeichnis wechseln
mkdir <dir> - verzeichnis erstellen
rename <fn1> fn2> - datei/verzeichnis umbenennen
format <volname> - sd-card formatieren
reboot - hive neu starten
copy <q> <z> <p> - datei kopieren
sysinfo - systeminformationen
color <0..7> - farbe wählen
cogs - belegung der cogs anzeigen

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,6 @@
sysconf
/? : Hilfe
/p : Konfiguration anzeigen
/h 0|1 : hss ab-/anschalten
/w 0|1 : wav ab-/anschalten
/s 0|1 : systemklänge ab-/anschalten

BIN
system/regnatix/wplay.spin Normal file

Binary file not shown.

View File

@ -0,0 +1,3 @@
wplay
/? : Hilfetext
/p name.wav : WAV-Datei abspielen

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,2 @@
[InternetShortcut]
URL=http://remix.kwed.org/index.php?search=boulder

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1 @@
con GP_RIGHT = %00000001 GP_LEFT = %00000010 GP_DOWN = %00000100 GP_UP = %00001000 GP_START = %00010000 GP_SELECT = %00100000 GP_B = %01000000 GP_A = %10000000 var long stack[6] long nes_bits pub start nes_bits := 0 'cognew(process, @stack) pub read 'return nes_bits return process pub process | i, bits ' set I/O ports to proper direction ' P3 = JOY_CLK (4) ' P4 = JOY_SH/LDn (5) ' P5 = JOY_DATAOUT0 (6) ' P6 = JOY_DATAOUT1 (7) ' NES Bit Encoding ' step 1: set I/Os DIRA[3] := 1 ' output DIRA[4] := 1 ' output DIRA[5] := 0 ' input DIRA[6] := 0 ' input repeat ' step 2: set clock and latch to 0 OUTA[3] := 0 ' JOY_CLK = 0 OUTA[4] := 0 ' JOY_SH/LDn = 0 'Delay(1) ' step 3: set latch to 1 OUTA[4] := 1 ' JOY_SH/LDn = 1 'Delay(1) ' step 4: set latch to 0 OUTA[4] := 0 ' JOY_SH/LDn = 0 ' step 5: read first bit of each game pad ' data is now ready to shift out ' first bit is ready ' left controller bits := INA[5] | (INA[6] << 8) ' step 7: read next 7 bits repeat i from 0 to 6 OUTA[3] := 1 ' JOY_CLK = 1 'Delay(1) OUTA[3] := 0 ' JOY_CLK = 0 bits := (bits << 1) bits := bits | INA[5] | (INA[6] << 8) 'Delay(1) ' invert bits to make positive logic and store result nes_bits := (!bits & $FFFF) return nes_bits

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,170 @@
{ Hive-Soundobjekt für Boulderdash
}
'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
pub Start: Pass
Pass := (fcCog := cognew(cCog, @cStack)+1) > 0
pub cCog | cmd
bus_init
repeat
cmd := bus_getchar 'quittung von regnatix empfangen
repeat until sndfx > 0 'warte bis fx gesendet werden soll
bus_putchar(sndfx) 'sndfx-Kommando senden
sndfx := 0
CON
'
' 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
dat 'soundadapter
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
pub music_on
sndfx := _music_on
pub music_off
sndfx := _music_off
pub moving_sound(surface)
repeat until sndfx == 0
if surface == $00
sndfx := _moving_sound1
else ' $01
sndfx := _moving_sound2
repeat until sndfx == 0
pub boulder_sound
sndfx := _boulder_sound
pub diamond_sound
repeat until sndfx == 0
sndfx := _diamond_sound
repeat until sndfx == 0
pub pick_sound
repeat until sndfx == 0
sndfx := _pick_sound
repeat until sndfx == 0
pub explosion_sound
repeat until sndfx == 0
sndfx := _explosion_sound
repeat until sndfx == 0
pub crack_sound
repeat until sndfx == 0
sndfx := _crack_sound
repeat until sndfx == 0
pub magic_wall_sound_on
repeat until sndfx == 0
sndfx := _magic_wall_sound_on
repeat until sndfx == 0
pub magic_wall_sound_off
repeat until sndfx == 0
sndfx := _magic_wall_sound_off
repeat until sndfx == 0
pub amoeba_sound_on
repeat until sndfx == 0
sndfx := _amoeba_sound_on
repeat until sndfx == 0
pub amoeba_sound_off
'sndfx := _amoeba_sound_off
pub time_ending_sound(sec_left)
repeat until sndfx == 0
sndfx := _time_ending_sound
repeat until sndfx == 0
pub bonus_point_sound(pts)
repeat until sndfx == 0
sndfx := _bonus_point_sound
repeat until sndfx == 0
pub cover_sound
sndfx := _cover_sound

View File

@ -0,0 +1,358 @@
var
long vsync_addr
long random_addr
long stack[40]
byte music
byte mute
byte amoeba
byte magic_wall
byte v1cnt, v1ctl
byte v2cnt, v2ctl
byte v3cnt, v3ctl
obj
sd : "SIDemu"
pub start(video_params, pin, rnd_addr)
vsync_addr := long[video_params + constant(6 * 4)]
random_addr := rnd_addr
v1cnt := 0
v2cnt := 0
v3cnt := 0
mute := false
music := false
amoeba := false
magic_wall := false
cognew(process, @stack)
sd.start(pin)
sd.set_register(23, $07) 'turn main volume half-up
pub music_on
v1cnt := 0
v2cnt := 0
v3cnt := 0
music_init
music := true
pub music_off
sd.set_register(4, sd#CREG_TRIANGLE) 'gate off
sd.set_register(11, sd#CREG_TRIANGLE) 'gate off
music := false
pub moving_sound(surface)
if mute
return
if surface == $00
sd.set_register(7, $00) 'freq
sd.set_register(8, $35)
else ' $01
sd.set_register(7, $00) 'freq
sd.set_register(8, $A5)
sd.set_register(12, $30) 'attack/decay
sd.set_register(13, $C0) 'sustain/release
sd.set_register(11, sd#CREG_NOISE | sd#CREG_GATE)
v2ctl := sd#CREG_NOISE
v2cnt := 2
pub boulder_sound
if mute
return
if v1cnt
return
sd.set_register(0, $32) 'freq
sd.set_register(1, $09)
sd.set_register(5, $00) 'attack/decay
sd.set_register(6, $F9) 'sustain/release
sd.set_register(4, sd#CREG_NOISE | sd#CREG_GATE)
v1ctl := sd#CREG_NOISE
v1cnt := 1
pub diamond_sound
if mute
return
if v1cnt
return
sd.set_register(0, byte[random_addr]) 'freq
sd.set_register(1, $86 + byte[random_addr] & $07)
sd.set_register(5, $00) 'attack/decay
sd.set_register(6, $F0) 'sustain/release
sd.set_register(4, sd#CREG_TRIANGLE | sd#CREG_GATE)
v1ctl := sd#CREG_TRIANGLE
v1cnt := 2
pub pick_sound
if mute
return
if v1cnt
return
sd.set_register(0, $78) 'freq
sd.set_register(1, $14)
sd.set_register(5, $00) 'attack/decay
sd.set_register(6, $F9) 'sustain/release
sd.set_register(4, sd#CREG_TRIANGLE | sd#CREG_GATE)
v1ctl := sd#CREG_TRIANGLE
v1cnt := 1
pub explosion_sound
if mute
return
if v1cnt
return
sd.set_register(0, $32) 'freq
sd.set_register(1, $14)
sd.set_register(5, $19) '$1D 'attack/decay
sd.set_register(6, $00) 'sustain/release
sd.set_register(4, sd#CREG_NOISE | sd#CREG_GATE)
v1ctl := sd#CREG_NOISE
v1cnt := 200
pub crack_sound
if mute
return
if v3cnt
return
sd.set_register(19, $19) 'attack/decay
sd.set_register(20, $01) 'sustain/release
sd.set_register(14, $32) 'freq
sd.set_register(15, $2F)
sd.set_register(18, sd#CREG_NOISE | sd#CREG_GATE)
v3ctl := sd#CREG_NOISE
v3cnt := 80
pub magic_wall_sound_on
if not magic_wall
magic_wall := true
sd.set_register(18, sd#CREG_TRIANGLE)
pub magic_wall_sound_off
if magic_wall
magic_wall := false
v3ctl := sd#CREG_TRIANGLE
v3cnt := 1
pub amoeba_sound_on
if not amoeba
amoeba := true
sd.set_register(18, sd#CREG_TRIANGLE)
pub amoeba_sound_off
if amoeba
amoeba := false
v3ctl := sd#CREG_TRIANGLE
v3cnt := 1
var
byte last_val
pub time_ending_sound(sec_left)
mute := true
if sec_left == last_val
return
last_val := sec_left
if sec_left == 0
mute := false
sd.set_register(4, sd#CREG_TRIANGLE)
waitcnt(clkfreq / 1000 + cnt)
sd.set_register(0, $00)
sd.set_register(1, $27 - sec_left)
sd.set_register(5, $0A) 'attack/decay
sd.set_register(6, $00) 'sustain/release
sd.set_register(4, sd#CREG_TRIANGLE | sd#CREG_GATE)
v1cnt := 0
pub bonus_point_sound(pts) | i
sd.set_register(5, $00) 'attack/decay
sd.set_register(6, $A0) 'sustain/release
sd.set_register(4, sd#CREG_TRIANGLE | sd#CREG_GATE)
repeat i from 2 to 30 step 2
sd.set_register(0, $00)
sd.set_register(1, $B0 - pts + i)
waitcnt(clkfreq / 500 + cnt)
sd.set_register(4, sd#CREG_TRIANGLE)
pub cover_sound
if v2cnt
return
sd.set_register(12, $05) 'attack/decay
sd.set_register(13, $00) 'sustain/release
sd.set_register(7, $00)
sd.set_register(8, $64 + byte[random_addr] & $7F) 'freq
sd.set_register(11, sd#CREG_TRIANGLE | sd#CREG_GATE)
v2ctl := sd#CREG_TRIANGLE
v2cnt := 1
pub process | r
repeat
'wait for vsync
repeat while byte[vsync_addr] == 0
repeat while byte[vsync_addr] <> 0
if music
play_note
if v1cnt
if --v1cnt == 0
sd.set_register(4, v1ctl)
if v2cnt
if --v2cnt == 0
sd.set_register(11, v2ctl)
if v3cnt
if --v3cnt == 0
sd.set_register(18, v3ctl)
if amoeba
if mute
sd.set_register(18, sd#CREG_TRIANGLE)
else
sd.set_register(19, $00) 'attack/decay
sd.set_register(20, $40) 'sustain/release
repeat
r := byte[random_addr] & $1F
while r < $07
sd.set_register(14, $00) 'freq
sd.set_register(15, r)
sd.set_register(18, sd#CREG_TRIANGLE | sd#CREG_GATE)
v3cnt := 2
elseif magic_wall
if mute
sd.set_register(18, sd#CREG_TRIANGLE)
else
sd.set_register(19, $00) 'attack/decay
sd.set_register(20, $A0) 'sustain/release
r := byte[random_addr] & $03
sd.set_register(14, $00) 'freq
sd.set_register(15, $86 + (r << 3))
sd.set_register(18, sd#CREG_TRIANGLE | sd#CREG_GATE)
v3cnt := 2
dat
notes
byte $16, $22, $1D, $26, $22, $29, $25, $2E, $14, $24, $1F, $27, $20, $29, $27, $30
byte $12, $2A, $12, $2C, $1E, $2E, $12, $31, $20, $2C, $33, $37, $21, $2D, $31, $35
byte $16, $22, $16, $2E, $16, $1D, $16, $24, $14, $20, $14, $30, $14, $24, $14, $20
byte $16, $22, $16, $2E, $16, $1D, $16, $24, $1E, $2A, $1E, $3A, $1E, $2E, $1E, $2A
byte $14, $20, $14, $2C, $14, $1B, $14, $22, $1C, $28, $1C, $38, $1C, $2C, $1C, $28
byte $11, $1D, $29, $2D, $11, $1F, $29, $2E, $0F, $27, $0F, $27, $16, $33, $16, $27
byte $16, $2E, $16, $2E, $16, $2E, $16, $2E, $22, $2E, $22, $2E, $16, $2E, $16, $2E
byte $14, $2E, $14, $2E, $14, $2E, $14, $2E, $20, $2E, $20, $2E, $14, $2E, $14, $2E
byte $16, $2E, $32, $2E, $16, $2E, $33, $2E, $22, $2E, $32, $2E, $16, $2E, $33, $2E
byte $14, $2E, $32, $2E, $14, $2E, $33, $2E, $20, $2C, $30, $2C, $14, $2C, $31, $2C
byte $16, $2E, $16, $3A, $16, $2E, $35, $38, $22, $2E, $22, $37, $16, $2E, $31, $35
byte $14, $2C, $14, $38, $14, $2C, $14, $38, $20, $2C, $20, $33, $14, $2C, $14, $38
byte $16, $2E, $32, $2E, $16, $2E, $33, $2E, $22, $2E, $32, $2E, $16, $2E, $33, $2E
byte $14, $2E, $32, $2E, $14, $2E, $33, $2E, $20, $2C, $30, $2C, $14, $2C, $31, $2C
byte $2E, $32, $29, $2E, $26, $29, $22, $26, $2C, $30, $27, $2C, $24, $27, $14, $20
byte $35, $32, $32, $2E, $2E, $29, $29, $26, $27, $30, $24, $2C, $20, $27, $14, $20
freqs
word $02DC, $030A, $033A, $036C, $03A0, $03D2, $0412, $044C
word $0492, $04D6, $0520, $056E, $05B8, $0614, $0674, $06D8
word $0740, $07A4, $0824, $0898, $0924, $09AC, $0A40, $0ADC
word $0B70, $0C28, $0CE8, $0DB0, $0E80, $0F48, $1048, $1130
word $1248, $1358, $1480, $15B8, $16E0, $1850, $19D0, $1B60
word $1D00, $1E90, $2090, $2260, $2490, $26B0, $2900, $2B70
word $2DC0, $0100, $0200, $0101, $0105, $0100, $0101, $0306
word $0101, $0102, $0101
var
long note
byte v1sr
pri music_init
note := 0
v1sr := $B0
sd.set_register(4, sd#CREG_TRIANGLE)
sd.set_register(5, $4F)
sd.set_register(6, $00)
sd.set_register(11, sd#CREG_TRIANGLE)
sd.set_register(12, $24) '$78)
sd.set_register(13, $75) '$78)
pub play_note | n, f
if v1sr == $B0
sd.set_register(4, sd#CREG_TRIANGLE)
sd.set_register(11, sd#CREG_TRIANGLE)
n := notes.byte[note++]
f := word[@freqs + 2*n - $14]
sd.set_register(0, f & $FF)
sd.set_register(1, f >> 8)
n := notes.byte[note++]
f := word[@freqs + 2*n - $14]
sd.set_register(7, f & $FF)
sd.set_register(8, f >> 8)
v1sr := $A0
return
if note == 256
note := 0
sd.set_register(6, v1sr | $01)
sd.set_register(4, sd#CREG_TRIANGLE | sd#CREG_GATE)
sd.set_register(11, sd#CREG_TRIANGLE | sd#CREG_GATE)
v1sr -= $10
if v1sr < $40
v1sr := $B0

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,260 @@
{{ ---------------------------------------------------------------------------------------------------------
Hive-Computer-Projekt: Boulder Dash - Hive-Version
http://hive-project.de
Basierend auf dem Fanprojekt diverser Propellerkö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ügt
Zur Hive-Version: Das Game an sich - also der ursprü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ßlich auf Bellatrix laufen. Dafü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 übernimmt, muß die
Soundausgabe angepasst werden. Im Originalcode übernimmt das Objekt "sound.spin" diese Aufgabe - welches
wieder den SIDemu in einer getrennten Cog startet. Hier zeigt sich die Stärke der SPIN-Objekte: Für die
Anpassung brauchte ich einfach nur ein neues Objekt gleicher Struktur definieren, ohne das Hauptprogramm
zu ä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ältigen:
- Bellatrix-Code laden
- SFX-Slots in Administra initialisieren
- Warten bis Bellatrix einen Ton von sich geben möchte und Übermittlung dieser
Tonesequenz an Administra
Damit werden natürlich auf der einen Seite massig Ressourcen in Bellatrix gegenüber dem ursprü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ß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änge $0..$fe, $ff endlos
freq frequenz $00..$ff
vol lautstä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
}

View File

@ -0,0 +1,28 @@
CON
_CLKMODE = XTAL1 + PLL16X
_XINFREQ = 5_000_000
OBJ
ios: "ios"
deb: "pterm"
PUB main | a,b,c
deb.Start(115200) ' Start des Debug-Terminals
deb.Str(string(deb#cs,"Debugterminal gestartet..."))
ios.start
ios.startram 'code für test im ram, sollte bei bin-datei auskommentiert werden
ios.print(string("Debugterminal gestartet..."))
waitcnt(clkfreq*3+cnt)
repeat 100
a?
a := a & $FF
ios.printdec(a)
ios.print(string(" : "))
repeat