This commit is contained in:
drohne235@googlemail.com 2010-11-26 22:40:50 +00:00
parent c2415d33c2
commit 3431f72112
104 changed files with 0 additions and 6929 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1 +0,0 @@

View File

@ -1,51 +0,0 @@
SD-Laufwerksfunktionen
1 sd_mount
2 sd_opendir
3 sd_nextfile
4 sd_open
5 sd_close
6 sd_getc
7 sd_putc
8 sd_getblk
9 sd_putblk
10 sd_eof
11 sd_seek ???
12 sd_fattrib
13 sd_ftime
14 sd_fsize
Managementfunktionen
92 mgr_starthss
93 mgr_stophss
94 mgr_startwav
95 mgr_stopwav
96 mgr_aload
97 mgr_cogs
98 mgr_version
99 mgr_reboot
HSS-Funktionen
100 hss_load
101 hss_play
102 hss_stop
103 hss_pause
104 hss_peek
105 hss_intreg
106 hss_vol
SFX-Funktionen
107 sfx_fire
108 sfx_setslot
109 sfx_keyoff
110 sfx_stop
WAV-Funktionen
150 sdw_start
151 sdw_stop
152 sdw_status

Binary file not shown.

View File

@ -1,738 +0,0 @@
''*****************************
''* Hydra Sound System v1.2 *
''* (C)2007 Andrew Arsenault *
''*****************************
''http://www.andrewarsenault.com/hss/
''e-mail: ym2413a@yahoo.com
''
'' Cogs used: 2
'' HUB-RAM: ~2.7k
'' Please visit the website for the latest version, documentation, examples and media files.
'' Thank you! --Ym2413a
'' 25.01.2009 Anpassungen für ein komfortableres Interface zur Visualisierung und Steuerung
CON
#0, iEndFlag 'Repeat oder Ende wurde erreicht
iRowFlag 'Flag das Songzeile fertig ist
iEngineC 'Patternzähler
iBeatC 'Beatzähler
iRepeat 'zähler für loops
#5, iChannel
#5, iChannel1
#10, iChannel2
#15, iChannel3
#16, iChannel4
#0, iNote
iOktave
iVolume
iEffekt
iInstrument
VAR
'Interface
word intreg[5 * 5]
'Sound Engine Stack
long hsnd_stack[18]
long cog1, cog2
'WavSynth Parameters
long snd_regs[48] 'Regs for Sound Hardware (8x6)+5dpcm
long dpcm_regs[5]
'DPCM Command Variables
word dpcmreg_ptr
'Global Hmus Player Vars
word tempo
word song_pc
word song_div
word song_ptr
word chfre[4]
byte chfx[4]
byte chvol[4]
byte hmus_state
byte hmvol
byte fxphs
'Sound FX Variables
word runlen[2]
word envamp[2]
word sfx_ptr[2]
byte envphs[2]
byte fmcnt[2], fmfreq[2]
byte loadsfx[2]
CON
'' Hss Master Control
PUB start: okay
okay := cog1 := cognew(@entry, @snd_regs)
okay := cog2 := cognew(hsound, @hsnd_stack)
PUB stop
cogstop(cog2)
cogstop(cog1)
PUB peek(addrptr) : var1
var1 := LONG[@snd_regs][addrptr]
PUB intread(index): wert 'interface: auslesen eines interfaceregisters
wert := intreg[index]
CON
'' Hydra Music Commands
PUB hmus_load(songptr) | z
hmvol := 15
song_div := 0
song_ptr := songptr
song_pc := WORD[songptr][8]
tempo := WORD[songptr][12]
repeat z from 0 to 3
chfx[z] := 0
repeat z from 0 to 5*5 'interface: playerinterface alle werte löschen
intreg[z] := 0
PUB hmus_play
hmus_state := 1
PUB hmus_stop | z
hmus_state := 0
repeat z from 0 to 3
chvol[z] := 0
PUB hmus_pause
hmus_state := 0
PUB hmus_tempo(var1)
tempo := var1
PUB get_hmus_tempo : var1
var1 := tempo
PUB hmus_vol(var1)
hmvol := var1 <# 15 #> 0
PUB get_hmus_vol : var1
var1 := hmvol
CON
'' FXsynth Commands
PUB sfx_play(chan, soundptr)
if(chan == 1)
sfx_ptr[0] := soundptr
loadsfx[0] := 0
if(chan == 2)
sfx_ptr[1] := soundptr
loadsfx[1] := 0
PUB sfx_stop(chan)
if(chan == 1)
sfx_ptr[0] := 0
if(chan == 2)
sfx_ptr[1] := 0
PUB sfx_keyoff(chan)
if(chan == 1)
envphs[0] := 3
if(chan == 2)
envphs[1] := 3
CON
'' Hydra DPCM Commands
PUB dpcm_play(soundptr)
dpcmreg_ptr := soundptr
PUB dpcm_stop
dpcmreg_ptr := 1
CON
''*****************************
''* Hss Sound Engine *
''*****************************
PRI Hsound
repeat
'Update Music Engine
UpdateMus(song_ptr, Hmus_state) 'Update Music Player
'volume/frequenzwerte werden in die soundregister geschrieben
VolumeInterpol 'Delay and Interpolate Volume to Remove Pops and Clicks.
'Update DPCM Engine
if(dpcmreg_ptr)
DpcmUpdate 'Update the DPCM registers
'Update SoundFX Engine
'FX channel A
FXSynth(0,32)
'FX channel B
FXSynth(1, 40)
PRI VolumeInterpol | z, channelmul, musvar, freqval
fxphs += 5
'Volume Interpolation
repeat z from 0 to 3 step 1
channelmul := 4+(8*z)
musvar := (chvol[z]*(hmvol+1))&$F0
snd_regs[channelmul] := (snd_regs[channelmul] & 15)+musvar
'Freq Interpolation
channelmul -= 1 'Jump down a REG to Freq
musvar := chfre[z]<<16
if(chfx[z] == 0) 'None
snd_regs[channelmul] := musvar
elseif(chfx[z] < 3) 'Vibrato (light/hard)
if(fxphs < 128)
snd_regs[channelmul] := musvar+(chfre[z]<<(7+chfx[z]))
else
snd_regs[channelmul] := musvar-(chfre[z]<<(7+chfx[z]))
elseif(chfx[z] == 3) 'Tremolo
if(fxphs < 128)
snd_regs[channelmul] := musvar
else
snd_regs[channelmul] := musvar<<1
else 'Portamento
freqval := snd_regs[channelmul]>>16
if(freqval & $F000 == chfre[z] & $F000)
snd_regs[channelmul] := musvar
elseif(freqval < chfre[z])
snd_regs[channelmul] := snd_regs[channelmul]+(chfx[z]<<22)
else
snd_regs[channelmul] := snd_regs[channelmul]-(chfx[z]<<22)
PRI UpdateMus(songptr, state) | i, channel, channelmul, scrdat, freq, freqoct, flag
if(state == 0)
return ''Song is not playing.
song_div++ 'zeitfaktor; wird erhöht bis...
if(song_div => tempo) 'Tempo Divider 'schwellwert erreicht, dann nächster beat
song_div := 0
flag := 0
intreg[iBeatC] := intreg[iBeatC] + 1 'interface: beatconter erhöhen
intreg[iRowFlag] := 0 'interface: Kennung das Zeile bearbeitet wird
repeat i from 5 to 5*5 'interface: channelwerte löschen
intreg[i] := 0
repeat 'Score Decoder and Processor
scrdat := BYTE[song_ptr][song_pc] 'song_pc ist zeiger auf wert in MusicDat
channel := scrdat & 3 'untere zwei bit enthalten die kanalnummer
channelmul := channel<<3 'jedem channel sind 8 registerwerte zugeordent
intreg[iEngineC] := song_pc 'interface: enginecounter setzen
song_pc++ 'zeiger auf nächsten wert setzen
''Base Commands
if(scrdat == 0) 'End Row 'nächste trackerzeile
intreg[iRowFlag] := 1 'interface: Zeile fertig bearbeitet
quit
if(scrdat == 1) 'Repeat Song 'wiederholt ab MusicLoop (MusicDat ist also die einleitung)
song_pc := WORD[songptr][9]
intreg[iRepeat] := intreg[iRepeat] + 1 'interface: flag das songende erreicht wurde
quit
if(scrdat == 2) 'End Song 'status wird auf 0 gesetzt
intreg[iEndFlag] := 1 'interface: flag das songende erreicht wurde
hmus_stop
quit
if(scrdat == 3) 'Set Flag
flag := 1
next
if((scrdat & $3C) == $20) 'Patch HI Note 'oktave erhöhen und veränderung zu "Change Note"
flag := 2
scrdat := scrdat>>3
scrdat += 64+channel
if(scrdat & 4) 'Change Note
freq := scrdat>>3 'note Bit3 bis Bit7 (32 Noten)
freqoct := freq/12
freq -= freqoct*12
case flag
1 : freqoct += 2
2 : freqoct += 6
other : freqoct += 4
flag := 0
snd_regs[4+channelmul] := snd_regs[4+channelmul] & $FE
intreg[(channel*iChannel)+iChannel+iNote] := freq + 1 'interface: note setzen (0 ist erste note!)
intreg[(channel*iChannel)+iChannel+iOktave] := freqoct 'interface: oktave setzen
'frequenz aus tabelle holen
'je nach oktave wird nach rechts verschoben (/2)
chfre[channel] := NoteFreqs[freq]>>(6-freqoct)
snd_regs[4+channelmul] := (snd_regs[4+channelmul] & $FE)+1
next 'Repeat To Next Datum
if(scrdat & 8) 'Change Evelope / Channel Effect
if(flag)
intreg[(channel*iChannel)+iChannel+iEffekt] := scrdat>>4 + 1 'interface: effektwert setzen
chfx[channel] := scrdat>>4
flag := 0
else
intreg[(channel*iChannel)+iChannel+iVolume] := scrdat>>4 'interface: volume setzen
chvol[channel] := scrdat>>4
next 'Repeat To Next Datum
if(scrdat & 16) 'Change Instrument
freq := (scrdat & $E0)>>3
freq += flag<<5
flag := 0
intreg[(channel*iChannel)+iChannel+iInstrument] := freq>>2 + 1 'interface: instrument setzen
snd_regs[0+channelmul] := songptr+WORD[songptr+32][freq] 'zeiger auf neues instrumentensample
snd_regs[1+channelmul] := WORD[songptr+32][freq+1] 'ende des samples
snd_regs[2+channelmul] := WORD[songptr+32][freq+2] 'loop
snd_regs[4+channelmul] := WORD[songptr+32][freq+3] & $0F 'flags?
next 'Repeat To Next Datum
if(scrdat & 64) 'Detune
chfre[channel] := chfre[channel]+(chfre[channel]>>8)
PRI DpcmUpdate
if(dpcmreg_ptr > 15) 'Play Sample.
dpcm_regs[2] := 65535 'End sample if one was playing
dpcm_regs[0] := dpcmreg_ptr+8
dpcm_regs[4] := 128
dpcm_regs[3] := LONG[dpcmreg_ptr][1] 'Get sampling rate
dpcm_regs[1] := WORD[dpcmreg_ptr][1] 'Get length
dpcm_regs[2] := 0 'Reset play counter
elseif(dpcmreg_ptr == 1) 'Stop Sample
dpcm_regs[2] := 65535 'End sample
dpcm_regs[4] := 128
dpcmreg_ptr := 0
PRI FXSynth(SoundVars, ChannelFX) | TimeCnt, SoundFX, Modwav, FMwav, AMwav
TimeCnt := Cnt
SoundFX := sfx_ptr[SoundVars]
if(loadsfx[SoundVars] == 0)
'Setup OSC WaveForm
case BYTE[SoundFX][0]
$00: 'Sine
snd_regs[ChannelFX] := @SineTable
snd_regs[1+ChannelFX] := 64
$01: 'Fast Sine
snd_regs[ChannelFX] := @FastSine
snd_regs[1+ChannelFX] := 32
$02: 'Sawtooth
snd_regs[ChannelFX] := @Sawtooth
snd_regs[1+ChannelFX] := 64
$03: 'Square
snd_regs[ChannelFX] := @SqrTable
snd_regs[1+ChannelFX] := 32
$04: 'Fast Square
snd_regs[ChannelFX] := @FastSqr
snd_regs[1+ChannelFX] := 8
$05: 'Buzz
snd_regs[ChannelFX] := @NoteFreqs
snd_regs[1+ChannelFX] := 24
$06: 'Noise
snd_regs[ChannelFX] := $F002
snd_regs[1+ChannelFX] := 3000
snd_regs[2+ChannelFX] := 0
snd_regs[4+ChannelFX] := $01
loadsfx[SoundVars] := 1
runlen[SoundVars] := 0
fmcnt[SoundVars] := 0
fmfreq[SoundVars] := 0
envamp[SoundVars] := 0
envphs[SoundVars] := 0
''Modulation Code
fmfreq[SoundVars]++
if(fmfreq[SoundVars] => BYTE[SoundFX][4])
fmfreq[SoundVars] := 0
fmcnt[SoundVars]++
fmcnt[SoundVars] := fmcnt[SoundVars] & $3F
case BYTE[SoundFX][5]
$00:
Modwav := BYTE[@SineTable][fmcnt[SoundVars]]
$01:
Modwav := BYTE[@FastSine][fmcnt[SoundVars] & 31]
$02:
Modwav := fmcnt[SoundVars]<<2
$03:
Modwav := !fmcnt[SoundVars]<<2
$04:
if(fmcnt[SoundVars] & 8)
Modwav := $ff
else
Modwav := $00
$05:
Modwav := BYTE[$F002][fmcnt[SoundVars]]
$FF:
Modwav := BYTE[SoundFX+12][fmcnt[SoundVars] & 15]
fmwav := Modwav/(BYTE[SoundFX][6]) 'FM amount
amwav := 256-(Modwav/(BYTE[SoundFX][7])) 'AM amount
amwav := (BYTE[SoundFX][3]*amwav)>>8
''Envelope Generator
if(envphs[SoundVars] == 0) 'Attack
envamp[SoundVars] += BYTE[SoundFX][8]
if(envamp[SoundVars] > 8191)
envamp[SoundVars] := 8191
envphs[SoundVars] := 1
if(BYTE[SoundFX][8] == $ff)
envamp[SoundVars] := 8191
if(envphs[SoundVars] == 1) 'Decay
envamp[SoundVars] -= BYTE[SoundFX][9]
if(envamp[SoundVars] & $8000)
envphs[SoundVars] := 2
if(envamp[SoundVars] =< (BYTE[SoundFX][10]<<5))
envphs[SoundVars] := 2
if(envphs[SoundVars] == 2) 'Sustain
envamp[SoundVars] := (BYTE[SoundFX][10]<<5)
if(envphs[SoundVars] == 3) 'Release
envamp[SoundVars] -= BYTE[SoundFX][11]
if(envamp[SoundVars] & $8000)
envamp[SoundVars] := 4
amwav := ((envamp[SoundVars]>>9)*(amwav+1))>>4
''Run Length and Outputing
if(SoundFX > 15)
runlen[SoundVars]++
snd_regs[3+ChannelFX] := (BYTE[SoundFX][2]+fmwav)<<24 'Update Frequency
snd_regs[4+ChannelFX] := (amwav<<4)+(snd_regs[4+ChannelFX] & $0F) 'Update Amplitude
else
snd_regs[4+ChannelFX] := $00 'Mute
if(BYTE[SoundFX][1] == $ff) '$ff = never stop
runlen[SoundVars] := 0
if(runlen[SoundVars] > (BYTE[SoundFX][1]<<5)) 'Duration KeyOff
envphs[SoundVars] := 3
WaitCnt(TimeCnt + 52_000) ''Delay for Synth Engine Update.
DAT
SineTable byte $80, $8c, $98, $a5, $b0, $bc, $c6, $d0
byte $da, $e2, $ea, $f0, $f5, $fa, $fd, $fe
byte $ff, $fe, $fd, $fa, $f5, $f0, $ea, $e2
byte $da, $d0, $c6, $bc, $b0, $a5, $98, $8c
byte $80, $73, $67, $5a, $4f, $43, $39, $2f
byte $25, $1d, $15, $0f, $0a, $05, $02, $01
byte $00, $01, $02, $05, $0a, $0f, $15, $1d
byte $25, $2f, $39, $43, $4f, $5a, $67, $73
Sawtooth byte $ff, $fb, $f7, $f3, $ef, $eb, $e7, $e3
byte $df, $db, $d7, $d3, $cf, $cb, $c7, $c3
byte $bf, $bb, $b7, $b3, $af, $ab, $a7, $a3
byte $9f, $9b, $97, $93, $8f, $8b, $87, $83
byte $80, $7c, $78, $74, $70, $6c, $68, $64
byte $60, $5c, $58, $54, $50, $4c, $48, $44
byte $40, $3c, $38, $34, $30, $2c, $28, $24
byte $20, $1c, $18, $14, $10, $0c, $08, $04
FastSine byte $80, $98, $b0, $c6, $da, $ea, $f5, $fd
byte $ff, $fd, $f5, $ea, $da, $c6, $b0, $98
byte $80, $67, $4f, $39, $25, $15, $0a, $02
byte $00, $02, $0a, $15, $25, $39, $4f, $67
SqrTable byte $ff, $ff, $ff, $ff, $ff, $ff, $ff, $ff
byte $ff, $ff, $ff, $ff, $ff, $ff, $ff, $ff
byte $00, $00, $00, $00, $00, $00, $00, $00
byte $00, $00, $00, $00, $00, $00, $00, $00
FastSqr byte $ff, $ff, $ff, $ff, $00, $00, $00, $00
'Note LookupTable.
NoteFreqs word $85F3, $8DEA, $965B, $9F4B, $A8C4, $B2CD, $BD6F, $C8B3, $D4A2, $E147, $EEAC, $FCDE 'Top Octave Lookup
CON
''*****************************
''* WaveTable Synth v1.2 *
''* DPCM Synth v1.1 *
''* (C)2006 Andrew Arsenault *
''*****************************
DAT
org
entry mov dira,Port_Pins 'Setup output pins
mov ctra,Right_ctra 'Setup Right Audio Channel
mov ctrb,Left_ctra 'Setup Left Audio Channel
mov ChlA_wave,#256 'Set channel signals.
mov ChlA_offset,#0 'Set channel's offset.
mov ChlA_counter,#0
mov Time,#10
add Time,cnt 'Prepare for asm type WAITCNT loop.
'MAIN LOOP
update waitcnt Time,Timing_delay 'Wait for CNT = D, then add S into D
'Transfer Sound Registers
mov addrregs,par
mov y,NumberOfChannels
'Fetch Channel's Registers
transferchl rdlong ChlAp_sampptr,addrregs
add addrregs,#4
rdlong ChlAp_sampend,addrregs
add addrregs,#4
rdlong Ch1Ap_samplpp,addrregs
add addrregs,#4
rdlong Ch1Ap_freq,addrregs
add addrregs,#4
rdlong ChlAp_keyon,addrregs
'Fetch Channel's Static Variables
add addrregs,#8
rdlong ChlA_offset,addrregs
add addrregs,#4
rdlong ChlA_counter,addrregs
'Run Synth Engine on Channel
call #wvsynth
'Store Channel's Static Variables (Tucked Center X move to Wave)
wrlong ChlA_counter,addrregs
sub addrregs,#4
sub x,#256
wrlong ChlA_offset,addrregs
sub addrregs,#4
mov ChlA_wave,x 'Doesn't Waste anything doing this.
wrlong ChlA_wave,addrregs
add addrregs,#12
'Loop Until All Channel's Are Done.
djnz y,#transferchl
'Run DPCM Engine
call #dpcm
'Mix Channels Together
mov addrregs,par
mov ChlA_wave,#0
add addrregs,#5*4
mov y,NumberOfChannels
mixchls rdlong x,addrregs
add ChlA_wave,x
add addrregs,#8*4
djnz y,#mixchls
mov x,DPCM_wave 'Add DPCM
shl x,#2
add ChlA_wave,x
shl ChlA_wave,#20 'Convert 12bit singal into a 32bit one.
'Update output Channels then repeat again.
mov frqa,ChlA_wave
mov frqb,ChlA_wave
jmp #update
'-------------------------Dpcm Engine-------------------------'
dpcm mov addrregs,par
add addrregs,#192
rdlong DPCM_address,addrregs 'Start Address
add addrregs,#4
rdlong DPCM_runlen,addrregs 'File Lenght
add addrregs,#4
rdlong DPCM_offset,addrregs 'File Offset
add addrregs,#4
rdlong DPCM_freq,addrregs 'Playback Speed
add addrregs,#4
rdlong DPCM_wave,addrregs 'Waveform Amp
'Check for if keyon/length is set.
cmp DPCM_offset,DPCM_runlen wc
if_ae jmp #mute_dpcm 'End of file
'Freq Timer/Divider and Increase sampling offset
add DPCM_counter,DPCM_freq wc
if_nc jmp #done_dpcm
'Decode DPCM
add DPCM_address,DPCM_offset
rdbyte x,DPCM_address 'Fetch Datum
mov DPCM_delta,x
shr DPCM_delta,#6
mov y,#1
shl y,DPCM_delta
mov DPCM_delta,y
mov y,#1
shl y,DPCM_phs
test x,y wc
if_c add DPCM_wave,DPCM_delta
if_nc sub DPCM_wave,DPCM_delta
add DPCM_phs,#1
cmp DPCM_phs,#6 wc
if_b jmp #done_dpcm
mov DPCM_phs,#0
add DPCM_offset,#1
jmp #done_dpcm
mute_dpcm mov DPCM_wave, #128
done_dpcm mov addrregs,par
add addrregs,#200
wrlong DPCM_offset,addrregs 'File Offset
add addrregs,#8
wrlong DPCM_wave,addrregs 'Wave
dpcm_ret ret
'-----------------------Dpcm Engine End-----------------------'
'-------------------------Sound Engine-------------------------'
'Freq Timer/Divider and Increase sampling offset
wvsynth add ChlA_counter,Ch1Ap_freq wc
if_c add ChlA_offset,#1
'Reset sample position and lock at zero if Keyoff.
test ChlAp_keyon,#%0001 wc
if_nc mov ChlA_offset,#0
'Reset(loop) if needed
cmp ChlA_offset,ChlAp_sampend wc
if_ae mov ChlA_offset,Ch1Ap_samplpp
'Check BitRate and Set Offset
mov x,ChlA_offset
test ChlAp_keyon,#%0010 wc
if_c shr x,#1
'Fetch WaveTable
mov ChlA_wave,ChlAp_sampptr
add ChlA_wave,x
rdbyte ChlA_wave,ChlA_wave
'Check BitRate and Skip if 8bit
test ChlAp_keyon,#%0010 wc
if_nc jmp #skip_4bitsam
'Convert 4bit to 8bit
test ChlA_offset,#%0001 wc
if_c shr ChlA_wave,#4
if_nc and ChlA_wave,#%00001111
mov x,ChlA_wave
shl ChlA_wave,#4
add ChlA_wave,x
'Center Amplitude and mute if Keyoff.
skip_4bitsam test ChlAp_keyon,#%0001 wc
if_nc mov ChlA_wave,#128
'Volume Multiply
mov x,#0
test ChlAp_keyon,#%10000000 wc
if_c add x,ChlA_wave
if_nc add x,#128
shr ChlA_wave,#1
test ChlAp_keyon,#%01000000 wc
if_c add x,ChlA_wave
if_nc add x,#64
add x,#64
shr ChlA_wave,#1
test ChlAp_keyon,#%00100000 wc
if_c add x,ChlA_wave
if_nc add x,#32
add x,#96
shr ChlA_wave,#1
test ChlAp_keyon,#%00010000 wc
if_c add x,ChlA_wave
if_nc add x,#16
add x,#112
'Return Audio as X.
wvsynth_ret ret
'-----------------------Sound Engine End-----------------------'
Port_Pins long %00000000_00000000_00000011_00000000
'- CTR PLL -------- BPIN --- APIN
Right_ctra long %0_00110_000_00000000_000000_000_001000
Left_ctra long %0_00110_000_00000000_000000_000_001001
Timing_delay long 2500 'Sampling Rate = 32,000.00hz
NumberOfChannels long 6
Time res 1
addrregs res 1
x res 1
y res 1
'WaveTable Synth Accumulators
ChlA_wave res 1
ChlA_offset res 1
ChlA_counter res 1
ChlAp_sampptr res 1
ChlAp_sampend res 1
Ch1Ap_samplpp res 1
Ch1Ap_freq res 1
ChlAp_keyon res 1
'DPCM Accumulators
DPCM_wave res 1
DPCM_address res 1
DPCM_offset res 1
DPCM_counter res 1
DPCM_freq res 1
DPCM_runlen res 1
DPCM_phs res 1
DPCM_delta res 1

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,104 +0,0 @@
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.

Binary file not shown.

View File

@ -1,45 +0,0 @@
{
vga-bildschirmtreiber-demo
- verwendet zwei cogs
- auflösung 1024 x 768
- 64 x 128 textzeichen
- font ohne umlaute!
}
CON
_clkmode = xtal1 + pll16x
_xinfreq = 5_000_000
VGABasePin = 8
OBJ
vga : "bel-vga1024"
VAR
long sync ' gets signal for vertical refresh sync
byte VGACogStatus ' results of trying to start the VGA display cog
PUB main | i
VGACogStatus := vga.Start(VGABasePin,@sync)
vga.print_string(string("abcd"))
vga.printchar(0)
vga.newline
repeat
repeat i from $20 to $ff
vga.printchar(i)
waitcnt(500_000 + cnt)

View File

@ -1,144 +0,0 @@
CON
cols = VGA#cols 'anzahl der spalten
rows = VGA#rows 'anzahl der zeilen
chrs = cols * rows 'anzahl der zeichen
OBJ
VGA : "bel-vga1024-htext"
VAR
byte array[chrs] 'bildschirmspeicher
byte VGACogStatus 'status des vga-treiber-cogs
byte cx0, cy0, cm0 'x, y, mode von cursor 0
byte cx1, cy1, cm1 'x, y, mode von cursor 1
word colors[rows] 'zeilenfarbenspeicher
long ScreenIndex 'index im bildschirmspeicher
long RowIndex 'zeilenindex
long ColumnIndex 'spaltenindex
long color 'zeilenfarbe
PUB Start(BasePin,pSyncAddress)| ColorIndex
stop 'stopt ein bereits laufenden vga-task
cm0 := %000 'cursor 0 aus
cm1 := %110 'cursor 1 unterstrich blinkend
printchar($0E) 'bildschirm löschen
ColorIndex := 0 'graue balken auf scharzem grund
repeat rows
colors[ColorIndex++] := %00000100_01101000 'rrggbb00_rrggbb00
VGACogStatus := VGA.Start(BasePin,@array, @colors, @cx0, pSyncAddress) 'startet vga-treiber (2cogs)
return true
PUB Stop '' to stop specific running monitor cog
VGA.stop ' stop any VGA cogs that were started
PUB home
'' move writing place to upper left without clearing screen
SetXY(0,0)
PUB SetXY(x,y)
ColumnIndex := x <# cols 'setzt spalte mit begrenzung auf spaltenzahl
RowIndex := y <# rows 'setzt zeile mit begrenzung auf zeilenzahl
ScreenIndex := ColumnIndex + (RowIndex * cols) 'berechnet bildschirmindex
PUB print_string(ptr)
repeat while byte[ptr]
printchar(byte[ptr++])
PUB printchar(c) | i, k
'' Print a character
''
'' $0D = new line
'' $0E = clear screen
'' $20..$FF = character
case c
$0D: 'return?
newline
$20..$FF: 'character?
array[RowIndex * cols + ColumnIndex] := c
if ++ColumnIndex == cols
newline
cx1 := ColumnIndex
cy1 := RowIndex
$0E: 'clear screen?
ScreenIndex := 0
repeat chrs
array[ScreenIndex++] := 32
home
PUB newline_test | i
ColumnIndex := 0
if (RowIndex += 1) == rows
RowIndex -= 1
'scroll lines
ScreenIndex := 0
repeat i from 0 to chrs - cols
array[ScreenIndex + i] := array[ScreenIndex + i + cols]
'clear new line
bytefill(@array[(rows-1)*cols], 32, cols) 'BYTEFILL (StartAddress, Value, Count)
PUB newline | i
ColumnIndex := 0
if (RowIndex += 1) == rows
RowIndex -= 1
'scroll lines
repeat i from 0 to rows-2
bytemove(@array[i*cols], @array[(i+1)*cols], cols) 'BYTEMOVE (DestAddress, SrcAddress, Count)
'clear new line
' bytefill(@array[(rows-1)*cols], 32, cols<<1) 'BYTEFILL (StartAddress, Value, Count)
' code fehlerhaft, zähler ist falsch gesetzt!
bytefill(@array[(rows-1)*cols], 32, cols) 'BYTEFILL (StartAddress, Value, Count)
{
PUB newline | i
ColumnIndex := 0
if (RowIndex += 1) == rows
RowIndex -= 2
'scroll lines
repeat i from 0 to rows-3
wordmove(@array.word[i*cols], @array.word[(i+2)*cols], cols)
'clear new line
wordfill(@array.word[(rows-2)*cols], 32, cols<<1)
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,7 +0,0 @@
/? : hilfetext
/p name.wav : hss-datei abspielen
/d : verzeichnis abspielen
/s : wiedergabe stoppen
/t : anzeige trackerliste
/r : anzeige engine-register
/i : anzeige interface-register

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,22 +0,0 @@
help - diese hilfe
<dateiname> - bin/adm/bel-datei wird gestartet
mount - sd-card mounten
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
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
sysinfo - systeminformationen
color <0..7> - farbe wählen
cogs - belegung der cogs anzeigen

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,8 +0,0 @@
/? : Hilfe
/p : Konfiguration anzeigen
/h 0|1 : hss ab-/anschalten
/w 0|1 : wav ab-/anschalten
/s 0|1 : systemklänge ab-/anschalten
/l 0..100 : wav-lautstärke links
/r 0..100 : wav-lautstärke rechts
/h 0..15 : hss-lautstärke

Binary file not shown.

View File

@ -1,5 +0,0 @@
/? : Hilfetext
/p name.wav : WAV-Datei abspielen
/d : Verzeichnis wiedergeben
/l 0..100 : Lautstärke links
/r 0..100 : Lautstärke rechts

Binary file not shown.

Binary file not shown.

View File

@ -1 +0,0 @@
bonus ' Wav Len Fre Vol LFO LFW FMa AMa Att Dec Sus Rel byte $03,$03,$FF,$0F,$02,$00,$05,$00,$FF,$01,$50,$11 byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$01

View File

@ -1 +0,0 @@
crack ' Wav Len Fre Vol LFO LFW FMa AMa Att Dec Sus Rel byte $01,$22,$01,$0F,$11,$00,$05,$00,$55,$01,$50,$11 byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$01

View File

@ -1 +0,0 @@
error ' Wav Len Fre Vol LFO LFW FMa AMa Att Dec Sus Rel byte $04,$01,$80,$0F,$00,$00,$00,$00,$FF,$00,$00,$80 byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$01

View File

@ -1 +0,0 @@
exp ' Wav Len Fre Vol LFO LFW FMa AMa Att Dec Sus Rel byte $06,$04,$10,$0F,$00,$00,$00,$00,$FF,$01,$50,$11 byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$01

View File

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

View File

@ -1 +0,0 @@
wall ' Wav Len Fre Vol LFO LFW FMa AMa Att Dec Sus Rel byte $04,$FF,$FF,$0F,$01,$00,$01,$00,$FF,$06,$20,$00 byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$01

Binary file not shown.

View File

@ -1 +0,0 @@
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

@ -1,168 +0,0 @@
{ 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
repeat until sndfx > 0 'warte bis fx gesendet werden soll
bus_putchar(sndfx~) 'sndfx-Kommando senden
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

@ -1,358 +0,0 @@
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

@ -1,304 +0,0 @@
{{ ---------------------------------------------------------------------------------------------------------
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
19-04-2010 - Anpassung an TriOS: Boulder läuft jetzt auch aus dem Verzeichnis. Bedingt durch das
neue, etwas trägere WAV-Soundsystem, habe ich einige Effekte durch HSS/SFX ersetzt.
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"
' debugx : "pterm" 'debug
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]
byte fl_musicon
PUB main | a,b,c,i,n,stradr
'initialisierung
ios.start 'ios initialisieren
' ios.startram 'code für test im ram, sollte bei bin-datei auskommentiert werden
' debugx.start(115200)
ios.admsetsyssnd(0) 'systemsounds abschalten
ios.sddmact(ios#DM_USER) 'wieder in userverzeichnis wechseln
ios.print(string("Boulder Dash - Loading..."))
'bellatrix-code laden
ios.parastart
parastr[0] := 0
ios.paranext(@parastr)
case parastr[0]
"n":
ios.belload(@beln) 'grafiktreiber ntsc laden
other:
ios.belload(@belp) 'grafiktreiber pal laden
ios.sddmact(ios#DM_USER) '???
'sfx-slots setzen
ios.sfx_setslot(@fx_moving_sound1, 0)
ios.sfx_setslot(@fx_moving_sound2, 1)
ios.sfx_setslot(@fx_boulder_sound,2)
ios.sfx_setslot(@fx_diamond_sound,3)
ios.sfx_setslot(@fx_pick_sound,4)
ios.sfx_setslot(@fx_amoeba_sound,5)
ios.sfx_setslot(@fx_time_sound,6)
ios.sfx_setslot(@fx_cover_sound,7)
ios.sfx_setslot(@fx_bonus,8)
ios.sfx_setslot(@fx_crack,9)
ios.sfx_setslot(@fx_explosion,10)
ios.sfx_setslot(@fx_wall,11)
'soundadapter
repeat
case ios.bus_getchar2
_music_on: 'titelmusik
ios.admsetsound(ios#SND_HSSOFF) 'hss ausschalten
ios.admsetsound(ios#SND_WAVON) 'wav einschalten
n := ios.wav_play(@wav1)
fl_musicon := 1
_music_off:
if fl_musicon
ios.wav_stop
ios.admsetsound(ios#SND_WAVOFF) 'wav ausschalten
ios.admsetsound(ios#SND_HSSON) 'hss anschalten
fl_musicon := 0
_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_setslot(@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: 'explosion
ios.sfx_fire(10,1)
waitcnt(clkfreq * 3 + cnt)
_crack_sound: 'eingang
ios.sfx_fire(9,1)
waitcnt(clkfreq / 3 + cnt)
_magic_wall_sound_on:
ios.sfx_fire(11,2)
_magic_wall_sound_off:
_amoeba_sound_on:
ios.sfx_fire(5,2)
_amoeba_sound_off:
_time_ending_sound:
ios.sfx_fire(6,2)
_bonus_point_sound: 'bonus
ios.sfx_fire(8,2)
waitcnt(clkfreq * 4 + cnt)
_cover_sound:
b?
b := b & $FF
byte[@fx_cover_sound+2] := b
ios.sfx_setslot(@fx_cover_sound,7)
ios.sfx_fire(7,1)
waitcnt(clkfreq / 30 + cnt)
DAT
wav1 byte "bd.wav",0 ' titelmusik
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
fx_bonus
' Wav Len Fre Vol LFO LFW FMa AMa Att Dec Sus Rel
byte $03,$03,$FF,$0F,$02,$00,$05,$00,$FF,$01,$50,$11
byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$01
fx_crack
' Wav Len Fre Vol LFO LFW FMa AMa Att Dec Sus Rel
byte $01,$22,$01,$0F,$11,$00,$05,$00,$55,$01,$50,$11
byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$01
fx_explosion
' Wav Len Fre Vol LFO LFW FMa AMa Att Dec Sus Rel
byte $06,$04,$10,$0F,$00,$00,$00,$00,$FF,$01,$50,$11
byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$01
fx_wall
' Wav Len Fre Vol LFO LFW FMa AMa Att Dec Sus Rel
byte $04,$FF,$FF,$0F,$01,$00,$01,$00,$FF,$06,$20,$00
byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$01
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
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,2 +0,0 @@
<EFBFBD><EFBFBD><EFBFBD>_<EFBFBD><EFBFBD><EFBFBD>_<EFBFBD><EFBFBD><EFBFBD>_<EFBFBD><EFBFBD><EFBFBD>_<EFBFBD><EFBFBD><EFBFBD>_<EFBFBD><EFBFBD><EFBFBD>_<EFBFBD><EFBFBD><EFBFBD>_<EFBFBD><EFBFBD><EFBFBD>_<EFBFBD><EFBFBD><EFBFBD>_<EFBFBD><EFBFBD><EFBFBD>_<EFBFBD><EFBFBD><EFBFBD>_<EFBFBD><EFBFBD><EFBFBD>_<EFBFBD><EFBFBD><EFBFBD>_<EFBFBD><EFBFBD><EFBFBD>_<EFBFBD><EFBFBD><EFBFBD>
<EFBFBD><EFBFBD><EFBFBD>

View File

@ -1,3 +0,0 @@
<EFBFBD><EFBFBD><EFBFBD>
<EFBFBD><EFBFBD><EFBFBD>
<EFBFBD><EFBFBD><EFBFBD><0F><><EFBFBD><0F><><EFBFBD><0F><><EFBFBD><0F><><EFBFBD><0F><><EFBFBD><0F><><EFBFBD><0F><><EFBFBD><0F><><EFBFBD><0F><><EFBFBD><0F><><EFBFBD><0F><><EFBFBD>UUUUUU

View File

@ -1 +0,0 @@
UU<EFBFBD><EFBFBD>UU<EFBFBD><EFBFBD>U<EFBFBD><EFBFBD><EFBFBD>U<EFBFBD><EFBFBD><EFBFBD>U<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>

View File

@ -1 +0,0 @@
<EFBFBD>WUU<EFBFBD>UU<EFBFBD><EFBFBD>WU<EFBFBD><EFBFBD>_U<EFBFBD><EFBFBD><EFBFBD>U<EFBFBD><EFBFBD><EFBFBD><17><><EFBFBD><17><><EFBFBD><1F><><EFBFBD>/<2F><><EFBFBD>+<2B><><EFBFBD>+<2B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E5BC80><EFBFBD><EFBFBD>

View File

@ -1,4 +0,0 @@
UU˙_U˙˙U˙˙W˙˙_˙˙˙˙˙˙˙˙˙˙ż˙˙Ż
˙˙Ť
˙˙Ş
˙ŻŞ*żŞŞ*ŞŞŞ*ŞŞŞ*

View File

@ -1 +0,0 @@
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>

View File

@ -1,670 +0,0 @@
''LCARS tryout in XGA *
'Trying to emulate look of this page: http://www.lcarscom.net/databank.htm
'Copyright 2008 Raymond Allen
{{ ---------------------------------------------------------------------------------------------------------
Hive-Computer-Projekt
Name : StarTracker
Chip : Bellatrix-Code (soundplayer)
Version : 0.1
Dateien : stint.spin
Beschreibung : Grafiktreiber für StarTracker
Eigenschaften :
Logbuch :
Kommandoliste:
0 1 Tastaturstatus abfragen
0 2 Tastaturzeichen holen
0 3 n Screensteuerzeichen
0 3 0 CLS
0 3 1 Home
0 3 2 Backspace
0 3 3 TAB
0 3 4 n SETCUR Cursorzeichen auf n setzen
0 3 5 POS1
0 3 6 x SETX
0 3 7 y SETY
0 3 8 (x) GETX
0 3 9 (y) GETY
0 3 10 c SETCOL
0 3 11 n SLINE
0 3 13 SCREENINIT
0 3 14 CURON
0 3 15 CUROFF
0 99 Reboot und neuen Treiber laden
0 100 testfunktion
1..255 Zeichenausgabe
--------------------------------------------------------------------------------------------------------- }}
CON
_clkmode = xtal1 + pll16x
_xinfreq = 5_000_000
'number of custom 16x16 characters
nuchars = (6*3+1*7+47+23*2+20*5) '!!!!! you must have the correct # here for alignment later
'signaldefinitionen regnatix
#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
COLS = 64
ROWS = 48
TILES = cols * rows
TAB1 = 16
TAB2 = 32
TAB3 = 48
SPACETILE = $8000 + $20 << 6
VGA_BASPORT = 8 'vga startport
VGA_RESX = COLS * 16 'vga anzahl pixel x
VGA_RESY = ROWS * 16 'vga anzahl pixel y
KEYB_DPORT = BEL_KEYBD 'tastatur datenport
KEYB_CPORT = BEL_KEYBC 'tastatur taktport
MOUSE_DPORT = BEL_MOUSED
MOUSE_CPORT = BEL_MOUSEC
CURSORCHAR = $0E 'cursorzeichen
DB_WAIT = %00000001_00000000_00000000_00000000 'dira-wert f?r wait-status am bus
DB_IN = %00001001_00000000_00000000_00000000 'dira-wert f?r datenbuseingabe
DB_OUT = %00001001_00000000_00000000_11111111 'dira-wert f?r datenbusausgabe
CNT_HBEAT = 5_000_0000 'blinkgeschw. front-led
VAR
'variables for display
long col, row, color, flag
long array[tiles/2]
long stackhb[9] 'stack f?r hbeat-cog
byte cursor 'cursorzeichen
byte curstat 'cursorstatus 1 = ein
byte sline 'startzeile des scrollfensters
byte eline 'endzeile des scrollfensters
'for custom characters
word user_charbase
'for drawing buttons
word ptr
byte boxcolor
byte sBuffer[32] 'stingpuffer
OBJ
vga : "stvga"
keyb : "stkeyb"
PUB main | zeichen
{{interpreter f?r hostdialog}}
init_subsysteme 'bus/vga/keyboard/maus initialisieren
repeat
zeichen := bus_getchar '1. zeichen empfangen
if zeichen > 0
print_char(zeichen)
else
zeichen := bus_getchar '2. zeichen kommando empfange
case zeichen
1: bus_putchar(keyb.gotkey) '1: Tastaturstatus senden
2: bus_putchar(keyb.key) '2: Tastaturzeichen senden
3: zeichen := bus_getchar '3: Sonderzeichen von $100 bis $1FF ausgeben
print_char(zeichen + $100)
10: cmd_bitmap1
11: cmd_fillbox
12: cmd_drawtxt
99: reboot '99: bellatrix neu starten
100: gfx1
PUB gfx1
PUB cmd_bitmap1 | nBitmap,pBitmap,xPos,yPos,xSize,ySize,clr
'Bitmap1Bit(@endcap_med_left,1,1,1,2,1)
'Bitmap1Bit(pBitmap, xPos, yPos, xSize, ySize, clr)
nBitmap := bus_getchar
xPos := bus_getchar
yPos := bus_getchar
xSize := bus_getchar
ySize := bus_getchar
clr := bus_getchar
case nBitmap
0: pBitmap := @title
1: pBitmap := @footer
2: pBitmap := @button1
3: pBitmap := @button2
4: pBitmap := @button3
5: pBitmap := @button4
6: pBitmap := @button5
7: pBitmap := @button6
8: pBitmap := @button7
9: pBitmap := @button8
10: pBitmap := @button9
11: pBitmap := @corner_topleft
12: pBitmap := @corner_topright
13: pBitmap := @corner_bottomLeft
14: pBitmap := @endcap_med_left
15: pBitmap := @endcap_med_right
16: pBitmap := @endcap_small_left
17: pBitmap := @endcap_small_right
Bitmap1Bit(pBitmap, xPos, yPos, xSize, ySize, clr)
PUB cmd_fillbox | left,top,width,height,clr,bBottomBreak,bRightBreak,bTrimRight
'FillBlock(3,1,35,2,3,false,false,false)
'FillBlock(left,top,width,height,clr,bBottomBreak,bRightBreak,bTrimRight)
left := bus_getchar
top := bus_getchar
width := bus_getchar
height := bus_getchar
clr := bus_getchar
bBottomBreak := bus_getchar
bRightBreak := bus_getchar
bTrimRight := bus_getchar
FillBlock(left,top,width,height,clr,bBottomBreak,bRightBreak,bTrimRight)
PUB cmd_drawtxt | nButton,pButton,nLen,c,i
'DrawText(@button,@string,bInvert)
nButton := bus_getchar
nLen := bus_getchar
repeat i from 0 to nLen - 1
c := bus_getchar
sBuffer[i] := c
sBuffer[i+1] := 0
case nButton
0: pButton := @title
1: pButton := @footer
2: pButton := @button1
3: pButton := @button2
4: pButton := @button3
5: pButton := @button4
6: pButton := @button5
7: pButton := @button6
8: pButton := @button7
9: pButton := @button8
10: pButton := @button9
DrawText(pButton, @sBuffer,false)
PUB init_subsysteme
{{initialisierung des belatrix-chips}}
cognew(led_hbeat, @stackhb) 'heartbeat aktivieren
bus_init 'bussignale initialisieren
'64 byte align the user characters
user_charbase := @uchar & $FFC0 'destination
'user_charbase_offset := user_charbase-@uchar
longmove(user_charbase,@uchar,16*nuchars)
keyb.start(keyb_dport, keyb_cport) 'tastaturport starten
vga.start(vga_basport, @array, @vgacolors, 0,0,0) 'vga-treiber starten
print_char($100) 'bildschirm l?schen
cursor := CURSORCHAR 'cursorzeichen setzen
curstat := 1 'cursor anschalten
sline := 2
eline := rows
PUB bus_init
{{initialisierung des bussystems}}
dira := db_in 'datenbus auf eingabe schalten
outa[bus_hs] := 1 'handshake inaktiv
PUB bus_putchar(zeichen)
{{ein byte ?ber bus ausgeben}}
waitpeq(%00000010_00000000_00000000_00000000,%00000010_10000000_00000000_00000000,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(%00000000_00000000_00000000_00000000,%00000010_00000000_00000000_00000000,0) 'busclk=0?
'waitcnt(1_000 + cnt) 'zeit f?r master
outa[bus_hs] := 1 'daten ung?ltig
dira := db_in 'bus freigeben
PUB bus_getchar : zeichen
{{ein byte ?ber bus empfangen}}
waitpeq(%00000010_00000000_00000000_00000000,%00000010_10000000_00000000_00000000,0) 'busclk=1? & prop2=0?
zeichen := ina[7..0] 'daten einlesen
outa[bus_hs] := 0 'daten quittieren
outa[bus_hs] := 1
waitpeq(%00000000_00000000_00000000_00000000,%00000010_00000000_00000000_00000000,0) 'busclk=0?
PUB led_hbeat
{{led_hbeat - herzschlag f?r front-led}}
dira := db_in
repeat
!outa[hbeat]
waitcnt(cnt_hbeat + cnt)
PUB print_str(strptr)
{{zeichenkette auf bildschirm ausgeben}}
repeat while byte[strptr]
print_char(byte[strptr++])
PUB print_char(c) | code,n
{{zeichen auf bildschirm ausgeben}}
'' Print a character
''
'' $0D = new line
'' $20..$FF = character
'' $100 = clear screen
'' $101 = home
'' $108 = backspace
''$110..$11F = select color
case c
$00..$0C:
pchar(c)
if curstat == 1
schar(cursor)
$0D: 'return?
if curstat == 1
schar($20)
newline
if curstat == 1
schar(cursor)
$0E..$FF: 'character?
pchar(c)
if curstat == 1
schar(cursor)
$100: 'clear screen?
if curstat == 1
schar($20)
n := sline * cols * 2
wordfill(@array + n, spacetile, tiles - n)
row := sline
col := 0
if curstat == 1
schar(cursor)
$101: 'home?
row := sline
col := 0
$102: 'backspace?
if col
if curstat == 1
schar($20)
col--
if curstat == 1
schar(cursor)
$103: 'tab
if col < TAB1
if curstat == 1
schar($20)
col := TAB1
if curstat == 1
schar(cursor)
return
if col < TAB2
if curstat == 1
schar($20)
col := TAB2
if curstat == 1
schar(cursor)
return
if col < TAB3
if curstat == 1
schar($20)
col := TAB3
if curstat == 1
schar(cursor)
return
$104: 'setcur
code := bus_getchar
cursor := code
if curstat == 1
schar(code)
$105: 'pos1
if curstat == 1
schar($20)
col := 0
if curstat == 1
schar(cursor)
$106: 'setx
if curstat == 1
schar($20)
col := bus_getchar
if curstat == 1
schar(cursor)
$107: 'sety
if curstat == 1
schar($20)
row := bus_getchar * 2 + sline '2 tiles pro zeichen!
if curstat == 1
schar(cursor)
$108: 'getx
bus_putchar(col)
$109: 'gety
bus_putchar(row / 2)
$110: 'setcolor
color := bus_getchar
$111: 'sline
sline := bus_getchar * 2
$112: 'eline
eline := bus_getchar * 2
$113: 'screeninit
wordfill(@array, spacetile, tiles)
row := 0
col := 0
sline := 0
$114: 'curon
curstat := 1
schar(cursor)
$115: 'curoff
if curstat == 1
schar($20)
curstat := 0
$116: 'scrollup
scrollup
$130..$13F: 'select color?
color := c & $F
PRI schar(c)| i,k
'schreibt zeichen an aktuelle position ohne cursorposition zu ver?ndern
k := color << 1 + c & 1
i := $8000 + (c & $FE) << 6 + k
array.word[row * cols + col] := i 'oberes tile setzen
array.word[(row + 1) * cols + col] := i | $40 'unteres tile setzen
PRI pchar(c)
'schreibt zeichen an aktuelle position z?hlt position weiter
schar(c)
if ++col == cols
newline
PUB newline | i
col := 0
if (row += 2) == rows
row -= 2
'scroll lines
repeat i from sline to rows-3
wordmove(@array.word[i*cols], @array.word[(i+2)*cols], cols) 'wordmove(dest,src,cnt)
'clear new line
wordfill(@array.word[(rows-2)*cols], spacetile, cols<<1)
PUB scrollup | i 'scrollt den screen nach oben
'scroll lines
repeat i from sline to rows-3
wordmove(@array.word[i*cols], @array.word[(i+2)*cols], cols) 'wordmove(dest,src,cnt)
'clear new line
wordfill(@array.word[(rows-2)*cols], spacetile, cols<<1)
PRI DrawText(pBmp,str,bInvert)|x1,x2,i,j,b,k,c,s
'draw prop font into bitmap
k:=0 'current column
repeat s from 0 to strsize(str)-1
c:=byte[str][s]
if (c=>32) and (c=<(95+2)) 'note: char 96=dot, 97=degree
x1:=word[@FontTable][c-32]
x2:=word[@FontTable][c-32+1]
repeat i from x1 to x2-1
DrawFontColumn(i,j,pBmp,k,b)
'repeat j from 0 to 31
' b:=getFontPixel(i,j)
' setFontPixel(pBmp,k,j,b)
k++
PRI DrawFontColumn(x,y,pdest,k,b)|dtile,stile,doffset,soffset,psrc,d,pixel,j
stile:=x/16
soffset:=(x//16)*2
psrc:=@font+4*16*stile+user_charbase-@uchar
dtile:=k/16
doffset:=(k//16)*2
pdest+=4*16*dtile+user_charbase-@uchar
repeat j from 0 to 31
y:=j
if y=>16
y-=16
if j==16
soffset++
doffset++
pixel:=long[psrc][y//16]
pixel>>=soffset
pixel&=$1
'draw
if pixel
long[pdest][y//16]|=|<doffset
else
long[pdest][y//16]&=!(|<doffset)
PRI getFontPixel(x,y)|tile,offset,p,d
'return boolean indicating state of font pixel at (x,y)
tile:=x/16
offset:=(x//16)*2
if y=>16
offset++
y-=16
p:=@font+4*16*tile
d:=long[p+user_charbase-@uchar][y//16]
d>>=offset
return (d&$1)>0
PRI setFontPixel(p,x,y,b)|tile,offset,d
'set (b=true) or clear (b=false) pixel in bmp @p at coordinates (x,y)
tile:=x/16
offset:=(x//16)*2
if y=>16
offset++
y-=16
p+=4*16*tile+user_charbase-@uchar
'd:=long[p][y//16]
if b
long[p][y//16]|=|<offset
else
long[p][y//16]&=!(|<offset)
PRI FillBlock(left,top,width,height,clr,bBottomBreak,bRightBreak,bTrimRight)|x,y,p,bBottomTile
' fill a block and optionally add break to bottom or right edges
repeat y from top to top+height-1
repeat x from left to left+width-1
bBottomTile:=false
p:=@filled_space
if bRightBreak
if (x==(left+width-1 ))
p:=@hv_break
if bBottomBreak
bBottomTile:=true
if y==(top+height-1)
p:=@hv_break
if (bTrimRight and bBottomBreak) and (x==(left+width-1 ))
if (y==(top+height-1))
p:=@hv_break2
else
p:=@hv_break
bBottomTile:=false
Bitmap1BitTile(p,x,y,clr,bBottomTile)
PRI uPrint(c,ncol,nrow)
uPrintTop(c,ncol,nrow)
uPrintBottom(c,ncol,nrow+1)
PRI uPrintTop(c,ncol,nrow)|i,k
'print top part of a character
k := color << 1 + c & 1
i := user_charbase + (c & $FE) << 6 + k
array.word[nrow * cols + ncol] := i'user_charbase + (c<<6) + color'(color << 1 + c & 1) << 10 + user_charbase>>6 + c & $FE
PRI uPrintBottom(c,ncol,nrow)|i,k
'print bottom part of a character
k := color << 1 + c & 1
i := user_charbase + (c & $FE) << 6 + k
array.word[nrow * cols + ncol] := i+$40'user_charbase + (c<<6) + color+$40'(color << 1 + c & 1) << 10 + user_charbase>>6 + c & $FE +1
PRI Bitmap2Bit(pBitmap, xPos, yPos, xSize, ySize, clr)|c,i,j,BmpAddress
row:=yPos
col:=xPos
c:=0
BmpAddress:=pBitmap+user_charbase-@uchar
repeat j from 0 to (ySize-1)
repeat i from 0 to (xSize-1)
array.word[row * cols + col] := BmpAddress + (c<<6) + clr
'Print2Bit(c,clr,pBitmap)
c++
col++
row++
col:=xPos
PRI Bitmap1Bit(pBitmap, xPos, yPos, xSize, ySize, clr)|c,i,j,BmpAddress
row:=yPos
col:=xPos
c:=0
BmpAddress:=pBitmap+user_charbase-@uchar
repeat j from 0 to (ySize-1) step 2
repeat i from 0 to (xSize-1)
array.word[row * cols + col] := (clr<<1+1) + BmpAddress +c<<6
if ySize<>1
array.word[(row+1) * cols + col] := (clr<<1) + BmpAddress +c<<6
c++
col++
row+=2
col:=xPos
PRI Bitmap1BitTile(pBitmap,x,y,clr,bLower)|BmpAddress
'print just the upper or lower tile of a 2-tile bitmap
BmpAddress:=pBitmap+user_charbase-@uchar
clr:=clr<<1+1
if bLower
clr-=1
array.word[y * cols + x] := clr + BmpAddress
DAT
vgacolors long
'0..1: text color 0:
long $90009000 'orange on black
long $90900000
'2..3: text color 1:
long $5c005c00 'blue on black
long $5c5c0000
'4..5: text color 2:
long $94009400 'light red on black
long $94940000
'6..7: text color 3:
long $98009800 'purple on black
long $98980000
'8..9: text color 4:
long $f800f800 'yellow on black
long $f8f80000
'10..11: text color 5:
long $84008400 'dark red on black
long $84840000
'12: graphics 2: 'card edge colors
long $100000FC ''green,black,black,white
'13: graphics 3: 'red face card colors
long $F0C000FC ' yellow,red,black,white
'14: graphics 4: 'black face card colors
long $F000C0FC ''yellow,black,red,white
'15: graphics 5: button colors
long $FC54A8A8 'lt grey, dk.gray, gray, gray
FontTable word
word 8, 16,21,32,60,72,92,107,114,121,129,138,150,156,164,170,184,195,203,214,225,239,250,261,273,284,295,300,306,316,333,343,354,378,392 'to B
word 403,414,425,435,445,456,467,472,483,496,506,523,537,548,559,570,582,593,605,616,630,649,663,676,686,695,706,720,733,743,751 'note last two chars are dot and degree
padding LONG 7[16] 'alignment padding for the following user defined characters
uchar long
corner_topleft long
file "corner_topleft.dat" '6x2
corner_topright long
file "corner_topright.dat" '6x2
corner_bottomLeft long
file "corner_bottomLeft.dat" '6x2
hv_break long
file "hv_break.dat" '1x2
hv_break2 long
file "hv_break2.dat" '1x2
endcap_med_left long
file "endcap_med_left.dat" '1x2
endcap_med_right long
file "endcap_med_right.dat" '1x2
endcap_small_left long
file "endcap_small_left.dat" '1x2
endcap_small_right long
file "endcap_small_right.dat" '1x2
filled_space long
file "filled_space.dat" '1x2
font long
file "font_29p5.dat" '47x2
title long 0[16*23] 'space for title 23x2
footer long 0[16*23] 'space for footer 23x2
button1 long 0[16*20] 'space for button text 10x2
button2 long 0[16*20] 'space for button text
button3 long 0[16*20] 'space for button text
button4 long 0[16*20] 'space for button text
button5 long 0[16*20] 'space for button text
button6 long 0[16*20] 'space for button text 10x2
button7 long 0[16*20] 'space for button text
button8 long 0[16*20] 'space for button text
button9 long 0[16*20] 'space for button text

Some files were not shown because too many files have changed in this diff Show More