Toolbox-3/source/boing/boing-reg.spin

273 lines
9.6 KiB
Plaintext

{{
}}
OBJ
ios: "reg-ios"
CON
_CLKMODE = XTAL1 + PLL16X
_XINFREQ = 5_000_000
SIDMASK = %00000000_00000000_00000000_00010000
VAR
long dmpreg
long fcnt
long fpos
long datcnt 'zeiger für dateiliste
byte fl_bye 'flag player beenden
byte fn[12] 'puffer für dateinamen
long dmu 'marker des aktuellen userverzeichnisses
long bx,by,bxv,byv
PUB main | key
ios.start
ios.belload(string("boing.bel"))
ios.sdclose
ifnot (ios.admgetspec & SIDMASK)
ios.sddmset(ios#DM_USER) 'u-marker setzen
dmu := ios.sddmget(ios#DM_USER) 'usermarker von administra holen
ios.admload(string("boing.adm"))
ios.sddmput(ios#DM_USER,dmu) 'usermarker wieder in administra setzen
ios.sddmact(ios#DM_USER) 'u-marker aktivieren
play_count
repeat
intro
\boing(string("boing.sid"))
play_dir
ios.belreset
ios.admreset
waitcnt(cnt+clkfreq*2)
ios.stop
PRI esc_key
if ios.g0_keystat
case ios.g0_keycode
27:
'ESC - geordneter rücksturz zur erde... :)
ios.sid_dmpstop 'ok, erstmal die mucke aus
ios.sid_mute(3)
ios.belreset
ios.sddmset(ios#DM_USER) 'u-marker setzen
dmu := ios.sddmget(ios#DM_USER) 'usermarker von administra holen
ios.admreset
waitcnt(cnt+clkfreq*2)
ios.sddmput(ios#DM_USER,dmu) 'usermarker wieder in administra setzen
ios.sddmact(ios#DM_USER) 'u-marker aktivieren
credits
ios.stop
"n":
ios.sid_dmpstop
ios.sid_mute(3)
abort
"p":
ios.sid_dmppause
PRI credits
ios.curoff
ios.printcls
ios.printnl
ios.print(string("Bouncing Ball for Hive - 2013 ",$0d,$0d))
ios.print(string("Graphics-Code : kuroneko",$0d))
ios.print(string("SidCog : Ahle2 ",$0d))
ios.print(string("Hive-Code : drohne235",$0d,$0d))
ios.curon
CON 'sd-player
PRI play_dir|stradr,len,i 'alle songs auf der sd-card abspielen
datcnt := 0 'zum listenanfang
repeat i from 0 to fcnt-1 'dateiliste abspielen
fpos := i + 1
play_dir_rdlst(@fn)
\boing(@fn)
PRI play_count|stradr,i
ios.sddir 'kommando: verzeichnis öffnen
datcnt := 0 'zum listenanfang
fcnt := 0 'zähler für dateianzahl
fl_bye := 0
repeat while (stradr := ios.sdnext) 'dateiliste einlesen
if str_find(stradr,string(".DMP"))
fcnt++
play_dir_wrlst(stradr)
PRI play_dir_wrlst(stradr)|len,i 'kopiert dateinamen in liste
len := strsize(stradr)
repeat i from 0 to len-1
ios.ram_wrbyte(ios#usrmod,byte[stradr][i],datcnt++)
ios.ram_wrbyte(ios#usrmod,0,datcnt++)
PRI play_dir_rdlst(stradr)|i,n 'liest dateinamen aus list
i := 0
repeat
n := ios.ram_rdbyte(ios#usrmod,datcnt++)
byte[stradr][i++] := n
while n <> 0
PRI str_find(string_1, string_2) : buffer | counter 'sys: string suchen
'' ┌──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
'' │ Searches a string of characters for the first occurence of the specified string of characters. │
'' │ │
'' │ Returns the address of that string of characters if found and zero if not found. │
'' │ │
'' │ string1 - A pointer to the string of characters to search. │
'' │ string2 - A pointer to the string of characters to find in the string of characters to search. │
'' └──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
repeat strsize(string_1--)
if(byte[++string_1] == byte[string_2])
repeat counter from 0 to (strsize(string_2) - 1)
if(byte[string_1][counter] <> byte[string_2][counter])
buffer~~
ifnot(buffer~)
return string_1
CON
res_x = 400
res_y = 300
LBASE = 0
RBASE = res_x - 112
YBASE = res_y - 112
LSHIFT = 8
PRI intro
ball_on(0)
grid_on
pause(3)
bar_on
pause(3)
PRI boing(stradr)|r,b1,b2,b3,status
bx := 0
by := 0
bxv := 2
byv := 1
ball_on(1)
ios.sid_mdmpplay(stradr) ' läuft auf sid2
repeat
bx += bxv
by += byv
if bx < LBASE
bx := constant(2*LBASE) - bx
-bxv
if bx > RBASE
bx := constant(2*RBASE) - bx
-bxv
if by > YBASE
by := constant(2*YBASE) - by
-byv
ifnot ++r & 7 ' add some gravity
byv++
status := ios.sid_dmpstatus 'playerstatus abfragen
dmpreg := ios.sid_dmpreg
b1 := (word[dmpreg + 0]>>LSHIFT) #> 1
b2 := (word[dmpreg + 2]>>LSHIFT) #> 1
b3 := (word[dmpreg + 4]>>LSHIFT) #> 1
bars(b1,b2,b3)
setBall(bx,by)
esc_key
waitVBL
while status
ios.sid_dmpstop
PRI keystat : char
ios.bus_putchar2(1)
return ios.bus_getchar2
PRI waitVBL
ios.bus_putchar2(4)
PRI setBall(x,y)
ios.bus_putchar2(3)
ios.bus_putword2(x)
ios.bus_putword2(y)
PRI boing_test
ios.bus_putchar2(5)
PRI bars(b1,b2,b3)
ios.bus_putchar2(6)
ios.bus_putchar2(b1)
ios.bus_putchar2(b2)
ios.bus_putchar2(b3)
PRI grid_on
ios.bus_putchar2(7)
PRI grid_off
ios.bus_putchar2(8)
PRI show_on
ios.bus_putchar2(9)
PRI bar_on
ios.bus_putchar2(10)
PRI ball_on(bflag)
ios.bus_putchar2(11)
ios.bus_putchar2(bflag)
PRI grid(line,val)
ios.bus_putchar2(3)
ios.bus_putword2(line)
ios.bus_putword2(val)
PRI pause(sec)
waitcnt(cnt + clkfreq * sec)
DAT
{{
┌──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ TERMS OF USE: MIT License │
├──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation │
│files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, │
│modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software│
│is furnished to do so, subject to the following conditions: │
│ │
│The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.│
│ │
│THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE │
│WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR │
│COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, │
│ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. │
└──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
}}