406 lines
15 KiB
Plaintext
406 lines
15 KiB
Plaintext
{{
|
|
┌──────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
|
│ Autor: Ingo Kripahle │
|
|
│ Copyright (c) 2010 Ingo Kripahle │
|
|
│ See end of file for terms of use. │
|
|
│ Die Nutzungsbedingungen befinden sich am Ende der Datei │
|
|
└──────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
|
|
|
Informationen : hive-project.de
|
|
Kontakt : drohne235@googlemail.com
|
|
System : TriOS
|
|
Name : TriBorg - SID-Player
|
|
Chip : Regnatix
|
|
Typ : Programm
|
|
Version :
|
|
Subversion :
|
|
Funktion :
|
|
Komponenten : -
|
|
COG's : -
|
|
Logbuch :
|
|
Kommandoliste :
|
|
Notizen :
|
|
|
|
}}
|
|
|
|
OBJ
|
|
ios: "reg-ios"
|
|
|
|
CON
|
|
|
|
_CLKMODE = XTAL1 + PLL16X
|
|
_XINFREQ = 5_000_000
|
|
|
|
SIDMASK = %00000000_00000000_00000000_00010000
|
|
|
|
XMAX = 256
|
|
YMAX = 192
|
|
|
|
x_tiles = 16
|
|
y_tiles = 12
|
|
|
|
bit_base = $2000
|
|
disp_base = $5000
|
|
len_colblk = (x_tiles * y_tiles) * 2 + 256
|
|
|
|
'ademo1
|
|
lines = 5
|
|
thickness = 2
|
|
s_obj = 200 'scale
|
|
d_obj = 64 'durchmesser
|
|
r_obj = d_obj/2 'radius
|
|
rotvar = 14 'rotationsvarianz
|
|
arcstep = 16
|
|
|
|
VAR
|
|
|
|
'achtung, folgende reihenfolge darf nicht verändert werden!
|
|
word screen[x_tiles * y_tiles] 'tilemap
|
|
long colortab[64] 'farbregister
|
|
|
|
long heap_len
|
|
long heap_use
|
|
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
|
|
|
|
PUB main|i,x,y,n,len
|
|
|
|
ios.start
|
|
ios.belload(string("triborg.bel"))
|
|
ios.g0_dynamic
|
|
ios.g0_clear
|
|
ios.g0_copy
|
|
screenset1 'farben und tiles setzen
|
|
heap_len := ios.g0_datlen
|
|
ios.g0_datblk(@grdat,0,heap_len) 'heapdaten senden
|
|
|
|
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("triborg.adm"))
|
|
ios.sddmput(ios#DM_USER,dmu) 'usermarker wieder in administra setzen
|
|
ios.sddmact(ios#DM_USER) 'u-marker aktivieren
|
|
|
|
play_count
|
|
repeat
|
|
ios.sid_sdmpplay(string("triborg.sid"))
|
|
\phase1(400)
|
|
\phase2(445)
|
|
\phase3(250)
|
|
\phase4
|
|
play_dir
|
|
|
|
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.g0_reboot 'grafiksubsystem neu im textmodus starten
|
|
ios.admreset 'administra neu starten
|
|
waitcnt(cnt+clkfreq*2) 'geben wir den damen noch ein wenig zeit...
|
|
reboot
|
|
"n":
|
|
ios.sid_dmpstop
|
|
ios.sid_mute(3)
|
|
abort
|
|
"p":
|
|
ios.sid_dmppause
|
|
ios.sid_mute(3)
|
|
repeat until ios.g0_keystat
|
|
|
|
|
|
PRI screenset1|i,tx,ty
|
|
|
|
'tilescreen setzen
|
|
repeat tx from 0 to x_tiles - 1
|
|
repeat ty from 0 to y_tiles - 1
|
|
screen[ty * x_tiles + tx] := disp_base >> 6 + ty + tx * y_tiles + ((ty & $3F) << 10)
|
|
|
|
'farbtabelle füllen
|
|
repeat i from 0 to 63
|
|
colortab[i] := $00001010 * (i<<1+4) & $F + $48060D02
|
|
|
|
ios.g0_colortab(@colortab)
|
|
ios.g0_screen(@screen)
|
|
|
|
|
|
PRI phase1(frcnt) | k
|
|
|
|
ios.g0_textmode(5,5,6,0)
|
|
ios.g0_colorwidth(2,8)
|
|
repeat frcnt
|
|
ios.g0_clear
|
|
ios.g0_text(15,k,@string4 - @grdat)
|
|
ios.g0_copy
|
|
k := k + 1 <# 60
|
|
esc_key
|
|
|
|
PRI phase2(frcnt) | k
|
|
|
|
ios.g0_textmode(5,5,6,0)
|
|
ios.g0_colorwidth(2,8)
|
|
k := 255
|
|
repeat frcnt
|
|
ios.g0_clear
|
|
ios.g0_text(15,60,@string4 - @grdat)
|
|
ios.g0_text(15,k,@string3 - @grdat)
|
|
ios.g0_copy
|
|
k := k - 1 #> 60
|
|
esc_key
|
|
|
|
PRI phase3(frcnt) | k
|
|
|
|
k := 0
|
|
ios.g0_textmode(5,5,6,0)
|
|
repeat frcnt
|
|
ios.g0_clear
|
|
ios.g0_colorwidth(2,8)
|
|
ios.g0_text(15,60,@string2 - @grdat)
|
|
cores1(400,ymax/2 - 5,cnt>>14,600 + k <# 1600,2)
|
|
ios.g0_colorwidth(2,8)
|
|
ios.g0_text(15,60,@string1 - @grdat)
|
|
ios.g0_copy
|
|
k := k + 5
|
|
esc_key
|
|
|
|
PRI phase4 | status
|
|
|
|
ios.g0_textmode(5,5,6,0)
|
|
repeat
|
|
dmpreg := ios.sid_dmpreg
|
|
status := ios.sid_dmpstatus
|
|
ios.g0_clear
|
|
ios.g0_colorwidth(2,8)
|
|
ios.g0_text(15,60,@string2 - @grdat)
|
|
cores2(400,ymax/2 - 5,cnt >> 14,2000,1)
|
|
ios.g0_colorwidth(2,8)
|
|
ios.g0_text(15,60,@string1 - @grdat)
|
|
ios.g0_copy
|
|
esc_key
|
|
while status
|
|
|
|
PRI phase5 | status
|
|
|
|
ios.g0_textmode(5,5,6,0)
|
|
repeat
|
|
dmpreg := ios.sid_dmpreg
|
|
status := ios.sid_dmpstatus
|
|
ios.g0_clear
|
|
ios.g0_colorwidth(2,8)
|
|
ios.g0_text(15,60,@string2 - @grdat)
|
|
cores2(400,ymax/2 - 5,cnt >> 14,2000,1)
|
|
ios.g0_colorwidth(2,8)
|
|
ios.g0_text(15,60,@string1 - @grdat)
|
|
ios.g0_copy
|
|
esc_key
|
|
while status
|
|
|
|
PRI play(stradr) | status,k
|
|
|
|
k := 0
|
|
ios.sid_sdmpplay(stradr) 'sound starten
|
|
ios.g0_datblk(@grdat,@fn - @grdat,12) 'dateinamen aktualisieren
|
|
repeat
|
|
k++
|
|
dmpreg := ios.sid_dmpreg 'sounddaten holen
|
|
status := ios.sid_dmpstatus 'playerstatus abfragen
|
|
ios.g0_clear
|
|
ios.g0_colorwidth(2,8)
|
|
ios.g0_textmode(5,5,6,0)
|
|
ios.g0_text(15,60,@string2 - @grdat)
|
|
cores2(400,ymax/2 - 5,cnt >> 14,2000,1)
|
|
ios.g0_colorwidth(2,8)
|
|
ios.g0_text(15,60,@string1 - @grdat)
|
|
if k < XMAX 'dateiname und zählerstand
|
|
ios.g0_textmode(2,1,6,0)
|
|
ios.g0_colorwidth(2,0)
|
|
ios.g0_text(k,5,@fn - @grdat)
|
|
ios.g0_printdec(70,150,fpos,4,@val1,@val1 - @grdat)
|
|
ios.g0_printdec(130,150,fcnt,4,@val2,@val2 - @grdat)
|
|
|
|
ios.g0_copy
|
|
esc_key
|
|
while status
|
|
ios.sid_dmpstop
|
|
|
|
PRI cores1(x,y,angle,radius,col)|x1,y1,x2,y2,x3,y3
|
|
|
|
x1 := x + sin(angle)/(radius)
|
|
y1 := y + cos(angle)/(radius)
|
|
x2 := x + sin(angle+2730)/(radius)
|
|
y2 := y + cos(angle+2730)/(radius)
|
|
x3 := x + sin(angle+5460)/(radius)
|
|
y3 := y + cos(angle+5460)/(radius)
|
|
|
|
ios.g0_colorwidth(0,0) 'startpunkt
|
|
ios.g0_plot(x1,y1)
|
|
|
|
ios.g0_colorwidth(col, 7) 'kreise
|
|
ios.g0_arc(x1, y1, 20, 20, 0, $1fff/(arcstep-1), arcstep, 2)
|
|
ios.g0_arc(x2, y2, 20, 20, 0, $1fff/(arcstep-1), arcstep, 2)
|
|
ios.g0_arc(x3, y3, 20, 20, 0, $1fff/(arcstep-1), arcstep, 2)
|
|
|
|
PRI cores2(x,y,angle,radius,col)|x1,y1,x2,y2,x3,y3,r1,r2,r3,xl,yl
|
|
|
|
x1 := x + sin(angle)/(radius - word[dmpreg + 0]>>6)
|
|
y1 := y + cos(angle)/(radius - word[dmpreg + 0]>>6)
|
|
x2 := x + sin(angle+2730)/(radius - word[dmpreg + 2]>>6)
|
|
y2 := y + cos(angle+2730)/(radius - word[dmpreg + 2]>>6)
|
|
x3 := x + sin(angle+5460)/(radius - word[dmpreg + 4]>>6)
|
|
y3 := y + cos(angle+5460)/(radius - word[dmpreg + 4]>>6)
|
|
r1 := byte[dmpreg + 1] >> 3
|
|
r2 := byte[dmpreg + 3] >> 3
|
|
r3 := byte[dmpreg + 5] >> 3
|
|
|
|
ios.g0_colorwidth(2,0) 'startpunkt
|
|
ios.g0_plot(x,y)
|
|
xl := x + sin(angle+2730)/(500 - word[dmpreg + 0]>>7)
|
|
yl := y + cos(angle+2730)/(500 - word[dmpreg + 0]>>7)
|
|
ios.g0_line(xl,yl)
|
|
|
|
ios.g0_colorwidth(0,0) 'startpunkt
|
|
ios.g0_plot(x1,y1)
|
|
|
|
ios.g0_colorwidth(col, 7) 'kreise
|
|
ios.g0_arc(x1, y1, r1, r1, 0, $1fff/(arcstep-1), arcstep, 2)
|
|
ios.g0_arc(x2, y2, r2, r2, 0, $1fff/(arcstep-1), arcstep, 2)
|
|
ios.g0_arc(x3, y3, r3, r3, 0, $1fff/(arcstep-1), arcstep, 2)
|
|
|
|
PRI cos(angle) : x
|
|
x := sin(angle + $800)
|
|
|
|
PRI sin(angle) : y
|
|
'' Get sine of angle (0-8191)
|
|
y := angle << 1 & $FFE ' address
|
|
if angle & $800
|
|
y := word[$F000 - y]
|
|
else
|
|
y := word[$E000 + y]
|
|
if angle & $1000
|
|
-y
|
|
CON 'sd-player
|
|
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|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)
|
|
\play(@fn)
|
|
|
|
|
|
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
|
|
|
|
DAT 'heap-daten
|
|
|
|
grdat
|
|
|
|
DAT 'stringpuffer
|
|
|
|
val1 'stringpuffer für zahlenausgabe
|
|
byte "00000000",0 '8 digits
|
|
byte 0 'wichtig: auf wortgrenze auffüllen!
|
|
|
|
val2 'stringpuffer für zahlenausgabe
|
|
byte "00000000",0 '8 digits
|
|
byte 0 'wichtig: auf wortgrenze auffüllen!
|
|
|
|
strend
|
|
|
|
|
|
DAT 'strings
|
|
|
|
string1
|
|
byte " rg",0
|
|
|
|
string2
|
|
byte "TriBo",0
|
|
|
|
string3
|
|
byte "Tri",0
|
|
|
|
string4
|
|
byte " Borg",0
|
|
|
|
fn
|
|
byte "--------.---",0
|
|
|
|
grdatend
|
|
|
|
|
|
|
|
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. │
|
|
└──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
|
}}
|