commit 323985175caa14de87b1ddfad6553892c34f467d Author: Joerg Deckert Date: Sat May 3 10:52:31 2014 +0200 initial commit diff --git a/README.md b/README.md new file mode 100644 index 0000000..d7655d5 --- /dev/null +++ b/README.md @@ -0,0 +1,210 @@ +HIVE TOOLBOX 1 +============== + +Nach einer gründlichen Aufräumarbeit im TriOS ist diese Toolbox 1 das erste +Paket einer ganzen Serie von Anwendungen, Democodes, Tools und Mediendateien +für den Hive. Viele Fragmente gab es bisher schon auf meiner Festplatte oder +sind bei der Programmierung vom TriOS entstanden, aber meist hatten sie mehr +einen experimentellen Charakter und fehlte noch eine Kleinigkeit. Einige +wenige Dateien sind Beispiele von Parallax oder aus der Community, die ich +an den Hive angepasst habe. In dieser Toolbox enthalten sind Codebeispiele +aus folgenden Themenbereichen: + + - Bellatrix-Programmierung: Dabei handelt es sich um reinen Bellatrix-Code, + also ohne Anbindung und Kommunikation zu Regnatix. + - Graphics-Objekt: Wie werden einfache Grafiken erzeugt, die Maus eingebunden, + Animationen erzeugt usw. + - Grundlegende Ansteuerung der zwei SID-COG's im Administra-Code admsid.adm + - Regnatix-Code: Ein einfaches Hallo-Welt und ein Beispiel, wie die Parameter- + übergabe von Regime funktioniert + +Ich hoffe, dass diese Fragmente ein wenig zum Experimentieren einladen und +zeigen können, wie einfach die Programmierung der Slavechips und des Hive ist. +Alle Demos sind direkt in Regime startbar und werden entweder mit ESC oder der +rechten Maustaste abgebrochen. Teilweise ist noch die linke Taste und das +Scrollrad mit einer Funktion belegt - einfach mal testen. + +Vorraussetzungen: Als Compiler muß Brat's Spin Tool - kurz BST - verwendet +werden. In den Einstellungen des Compilers (Tools/Compiler Preferences/Search +Paths) muss das lib-Verzeichnis im TriOS eingetragen werden, damit der Compiler +die benötigten Bibliotheken findet. + +Downloadlink BST: http://www.fnarfbargle.com/bst.html + +Um mit der makelog-Batchdatei alle ausführbaren Dateien in einem Rutsch zu +erstellen, müssen die Quelltexte in folgender Struktur vorliegen: + +hive-trios +tbox-1 +tbox-2 + +tbox-X + +Diese Struktur ist nötig, damit auch der Kommandozeilencompiler bstc.exe auf +die Bibliotheken von TriOS zugreifen kann. Alternativ könnte man natürlich auch +den Pfad in der Batchdatei anpassen. + +------------------------------------------------------------------------------- + + +Name : 1-koord.bel +Chip : Bellatrix +Video : TV + + - Initialisierung des Graphics-Objektes + - Einfache Grafikbefehle, Textausgabe + - Darstellung des Koordinatensystems + + +Name : 2-dots +Chip : Bellatrix +Video : TV + + - Füllt den Bildschirm mit Kreisen verschiedener Farbe. + + +Name : 3-objekt +Chip : Bellatrix +Video : TV + + - Verwendung und Animation von Vektorobjekten + + +Name : 4-boing +Chip : Bellatrix +Video : TV + + - Animiertes Vektorobjekt + + +Name : 5-scroll +Chip : Bellatrix +Video : TV + + - Animiertes Vektorobjekt mit Textcroller + + +Name : 6-mouse1 +Chip : Bellatrix +Video : TV + + - Bewegung und Drehung eines Vektorobjektes mit der Maus. + + +Name : 6-mouse2 +Chip : Bellatrix +Video : TV + + - Mauspfeil mit Koordinatenkreuz + - Numerische Koordinatenanzeige + + +Name : 7-sat +Chip : Bellatrix +Video : TV + + - Animation, kreisendes Objekt + + +Name : 8-sinus +Chip : Bellatrix +Video : TV + + - Vektorobjekt mit hinterlegtem Sinus + - Verwendung der Sinustabelle + + +Name : 9-lissa1 +Chip : Bellatrix +Video : TV + + - Lissajou-Figur mit Maussteuerung + + +Name : 9-lissa2 +Chip : Bellatrix +Video : TV + + - Lissajou-Animation aus 256 Linienfragmenten + + +Name : 10-ani1 +Chip : Bellatrix +Video : TV + + - Mauscursor mit Objekt an Gummiseil + + +Name : 10-ani2 +Chip : Bellatrix +Video : TV + + - Mauscursor mit zwei per Gummisiel gekoppelten Objekten + + +Name : 11-logo1 +Chip : Bellatrix +Video : TV + + - Hive-Logo + + +Name : 11-logo2 +Chip : Bellatrix +Video : TV + + - Animation aus zwei drehenden Hive-Logos mit Scrolltext + + +Name : 12-matr +Chip : Bellatrix +Video : VGA + TV + +- Gleichzeitige Ausgabe von verschiedenen Bildern an VGA und TV +- Matrix-Anzeige auf VGA +- Echtzeit Farbscroller ohne Bildpuffer auf TV + + +Name : 13-gdemo +Chip : Bellatrix +Video : TV + + - Graphics-Demo von Parallax + + +Name : 14-gpal +Chip : Bellatrix +Video : TV + + - Anzeige der Graphics-Farbpallette von Parallax + - Numerische Anzeige des Farbwertes unter Mauscursor + + +Name : 15-sid1, 15-sid2 +Chip : Regnatix +Video : VGA + + - Einfacher Trackersound auf SID 1 bw. SID 2 + - admsid.adm muss vorher geladen werden! + + +Name : 16-hallo +Chip : Regnatix +Video : VGA + + - Hive Version von "Hallo Welt!" + + +Name : 17-para +Chip : Regnatix +Video : VGA + + - Beispiel wie Parameter von der Kommandozeile an die Anwendung übergeben + werden + + +Name : 18-tdemo +Chip : Regnatix +Video : VGA + + - Einfache Anwendung der Zeichenausgabefunktionen diff --git a/make.sh b/make.sh new file mode 100755 index 0000000..8fd5902 --- /dev/null +++ b/make.sh @@ -0,0 +1,38 @@ +#! /bin/sh + +# Definitionen +##D="-D __DEBUG -D __LANG_EN" +##D="-D __LANG_EN" +D="-D __LANG_DE" + +# Pfade +##bin="../Bin" +bin="/home/ftp/hive" +sdtbox="${bin}/sdcard/tbox-1" +sdsys="${bin}/sdcard/system" +libpath="../TriOS/lib" +BSTC="bstc" + +# ---------------------------------------------------------------- +# Alte Versionen löschen + +rm -rf ${sdtbox} +rm -f ${sdsys}/matrix.bel +mkdir -p ${sdtbox} +mkdir -p ${sdsys} + +# ---------------------------------------------------------------- +# Bin-Dateien erzeugen + +for FILE in source/bellatrix/*.spin ; do + ${BSTC} -L ${libpath} ${D} -b -O a ${FILE} + BASE="`basename ${FILE} .spin`" + mv "${BASE}.binary" "${sdtbox}/${BASE}.bel" +done +cp "${sdtbox}/12-matr.bel" "${sdsys}/matrix.bel" + +for FILE in source/regnatix/*.spin ; do + ${BSTC} -L ${libpath} ${D} -b -O a ${FILE} + BASE="`basename ${FILE} .spin`" + mv "${BASE}.binary" "${sdtbox}/${BASE}.bin" +done diff --git a/source/bellatrix/1-koord.spin b/source/bellatrix/1-koord.spin new file mode 100644 index 0000000..9bf4590 --- /dev/null +++ b/source/bellatrix/1-koord.spin @@ -0,0 +1,239 @@ +{ + +} + +CON + _CLKMODE = XTAL1 + PLL16X + _XINFREQ = 5_000_000 + _stack = ($3000 + $3000 + 100) >> 2 + + x_tiles = 16 + y_tiles = 12 + + paramcount = 14 + bitmap_base = $2000 + display_base = $5000 + + +VAR + long tv_status '0/1/2 = off/visible/invisible read-only + long tv_enable '0/? = off/on write-only + long tv_pins '%ppmmm = pins write-only + long tv_mode '%ccinp = chroma,interlace,ntsc/pal,swap write-only + long tv_screen 'pointer to screen (words) write-only + long tv_colors 'pointer to colors (longs) write-only + long tv_hc 'horizontal cells write-only + long tv_vc 'vertical cells write-only + long tv_hx 'horizontal cell expansion write-only + long tv_vx 'vertical cell expansion write-only + long tv_ho 'horizontal offset write-only + long tv_vo 'vertical offset write-only + long tv_broadcast 'broadcast frequency (Hz) write-only + long tv_auralcog 'aural fm cog write-only + + word screen[x_tiles * y_tiles] 'tilemap + long colors[64] 'farbregister + + + +OBJ + tv : "bel-tv" 'located in default Library + gr : "bel-graphics" 'located in default Library + kb : "bel-keyb" + +PUB main | x,y,j + + init_subsystem + + gr.clear + + gr.width(15) + gr.color(1) + + gr.plot(0,0) 'ecke links unten + gr.plot(256,0) 'ecke rechts unten + gr.plot(0,192) 'ecke links oben + gr.plot(256,192) 'ecke rechts oben + + gr.color(1) + gr.plot(100,96) + gr.color(2) + gr.plot(110,96) + gr.color(3) + gr.plot(120,96) + + gr.colorwidth(2,0) + gr.textmode(1,1,6,0 ) + gr.text(20,56,string("256x192 Pixel, 4 aus 64 Farben/Tile")) + gr.text(5,5,string("000:000")) + gr.text(210,5,string("255:000")) + gr.text(5,170,string("000:192")) + gr.text(210,170,string("255:192")) + + gr.copy(display_base) + + repeat ' warten auf abbruch (esc) + ifexit + +CON + +#16, BEL_KEYBC,BEL_KEYBD 'keyboard-signale +#18, BEL_MOUSEC,BEL_MOUSED 'maus-signale + +PRI ifexit + + if kb.key == kb#Esc + reboot + +PRI init_subsystem | i,dx,dy + + kb.start(BEL_KEYBD, BEL_KEYBC) 'tastaturport starten + + 'tv-treiber starten + longmove(@tv_status, @tvparams, paramcount) + tv_screen := @screen + tv_colors := @colors + tv.start(@tv_status) + +' farbtabelle setzen +' PPPP_M_LLL +' ---+ | --+ +' | | +- 0..1 sync +' | | 2..6 helligkeit b/w +' | | 2..6 helligkeit col +' | | 7 - +' | +----- 0 - b/w +' | 1 - col +' +------- ntsc-palette (blau...grün..rot) +' +' b/w - 6 helligkeitsstufen 6 +' col - 16color x 5 luma 64 +' hsat - 16 highsat-farben 16 +' +' $aa_bb_cc_dd +' $aa - color 3 +' $bb - color 2 +' $cc - color 1 +' $dd - color 0 (hintergrund) + + repeat i from 0 to 63 +' colors[i] := %1010_1_101__0000_0_010__0010_1_111__0000_0_111 +' colors[i] := %1010_1_101__0000_0_010__0010_1_111__0011_0_111 +' colors[i] := c_hsat(3,0)+c_hsat(2,2)+c_hsat(1,6)+c_hsat(0,8) 'gesättigte farben +' colors[i] := c_bw(3,1)+c_bw(2,2)+c_bw(1,3)+c_bw(0,4) 'graustufen +' colors[i] := c_col(3,0,2)+c_col(2,3,2)+c_col(1,6,2)+c_col(0,9,2) + colors[i] := $00001010 * (i<<1+4) & $F + $0D060D02 + + 'init tile screen + repeat dx from 0 to tv_hc - 1 + repeat dy from 0 to tv_vc - 1 + screen[dy * tv_hc + dx] := display_base >> 6 + dy + dx * tv_vc + ((dy & $3F) << 10) +{ + i := 0 + repeat dy from 0 to tv_vc - 1 + repeat dx from 0 to tv_hc - 1 + screen[i++] := display_base >> 6 + dy + dx * tv_vc + (dy << 10) +} + 'start and setup graphics + gr.start + gr.setup(tv_hc, tv_vc, 0, 0, bitmap_base) + +PRI c_hsat(bnr,cnr):col 'tool: erzeugt einen gesättigten farbwert +' bnr : bytenummer +' cnr : 0..15 farbnummer + col := (%0000_1_000 + (cnr<<4))<<(bnr*8) + +PRI c_bw(bnr,cnr):col 'tool: erzeugt einen monochromwert +' bnr : bytenummer +' cnr : 0..5 graustufen + col := (%0000_0_000 + cnr+2)<<(bnr*8) + +PRI c_col(bnr,chroma,lumi):col 'tool: erzeugt einen farbwert +' bnr : bytenummer +' croma : 0..15 chroma +' lumi : 0..5 luminanz + col := (%0000_1_000+(lumi+2)+(chroma<<4))<<(bnr*8) + +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 + + +DAT 'tv-parameter + +tvparams long 0 'status + long 1 'enable + long %010_0101 'pins New Board + long %0000 'mode + long 0 'screen + long 0 'colors + long x_tiles 'hc - horizontale tiles + long y_tiles 'vc - vertikale tiles + long 10 'hx + long 1 'vx + long 0 'ho + long 0 'vo + long 60_000_000 '_xinfreq<<4 'broadcast + long 0 'auralcog + +DAT 'vektorobjekte + +vecdef1 word $4000+$2000/3*0 'triangle + word 50 + word $8000+$2000/3*1+1 + word 50 + word $8000+$2000/3*2-1 + word 50 + word $8000+$2000/3*0 + word 50 + word 0 + +vecdef2 word $4000+$2000/12*0 'star + word 50 + word $8000+$2000/12*1 + word 20 + word $8000+$2000/12*2 + word 50 + word $8000+$2000/12*3 + word 20 + word $8000+$2000/12*4 + word 50 + word $8000+$2000/12*5 + word 20 + word $8000+$2000/12*6 + word 50 + word $8000+$2000/12*7 + word 20 + word $8000+$2000/12*8 + word 50 + word $8000+$2000/12*9 + word 20 + word $8000+$2000/12*10 + word 50 + word $8000+$2000/12*11 + word 20 + word $8000+$2000/12*0 + word 50 + word 0 + +vecdef3 word $4000+$2000/4*0 'box + word 50 + word $8000+$2000/4*1 + word 30 + word $8000+$2000/4*2 + word 50 + word $8000+$2000/4*3 + word 30 + word $8000+$2000/4*0 + word 50 + word 0 + diff --git a/source/bellatrix/10-ani1.spin b/source/bellatrix/10-ani1.spin new file mode 100644 index 0000000..9dad8e7 --- /dev/null +++ b/source/bellatrix/10-ani1.spin @@ -0,0 +1,210 @@ +{ + +} + +CON + _CLKMODE = XTAL1 + PLL16X + _XINFREQ = 5_000_000 + _stack = ($3000 + $3000 + 100) >> 2 + + x_tiles = 16 + y_tiles = 12 + + paramcount = 14 + bitmap_base = $2000 + display_base = $5000 + + max_x = x_tiles * 16 + max_y = y_tiles * 16 + + s_obj = 200 'scale + d_obj = 64 'durchmesser + r_obj = d_obj/2 'radius + rotvar = 16 'rotationsvarianz + arcstep = 16 + arcdistx = 0 + arcdisty = -100 + rband = 10 + +VAR + long tv_status '0/1/2 = off/visible/invisible read-only + long tv_enable '0/? = off/on write-only + long tv_pins '%ppmmm = pins write-only + long tv_mode '%ccinp = chroma,interlace,ntsc/pal,swap write-only + long tv_screen 'pointer to screen (words) write-only + long tv_colors 'pointer to colors (longs) write-only + long tv_hc 'horizontal cells write-only + long tv_vc 'vertical cells write-only + long tv_hx 'horizontal cell expansion write-only + long tv_vx 'vertical cell expansion write-only + long tv_ho 'horizontal offset write-only + long tv_vo 'vertical offset write-only + long tv_broadcast 'broadcast frequency (Hz) write-only + long tv_auralcog 'aural fm cog write-only + + word screen[x_tiles * y_tiles] 'tilemap + long colors[64] 'farbregister + + long x,y,x1,y1,dx1,dy1,j,mousex,mousey,rflag,k,speed,distx,disty + +OBJ + tv : "bel-tv" 'located in default Library + gr : "bel-graphics" 'located in default Library + mouse : "bel-mouse" + +PUB main + + init_subsystem + + x := x1 := max_x/2 + y := y1 := max_y/2 + dx1 := 0 + dy1 := 0 + speed := 4 + + repeat + gr.clear + + 'draw objects + gr.textmode( 3, 3, 6, 0 ) + gr.colorwidth(2, 0) + gr.arc(x, y, 3, 3, 0, $1fff/(arcstep-1), arcstep, 2) + gr.colorwidth(3, 2) + gr.arc(x1, y1, 6, 6, 0, $1fff/(arcstep-1), arcstep, 2) + gr.colorwidth(2, 0) + gr.plot(x,y) + gr.line(x1,y1) + + 'rubberband + + distx := x - x1 + disty := y - y1 + + if k == speed + k~ + if distx > 0 + dx1 := dx1+2 + else 'if distx < 0 + dx1 := dx1-2 + if disty > 0 + dy1 := dy1+2 + else 'if disty < 0 + dy1 := dy1-2 + x1 := x1 + dx1 + y1 := y1 + dy1 + + ifnot mouse.buttons == 1 + x1 := x1 + distx/40 + y1 := y1 + disty/40 + + 'mousefunctions + x += mouse.delta_x + y += mouse.delta_y + + + k++ + gr.copy(display_base) + ifexit + +PRI ifexit + + if mouse.buttons == 2 + reboot + +PRI init_subsystem | i,dx,dy + + 'tv-treiber starten + longmove(@tv_status, @tvparams, paramcount) + tv_screen := @screen + tv_colors := @colors + tv.start(@tv_status) + +' farbtabelle setzen +' PPPP_M_LLL +' ---+ | --+ +' | | +- 0..1 sync +' | | 2..6 helligkeit b/w +' | | 2..6 helligkeit col +' | | 7 - +' | +----- 0 - b/w +' | 1 - col +' +------- ntsc-palette (blau...grün..rot) +' +' b/w - 6 helligkeitsstufen 6 +' col - 16color x 5 luma 64 +' hsat - 16 highsat-farben 16 +' +' $aa_bb_cc_dd +' $aa - color 3 +' $bb - color 2 +' $cc - color 1 +' $dd - color 0 (hintergrund) + + repeat i from 0 to 63 +' colors[i] := %1010_1_101__0000_0_010__0010_1_111__0000_0_111 +' colors[i] := %1010_1_101__0000_0_010__0010_1_111__0011_0_111 +' colors[i] := c_hsat(3,0)+c_hsat(2,2)+c_hsat(1,6)+c_hsat(0,8) 'gesättigte farben +' colors[i] := c_bw(3,1)+c_bw(2,2)+c_bw(1,3)+c_bw(0,4) 'graustufen +' colors[i] := c_col(3,0,2)+c_col(2,3,2)+c_col(1,6,2)+c_col(0,9,2) + colors[i] := $00001010 * (i<<1+4) & $F + $0D060D02 + + 'init tile screen + repeat dx from 0 to tv_hc - 1 + repeat dy from 0 to tv_vc - 1 + screen[dy * tv_hc + dx] := display_base >> 6 + dy + dx * tv_vc + ((dy & $3F) << 10) + + 'start and setup graphics + gr.start + gr.setup(tv_hc, tv_vc, 0, 0, bitmap_base) + + 'mouse + mouse.start(19, 18) + +PRI c_hsat(bnr,cnr):col 'tool: erzeugt einen gesättigten farbwert +' bnr : bytenummer +' cnr : 0..15 farbnummer + col := (%0000_1_000 + (cnr<<4))<<(bnr*8) + +PRI c_bw(bnr,cnr):col 'tool: erzeugt einen monochromwert +' bnr : bytenummer +' cnr : 0..5 graustufen + col := (%0000_0_000 + cnr+2)<<(bnr*8) + +PRI c_col(bnr,chroma,lumi):col 'tool: erzeugt einen farbwert +' bnr : bytenummer +' croma : 0..15 chroma +' lumi : 0..5 luminanz + col := (%0000_1_000+(lumi+2)+(chroma<<4))<<(bnr*8) + +PRI cos(angle) : cosval + cosval := sin(angle + $800) + +PRI sin(angle) : sinval + '' Get sine of angle (0-8191) + sinval := angle << 1 & $FFE ' address + if angle & $800 + sinval := word[$F000 - sinval] + else + sinval := word[$E000 + sinval] + if angle & $1000 + -sinval + + +DAT 'tv-parameter + +tvparams long 0 'status + long 1 'enable + long %010_0101 'pins New Board + long %0000 'mode + long 0 'screen + long 0 'colors + long x_tiles 'hc - horizontale tiles + long y_tiles 'vc - vertikale tiles + long 10 'hx + long 1 'vx + long 0 'ho + long 0 'vo + long 60_000_000 '_xinfreq<<4 'broadcast + long 0 'auralcog + + diff --git a/source/bellatrix/10-ani2.spin b/source/bellatrix/10-ani2.spin new file mode 100644 index 0000000..395437a --- /dev/null +++ b/source/bellatrix/10-ani2.spin @@ -0,0 +1,236 @@ +{ + +} + +CON + _CLKMODE = XTAL1 + PLL16X + _XINFREQ = 5_000_000 + _stack = ($3000 + $3000 + 100) >> 2 + + x_tiles = 16 + y_tiles = 12 + + paramcount = 14 + bitmap_base = $2000 + display_base = $5000 + + max_x = x_tiles * 16 + max_y = y_tiles * 16 + + s_obj = 200 'scale + d_obj = 64 'durchmesser + r_obj = d_obj/2 'radius + rotvar = 16 'rotationsvarianz + arcstep = 16 + arcdistx = 0 + arcdisty = -100 + rband = 10 + +VAR + long tv_status '0/1/2 = off/visible/invisible read-only + long tv_enable '0/? = off/on write-only + long tv_pins '%ppmmm = pins write-only + long tv_mode '%ccinp = chroma,interlace,ntsc/pal,swap write-only + long tv_screen 'pointer to screen (words) write-only + long tv_colors 'pointer to colors (longs) write-only + long tv_hc 'horizontal cells write-only + long tv_vc 'vertical cells write-only + long tv_hx 'horizontal cell expansion write-only + long tv_vx 'vertical cell expansion write-only + long tv_ho 'horizontal offset write-only + long tv_vo 'vertical offset write-only + long tv_broadcast 'broadcast frequency (Hz) write-only + long tv_auralcog 'aural fm cog write-only + + word screen[x_tiles * y_tiles] 'tilemap + long colors[64] 'farbregister + + long x,y,x1,y1,dx1,dy1,j,mousex,mousey,rflag,k,speed,distx,disty,distx2,disty2,dx2,dy2,x2,y2 + +OBJ + tv : "bel-tv" 'located in default Library + gr : "bel-graphics" 'located in default Library + mouse : "bel-mouse" + +PUB main + + init_subsystem + + x := x1 := x2 := max_x/2 + y := y1 := y2 := max_y/2 + dx1 := dx2 := 0 + dy1 := dx2 := 0 + speed := 3 + + repeat + gr.clear + + 'draw objects + gr.textmode( 3, 3, 6, 0 ) + + 'cursor + gr.colorwidth(2, 0) + gr.arc(x, y, 3, 3, 0, $1fff/(arcstep-1), arcstep, 2) + + ' 1. kugel + gr.colorwidth(1, 1) + gr.arc(x1, y1, 5, 5, 0, $1fff/(arcstep-1), arcstep, 2) + gr.colorwidth(2, 0) + gr.plot(x,y) + gr.line(x1,y1) + + ' 2. kugel + gr.colorwidth(1, 2) + gr.arc(x2, y2, 8, 8, 0, $1fff/(arcstep-1), arcstep, 2) + gr.colorwidth(2, 0) + gr.plot(x1,y1) + gr.line(x2,y2) + + 'rubberband + + distx := x - x1 + disty := y - y1 + distx2 := x1 - x2 + disty2 := y1 - y2 + + if k == speed + k~ + if distx > 0 + dx1 := dx1+2 + else 'if distx < 0 + dx1 := dx1-2 + if disty > 0 + dy1 := dy1+2 + else 'if disty < 0 + dy1 := dy1-2 + x1 := x1 + dx1 + y1 := y1 + dy1 + + if distx2 > 0 + dx2 := dx2+2 + else 'if distx < 0 + dx2 := dx2-2 + if disty2 > 0 + dy2 := dy2+2 + else 'if disty < 0 + dy2 := dy2-2 + x2 := x2 + dx2 + y2 := y2 + dy2 + + if mouse.buttons == 1 + x1 := x1 + distx/40 + y1 := y1 + disty/40 + x2 := x2 + distx2/40 + y2 := y2 + disty2/40 + + 'mousefunctions + x += mouse.delta_x + y += mouse.delta_y + + + k++ + gr.copy(display_base) + ifexit + +PRI ifexit + + if mouse.buttons == 2 + reboot + +PRI init_subsystem | i,dx,dy + + 'tv-treiber starten + longmove(@tv_status, @tvparams, paramcount) + tv_screen := @screen + tv_colors := @colors + tv.start(@tv_status) + +' farbtabelle setzen +' PPPP_M_LLL +' ---+ | --+ +' | | +- 0..1 sync +' | | 2..6 helligkeit b/w +' | | 2..6 helligkeit col +' | | 7 - +' | +----- 0 - b/w +' | 1 - col +' +------- ntsc-palette (blau...grün..rot) +' +' b/w - 6 helligkeitsstufen 6 +' col - 16color x 5 luma 64 +' hsat - 16 highsat-farben 16 +' +' $aa_bb_cc_dd +' $aa - color 3 +' $bb - color 2 +' $cc - color 1 +' $dd - color 0 (hintergrund) + + repeat i from 0 to 63 +' colors[i] := %1010_1_101__0000_0_010__0010_1_111__0000_0_111 +' colors[i] := %1010_1_101__0000_0_010__0010_1_111__0011_0_111 +' colors[i] := c_hsat(3,0)+c_hsat(2,2)+c_hsat(1,6)+c_hsat(0,8) 'gesättigte farben +' colors[i] := c_bw(3,1)+c_bw(2,2)+c_bw(1,3)+c_bw(0,4) 'graustufen +' colors[i] := c_col(3,0,2)+c_col(2,3,2)+c_col(1,6,2)+c_col(0,9,2) + colors[i] := $00001010 * (i<<1+4) & $F + $0D060D02 + + 'init tile screen + repeat dx from 0 to tv_hc - 1 + repeat dy from 0 to tv_vc - 1 + screen[dy * tv_hc + dx] := display_base >> 6 + dy + dx * tv_vc + ((dy & $3F) << 10) + + 'start and setup graphics + gr.start + gr.setup(tv_hc, tv_vc, 0, 0, bitmap_base) + + 'mouse + mouse.start(19, 18) + +PRI c_hsat(bnr,cnr):col 'tool: erzeugt einen gesättigten farbwert +' bnr : bytenummer +' cnr : 0..15 farbnummer + col := (%0000_1_000 + (cnr<<4))<<(bnr*8) + +PRI c_bw(bnr,cnr):col 'tool: erzeugt einen monochromwert +' bnr : bytenummer +' cnr : 0..5 graustufen + col := (%0000_0_000 + cnr+2)<<(bnr*8) + +PRI c_col(bnr,chroma,lumi):col 'tool: erzeugt einen farbwert +' bnr : bytenummer +' croma : 0..15 chroma +' lumi : 0..5 luminanz + col := (%0000_1_000+(lumi+2)+(chroma<<4))<<(bnr*8) + +PRI cos(angle) : cosval + cosval := sin(angle + $800) + +PRI sin(angle) : sinval + '' Get sine of angle (0-8191) + sinval := angle << 1 & $FFE ' address + if angle & $800 + sinval := word[$F000 - sinval] + else + sinval := word[$E000 + sinval] + if angle & $1000 + -sinval + + +DAT 'tv-parameter + +tvparams long 0 'status + long 1 'enable + long %010_0101 'pins New Board + long %0000 'mode + long 0 'screen + long 0 'colors + long x_tiles 'hc - horizontale tiles + long y_tiles 'vc - vertikale tiles + long 10 'hx + long 1 'vx + long 0 'ho + long 0 'vo + long 60_000_000 '_xinfreq<<4 'broadcast + long 0 'auralcog + + diff --git a/source/bellatrix/11-logo1.spin b/source/bellatrix/11-logo1.spin new file mode 100644 index 0000000..ff68c6a --- /dev/null +++ b/source/bellatrix/11-logo1.spin @@ -0,0 +1,291 @@ +{ + +} + +CON + _CLKMODE = XTAL1 + PLL16X + _XINFREQ = 5_000_000 + _stack = ($3000 + $3000 + 100) >> 2 + + x_tiles = 16 + y_tiles = 12 + + paramcount = 14 + bitmap_base = $2000 + display_base = $5000 + + max_x = x_tiles * 16 + max_y = y_tiles * 16 + + s_obj = 200 'scale + d_obj = 64 'durchmesser + r_obj = d_obj/2 'radius + rotvar = 16 'rotationsvarianz + arcstep = 16 + arcdistx = 0 + arcdisty = -100 + rband = 10 + +VAR + long tv_status '0/1/2 = off/visible/invisible read-only + long tv_enable '0/? = off/on write-only + long tv_pins '%ppmmm = pins write-only + long tv_mode '%ccinp = chroma,interlace,ntsc/pal,swap write-only + long tv_screen 'pointer to screen (words) write-only + long tv_colors 'pointer to colors (longs) write-only + long tv_hc 'horizontal cells write-only + long tv_vc 'vertical cells write-only + long tv_hx 'horizontal cell expansion write-only + long tv_vx 'vertical cell expansion write-only + long tv_ho 'horizontal offset write-only + long tv_vo 'vertical offset write-only + long tv_broadcast 'broadcast frequency (Hz) write-only + long tv_auralcog 'aural fm cog write-only + + word screen[x_tiles * y_tiles] 'tilemap + long colors[64] 'farbregister + + + +OBJ + tv : "bel-tv" 'located in default Library + gr : "bel-graphics-xor" 'located in default Library + mouse : "bel-mouse" + +PUB main | x,y,rflag,k + + init_subsystem + + x := max_x/2 + y := max_y/2 + + repeat + gr.clear + + logo(x,y,0,3) + + 'mousefunctions + x += mouse.delta_x + y += mouse.delta_y + rflag := mouse.buttons + + k++ + gr.copy(display_base) + ifexit + +PRI ifexit + + if mouse.buttons == 2 + reboot + +PRI logo(x,y,a,c) + + 'draw objects + gr.colorwidth(c, 10) + gr.plot(x, y+25) + gr.line(x-29, y-25) + gr.line(x+29, y-25) + gr.line(x,y+25) + + gr.colorwidth(0, 15) + gr.arc(x, y+25, 9, 9, 0, $1fff/(arcstep-1), arcstep, 2) + gr.arc(x-29, y-25, 9, 9, 0, $1fff/(arcstep-1), arcstep, 2) + gr.arc(x+29, y-25, 9, 9, 0, $1fff/(arcstep-1), arcstep, 2) + + gr.colorwidth(c, 5) + gr.arc(x, y+25, 20, 20, 0, $1fff/(arcstep-1), arcstep, 2) + gr.arc(x-29, y-25, 20, 20, 0, $1fff/(arcstep-1), arcstep, 2) + gr.arc(x+29, y-25, 20, 20, 0, $1fff/(arcstep-1), arcstep, 2) + + +PRI init_subsystem | i,dx,dy + + 'tv-treiber starten + longmove(@tv_status, @tvparams, paramcount) + tv_screen := @screen + tv_colors := @colors + tv.start(@tv_status) + +' farbtabelle setzen +' PPPP_M_LLL +' ---+ | --+ +' | | +- 0..1 sync +' | | 2..6 helligkeit b/w +' | | 2..6 helligkeit col +' | | 7 - +' | +----- 0 - b/w +' | 1 - col +' +------- ntsc-palette (blau...grün..rot) +' +' b/w - 6 helligkeitsstufen 6 +' col - 16color x 5 luma 64 +' hsat - 16 highsat-farben 16 +' +' $aa_bb_cc_dd +' $aa - color 3 +' $bb - color 2 +' $cc - color 1 +' $dd - color 0 (hintergrund) + + repeat i from 0 to 63 +' colors[i] := %1010_1_101__0000_0_010__0010_1_111__0000_0_111 +' colors[i] := %1010_1_101__0000_0_010__0010_1_111__0011_0_111 +' colors[i] := c_hsat(3,0)+c_hsat(2,2)+c_hsat(1,6)+c_hsat(0,8) 'gesättigte farben +' colors[i] := c_bw(3,1)+c_bw(2,2)+c_bw(1,3)+c_bw(0,4) 'graustufen +' colors[i] := c_col(3,0,2)+c_col(2,3,2)+c_col(1,6,2)+c_col(0,9,2) + colors[i] := $00001010 * (i<<1+4) & $F + $0D060D02 + + 'init tile screen + repeat dx from 0 to tv_hc - 1 + repeat dy from 0 to tv_vc - 1 + screen[dy * tv_hc + dx] := display_base >> 6 + dy + dx * tv_vc + ((dy & $3F) << 10) + + 'start and setup graphics + gr.start + gr.setup(tv_hc, tv_vc, 0, 0, bitmap_base) + + 'mouse + mouse.start(19, 18) + +PUB set_tile_color(tilex, tiley, palette) | temp 'doug@opengeek.org + + 'The screen[] array contains both the tile HUB image data address, and an index into the color palette + 'array, which can be defined as a DAT block, as done in this program, or as a VAR as done in the + 'original + + 'The lower 10 bits are the HUB image address data (where the pixels are defined) + 'The upper 6 bits point to sets of colors, contained in the colors[] array + + temp := screen[tiley * tv_hc + tilex] 'get current screen tile value + temp := temp & %00000011_11111111 'clear color palette index value, leaving image address bits + temp := temp + (palette << 10) 'replace color palette index value with the new one + screen[tiley * tv_hc + tilex] := temp 'update the screen + + +PUB set_color_palette(palette_num, palette_colors) 'doug@opengeek.org + + 'only 64 palettes possible... (& %111111) insures no overwrite occurs on larger values + 'the colors run like this in the long: 33_22_11_00, where 33 = color 3, 22 = color 2, etc... + 'color 00 is the background color. + + colors[palette_num & %111111] := palette_colors 'Write the colors into the colors[] array + +PUB set_tile_address(tilex, tiley, HUB_address) | temp 'doug@opengeek.org + + temp := screen[tiley * tv_hc + tilex] 'Get current screen tile value from screen[] array + temp := temp & %11111100_00000000 'Zero out the screen memory address pointer bits, leaving color bits + temp := temp + (HUB_address >> 6) 'Set screen memory pointer bits, from the most significant bits in the HUB + 'address given. Tiles must be 64 byte aligned, due to how the TV driver + 'decodes the screen array bits, 6 for color, 10 for screen pixel address in HUB + screen[tiley * tv_hc + tilex] := temp 'Update screen array for that tile, reflecting address change. + +PUB get_tile_address(tilex, tiley) | temp 'doug@opengeek.org + + temp := screen[tiley * tv_hc + tilex] 'Get current screen tile value from screen[] array + temp := temp & %00000011_11111111 'Zero out the color bits, leaving just the address + temp := temp << 6 'Shift to reflect effective HUB address. Tiles must + 'be 64 byte aligned, due to how the TV driver + 'decodes the screen array bits, 6 for color, 10 for + 'screen pixel address in HUB + return temp 'return that address! + + +PRI c_hsat(bnr,cnr):col 'tool: erzeugt einen gesättigten farbwert +' bnr : bytenummer +' cnr : 0..15 farbnummer + col := (%0000_1_000 + (cnr<<4))<<(bnr*8) + +PRI c_bw(bnr,cnr):col 'tool: erzeugt einen monochromwert +' bnr : bytenummer +' cnr : 0..5 graustufen + col := (%0000_0_000 + cnr+2)<<(bnr*8) + +PRI c_col(bnr,chroma,lumi):col 'tool: erzeugt einen farbwert +' bnr : bytenummer +' croma : 0..15 chroma +' lumi : 0..5 luminanz + col := (%0000_1_000+(lumi+2)+(chroma<<4))<<(bnr*8) + +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 + + +DAT 'tv-parameter + +tvparams long 0 'status + long 1 'enable + long %010_0101 'pins New Board + long %0000 'mode + long 0 'screen + long 0 'colors + long x_tiles 'hc - horizontale tiles + long y_tiles 'vc - vertikale tiles + long 10 'hx + long 1 'vx + long 0 'ho + long 0 'vo + long 60_000_000 '_xinfreq<<4 'broadcast + long 0 'auralcog + +DAT 'vektorobjekte + +vecdef1 word $4000+$2000/3*0 'triangle + word 50 + word $8000+$2000/3*1+1 + word 50 + word $8000+$2000/3*2-1 + word 50 + word $8000+$2000/3*0 + word 50 + word 0 + +vecdef2 word $4000+$2000/12*0 'star + word 50 + word $8000+$2000/12*1 + word 20 + word $8000+$2000/12*2 + word 50 + word $8000+$2000/12*3 + word 20 + word $8000+$2000/12*4 + word 50 + word $8000+$2000/12*5 + word 20 + word $8000+$2000/12*6 + word 50 + word $8000+$2000/12*7 + word 20 + word $8000+$2000/12*8 + word 50 + word $8000+$2000/12*9 + word 20 + word $8000+$2000/12*10 + word 50 + word $8000+$2000/12*11 + word 20 + word $8000+$2000/12*0 + word 50 + word 0 + +vecdef3 word $4000+$2000/4*0 'box + word 50 + word $8000+$2000/4*1 + word 30 + word $8000+$2000/4*2 + word 50 + word $8000+$2000/4*3 + word 30 + word $8000+$2000/4*0 + word 50 + word 0 + diff --git a/source/bellatrix/11-logo2.spin b/source/bellatrix/11-logo2.spin new file mode 100644 index 0000000..96e25de --- /dev/null +++ b/source/bellatrix/11-logo2.spin @@ -0,0 +1,338 @@ +{ + +} + +CON + _CLKMODE = XTAL1 + PLL16X + _XINFREQ = 5_000_000 + _stack = ($3000 + $3000 + 100) >> 2 + + x_tiles = 16 + y_tiles = 12 + + paramcount = 14 + bitmap_base = $2000 + display_base = $5000 + + max_x = x_tiles * 16 + max_y = y_tiles * 16 + + s_obj = 200 'scale + d_obj = 64 'durchmesser + r_obj = d_obj/2 'radius + rotvar = 16 'rotationsvarianz + arcstep = 16 + arcdistx = 0 + arcdisty = -100 + rband = 10 + +VAR + long tv_status '0/1/2 = off/visible/invisible read-only + long tv_enable '0/? = off/on write-only + long tv_pins '%ppmmm = pins write-only + long tv_mode '%ccinp = chroma,interlace,ntsc/pal,swap write-only + long tv_screen 'pointer to screen (words) write-only + long tv_colors 'pointer to colors (longs) write-only + long tv_hc 'horizontal cells write-only + long tv_vc 'vertical cells write-only + long tv_hx 'horizontal cell expansion write-only + long tv_vx 'vertical cell expansion write-only + long tv_ho 'horizontal offset write-only + long tv_vo 'vertical offset write-only + long tv_broadcast 'broadcast frequency (Hz) write-only + long tv_auralcog 'aural fm cog write-only + + word screen[x_tiles * y_tiles] 'tilemap + long colors[64] 'farbregister + + + +OBJ + tv : "bel-tv" 'located in default Library + gr : "bel-graphics-xor" 'located in default Library + mouse : "bel-mouse" + +PUB main | x,y,rflag,k + + init_subsystem + + x := max_x/2 + y := max_y/2 + + repeat + gr.clear + + logo(max_x/2,max_y/2,0-cnt>>16,9,1) + logo(max_x/2,max_y/2,cnt>>14,17,2) + + 'mousefunctions + x += mouse.delta_x + y += mouse.delta_y + rflag := mouse.buttons + + ' scroller + gr.colorwidth(3, 8) + gr.textmode( 5, 5, 6, 0 ) + gr.text( 500-(k & $7ff), 60, @text1 ) + k += 2 + + gr.copy(display_base) + ifexit + +PRI ifexit + + if mouse.buttons == 2 + reboot + +DAT 'scrolltext + +text1 byte "HIVE" + +PRI logo(x,y,angle,radius,col)|x1,y1,x2,y2,x3,y3 + + gr.colorwidth(col, 10) 'lines + x1 := x + sin(angle)/(radius*100) + y1 := y + cos(angle)/(radius*100) + gr.plot(x1,y1) + x2 := x + sin(angle+2730)/(radius*100) + y2 := y + cos(angle+2730)/(radius*100) + gr.line(x2,y2) + x3 := x + sin(angle+5460)/(radius*100) + y3 := y + cos(angle+5460)/(radius*100) + gr.line(x3,y3) + gr.line(x1,y1) + + gr.colorwidth(0, 15) 'black arcs + gr.arc(x1, y1, 9, 9, 0, $1fff/(arcstep-1), arcstep, 2) + gr.arc(x2, y2, 9, 9, 0, $1fff/(arcstep-1), arcstep, 2) + gr.arc(x3, y3, 9, 9, 0, $1fff/(arcstep-1), arcstep, 2) + + gr.colorwidth(col, 5) 'colored arcs + gr.arc(x1, y1, 20, 20, 0, $1fff/(arcstep-1), arcstep, 2) + gr.arc(x2, y2, 20, 20, 0, $1fff/(arcstep-1), arcstep, 2) + gr.arc(x3, y3, 20, 20, 0, $1fff/(arcstep-1), arcstep, 2) + + +PRI kreis(x,y,angle,radius,col)|xc,yc + + xc := x + sin(angle)/(radius*100) + yc := y + cos(angle)/(radius*100) + + gr.colorwidth(0, 15) + gr.arc(xc, yc, 9, 9, 0, $1fff/(arcstep-1), arcstep, 2) + + gr.colorwidth(col, 5) + gr.arc(xc, yc, 20, 20, 0, $1fff/(arcstep-1), arcstep, 2) + + +PRI logo2(x,y,a,c) + + 'draw objects + gr.colorwidth(c, 10) + gr.plot(x, y+25) + gr.line(x-29, y-25) + gr.line(x+29, y-25) + gr.line(x,y+25) + + gr.colorwidth(0, 15) + gr.arc(x, y+25, 9, 9, 0, $1fff/(arcstep-1), arcstep, 2) + gr.arc(x-29, y-25, 9, 9, 0, $1fff/(arcstep-1), arcstep, 2) + gr.arc(x+29, y-25, 9, 9, 0, $1fff/(arcstep-1), arcstep, 2) + + gr.colorwidth(c, 5) + gr.arc(x, y+25, 20, 20, 0, $1fff/(arcstep-1), arcstep, 2) + gr.arc(x-29, y-25, 20, 20, 0, $1fff/(arcstep-1), arcstep, 2) + gr.arc(x+29, y-25, 20, 20, 0, $1fff/(arcstep-1), arcstep, 2) + + +PRI init_subsystem | i,dx,dy + + 'tv-treiber starten + longmove(@tv_status, @tvparams, paramcount) + tv_screen := @screen + tv_colors := @colors + tv.start(@tv_status) + +' farbtabelle setzen +' PPPP_M_LLL +' ---+ | --+ +' | | +- 0..1 sync +' | | 2..6 helligkeit b/w +' | | 2..6 helligkeit col +' | | 7 - +' | +----- 0 - b/w +' | 1 - col +' +------- ntsc-palette (blau...grün..rot) +' +' b/w - 6 helligkeitsstufen 6 +' col - 16color x 5 luma 64 +' hsat - 16 highsat-farben 16 +' +' $aa_bb_cc_dd +' $aa - color 3 +' $bb - color 2 +' $cc - color 1 +' $dd - color 0 (hintergrund) + + repeat i from 0 to 63 +' colors[i] := %1010_1_101__0000_0_010__0010_1_111__0000_0_111 +' colors[i] := %1010_1_101__0000_0_010__0010_1_111__0011_0_111 +' colors[i] := c_hsat(3,0)+c_hsat(2,2)+c_hsat(1,6)+c_hsat(0,8) 'gesättigte farben +' colors[i] := c_bw(3,1)+c_bw(2,2)+c_bw(1,3)+c_bw(0,4) 'graustufen +' colors[i] := c_col(3,0,2)+c_col(2,3,2)+c_col(1,6,2)+c_col(0,9,2) + colors[i] := $00001010 * (i<<1+4) & $F + $0D060D02 'farbverlauf + + 'init tile screen + repeat dx from 0 to tv_hc - 1 + repeat dy from 0 to tv_vc - 1 + screen[dy * tv_hc + dx] := display_base >> 6 + dy + dx * tv_vc + ((dy & $3F) << 10) + + 'start and setup graphics + gr.start + gr.setup(tv_hc, tv_vc, 0, 0, bitmap_base) + + 'mouse + mouse.start(19, 18) + +PUB set_tile_color(tilex, tiley, palette) | temp 'doug@opengeek.org + + 'The screen[] array contains both the tile HUB image data address, and an index into the color palette + 'array, which can be defined as a DAT block, as done in this program, or as a VAR as done in the + 'original + + 'The lower 10 bits are the HUB image address data (where the pixels are defined) + 'The upper 6 bits point to sets of colors, contained in the colors[] array + + temp := screen[tiley * tv_hc + tilex] 'get current screen tile value + temp := temp & %00000011_11111111 'clear color palette index value, leaving image address bits + temp := temp + (palette << 10) 'replace color palette index value with the new one + screen[tiley * tv_hc + tilex] := temp 'update the screen + + +PUB set_color_palette(palette_num, palette_colors) 'doug@opengeek.org + + 'only 64 palettes possible... (& %111111) insures no overwrite occurs on larger values + 'the colors run like this in the long: 33_22_11_00, where 33 = color 3, 22 = color 2, etc... + 'color 00 is the background color. + + colors[palette_num & %111111] := palette_colors 'Write the colors into the colors[] array + +PUB set_tile_address(tilex, tiley, HUB_address) | temp 'doug@opengeek.org + + temp := screen[tiley * tv_hc + tilex] 'Get current screen tile value from screen[] array + temp := temp & %11111100_00000000 'Zero out the screen memory address pointer bits, leaving color bits + temp := temp + (HUB_address >> 6) 'Set screen memory pointer bits, from the most significant bits in the HUB + 'address given. Tiles must be 64 byte aligned, due to how the TV driver + 'decodes the screen array bits, 6 for color, 10 for screen pixel address in HUB + screen[tiley * tv_hc + tilex] := temp 'Update screen array for that tile, reflecting address change. + +PUB get_tile_address(tilex, tiley) | temp 'doug@opengeek.org + + temp := screen[tiley * tv_hc + tilex] 'Get current screen tile value from screen[] array + temp := temp & %00000011_11111111 'Zero out the color bits, leaving just the address + temp := temp << 6 'Shift to reflect effective HUB address. Tiles must + 'be 64 byte aligned, due to how the TV driver + 'decodes the screen array bits, 6 for color, 10 for + 'screen pixel address in HUB + return temp 'return that address! + + +PRI c_hsat(bnr,cnr):col 'tool: erzeugt einen gesättigten farbwert +' bnr : bytenummer +' cnr : 0..15 farbnummer + col := (%0000_1_000 + (cnr<<4))<<(bnr*8) + +PRI c_bw(bnr,cnr):col 'tool: erzeugt einen monochromwert +' bnr : bytenummer +' cnr : 0..5 graustufen + col := (%0000_0_000 + cnr+2)<<(bnr*8) + +PRI c_col(bnr,chroma,lumi):col 'tool: erzeugt einen farbwert +' bnr : bytenummer +' croma : 0..15 chroma +' lumi : 0..5 luminanz + col := (%0000_1_000+(lumi+2)+(chroma<<4))<<(bnr*8) + +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 + + +DAT 'tv-parameter + +tvparams long 0 'status + long 1 'enable + long %010_0101 'pins New Board + long %0000 'mode + long 0 'screen + long 0 'colors + long x_tiles 'hc - horizontale tiles + long y_tiles 'vc - vertikale tiles + long 10 'hx + long 1 'vx + long 0 'ho + long 0 'vo + long 60_000_000 '_xinfreq<<4 'broadcast + long 0 'auralcog + +DAT 'vektorobjekte + +vecdef1 word $4000+$2000/3*0 'triangle + word 50 + word $8000+$2000/3*1+1 + word 50 + word $8000+$2000/3*2-1 + word 50 + word $8000+$2000/3*0 + word 50 + word 0 + +vecdef2 word $4000+$2000/12*0 'star + word 50 + word $8000+$2000/12*1 + word 20 + word $8000+$2000/12*2 + word 50 + word $8000+$2000/12*3 + word 20 + word $8000+$2000/12*4 + word 50 + word $8000+$2000/12*5 + word 20 + word $8000+$2000/12*6 + word 50 + word $8000+$2000/12*7 + word 20 + word $8000+$2000/12*8 + word 50 + word $8000+$2000/12*9 + word 20 + word $8000+$2000/12*10 + word 50 + word $8000+$2000/12*11 + word 20 + word $8000+$2000/12*0 + word 50 + word 0 + +vecdef3 word $4000+$2000/4*0 'box + word 50 + word $8000+$2000/4*1 + word 30 + word $8000+$2000/4*2 + word 50 + word $8000+$2000/4*3 + word 30 + word $8000+$2000/4*0 + word 50 + word 0 + diff --git a/source/bellatrix/12-matr.spin b/source/bellatrix/12-matr.spin new file mode 100644 index 0000000..6e59e97 --- /dev/null +++ b/source/bellatrix/12-matr.spin @@ -0,0 +1,328 @@ +CON 'Hive-Computer-Projekt +{{ +Tutorial : "Build your OS" +Name : VGA-Texttreiber +Chip : Bellatrix-Code +Version : 0 +Dateien : +}} + +CON 'Konstanten + _clkmode = xtal1 + pll16x + _xinfreq = 5_000_000 + + cols = 64 + rows = 48 + tiles = cols * rows + spacetile = $8000 + $20 << 6 + vga_basport = 8 'vga startport + keyb_dport = 17 'tastatur datenport + keyb_cport = 16 'tastatur taktport + CURSORCHAR = $0E 'cursorzeichen + TAB1 = 16 + TAB2 = 32 + TAB3 = 48 + + +OBJ 'Verwendete Objekte + vga : "bel-vga" + key : "bel-keyb" + gfx1 : "bel-gfx1" + +VAR 'Variablen + long cur,col, row, color + long array[tiles/2] + byte cursor 'cursorzeichen + byte curstat 'cursorstatus 1 = ein + byte sline 'startzeile des scrollfensters + byte eline 'endzeile des scrollfensters + + long stack1[48] + long stack2[48] + long stack3[48] + long stack4[48] + +CON +srow = 3 +erow = 45 +rndfac = $efffffff/256 + +PUB main | i 'Hauptroutine + init_subsysteme + gfx1.start 'tv-scroller starten + print_char($115) + cognew(mstring(0), @stack1) + cognew(mstring(0), @stack2) + cognew(mstring(0), @stack3) + cognew(mstring(0), @stack4) + mstring(0) + +PUB mstring(cid) | i,len,x,ecnt,acc + i := cnt + repeat + acc := ?i & $6f + len := ?i & $2f + x := ?i & $3f + ecnt:= ?i & $3ef + 10 + if acc == $2f + flow(len,x,ecnt,cid+3) + else + flow(len,x,ecnt,cid) + if key.key == key#Esc + reboot + +PUB flow(len,x,ecnt,cid) | y,char,rnd,ccnt,mrow,mcol,mcolor + mcol := x + mrow := srow + repeat len + repeat ccnt from 0 to ecnt + mcolor := 1 + cid + mchar(?char & $FF,mrow,mcol,mcolor) + mcolor := 0 + cid + mchar(?char & $FF,mrow,mcol,mcolor) + if mrow++ => erow + mrow := srow + +PUB unflow(len,x,ecnt,cid) | y,char,rnd,ccnt,mrow,mcol,mcolor + mcol := x + mrow := srow + repeat len + repeat ccnt from 0 to ecnt + mcolor := 1 + cid + mchar(?char & $FF,mrow,mcol,4)'mcolor) + mchar(" ",mrow,mcol,mcolor) + if mrow++ => erow + mrow := srow + + +PRI mchar(c,mrow,mcol,mcolor) | i,k +'schreibt zeichen an aktuelle position ohne cursorposition zu verändern + k := mcolor << 1 + c & 1 + i := $8000 + (c & $FE) << 6 + k + array.word[mrow * cols + mcol] := i 'oberes tile setzen + array.word[(mrow + 1) * cols + mcol] := i | $40 'unteres tile setzen + +PUB init_subsysteme +{{initialisierung des belatrix-chips}} + color := 1 + key.start(keyb_dport, keyb_cport) 'tastaturport starten + vga.start(vga_basport, @array, @vgacolors, 0, 0, 0) 'vga-treiber starten + print_char($100) + print_string(@ver1) + print_char($0D) + cursor := CURSORCHAR 'cursorzeichen setzen + curstat := 1 'cursor anschalten + sline := 2 + eline := rows + +PRI print_string(ptr) 'Stringausgabe + repeat while byte[ptr] 'wiederhole bis $0 + print_char(byte[ptr++]) 'ausgabe des zeichens + +PUB printdec(value) | i + if value < 0 'negativer zahlenwert + -value + print_char("-") + i := 1_000_000_000 + repeat 10 'zahl zerlegen + if value => i + print_char(value / i + "0") + value //= i + result~~ + elseif result or i == 1 + print_char("0") + i /= 10 'nächste stelle + +PUB printhex(value, digits) + value <<= (8 - digits) << 2 + repeat digits + print_char(lookupz((value <-= 4) & $F : "0".."9", "A".."F")) + +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 + + $0A: 'LF ausblenden + return + + $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 + + $105: 'pos1 + if curstat == 1 + schar($20) + col := 0 + if curstat == 1 + schar(cursor) + + $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 + + $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) + +DAT 'Daten + +'============================================================ +' v h v h ' v=Vordergrund, h=Hintergrund +' long $ 3C 04 3C 04 'Muster +' v v h h +' long $ 3C 3C 04 04 'Muster +' +'0 %%RGBx_RGBx_RGBx_RGBx +' long %%0220_0010_0220_0010 +' long %%0220_0220_0010_0010 +'============================================================ + +vgacolors long 'farbtabelle + +'0 %%RGBx_RGBx_RGBx_RGBx 'dunkles grün auf schwarz + long %%0100_0000_0100_0000 + long %%0100_0100_0000_0000 + +'1 %%RGBx_RGBx_RGBx_RGBx 'helles grün auf schwarz + long %%0200_0000_0200_0000 + long %%0200_0200_0000_0000 + +'2 %%RGBx_RGBx_RGBx_RGBx 'dunkles rot auf schwarz + long %%1000_0000_1000_0000 + long %%1000_1000_0000_0000 + +'3 %%RGBx_RGBx_RGBx_RGBx 'helles rot auf schwarz + long %%2000_0000_2000_0000 + long %%2000_2000_0000_0000 + +'4 %%RGBx_RGBx_RGBx_RGBx 'dunkles rot auf schwarz + long %%0010_0000_0010_0000 + long %%0010_0010_0000_0000 + +'5 %%RGBx_RGBx_RGBx_RGBx 'helles rot auf schwarz + long %%0020_0000_0020_0000 + long %%0020_0020_0000_0000 + + long $0C000C00 'blue + long $0C0C0000 + long $FC00FC00 'white + long $FCFC0000 + long $FF80FF80 'red/white + long $FFFF8080 + long $FF20FF20 'green/white + long $FFFF2020 + long $FF28FF28 'cyan/white + long $FFFF2828 + long $C0408080 'redbox + long $3010F020 'greenbox + long $3C142828 'cyanbox + long $FC54A8A8 'greybox + long $3C14FF28 'cyanbox+underscore + long $F030C050 'graphics colors + +ver1 byte "▶Hive - UniMatrix",0 +prompt1 byte "ok",$0D, 0 + + diff --git a/source/bellatrix/13-gdemo.spin b/source/bellatrix/13-gdemo.spin new file mode 100644 index 0000000..f9b58c2 --- /dev/null +++ b/source/bellatrix/13-gdemo.spin @@ -0,0 +1,269 @@ +''*************************************** +''* Graphics Demo * +''* Author: Chip Gracey * +''* Copyright (c) 2005 Parallax, Inc. * +''* See end of file for terms of use. * +''*************************************** + + +CON + + _clkmode = xtal1 + pll16x + _xinfreq = 5_000_000 + _stack = ($3000 + $3000 + 100) >> 2 'accomodate display memory and stack + + x_tiles = 16 + y_tiles = 12 + + paramcount = 14 + bitmap_base = $2000 + display_base = $5000 + + lines = 5 + thickness = 2 + + +VAR + + long mousex, mousey + + long tv_status '0/1/2 = off/visible/invisible read-only + long tv_enable '0/? = off/on write-only + long tv_pins '%ppmmm = pins write-only + long tv_mode '%ccinp = chroma,interlace,ntsc/pal,swap write-only + long tv_screen 'pointer to screen (words) write-only + long tv_colors 'pointer to colors (longs) write-only + long tv_hc 'horizontal cells write-only + long tv_vc 'vertical cells write-only + long tv_hx 'horizontal cell expansion write-only + long tv_vx 'vertical cell expansion write-only + long tv_ho 'horizontal offset write-only + long tv_vo 'vertical offset write-only + long tv_broadcast 'broadcast frequency (Hz) write-only + long tv_auralcog 'aural fm cog write-only + + word screen[x_tiles * y_tiles] + long colors[64] + + byte x[lines] + byte y[lines] + byte xs[lines] + byte ys[lines] + + +OBJ + + tv : "bel-tv" + gr : "bel-graphics" + mouse : "bel-mouse" + + +PUB start | i, j, k, kk, dx, dy, pp, pq, rr, numx, numchr + + 'start tv + longmove(@tv_status, @tvparams, paramcount) + tv_screen := @screen + tv_colors := @colors + tv.start(@tv_status) + + 'init colors + repeat i from 0 to 63 + colors[i] := $00001010 * (i+4) & $F + $2B060C02 + + 'init tile screen + repeat dx from 0 to tv_hc - 1 + repeat dy from 0 to tv_vc - 1 + screen[dy * tv_hc + dx] := display_base >> 6 + dy + dx * tv_vc + ((dy & $3F) << 10) + + 'init bouncing lines + i := 1001 + j := 123123 + k := 8776434 + repeat i from 0 to lines - 1 + x[i] := ?j // 64 + y[i] := k? // 48 + repeat until xs[i] := k? ~> 29 + repeat until ys[i] := ?j ~> 29 + + 'start and setup graphics + gr.start + gr.setup(16, 12, 128, 96, bitmap_base) + + 'start mouse + mouse.start(19, 18) + + repeat + + 'clear bitmap + gr.clear + + 'draw spinning triangles + gr.colorwidth(1,0) + repeat i from 1 to 8 + gr.vec(0, 0, (k & $7F) << 3 + i << 5, k << 6 + i << 8, @vecdef) + + 'draw expanding mouse crosshairs + gr.colorwidth(2,k>>2) + mousex := mousex + mouse.delta_x #> -128 <# 127 + mousey := mousey + mouse.delta_y #> -96 <# 95 + ' winkel in 90grad schritten + gr.pix(mousex, mousey, k>>4 & $7, @pixdef) ' + + 'if left mouse button pressed, throw snowballs + if mouse.button(0) + gr.width(pq & $F) + gr.color(2) + pp := (pq & $F)*(pq & $F) + 5 + pq++ + gr.arc(mousex, mousey, pp, pp>>1, -k * 200, $200, 8, 0) + else + pq~ + + 'if right mouse button pressed, exit + if mouse.button(1) + reboot + + 'draw expanding pixel halo + gr.colorwidth(1,k) + gr.arc(0,0,80,30,-k<<5,$2000/9,10,0) + + 'step bouncing lines + repeat i from 0 to lines - 1 + if ||~x[i] > 60 + -xs[i] + if ||~y[i] > 40 + -ys[i] + x[i] += xs[i] + y[i] += ys[i] + + 'draw bouncing lines + gr.colorwidth(1,thickness) + gr.plot(~x[0], ~y[0]) + repeat i from 1 to lines - 1 + gr.line(~x[i],~y[i]) + gr.line(~x[0], ~y[0]) + + 'draw spinning stars and revolving crosshairs and dogs + gr.colorwidth(2,0) + repeat i from 0 to 7 + gr.vecarc(80,50,30,30,-(i<<10+k<<6),$40,-(k<<7),@vecdef2) + gr.pixarc(-80,-40,30,30,i<<10+k<<6,0,@pixdef2) + gr.pixarc(-80,-40,20,20,-(i<<10+k<<6),0,@pixdef) + + 'draw small box with text + gr.colorwidth(1,14) + gr.box(60,-80,60,16) + gr.textmode(1,1,6,5) + gr.colorwidth(2,0) + gr.text(90,-72,@pchip) + + 'draw incrementing digit + if not ++numx & 7 + numchr++ + if numchr < "0" or numchr > "9" + numchr := "0" + gr.textmode(4,4,6,5) + gr.colorwidth(1,4) + gr.text(-90,50,@numchr) + gr.text(-30,50,@numchr) + gr.text(30,50,@numchr) + + 'copy bitmap to display + gr.copy(display_base) + + 'increment counter that makes everything change + k++ + + +DAT + +tvparams long 0 'status + long 1 'enable + long %010_0101 'pins + long %0000 'mode + long 0 'screen + long 0 'colors + long x_tiles 'hc + long y_tiles 'vc + long 10 'hx + long 1 'vx + long 0 'ho + long 0 'vo + long 0 'broadcast + long 0 'auralcog + +vecdef word $4000+$2000/3*0 'triangle + word 50 + word $8000+$2000/3*1+1 + word 50 + word $8000+$2000/3*2-1 + word 50 + word $8000+$2000/3*0 + word 50 + word 0 + +vecdef2 word $4000+$2000/12*0 'star + word 50 + word $8000+$2000/12*1 + word 20 + word $8000+$2000/12*2 + word 50 + word $8000+$2000/12*3 + word 20 + word $8000+$2000/12*4 + word 50 + word $8000+$2000/12*5 + word 20 + word $8000+$2000/12*6 + word 50 + word $8000+$2000/12*7 + word 20 + word $8000+$2000/12*8 + word 50 + word $8000+$2000/12*9 + word 20 + word $8000+$2000/12*10 + word 50 + word $8000+$2000/12*11 + word 20 + word $8000+$2000/12*0 + word 50 + word 0 + +pixdef word 'crosshair + byte 2,7,3,3 + word %%00333000,%%00000000 + word %%03020300,%%00000000 + word %%30020030,%%00000000 + word %%32222230,%%00000000 + word %%30020030,%%02000000 + word %%03020300,%%22200000 + word %%00333000,%%02000000 + +pixdef2 word 'dog + byte 1,4,0,3 + word %%20000022 + word %%02222222 + word %%02222200 + word %%02000200 + +pchip byte "Propeller",0 'text + +{{ + +┌──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ +│ 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. │ +└──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ +}} diff --git a/source/bellatrix/14-gpal.spin b/source/bellatrix/14-gpal.spin new file mode 100644 index 0000000..6863a99 --- /dev/null +++ b/source/bellatrix/14-gpal.spin @@ -0,0 +1,215 @@ +''*************************************** +''* Graphics Palette * +''* Author: Chip Gracey * +''* Copyright (c) 2006 Parallax, Inc. * +''* See end of file for terms of use. * +''*************************************** + +CON + + _clkmode = xtal1 + pll16x + _xinfreq = 5_000_000 + _free = ($3000 + $3000) >> 2 'accomodate bitmap buffers + _stack = $100 'insure sufficient stack + + x_tiles = 16 + y_tiles = 12 + + paramcount = 14 + bitmap_base = $2000 + display_base = $5000 + +VAR + + long mousex, mousey + + long tv_status '0/1/2 = off/visible/invisible read-only + long tv_enable '0/? = off/on write-only + long tv_pins '%ppmmm = pins write-only + long tv_mode '%ccinp = chroma,interlace,ntsc/pal,swap write-only + long tv_screen 'pointer to screen (words) write-only + long tv_colors 'pointer to colors (longs) write-only + long tv_hc 'horizontal cells write-only + long tv_vc 'vertical cells write-only + long tv_hx 'horizontal cell expansion write-only + long tv_vx 'vertical cell expansion write-only + long tv_ho 'horizontal offset write-only + long tv_vo 'vertical offset write-only + long tv_broadcast 'broadcast frequency (Hz) write-only + long tv_auralcog 'aural fm cog write-only + + word screen[x_tiles * y_tiles] + long colors[64] + +OBJ + + tv : "bel-tv" + gr : "bel-graphics" + mouse : "bel-mouse" + + +PUB start | x, y, i, c, k, col + + 'start tv + longmove(@tv_status, @tvparams, paramcount) + tv_screen := @screen + tv_colors := @colors + tv.start(@tv_status) + + 'init colors + repeat i from $00 to $0F + case i + 5..10 : c := $01000000 * (i - 5) + $02020507 + other : c := $07020504 + colors[i] := c + repeat i from $10 to $1F + colors[i] := $10100000 * (i & $F) + $0B0A0507 + repeat i from $20 to $2F + colors[i] := $10100000 * (i & $F) + $0D0C0507 + repeat i from $30 to $3F + colors[i] := $10100000 * (i & $F) + $080E0507 + + 'init tile screen + repeat x from 0 to tv_hc - 1 + repeat y from 0 to tv_vc - 1 + case y + 0, 2 : i := $30 + x + 3..4 : i := $20 + x + 5..6 : i := $10 + x + 8 : i := x + other: i := 0 + screen[x + y * tv_hc] := i << 10 + display_base >> 6 + x * tv_vc + y + + 'start and setup graphics + gr.start + gr.setup(16, 12, 0, 0, bitmap_base) + + 'start mouse + mouse.start(19, 18) + mousex := 128 + mousey := 35 + + repeat + + 'clear bitmap + gr.clear + + 'draw color samples + gr.width(14)'(29) + + 'draw saturated samples + gr.color(3) + repeat x from 0 to 15 + gr.plot(x << 4 + 7, 183) + + 'draw gradient samples + repeat y from 2 to 6 + gr.color(y & 1 | 2) + repeat x from 0 to 15 + gr.plot(x << 4 + 7, 183 - y << 4) + + 'draw monochrome samples + gr.color(3) + repeat x from 5 to 10 + gr.plot(x << 4 + 7, 55) + + 'draw mouse pointer + gr.width(0) + mousex := mousex + mouse.delta_x #> 0 <# 251 + mousey := mousey + mouse.delta_y #> 4 <# 191 + + gr.width(0)'(29) + gr.color(4) + gr.plot(mousex, mousey) + + gr.pix(mousex, mousey, 0, @pixdef) + + 'check mouse position + c~~ + if mousey => 176 + c := (mousex & $F0 + $8) + elseif mousey => 80 and mousey < 160 + c := (mousex & $F0 + $E - (159 - mousey) >> 4) + elseif mousey => 48 and mousey < 64 and mousex => 80 and mousex < 176 + c := (mousex - 80) >> 4 + 2 + + 'show appropriate message + if c => 0 + gr.colorwidth(3, 10) + gr.textmode(3, 3, 8, %0101) + hexstring[0] := hex(c >> 4) + hexstring[1] := hex(c & $F) + gr.text(128, 17, @colorstring) + colors.byte[2] := c + gr.colorwidth(2, 6) + gr.text(128, 17, @colorstring) + else + gr.colorwidth(3, 0) + gr.textmode(2, 2, 6, %0101) + gr.text(128, 20, string("Point mouse to color")) + + 'copy bitmap to display + gr.copy(display_base) + + 'animate mouse pointer color + c := k++ & 3 + 4 + i := -3 + repeat 64 + colors.byte[i += 4] := c + + 'if right mouse button pressed, exit + if mouse.button(1) + reboot + +PRI hex(value) : chr + + return lookupz(value : "0".."9", "A".."F") + +DAT + +tvparams long 0 'status + long 1 'enable + long %010_0101 'pins + long %0000 'mode + long 0 'screen + long 0 'colors + long x_tiles 'hc + long y_tiles 'vc + long 10 'hx + long 1 'vx + long 0 'ho + long 0 'vo + long 60_000_000 'broadcast + long 0 'auralcog + + +pixdef word 'arrow pointer + byte 1,5,0,4 + word %%11110000 + word %%11100000 + word %%11110000 + word %%10111000 + word %%00011000 + + +colorstring byte "COLOR " +hexstring byte "00",0 + +{{ + +┌──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ +│ 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. │ +└──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ +}} diff --git a/source/bellatrix/2-dots.spin b/source/bellatrix/2-dots.spin new file mode 100644 index 0000000..eaa3510 --- /dev/null +++ b/source/bellatrix/2-dots.spin @@ -0,0 +1,219 @@ +{ + +} + +CON + _CLKMODE = XTAL1 + PLL16X + _XINFREQ = 5_000_000 + _stack = ($3000 + $3000 + 100) >> 2 + + x_tiles = 16 + y_tiles = 12 + + paramcount = 14 + bitmap_base = $2000 + display_base = $5000 + + +VAR + long tv_status '0/1/2 = off/visible/invisible read-only + long tv_enable '0/? = off/on write-only + long tv_pins '%ppmmm = pins write-only + long tv_mode '%ccinp = chroma,interlace,ntsc/pal,swap write-only + long tv_screen 'pointer to screen (words) write-only + long tv_colors 'pointer to colors (longs) write-only + long tv_hc 'horizontal cells write-only + long tv_vc 'vertical cells write-only + long tv_hx 'horizontal cell expansion write-only + long tv_vx 'vertical cell expansion write-only + long tv_ho 'horizontal offset write-only + long tv_vo 'vertical offset write-only + long tv_broadcast 'broadcast frequency (Hz) write-only + long tv_auralcog 'aural fm cog write-only + + word screen[x_tiles * y_tiles] 'tilemap + long colors[64] 'farbregister + + + +OBJ + tv : "bel-tv" 'located in default Library + gr : "bel-graphics" 'located in default Library + kb : "bel-keyb" + +PUB main | x,y,j + + init_subsystem + + repeat + gr.clear + gr.width(14) + gr.color(1) + repeat x from 0 to x_tiles-1 + repeat y from 0 to y_tiles-1 + gr.plot(x*16+8,y*16+8) + gr.copy(display_base) + ifexit + +CON + +#16, BEL_KEYBC,BEL_KEYBD 'keyboard-signale +#18, BEL_MOUSEC,BEL_MOUSED 'maus-signale + +PRI ifexit + + if kb.key == kb#Esc + reboot + +PRI init_subsystem | i,dx,dy + + kb.start(BEL_KEYBD, BEL_KEYBC) 'tastaturport starten + + 'tv-treiber starten + longmove(@tv_status, @tvparams, paramcount) + tv_screen := @screen + tv_colors := @colors + tv.start(@tv_status) + +' farbtabelle setzen +' PPPP_M_LLL +' ---+ | --+ +' | | +- 0..1 sync +' | | 2..6 helligkeit b/w +' | | 2..6 helligkeit col +' | | 7 - +' | +----- 0 - b/w +' | 1 - col +' +------- ntsc-palette (blau...grün..rot) +' +' b/w - 6 helligkeitsstufen 6 +' col - 16color x 5 luma 64 +' hsat - 16 highsat-farben 16 +' +' $aa_bb_cc_dd +' $aa - color 3 +' $bb - color 2 +' $cc - color 1 +' $dd - color 0 (hintergrund) + + repeat i from 0 to 63 +' colors[i] := %1010_1_101__0000_0_010__0010_1_111__0000_0_111 +' colors[i] := %1010_1_101__0000_0_010__0010_1_111__0011_0_111 +' colors[i] := c_hsat(3,0)+c_hsat(2,2)+c_hsat(1,6)+c_hsat(0,8) 'gesättigte farben +' colors[i] := c_bw(3,1)+c_bw(2,2)+c_bw(1,3)+c_bw(0,4) 'graustufen +' colors[i] := c_col(3,0,2)+c_col(2,3,2)+c_col(1,6,2)+c_col(0,9,2) + colors[i] := $00001010 * (i<<1+4) & $F + $0D060D02 + + 'init tile screen + repeat dx from 0 to tv_hc - 1 + repeat dy from 0 to tv_vc - 1 + screen[dy * tv_hc + dx] := display_base >> 6 + dy + dx * tv_vc + ((dy & $3F) << 10) +{ + i := 0 + repeat dy from 0 to tv_vc - 1 + repeat dx from 0 to tv_hc - 1 + screen[i++] := display_base >> 6 + dy + dx * tv_vc + (dy << 10) +} + 'start and setup graphics + gr.start + gr.setup(tv_hc, tv_vc, 0, 0, bitmap_base) + +PRI c_hsat(bnr,cnr):col 'tool: erzeugt einen gesättigten farbwert +' bnr : bytenummer +' cnr : 0..15 farbnummer + col := (%0000_1_000 + (cnr<<4))<<(bnr*8) + +PRI c_bw(bnr,cnr):col 'tool: erzeugt einen monochromwert +' bnr : bytenummer +' cnr : 0..5 graustufen + col := (%0000_0_000 + cnr+2)<<(bnr*8) + +PRI c_col(bnr,chroma,lumi):col 'tool: erzeugt einen farbwert +' bnr : bytenummer +' croma : 0..15 chroma +' lumi : 0..5 luminanz + col := (%0000_1_000+(lumi+2)+(chroma<<4))<<(bnr*8) + +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 + + +DAT 'tv-parameter + +tvparams long 0 'status + long 1 'enable + long %010_0101 'pins New Board + long %0000 'mode + long 0 'screen + long 0 'colors + long x_tiles 'hc - horizontale tiles + long y_tiles 'vc - vertikale tiles + long 10 'hx + long 1 'vx + long 0 'ho + long 0 'vo + long 60_000_000 '_xinfreq<<4 'broadcast + long 0 'auralcog + +DAT 'vektorobjekte + +vecdef1 word $4000+$2000/3*0 'triangle + word 50 + word $8000+$2000/3*1+1 + word 50 + word $8000+$2000/3*2-1 + word 50 + word $8000+$2000/3*0 + word 50 + word 0 + +vecdef2 word $4000+$2000/12*0 'star + word 50 + word $8000+$2000/12*1 + word 20 + word $8000+$2000/12*2 + word 50 + word $8000+$2000/12*3 + word 20 + word $8000+$2000/12*4 + word 50 + word $8000+$2000/12*5 + word 20 + word $8000+$2000/12*6 + word 50 + word $8000+$2000/12*7 + word 20 + word $8000+$2000/12*8 + word 50 + word $8000+$2000/12*9 + word 20 + word $8000+$2000/12*10 + word 50 + word $8000+$2000/12*11 + word 20 + word $8000+$2000/12*0 + word 50 + word 0 + +vecdef3 word $4000+$2000/4*0 'box + word 50 + word $8000+$2000/4*1 + word 30 + word $8000+$2000/4*2 + word 50 + word $8000+$2000/4*3 + word 30 + word $8000+$2000/4*0 + word 50 + word 0 + diff --git a/source/bellatrix/3-objekt.spin b/source/bellatrix/3-objekt.spin new file mode 100644 index 0000000..d05b3a8 --- /dev/null +++ b/source/bellatrix/3-objekt.spin @@ -0,0 +1,238 @@ +{ + +} + +CON + _CLKMODE = XTAL1 + PLL16X + _XINFREQ = 5_000_000 + _stack = ($3000 + $3000 + 100) >> 2 + + x_tiles = 16 + y_tiles = 12 + + paramcount = 14 + bitmap_base = $2000 + display_base = $5000 + + +VAR + long tv_status '0/1/2 = off/visible/invisible read-only + long tv_enable '0/? = off/on write-only + long tv_pins '%ppmmm = pins write-only + long tv_mode '%ccinp = chroma,interlace,ntsc/pal,swap write-only + long tv_screen 'pointer to screen (words) write-only + long tv_colors 'pointer to colors (longs) write-only + long tv_hc 'horizontal cells write-only + long tv_vc 'vertical cells write-only + long tv_hx 'horizontal cell expansion write-only + long tv_vx 'vertical cell expansion write-only + long tv_ho 'horizontal offset write-only + long tv_vo 'vertical offset write-only + long tv_broadcast 'broadcast frequency (Hz) write-only + long tv_auralcog 'aural fm cog write-only + + word screen[x_tiles * y_tiles] 'tilemap + long colors[64] 'farbregister + + + +OBJ + tv : "bel-tv" 'located in default Library + gr : "bel-graphics" 'located in default Library + kb : "bel-keyb" + + +PUB main | x,y,j + + init_subsystem + + repeat + gr.clear + gr.colorwidth(1, 1) + + repeat j from 0 to 5 + gr.vec(j*2+64, j*5+100-(cnt>>23), 200-j*40, cnt>>16, @vecdef1) + repeat j from 0 to 5 + gr.vec(j*2+64, j*5+200-(cnt>>23), 200-j*40, cnt>>16, @vecdef2) + repeat j from 0 to 5 + gr.vec(j*2+64, j*5+300-(cnt>>23), 200-j*40, cnt>>16, @vecdef3) + + repeat j from 0 to 5 + gr.vec(j*2+128, j*5+100-(cnt>>23), 200-j*40, cnt>>16, @vecdef3) + repeat j from 0 to 5 + gr.vec(j*2+128, j*5+200-(cnt>>23), 200-j*40, cnt>>16, @vecdef1) + repeat j from 0 to 5 + gr.vec(j*2+128, j*5+300-(cnt>>23), 200-j*40, cnt>>16, @vecdef2) + + repeat j from 0 to 5 + gr.vec(j*2+192, j*5+100-(cnt>>23), 200-j*40, cnt>>16, @vecdef2) + repeat j from 0 to 5 + gr.vec(j*2+192, j*5+200-(cnt>>23), 200-j*40, cnt>>16, @vecdef3) + repeat j from 0 to 5 + gr.vec(j*2+192, j*5+300-(cnt>>23), 200-j*40, cnt>>16, @vecdef1) + + gr.copy(display_base) + ifexit + +CON + +#16, BEL_KEYBC,BEL_KEYBD 'keyboard-signale +#18, BEL_MOUSEC,BEL_MOUSED 'maus-signale + +PRI ifexit + + if kb.key == kb#Esc + reboot + +PRI init_subsystem | i,dx,dy + + kb.start(BEL_KEYBD, BEL_KEYBC) 'tastaturport starten + + 'tv-treiber starten + longmove(@tv_status, @tvparams, paramcount) + tv_screen := @screen + tv_colors := @colors + tv.start(@tv_status) + +' farbtabelle setzen +' PPPP_M_LLL +' ---+ | --+ +' | | +- 0..1 sync +' | | 2..6 helligkeit b/w +' | | 2..6 helligkeit col +' | | 7 - +' | +----- 0 - b/w +' | 1 - col +' +------- ntsc-palette (blau...grün..rot) +' +' b/w - 6 helligkeitsstufen 6 +' col - 16color x 5 luma 64 +' hsat - 16 highsat-farben 16 +' +' $aa_bb_cc_dd +' $aa - color 3 +' $bb - color 2 +' $cc - color 1 +' $dd - color 0 (hintergrund) + + repeat i from 0 to 63 +' colors[i] := %1010_1_101__0000_0_010__0010_1_111__0000_0_111 +' colors[i] := %1010_1_101__0000_0_010__0010_1_111__0011_0_111 +' colors[i] := c_hsat(3,0)+c_hsat(2,2)+c_hsat(1,6)+c_hsat(0,8) 'gesättigte farben +' colors[i] := c_bw(3,1)+c_bw(2,2)+c_bw(1,3)+c_bw(0,4) 'graustufen +' colors[i] := c_col(3,0,2)+c_col(2,3,2)+c_col(1,6,2)+c_col(0,9,2) + colors[i] := $00001010 * (i<<1+4) & $F + $0D060D02 + + 'init tile screen + repeat dx from 0 to tv_hc - 1 + repeat dy from 0 to tv_vc - 1 + screen[dy * tv_hc + dx] := display_base >> 6 + dy + dx * tv_vc + ((dy & $3F) << 10) +{ + i := 0 + repeat dy from 0 to tv_vc - 1 + repeat dx from 0 to tv_hc - 1 + screen[i++] := display_base >> 6 + dy + dx * tv_vc + (dy << 10) +} + 'start and setup graphics + gr.start + gr.setup(tv_hc, tv_vc, 0, 0, bitmap_base) + +PRI c_hsat(bnr,cnr):col 'tool: erzeugt einen gesättigten farbwert +' bnr : bytenummer +' cnr : 0..15 farbnummer + col := (%0000_1_000 + (cnr<<4))<<(bnr*8) + +PRI c_bw(bnr,cnr):col 'tool: erzeugt einen monochromwert +' bnr : bytenummer +' cnr : 0..5 graustufen + col := (%0000_0_000 + cnr+2)<<(bnr*8) + +PRI c_col(bnr,chroma,lumi):col 'tool: erzeugt einen farbwert +' bnr : bytenummer +' croma : 0..15 chroma +' lumi : 0..5 luminanz + col := (%0000_1_000+(lumi+2)+(chroma<<4))<<(bnr*8) + +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 + + +DAT 'tv-parameter + +tvparams long 0 'status + long 1 'enable + long %010_0101 'pins New Board + long %0000 'mode + long 0 'screen + long 0 'colors + long x_tiles 'hc - horizontale tiles + long y_tiles 'vc - vertikale tiles + long 10 'hx + long 1 'vx + long 0 'ho + long 0 'vo + long 60_000_000 '_xinfreq<<4 'broadcast + long 0 'auralcog + +DAT 'vektorobjekte + +vecdef1 word $4000+$2000/3*0 'triangle + word 50 + word $8000+$2000/3*1+1 + word 50 + word $8000+$2000/3*2-1 + word 50 + word $8000+$2000/3*0 + word 50 + word 0 + +vecdef2 word $4000+$2000/12*0 'star + word 50 + word $8000+$2000/12*1 + word 20 + word $8000+$2000/12*2 + word 50 + word $8000+$2000/12*3 + word 20 + word $8000+$2000/12*4 + word 50 + word $8000+$2000/12*5 + word 20 + word $8000+$2000/12*6 + word 50 + word $8000+$2000/12*7 + word 20 + word $8000+$2000/12*8 + word 50 + word $8000+$2000/12*9 + word 20 + word $8000+$2000/12*10 + word 50 + word $8000+$2000/12*11 + word 20 + word $8000+$2000/12*0 + word 50 + word 0 + +vecdef3 word $4000+$2000/4*0 'box + word 50 + word $8000+$2000/4*1 + word 30 + word $8000+$2000/4*2 + word 50 + word $8000+$2000/4*3 + word 30 + word $8000+$2000/4*0 + word 50 + word 0 + diff --git a/source/bellatrix/4-boing.spin b/source/bellatrix/4-boing.spin new file mode 100644 index 0000000..939719e --- /dev/null +++ b/source/bellatrix/4-boing.spin @@ -0,0 +1,247 @@ +{ + +} + +CON + _CLKMODE = XTAL1 + PLL16X + _XINFREQ = 5_000_000 + _stack = ($3000 + $3000 + 100) >> 2 + + x_tiles = 16 + y_tiles = 12 + + paramcount = 14 + bitmap_base = $2000 + display_base = $5000 + + max_x = x_tiles * 16 + max_y = y_tiles * 16 + + s_obj = 200 'scale + d_obj = 64 'durchmesser + r_obj = d_obj/2 'radius + rotvar = 14 'rotationsvarianz + +VAR + long tv_status '0/1/2 = off/visible/invisible read-only + long tv_enable '0/? = off/on write-only + long tv_pins '%ppmmm = pins write-only + long tv_mode '%ccinp = chroma,interlace,ntsc/pal,swap write-only + long tv_screen 'pointer to screen (words) write-only + long tv_colors 'pointer to colors (longs) write-only + long tv_hc 'horizontal cells write-only + long tv_vc 'vertical cells write-only + long tv_hx 'horizontal cell expansion write-only + long tv_vx 'vertical cell expansion write-only + long tv_ho 'horizontal offset write-only + long tv_vo 'vertical offset write-only + long tv_broadcast 'broadcast frequency (Hz) write-only + long tv_auralcog 'aural fm cog write-only + + word screen[x_tiles * y_tiles] 'tilemap + long colors[64] 'farbregister + + + +OBJ + tv : "bel-tv" 'located in default Library + gr : "bel-graphics" 'located in default Library + kb : "bel-keyb" + +PUB main | x,y,dx,dy,j + + init_subsystem + + x := max_x/2 + y := max_y/2 + dx := 1 + dy := 1 + + repeat + gr.clear + + 'objekt zeichnen + gr.colorwidth(1, 1) + repeat j from 0 to 5 + gr.vec(x+j*2, y+j*5, s_obj-j*40, cnt>>rotvar, @vecdef2) + + 'kollisionsabfrage + if (x + dx - r_obj) < 0 + dx := dx * -1 + else + if (x + dx + r_obj + 5) > max_x + dx := dx * -1 + if (y + dy - r_obj) < 0 + dy := dy * -1 + else + if (y + dy + r_obj + 5) > max_y + dy := dy * -1 + + x += dx + y += dy + + gr.copy(display_base) + ifexit + +CON + +#16, BEL_KEYBC,BEL_KEYBD 'keyboard-signale +#18, BEL_MOUSEC,BEL_MOUSED 'maus-signale + +PRI ifexit + + if kb.key == kb#Esc + reboot + +PRI init_subsystem | i,dx,dy + + kb.start(BEL_KEYBD, BEL_KEYBC) 'tastaturport starten + + 'tv-treiber starten + longmove(@tv_status, @tvparams, paramcount) + tv_screen := @screen + tv_colors := @colors + tv.start(@tv_status) + +' farbtabelle setzen +' PPPP_M_LLL +' ---+ | --+ +' | | +- 0..1 sync +' | | 2..6 helligkeit b/w +' | | 2..6 helligkeit col +' | | 7 - +' | +----- 0 - b/w +' | 1 - col +' +------- ntsc-palette (blau...grün..rot) +' +' b/w - 6 helligkeitsstufen 6 +' col - 16color x 5 luma 64 +' hsat - 16 highsat-farben 16 +' +' $aa_bb_cc_dd +' $aa - color 3 +' $bb - color 2 +' $cc - color 1 +' $dd - color 0 (hintergrund) + + repeat i from 0 to 63 +' colors[i] := %1010_1_101__0000_0_010__0010_1_111__0000_0_111 +' colors[i] := %1010_1_101__0000_0_010__0010_1_111__0011_0_111 +' colors[i] := c_hsat(3,0)+c_hsat(2,2)+c_hsat(1,6)+c_hsat(0,8) 'gesättigte farben +' colors[i] := c_bw(3,1)+c_bw(2,2)+c_bw(1,3)+c_bw(0,4) 'graustufen +' colors[i] := c_col(3,0,2)+c_col(2,3,2)+c_col(1,6,2)+c_col(0,9,2) + colors[i] := $00001010 * (i<<1+4) & $F + $0D060D02 + + 'init tile screen + repeat dx from 0 to tv_hc - 1 + repeat dy from 0 to tv_vc - 1 + screen[dy * tv_hc + dx] := display_base >> 6 + dy + dx * tv_vc + ((dy & $3F) << 10) +{ + i := 0 + repeat dy from 0 to tv_vc - 1 + repeat dx from 0 to tv_hc - 1 + screen[i++] := display_base >> 6 + dy + dx * tv_vc + (dy << 10) +} + 'start and setup graphics + gr.start + gr.setup(tv_hc, tv_vc, 0, 0, bitmap_base) + +PRI c_hsat(bnr,cnr):col 'tool: erzeugt einen gesättigten farbwert +' bnr : bytenummer +' cnr : 0..15 farbnummer + col := (%0000_1_000 + (cnr<<4))<<(bnr*8) + +PRI c_bw(bnr,cnr):col 'tool: erzeugt einen monochromwert +' bnr : bytenummer +' cnr : 0..5 graustufen + col := (%0000_0_000 + cnr+2)<<(bnr*8) + +PRI c_col(bnr,chroma,lumi):col 'tool: erzeugt einen farbwert +' bnr : bytenummer +' croma : 0..15 chroma +' lumi : 0..5 luminanz + col := (%0000_1_000+(lumi+2)+(chroma<<4))<<(bnr*8) + +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 + + +DAT 'tv-parameter + +tvparams long 0 'status + long 1 'enable + long %010_0101 'pins New Board + long %0000 'mode + long 0 'screen + long 0 'colors + long x_tiles 'hc - horizontale tiles + long y_tiles 'vc - vertikale tiles + long 10 'hx + long 1 'vx + long 0 'ho + long 0 'vo + long 60_000_000 '_xinfreq<<4 'broadcast + long 0 'auralcog + +DAT 'vektorobjekte + +vecdef1 word $4000+$2000/3*0 'triangle + word 50 + word $8000+$2000/3*1+1 + word 50 + word $8000+$2000/3*2-1 + word 50 + word $8000+$2000/3*0 + word 50 + word 0 + +vecdef2 word $4000+$2000/12*0 'star + word 50 + word $8000+$2000/12*1 + word 20 + word $8000+$2000/12*2 + word 50 + word $8000+$2000/12*3 + word 20 + word $8000+$2000/12*4 + word 50 + word $8000+$2000/12*5 + word 20 + word $8000+$2000/12*6 + word 50 + word $8000+$2000/12*7 + word 20 + word $8000+$2000/12*8 + word 50 + word $8000+$2000/12*9 + word 20 + word $8000+$2000/12*10 + word 50 + word $8000+$2000/12*11 + word 20 + word $8000+$2000/12*0 + word 50 + word 0 + +vecdef3 word $4000+$2000/4*0 'box + word 50 + word $8000+$2000/4*1 + word 30 + word $8000+$2000/4*2 + word 50 + word $8000+$2000/4*3 + word 30 + word $8000+$2000/4*0 + word 50 + word 0 + diff --git a/source/bellatrix/5-scroll.spin b/source/bellatrix/5-scroll.spin new file mode 100644 index 0000000..8554376 --- /dev/null +++ b/source/bellatrix/5-scroll.spin @@ -0,0 +1,256 @@ +{ + +} + +CON + _CLKMODE = XTAL1 + PLL16X + _XINFREQ = 5_000_000 + _stack = ($3000 + $3000 + 100) >> 2 + + x_tiles = 16 + y_tiles = 12 + + paramcount = 14 + bitmap_base = $2000 + display_base = $5000 + + max_x = x_tiles * 16 + max_y = y_tiles * 16 + + s_obj = 200 'scale + d_obj = 64 'durchmesser + r_obj = d_obj/2 'radius + rotvar = 14 'rotationsvarianz + +VAR + long tv_status '0/1/2 = off/visible/invisible read-only + long tv_enable '0/? = off/on write-only + long tv_pins '%ppmmm = pins write-only + long tv_mode '%ccinp = chroma,interlace,ntsc/pal,swap write-only + long tv_screen 'pointer to screen (words) write-only + long tv_colors 'pointer to colors (longs) write-only + long tv_hc 'horizontal cells write-only + long tv_vc 'vertical cells write-only + long tv_hx 'horizontal cell expansion write-only + long tv_vx 'vertical cell expansion write-only + long tv_ho 'horizontal offset write-only + long tv_vo 'vertical offset write-only + long tv_broadcast 'broadcast frequency (Hz) write-only + long tv_auralcog 'aural fm cog write-only + + word screen[x_tiles * y_tiles] 'tilemap + long colors[64] 'farbregister + + + +OBJ + tv : "bel-tv" 'located in default Library + gr : "bel-graphics" 'located in default Library + kb : "bel-keyb" + +PUB main | x,y,dx,dy,j,k + + init_subsystem + + x := max_x/2 + y := max_y/2 + dx := 3 + dy := 3 + + repeat + gr.clear + + ' objekt zeichnen + gr.colorwidth(1, 1) + repeat j from 0 to 5 + gr.vec(x+j*2, y+j*5, s_obj-j*40, cnt>>rotvar, @vecdef2) + + 'kollisionsabfrage + if (x + dx - r_obj) < 0 + dx := dx * -1 + else + if (x + dx + r_obj + 5) > max_x + dx := dx * -1 + if (y + dy - r_obj) < 0 + dy := dy * -1 + else + if (y + dy + r_obj + 5) > max_y + dy := dy * -1 + x += dx + y += dy + + ' scroller + gr.colorwidth(2, 8) + gr.textmode( 5, 5, 6, 0 ) + gr.text( 500-(k & $7ff), 56, @text1 ) + + gr.copy(display_base) + k += 2 + ifexit + +CON + +#16, BEL_KEYBC,BEL_KEYBD 'keyboard-signale +#18, BEL_MOUSEC,BEL_MOUSED 'maus-signale + +PRI ifexit + + if kb.key == kb#Esc + reboot + +DAT 'scrolltext + +text1 byte "hive - retro style computer" + +PRI init_subsystem | i,dx,dy + + kb.start(BEL_KEYBD, BEL_KEYBC) 'tastaturport starten + + 'tv-treiber starten + longmove(@tv_status, @tvparams, paramcount) + tv_screen := @screen + tv_colors := @colors + tv.start(@tv_status) + +' farbtabelle setzen +' PPPP_M_LLL +' ---+ | --+ +' | | +- 0..1 sync +' | | 2..6 helligkeit b/w +' | | 2..6 helligkeit col +' | | 7 - +' | +----- 0 - b/w +' | 1 - col +' +------- ntsc-palette (blau...grün..rot) +' +' b/w - 6 helligkeitsstufen 6 +' col - 16color x 5 luma 64 +' hsat - 16 highsat-farben 16 +' +' $aa_bb_cc_dd +' $aa - color 3 +' $bb - color 2 +' $cc - color 1 +' $dd - color 0 (hintergrund) + + repeat i from 0 to 63 +' colors[i] := %1010_1_101__0000_0_010__0010_1_111__0000_0_111 +' colors[i] := %1010_1_101__0000_0_010__0010_1_111__0011_0_111 +' colors[i] := c_hsat(3,0)+c_hsat(2,2)+c_hsat(1,6)+c_hsat(0,8) 'gesättigte farben +' colors[i] := c_bw(3,1)+c_bw(2,2)+c_bw(1,3)+c_bw(0,4) 'graustufen +' colors[i] := c_col(3,0,2)+c_col(2,3,2)+c_col(1,6,2)+c_col(0,9,2) + colors[i] := $00001010 * (i<<1+4) & $F + $0D060D02 + + 'init tile screen + repeat dx from 0 to tv_hc - 1 + repeat dy from 0 to tv_vc - 1 + screen[dy * tv_hc + dx] := display_base >> 6 + dy + dx * tv_vc + ((dy & $3F) << 10) +{ + i := 0 + repeat dy from 0 to tv_vc - 1 + repeat dx from 0 to tv_hc - 1 + screen[i++] := display_base >> 6 + dy + dx * tv_vc + (dy << 10) +} + 'start and setup graphics + gr.start + gr.setup(tv_hc, tv_vc, 0, 0, bitmap_base) + +PRI c_hsat(bnr,cnr):col 'tool: erzeugt einen gesättigten farbwert +' bnr : bytenummer +' cnr : 0..15 farbnummer + col := (%0000_1_000 + (cnr<<4))<<(bnr*8) + +PRI c_bw(bnr,cnr):col 'tool: erzeugt einen monochromwert +' bnr : bytenummer +' cnr : 0..5 graustufen + col := (%0000_0_000 + cnr+2)<<(bnr*8) + +PRI c_col(bnr,chroma,lumi):col 'tool: erzeugt einen farbwert +' bnr : bytenummer +' croma : 0..15 chroma +' lumi : 0..5 luminanz + col := (%0000_1_000+(lumi+2)+(chroma<<4))<<(bnr*8) + +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 + + +DAT 'tv-parameter + +tvparams long 0 'status + long 1 'enable + long %010_0101 'pins New Board + long %0000 'mode + long 0 'screen + long 0 'colors + long x_tiles 'hc - horizontale tiles + long y_tiles 'vc - vertikale tiles + long 10 'hx + long 1 'vx + long 0 'ho + long 0 'vo + long 60_000_000 '_xinfreq<<4 'broadcast + long 0 'auralcog + +DAT 'vektorobjekte + +vecdef1 word $4000+$2000/3*0 'triangle + word 50 + word $8000+$2000/3*1+1 + word 50 + word $8000+$2000/3*2-1 + word 50 + word $8000+$2000/3*0 + word 50 + word 0 + +vecdef2 word $4000+$2000/12*0 'star + word 50 + word $8000+$2000/12*1 + word 20 + word $8000+$2000/12*2 + word 50 + word $8000+$2000/12*3 + word 20 + word $8000+$2000/12*4 + word 50 + word $8000+$2000/12*5 + word 20 + word $8000+$2000/12*6 + word 50 + word $8000+$2000/12*7 + word 20 + word $8000+$2000/12*8 + word 50 + word $8000+$2000/12*9 + word 20 + word $8000+$2000/12*10 + word 50 + word $8000+$2000/12*11 + word 20 + word $8000+$2000/12*0 + word 50 + word 0 + +vecdef3 word $4000+$2000/4*0 'box + word 50 + word $8000+$2000/4*1 + word 30 + word $8000+$2000/4*2 + word 50 + word $8000+$2000/4*3 + word 30 + word $8000+$2000/4*0 + word 50 + word 0 + diff --git a/source/bellatrix/6-mouse1.spin b/source/bellatrix/6-mouse1.spin new file mode 100644 index 0000000..fcacc69 --- /dev/null +++ b/source/bellatrix/6-mouse1.spin @@ -0,0 +1,234 @@ +{ + +} + +CON + _CLKMODE = XTAL1 + PLL16X + _XINFREQ = 5_000_000 + _stack = ($3000 + $3000 + 100) >> 2 + + x_tiles = 16 + y_tiles = 12 + + paramcount = 14 + bitmap_base = $2000 + display_base = $5000 + + max_x = x_tiles * 16 + max_y = y_tiles * 16 + + s_obj = 200 'scale + d_obj = 64 'durchmesser + r_obj = d_obj/2 'radius + rotvar = 14 'rotationsvarianz + +VAR + long tv_status '0/1/2 = off/visible/invisible read-only + long tv_enable '0/? = off/on write-only + long tv_pins '%ppmmm = pins write-only + long tv_mode '%ccinp = chroma,interlace,ntsc/pal,swap write-only + long tv_screen 'pointer to screen (words) write-only + long tv_colors 'pointer to colors (longs) write-only + long tv_hc 'horizontal cells write-only + long tv_vc 'vertical cells write-only + long tv_hx 'horizontal cell expansion write-only + long tv_vx 'vertical cell expansion write-only + long tv_ho 'horizontal offset write-only + long tv_vo 'vertical offset write-only + long tv_broadcast 'broadcast frequency (Hz) write-only + long tv_auralcog 'aural fm cog write-only + + word screen[x_tiles * y_tiles] 'tilemap + long colors[64] 'farbregister + + + +OBJ + tv : "bel-tv" 'located in default Library + gr : "bel-graphics" 'located in default Library + mouse : "bel-mouse" + +PUB main | x,y,rot,dx,dy,j,i,mousex,mousey,rflag + + init_subsystem + + x := max_x/2 + y := max_y/2 + rot := 0 + dx := 1 + dy := 1 + + repeat + gr.clear + + 'objekt zeichnen + gr.colorwidth(1, 1) + repeat j from 0 to 5 + gr.vec(x+j*2, y+j*5, s_obj-j*40, rot, @vecdef2) + +' gr.arc(x-100, y, 100, 100, 0, $1fff, 15, 2) + + x += mouse.delta_x + y += mouse.delta_y + rot += mouse.delta_z * 500 + rflag := mouse.buttons + + if rflag == 1 + rot += 50 + + gr.copy(display_base) + ifexit + +PRI ifexit + + if mouse.buttons == 2 + reboot + +PRI init_subsystem | i,dx,dy + + 'tv-treiber starten + longmove(@tv_status, @tvparams, paramcount) + tv_screen := @screen + tv_colors := @colors + tv.start(@tv_status) + +' farbtabelle setzen +' PPPP_M_LLL +' ---+ | --+ +' | | +- 0..1 sync +' | | 2..6 helligkeit b/w +' | | 2..6 helligkeit col +' | | 7 - +' | +----- 0 - b/w +' | 1 - col +' +------- ntsc-palette (blau...grün..rot) +' +' b/w - 6 helligkeitsstufen 6 +' col - 16color x 5 luma 64 +' hsat - 16 highsat-farben 16 +' +' $aa_bb_cc_dd +' $aa - color 3 +' $bb - color 2 +' $cc - color 1 +' $dd - color 0 (hintergrund) + + repeat i from 0 to 63 +' colors[i] := %1010_1_101__0000_0_010__0010_1_111__0000_0_111 +' colors[i] := %1010_1_101__0000_0_010__0010_1_111__0011_0_111 +' colors[i] := c_hsat(3,0)+c_hsat(2,2)+c_hsat(1,6)+c_hsat(0,8) 'gesättigte farben +' colors[i] := c_bw(3,1)+c_bw(2,2)+c_bw(1,3)+c_bw(0,4) 'graustufen +' colors[i] := c_col(3,0,2)+c_col(2,3,2)+c_col(1,6,2)+c_col(0,9,2) + colors[i] := $00001010 * (i<<1+4) & $F + $0D060D02 + + 'init tile screen + repeat dx from 0 to tv_hc - 1 + repeat dy from 0 to tv_vc - 1 + screen[dy * tv_hc + dx] := display_base >> 6 + dy + dx * tv_vc + ((dy & $3F) << 10) + + 'start and setup graphics + gr.start + gr.setup(tv_hc, tv_vc, 0, 0, bitmap_base) + + 'mouse + mouse.start(19, 18) + +PRI c_hsat(bnr,cnr):col 'tool: erzeugt einen gesättigten farbwert +' bnr : bytenummer +' cnr : 0..15 farbnummer + col := (%0000_1_000 + (cnr<<4))<<(bnr*8) + +PRI c_bw(bnr,cnr):col 'tool: erzeugt einen monochromwert +' bnr : bytenummer +' cnr : 0..5 graustufen + col := (%0000_0_000 + cnr+2)<<(bnr*8) + +PRI c_col(bnr,chroma,lumi):col 'tool: erzeugt einen farbwert +' bnr : bytenummer +' croma : 0..15 chroma +' lumi : 0..5 luminanz + col := (%0000_1_000+(lumi+2)+(chroma<<4))<<(bnr*8) + +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 + + +DAT 'tv-parameter + +tvparams long 0 'status + long 1 'enable + long %010_0101 'pins New Board + long %0000 'mode + long 0 'screen + long 0 'colors + long x_tiles 'hc - horizontale tiles + long y_tiles 'vc - vertikale tiles + long 10 'hx + long 1 'vx + long 0 'ho + long 0 'vo + long 60_000_000 '_xinfreq<<4 'broadcast + long 0 'auralcog + +DAT 'vektorobjekte + +vecdef1 word $4000+$2000/3*0 'triangle + word 50 + word $8000+$2000/3*1+1 + word 50 + word $8000+$2000/3*2-1 + word 50 + word $8000+$2000/3*0 + word 50 + word 0 + +vecdef2 word $4000+$2000/12*0 'star + word 50 + word $8000+$2000/12*1 + word 20 + word $8000+$2000/12*2 + word 50 + word $8000+$2000/12*3 + word 20 + word $8000+$2000/12*4 + word 50 + word $8000+$2000/12*5 + word 20 + word $8000+$2000/12*6 + word 50 + word $8000+$2000/12*7 + word 20 + word $8000+$2000/12*8 + word 50 + word $8000+$2000/12*9 + word 20 + word $8000+$2000/12*10 + word 50 + word $8000+$2000/12*11 + word 20 + word $8000+$2000/12*0 + word 50 + word 0 + +vecdef3 word $4000+$2000/4*0 'box + word 50 + word $8000+$2000/4*1 + word 30 + word $8000+$2000/4*2 + word 50 + word $8000+$2000/4*3 + word 30 + word $8000+$2000/4*0 + word 50 + word 0 + diff --git a/source/bellatrix/6-mouse2.spin b/source/bellatrix/6-mouse2.spin new file mode 100644 index 0000000..760f71a --- /dev/null +++ b/source/bellatrix/6-mouse2.spin @@ -0,0 +1,262 @@ +{ + +} + +CON + _CLKMODE = XTAL1 + PLL16X + _XINFREQ = 5_000_000 + _stack = ($3000 + $3000 + 100) >> 2 + + x_tiles = 16 + y_tiles = 12 + + paramcount = 14 + bitmap_base = $2000 + display_base = $5000 + + max_x = x_tiles * 16 + max_y = y_tiles * 16 + + s_obj = 15 'scale + d_obj = 64 'durchmesser + r_obj = d_obj/2 'radius + rotvar = 14 'rotationsvarianz + +VAR + long tv_status '0/1/2 = off/visible/invisible read-only + long tv_enable '0/? = off/on write-only + long tv_pins '%ppmmm = pins write-only + long tv_mode '%ccinp = chroma,interlace,ntsc/pal,swap write-only + long tv_screen 'pointer to screen (words) write-only + long tv_colors 'pointer to colors (longs) write-only + long tv_hc 'horizontal cells write-only + long tv_vc 'vertical cells write-only + long tv_hx 'horizontal cell expansion write-only + long tv_vx 'vertical cell expansion write-only + long tv_ho 'horizontal offset write-only + long tv_vo 'vertical offset write-only + long tv_broadcast 'broadcast frequency (Hz) write-only + long tv_auralcog 'aural fm cog write-only + + word screen[x_tiles * y_tiles] 'tilemap + long colors[64] 'farbregister + + + +OBJ + tv : "bel-tv" 'located in default Library + gr : "bel-graphics" 'located in default Library + mouse : "bel-mouse" + +PUB main | x,y,rot,dx,dy,j,i,mousex,mousey,rflag + + init_subsystem + + x := max_x/2 + y := max_y/2 + rot := 0 + dx := 1 + dy := 1 + + repeat + gr.clear + + ' koordinatenkreuz zeichnen + gr.colorwidth(2, 0) + gr.plot(x,192) + gr.line(x,0) + gr.plot(0,y) + gr.line(255,y) + + 'cursor zeichnen + gr.colorwidth(0, 15) + gr.plot(x,y) + gr.colorwidth(2, 1) + gr.plot(x-3,y-3) + gr.line(x,y) + gr.line(x+3,y-3) + + x += mouse.delta_x + y += mouse.delta_y + rot += mouse.delta_z * 500 + rflag := mouse.buttons + + if rflag == 1 + rot += 50 + + ' koordinaten anzeigen + j := x + repeat i from 3 to 0 + ifnot (j//10) < 0 + kx[ i ] := ( j // 10 ) + "0" + j := j / 10 + j := y + repeat i from 3 to 0 + ifnot (j//10) < 0 + ky[ i ] := ( j // 10 ) + "0" + j := j / 10 + gr.colorwidth(2,0) + gr.text(5,5,@kx ) + + gr.copy(display_base) + ifexit + +dat 'koordinatenstring + +kx byte "0000" + byte ":" +ky byte "0000", 0 + +PRI ifexit + + if mouse.buttons == 2 + reboot + +PRI init_subsystem | i,dx,dy + + 'tv-treiber starten + longmove(@tv_status, @tvparams, paramcount) + tv_screen := @screen + tv_colors := @colors + tv.start(@tv_status) + +' farbtabelle setzen +' PPPP_M_LLL +' ---+ | --+ +' | | +- 0..1 sync +' | | 2..6 helligkeit b/w +' | | 2..6 helligkeit col +' | | 7 - +' | +----- 0 - b/w +' | 1 - col +' +------- ntsc-palette (blau...grün..rot) +' +' b/w - 6 helligkeitsstufen 6 +' col - 16color x 5 luma 64 +' hsat - 16 highsat-farben 16 +' +' $aa_bb_cc_dd +' $aa - color 3 +' $bb - color 2 +' $cc - color 1 +' $dd - color 0 (hintergrund) + + repeat i from 0 to 63 +' colors[i] := %1010_1_101__0000_0_010__0010_1_111__0000_0_111 +' colors[i] := %1010_1_101__0000_0_010__0010_1_111__0011_0_111 +' colors[i] := c_hsat(3,0)+c_hsat(2,2)+c_hsat(1,6)+c_hsat(0,8) 'gesättigte farben +' colors[i] := c_bw(3,1)+c_bw(2,2)+c_bw(1,3)+c_bw(0,4) 'graustufen +' colors[i] := c_col(3,0,2)+c_col(2,3,2)+c_col(1,6,2)+c_col(0,9,2) + colors[i] := $00001010 * (i<<1+4) & $F + $0D060D02 + + 'init tile screen + repeat dx from 0 to tv_hc - 1 + repeat dy from 0 to tv_vc - 1 + screen[dy * tv_hc + dx] := display_base >> 6 + dy + dx * tv_vc + ((dy & $3F) << 10) + + 'start and setup graphics + gr.start + gr.setup(tv_hc, tv_vc, 0, 0, bitmap_base) + + 'mouse + mouse.start(19, 18) + +PRI c_hsat(bnr,cnr):col 'tool: erzeugt einen gesättigten farbwert +' bnr : bytenummer +' cnr : 0..15 farbnummer + col := (%0000_1_000 + (cnr<<4))<<(bnr*8) + +PRI c_bw(bnr,cnr):col 'tool: erzeugt einen monochromwert +' bnr : bytenummer +' cnr : 0..5 graustufen + col := (%0000_0_000 + cnr+2)<<(bnr*8) + +PRI c_col(bnr,chroma,lumi):col 'tool: erzeugt einen farbwert +' bnr : bytenummer +' croma : 0..15 chroma +' lumi : 0..5 luminanz + col := (%0000_1_000+(lumi+2)+(chroma<<4))<<(bnr*8) + +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 + + +DAT 'tv-parameter + +tvparams long 0 'status + long 1 'enable + long %010_0101 'pins New Board + long %0000 'mode + long 0 'screen + long 0 'colors + long x_tiles 'hc - horizontale tiles + long y_tiles 'vc - vertikale tiles + long 10 'hx + long 1 'vx + long 0 'ho + long 0 'vo + long 60_000_000 '_xinfreq<<4 'broadcast + long 0 'auralcog + +DAT 'vektorobjekte + +vecdef1 word $4000+$2000/3*0 'triangle + word 50 + word $8000+$2000/3*1+1 + word 50 + word $8000+$2000/3*2-1 + word 50 + word $8000+$2000/3*0 + word 50 + word 0 + +vecdef2 word $4000+$2000/12*0 'star + word 50 + word $8000+$2000/12*1 + word 20 + word $8000+$2000/12*2 + word 50 + word $8000+$2000/12*3 + word 20 + word $8000+$2000/12*4 + word 50 + word $8000+$2000/12*5 + word 20 + word $8000+$2000/12*6 + word 50 + word $8000+$2000/12*7 + word 20 + word $8000+$2000/12*8 + word 50 + word $8000+$2000/12*9 + word 20 + word $8000+$2000/12*10 + word 50 + word $8000+$2000/12*11 + word 20 + word $8000+$2000/12*0 + word 50 + word 0 + +vecdef3 word $4000+$2000/4*0 'box + word 50 + word $8000+$2000/4*1 + word 30 + word $8000+$2000/4*2 + word 50 + word $8000+$2000/4*3 + word 30 + word $8000+$2000/4*0 + word 50 + word 0 + diff --git a/source/bellatrix/7-sat.spin b/source/bellatrix/7-sat.spin new file mode 100644 index 0000000..fac5711 --- /dev/null +++ b/source/bellatrix/7-sat.spin @@ -0,0 +1,250 @@ +{ + +} + +CON + _CLKMODE = XTAL1 + PLL16X + _XINFREQ = 5_000_000 + _stack = ($3000 + $3000 + 100) >> 2 + + x_tiles = 16 + y_tiles = 12 + + paramcount = 14 + bitmap_base = $2000 + display_base = $5000 + + max_x = x_tiles * 16 + max_y = y_tiles * 16 + + s_obj = 200 'scale + d_obj = 64 'durchmesser + r_obj = d_obj/2 'radius + rotvar = 16 'rotationsvarianz + arcstep = 16 + arcdistx = 0 + arcdisty = -100 + arcinertia = 10 + +VAR + long tv_status '0/1/2 = off/visible/invisible read-only + long tv_enable '0/? = off/on write-only + long tv_pins '%ppmmm = pins write-only + long tv_mode '%ccinp = chroma,interlace,ntsc/pal,swap write-only + long tv_screen 'pointer to screen (words) write-only + long tv_colors 'pointer to colors (longs) write-only + long tv_hc 'horizontal cells write-only + long tv_vc 'vertical cells write-only + long tv_hx 'horizontal cell expansion write-only + long tv_vx 'vertical cell expansion write-only + long tv_ho 'horizontal offset write-only + long tv_vo 'vertical offset write-only + long tv_broadcast 'broadcast frequency (Hz) write-only + long tv_auralcog 'aural fm cog write-only + + word screen[x_tiles * y_tiles] 'tilemap + long colors[64] 'farbregister + + + +OBJ + tv : "bel-tv" 'located in default Library + gr : "bel-graphics" 'located in default Library + mouse : "bel-mouse" + +PUB main | x,y,x1,y1,dx,dy,j,mousex,mousey,rflag + + init_subsystem + + x := max_x/2 + y := max_y/2 + dx := x + dy := y + + repeat + gr.clear + + 'draw center-object + gr.colorwidth(1, 2) + gr.arc(x, y, 5, 5, 0, $1fff/(arcstep-1), arcstep, 2) + + 'draw satellite + gr.colorwidth(1, 6) + x1 := sin(cnt>>13)/$ff<<2+dx + y1 := cos(cnt>>13)/$ff<<2+dy + dx := dx+(x-dx)/15 + dy := dy+(y-dy)/15 + gr.arc(x1, y1, 15, 15, 0, $1fff/(arcstep-1), arcstep, 2) + + ' draw line + gr.colorwidth(1, 0) + gr.plot(x,y) + gr.line(x1,y1) + + 'mousefunctions + x += mouse.delta_x + y += mouse.delta_y + rflag := mouse.buttons + + if rflag == 1 + x := max_x/2 + y := max_y/2 + dx := x + dy := y + + gr.copy(display_base) + ifexit + +PRI ifexit + + if mouse.buttons == 2 + reboot + +PRI init_subsystem | i,dx,dy + + 'tv-treiber starten + longmove(@tv_status, @tvparams, paramcount) + tv_screen := @screen + tv_colors := @colors + tv.start(@tv_status) + +' farbtabelle setzen +' PPPP_M_LLL +' ---+ | --+ +' | | +- 0..1 sync +' | | 2..6 helligkeit b/w +' | | 2..6 helligkeit col +' | | 7 - +' | +----- 0 - b/w +' | 1 - col +' +------- ntsc-palette (blau...grün..rot) +' +' b/w - 6 helligkeitsstufen 6 +' col - 16color x 5 luma 64 +' hsat - 16 highsat-farben 16 +' +' $aa_bb_cc_dd +' $aa - color 3 +' $bb - color 2 +' $cc - color 1 +' $dd - color 0 (hintergrund) + + repeat i from 0 to 63 +' colors[i] := %1010_1_101__0000_0_010__0010_1_111__0000_0_111 +' colors[i] := %1010_1_101__0000_0_010__0010_1_111__0011_0_111 +' colors[i] := c_hsat(3,0)+c_hsat(2,2)+c_hsat(1,6)+c_hsat(0,8) 'gesättigte farben +' colors[i] := c_bw(3,1)+c_bw(2,2)+c_bw(1,3)+c_bw(0,4) 'graustufen +' colors[i] := c_col(3,0,2)+c_col(2,3,2)+c_col(1,6,2)+c_col(0,9,2) + colors[i] := $00001010 * (i<<1+4) & $F + $0D060D02 + + 'init tile screen + repeat dx from 0 to tv_hc - 1 + repeat dy from 0 to tv_vc - 1 + screen[dy * tv_hc + dx] := display_base >> 6 + dy + dx * tv_vc + ((dy & $3F) << 10) + + 'start and setup graphics + gr.start + gr.setup(tv_hc, tv_vc, 0, 0, bitmap_base) + + 'mouse + mouse.start(19, 18) + +PRI c_hsat(bnr,cnr):col 'tool: erzeugt einen gesättigten farbwert +' bnr : bytenummer +' cnr : 0..15 farbnummer + col := (%0000_1_000 + (cnr<<4))<<(bnr*8) + +PRI c_bw(bnr,cnr):col 'tool: erzeugt einen monochromwert +' bnr : bytenummer +' cnr : 0..5 graustufen + col := (%0000_0_000 + cnr+2)<<(bnr*8) + +PRI c_col(bnr,chroma,lumi):col 'tool: erzeugt einen farbwert +' bnr : bytenummer +' croma : 0..15 chroma +' lumi : 0..5 luminanz + col := (%0000_1_000+(lumi+2)+(chroma<<4))<<(bnr*8) + +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 + + +DAT 'tv-parameter + +tvparams long 0 'status + long 1 'enable + long %010_0101 'pins New Board + long %0000 'mode + long 0 'screen + long 0 'colors + long x_tiles 'hc - horizontale tiles + long y_tiles 'vc - vertikale tiles + long 10 'hx + long 1 'vx + long 0 'ho + long 0 'vo + long 60_000_000 '_xinfreq<<4 'broadcast + long 0 'auralcog + +DAT 'vektorobjekte + +vecdef1 word $4000+$2000/3*0 'triangle + word 50 + word $8000+$2000/3*1+1 + word 50 + word $8000+$2000/3*2-1 + word 50 + word $8000+$2000/3*0 + word 50 + word 0 + +vecdef2 word $4000+$2000/12*0 'star + word 50 + word $8000+$2000/12*1 + word 20 + word $8000+$2000/12*2 + word 50 + word $8000+$2000/12*3 + word 20 + word $8000+$2000/12*4 + word 50 + word $8000+$2000/12*5 + word 20 + word $8000+$2000/12*6 + word 50 + word $8000+$2000/12*7 + word 20 + word $8000+$2000/12*8 + word 50 + word $8000+$2000/12*9 + word 20 + word $8000+$2000/12*10 + word 50 + word $8000+$2000/12*11 + word 20 + word $8000+$2000/12*0 + word 50 + word 0 + +vecdef3 word $4000+$2000/4*0 'box + word 50 + word $8000+$2000/4*1 + word 30 + word $8000+$2000/4*2 + word 50 + word $8000+$2000/4*3 + word 30 + word $8000+$2000/4*0 + word 50 + word 0 + diff --git a/source/bellatrix/8-sinus.spin b/source/bellatrix/8-sinus.spin new file mode 100644 index 0000000..518d066 --- /dev/null +++ b/source/bellatrix/8-sinus.spin @@ -0,0 +1,237 @@ +{ + +} + +CON + _CLKMODE = XTAL1 + PLL16X + _XINFREQ = 5_000_000 + _stack = ($3000 + $3000 + 100) >> 2 + + x_tiles = 16 + y_tiles = 12 + + paramcount = 14 + bitmap_base = $2000 + display_base = $5000 + + max_x = x_tiles * 16 + max_y = y_tiles * 16 + + s_obj = 200 'scale + d_obj = 64 'durchmesser + r_obj = d_obj/2 'radius + rotvar = 14 'rotationsvarianz + +VAR + long tv_status '0/1/2 = off/visible/invisible read-only + long tv_enable '0/? = off/on write-only + long tv_pins '%ppmmm = pins write-only + long tv_mode '%ccinp = chroma,interlace,ntsc/pal,swap write-only + long tv_screen 'pointer to screen (words) write-only + long tv_colors 'pointer to colors (longs) write-only + long tv_hc 'horizontal cells write-only + long tv_vc 'vertical cells write-only + long tv_hx 'horizontal cell expansion write-only + long tv_vx 'vertical cell expansion write-only + long tv_ho 'horizontal offset write-only + long tv_vo 'vertical offset write-only + long tv_broadcast 'broadcast frequency (Hz) write-only + long tv_auralcog 'aural fm cog write-only + + word screen[x_tiles * y_tiles] 'tilemap + long colors[64] 'farbregister + + + +OBJ + tv : "bel-tv" 'located in default Library + gr : "bel-graphics" 'located in default Library + mouse : "bel-mouse" + +PUB main | x,y,rot,dx,dy,j,mousex,mousey,rflag,sx + + init_subsystem + + x := max_x/2 + y := max_y/2 + rot := 0 + dx := 1 + dy := 1 + + repeat + gr.clear + + 'objekt zeichnen + gr.colorwidth(1, 0) + repeat j from 0 to 5 + gr.vec(x+j*2, y+j*5, s_obj-j*40, rot, @vecdef2) + + 'sinus zeichnen + gr.colorwidth(1, 0) + repeat sx from 0 to 255 + gr.plot(sx,sin(sx*(cnt>>24)+cnt>>16)/$ff<<2+max_y>>1) + + x += mouse.delta_x + y += mouse.delta_y + rot += mouse.delta_z * 200 + rflag := mouse.buttons + + if rflag == 1 + rot += 50 + + gr.copy(display_base) + ifexit + +PRI ifexit + + if mouse.buttons == 2 + reboot + +PRI init_subsystem | i,dx,dy + + 'tv-treiber starten + longmove(@tv_status, @tvparams, paramcount) + tv_screen := @screen + tv_colors := @colors + tv.start(@tv_status) + +' farbtabelle setzen +' PPPP_M_LLL +' ---+ | --+ +' | | +- 0..1 sync +' | | 2..6 helligkeit b/w +' | | 2..6 helligkeit col +' | | 7 - +' | +----- 0 - b/w +' | 1 - col +' +------- ntsc-palette (blau...grün..rot) +' +' b/w - 6 helligkeitsstufen 6 +' col - 16color x 5 luma 64 +' hsat - 16 highsat-farben 16 +' +' $aa_bb_cc_dd +' $aa - color 3 +' $bb - color 2 +' $cc - color 1 +' $dd - color 0 (hintergrund) + + repeat i from 0 to 63 +' colors[i] := %1010_1_101__0000_0_010__0010_1_111__0000_0_111 +' colors[i] := %1010_1_101__0000_0_010__0010_1_111__0011_0_111 +' colors[i] := c_hsat(3,0)+c_hsat(2,2)+c_hsat(1,6)+c_hsat(0,8) 'gesättigte farben +' colors[i] := c_bw(3,1)+c_bw(2,2)+c_bw(1,3)+c_bw(0,4) 'graustufen +' colors[i] := c_col(3,0,2)+c_col(2,3,2)+c_col(1,6,2)+c_col(0,9,2) + colors[i] := $00001010 * (i<<1+4) & $F + $0D060D02 + + 'init tile screen + repeat dx from 0 to tv_hc - 1 + repeat dy from 0 to tv_vc - 1 + screen[dy * tv_hc + dx] := display_base >> 6 + dy + dx * tv_vc + ((dy & $3F) << 10) + + 'start and setup graphics + gr.start + gr.setup(tv_hc, tv_vc, 0, 0, bitmap_base) + + 'mouse + mouse.start(19, 18) + +PRI c_hsat(bnr,cnr):col 'tool: erzeugt einen gesättigten farbwert +' bnr : bytenummer +' cnr : 0..15 farbnummer + col := (%0000_1_000 + (cnr<<4))<<(bnr*8) + +PRI c_bw(bnr,cnr):col 'tool: erzeugt einen monochromwert +' bnr : bytenummer +' cnr : 0..5 graustufen + col := (%0000_0_000 + cnr+2)<<(bnr*8) + +PRI c_col(bnr,chroma,lumi):col 'tool: erzeugt einen farbwert +' bnr : bytenummer +' croma : 0..15 chroma +' lumi : 0..5 luminanz + col := (%0000_1_000+(lumi+2)+(chroma<<4))<<(bnr*8) + +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 + + +DAT 'tv-parameter + +tvparams long 0 'status + long 1 'enable + long %010_0101 'pins New Board + long %0000 'mode + long 0 'screen + long 0 'colors + long x_tiles 'hc - horizontale tiles + long y_tiles 'vc - vertikale tiles + long 10 'hx + long 1 'vx + long 0 'ho + long 0 'vo + long 60_000_000 '_xinfreq<<4 'broadcast + long 0 'auralcog + +DAT 'vektorobjekte + +vecdef1 word $4000+$2000/3*0 'triangle + word 50 + word $8000+$2000/3*1+1 + word 50 + word $8000+$2000/3*2-1 + word 50 + word $8000+$2000/3*0 + word 50 + word 0 + +vecdef2 word $4000+$2000/12*0 'star + word 50 + word $8000+$2000/12*1 + word 20 + word $8000+$2000/12*2 + word 50 + word $8000+$2000/12*3 + word 20 + word $8000+$2000/12*4 + word 50 + word $8000+$2000/12*5 + word 20 + word $8000+$2000/12*6 + word 50 + word $8000+$2000/12*7 + word 20 + word $8000+$2000/12*8 + word 50 + word $8000+$2000/12*9 + word 20 + word $8000+$2000/12*10 + word 50 + word $8000+$2000/12*11 + word 20 + word $8000+$2000/12*0 + word 50 + word 0 + +vecdef3 word $4000+$2000/4*0 'box + word 50 + word $8000+$2000/4*1 + word 30 + word $8000+$2000/4*2 + word 50 + word $8000+$2000/4*3 + word 30 + word $8000+$2000/4*0 + word 50 + word 0 + diff --git a/source/bellatrix/9-lissa1.spin b/source/bellatrix/9-lissa1.spin new file mode 100644 index 0000000..a05cc15 --- /dev/null +++ b/source/bellatrix/9-lissa1.spin @@ -0,0 +1,232 @@ +{ + +} + +CON + _CLKMODE = XTAL1 + PLL16X + _XINFREQ = 5_000_000 + _stack = ($3000 + $3000 + 100) >> 2 + + x_tiles = 16 + y_tiles = 12 + + paramcount = 14 + bitmap_base = $2000 + display_base = $5000 + + max_x = x_tiles * 16 + max_y = y_tiles * 16 + + s_obj = 200 'scale + d_obj = 64 'durchmesser + r_obj = d_obj/2 'radius + rotvar = 14 'rotationsvarianz + +VAR + long tv_status '0/1/2 = off/visible/invisible read-only + long tv_enable '0/? = off/on write-only + long tv_pins '%ppmmm = pins write-only + long tv_mode '%ccinp = chroma,interlace,ntsc/pal,swap write-only + long tv_screen 'pointer to screen (words) write-only + long tv_colors 'pointer to colors (longs) write-only + long tv_hc 'horizontal cells write-only + long tv_vc 'vertical cells write-only + long tv_hx 'horizontal cell expansion write-only + long tv_vx 'vertical cell expansion write-only + long tv_ho 'horizontal offset write-only + long tv_vo 'vertical offset write-only + long tv_broadcast 'broadcast frequency (Hz) write-only + long tv_auralcog 'aural fm cog write-only + + word screen[x_tiles * y_tiles] 'tilemap + long colors[64] 'farbregister + + + +OBJ + tv : "bel-tv" 'located in default Library + gr : "bel-graphics" 'located in default Library + mouse : "bel-mouse" + +PUB main | x,y,rot,dx,dy,j,mousex,mousey,rflag,sx,sy,i,l + + init_subsystem + + x := max_x/2 + y := max_y/2 + rot := 1 + dx := 1 + dy := 1 + l := 0 + + repeat + gr.clear + + gr.colorwidth(1, 3) + repeat i from 0 to 255 + sx := sin(i*$1ff+cnt>>16+x) / $ff<<2 + max_x>>1 + sy := cos(i*$1ff*rot+cnt>>17+y) / $ff<<2 + max_y>>1 + gr.plot(sx,sy) + + x += mouse.delta_x * 10 + y += mouse.delta_y * 10 + rot += mouse.delta_z + if mouse.buttons == 1 + rot := 1 + + gr.copy(display_base) + ifexit + +PRI ifexit + + if mouse.buttons == 2 + reboot + +PRI init_subsystem | i,dx,dy + + 'tv-treiber starten + longmove(@tv_status, @tvparams, paramcount) + tv_screen := @screen + tv_colors := @colors + tv.start(@tv_status) + +' farbtabelle setzen +' PPPP_M_LLL +' ---+ | --+ +' | | +- 0..1 sync +' | | 2..6 helligkeit b/w +' | | 2..6 helligkeit col +' | | 7 - +' | +----- 0 - b/w +' | 1 - col +' +------- ntsc-palette (blau...grün..rot) +' +' b/w - 6 helligkeitsstufen 6 +' col - 16color x 5 luma 64 +' hsat - 16 highsat-farben 16 +' +' $aa_bb_cc_dd +' $aa - color 3 +' $bb - color 2 +' $cc - color 1 +' $dd - color 0 (hintergrund) + + repeat i from 0 to 63 +' colors[i] := %1010_1_101__0000_0_010__0010_1_111__0000_0_111 +' colors[i] := %1010_1_101__0000_0_010__0010_1_111__0011_0_111 +' colors[i] := c_hsat(3,0)+c_hsat(2,2)+c_hsat(1,6)+c_hsat(0,8) 'gesättigte farben +' colors[i] := c_bw(3,1)+c_bw(2,2)+c_bw(1,3)+c_bw(0,4) 'graustufen +' colors[i] := c_col(3,0,2)+c_col(2,3,2)+c_col(1,6,2)+c_col(0,9,2) + colors[i] := $00001010 * (i<<1+4) & $F + $0D060D02 + + 'init tile screen + repeat dx from 0 to tv_hc - 1 + repeat dy from 0 to tv_vc - 1 + screen[dy * tv_hc + dx] := display_base >> 6 + dy + dx * tv_vc + ((dy & $3F) << 10) + + 'start and setup graphics + gr.start + gr.setup(tv_hc, tv_vc, 0, 0, bitmap_base) + + 'mouse + mouse.start(19, 18) + +PRI c_hsat(bnr,cnr):col 'tool: erzeugt einen gesättigten farbwert +' bnr : bytenummer +' cnr : 0..15 farbnummer + col := (%0000_1_000 + (cnr<<4))<<(bnr*8) + +PRI c_bw(bnr,cnr):col 'tool: erzeugt einen monochromwert +' bnr : bytenummer +' cnr : 0..5 graustufen + col := (%0000_0_000 + cnr+2)<<(bnr*8) + +PRI c_col(bnr,chroma,lumi):col 'tool: erzeugt einen farbwert +' bnr : bytenummer +' croma : 0..15 chroma +' lumi : 0..5 luminanz + col := (%0000_1_000+(lumi+2)+(chroma<<4))<<(bnr*8) + +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 + + +DAT 'tv-parameter + +tvparams long 0 'status + long 1 'enable + long %010_0101 'pins New Board + long %0000 'mode + long 0 'screen + long 0 'colors + long x_tiles 'hc - horizontale tiles + long y_tiles 'vc - vertikale tiles + long 10 'hx + long 1 'vx + long 0 'ho + long 0 'vo + long 60_000_000 '_xinfreq<<4 'broadcast + long 0 'auralcog + +DAT 'vektorobjekte + +vecdef1 word $4000+$2000/3*0 'triangle + word 50 + word $8000+$2000/3*1+1 + word 50 + word $8000+$2000/3*2-1 + word 50 + word $8000+$2000/3*0 + word 50 + word 0 + +vecdef2 word $4000+$2000/12*0 'star + word 50 + word $8000+$2000/12*1 + word 20 + word $8000+$2000/12*2 + word 50 + word $8000+$2000/12*3 + word 20 + word $8000+$2000/12*4 + word 50 + word $8000+$2000/12*5 + word 20 + word $8000+$2000/12*6 + word 50 + word $8000+$2000/12*7 + word 20 + word $8000+$2000/12*8 + word 50 + word $8000+$2000/12*9 + word 20 + word $8000+$2000/12*10 + word 50 + word $8000+$2000/12*11 + word 20 + word $8000+$2000/12*0 + word 50 + word 0 + +vecdef3 word $4000+$2000/4*0 'box + word 50 + word $8000+$2000/4*1 + word 30 + word $8000+$2000/4*2 + word 50 + word $8000+$2000/4*3 + word 30 + word $8000+$2000/4*0 + word 50 + word 0 + diff --git a/source/bellatrix/9-lissa2.spin b/source/bellatrix/9-lissa2.spin new file mode 100644 index 0000000..03b7856 --- /dev/null +++ b/source/bellatrix/9-lissa2.spin @@ -0,0 +1,230 @@ +{ + +} + +CON + _CLKMODE = XTAL1 + PLL16X + _XINFREQ = 5_000_000 + _stack = ($3000 + $3000 + 100) >> 2 + + x_tiles = 16 + y_tiles = 12 + + paramcount = 14 + bitmap_base = $2000 + display_base = $5000 + + max_x = x_tiles * 16 + max_y = y_tiles * 16 + + s_obj = 200 'scale + d_obj = 64 'durchmesser + r_obj = d_obj/2 'radius + rotvar = 14 'rotationsvarianz + +VAR + long tv_status '0/1/2 = off/visible/invisible read-only + long tv_enable '0/? = off/on write-only + long tv_pins '%ppmmm = pins write-only + long tv_mode '%ccinp = chroma,interlace,ntsc/pal,swap write-only + long tv_screen 'pointer to screen (words) write-only + long tv_colors 'pointer to colors (longs) write-only + long tv_hc 'horizontal cells write-only + long tv_vc 'vertical cells write-only + long tv_hx 'horizontal cell expansion write-only + long tv_vx 'vertical cell expansion write-only + long tv_ho 'horizontal offset write-only + long tv_vo 'vertical offset write-only + long tv_broadcast 'broadcast frequency (Hz) write-only + long tv_auralcog 'aural fm cog write-only + + word screen[x_tiles * y_tiles] 'tilemap + long colors[64] 'farbregister + + + +OBJ + tv : "bel-tv" 'located in default Library + gr : "bel-graphics" 'located in default Library + mouse : "bel-mouse" + +PUB main | sx,sy,i,l,d,fx,fy,rot + + init_subsystem + + l := 1 + d := 0 + + repeat + gr.clear + + 'lissajou zeichnen + gr.colorwidth(1, 0) + fx := fx + 1 + mouse.delta_z + fy := fy + 1 + repeat i from 0 to 255 + sx := sin(i * ($1ff+fx)) / $1ff + max_x>>1 + sy := cos(i * ($1ff+fy)) / $2ff + max_y>>1 + if i == 0 + gr.plot(sx,sy) + gr.line(sx,sy) + + if mouse.buttons == 1 + fx := fy := l := 1 + + gr.copy(display_base) + ifexit + +PRI ifexit + + if mouse.buttons == 2 + reboot + +PRI init_subsystem | i,dx,dy + + 'tv-treiber starten + longmove(@tv_status, @tvparams, paramcount) + tv_screen := @screen + tv_colors := @colors + tv.start(@tv_status) + +' farbtabelle setzen +' PPPP_M_LLL +' ---+ | --+ +' | | +- 0..1 sync +' | | 2..6 helligkeit b/w +' | | 2..6 helligkeit col +' | | 7 - +' | +----- 0 - b/w +' | 1 - col +' +------- ntsc-palette (blau...grün..rot) +' +' b/w - 6 helligkeitsstufen 6 +' col - 16color x 5 luma 64 +' hsat - 16 highsat-farben 16 +' +' $aa_bb_cc_dd +' $aa - color 3 +' $bb - color 2 +' $cc - color 1 +' $dd - color 0 (hintergrund) + + repeat i from 0 to 63 +' colors[i] := %1010_1_101__0000_0_010__0010_1_111__0000_0_111 +' colors[i] := %1010_1_101__0000_0_010__0010_1_111__0011_0_111 +' colors[i] := c_hsat(3,0)+c_hsat(2,2)+c_hsat(1,6)+c_hsat(0,8) 'gesättigte farben +' colors[i] := c_bw(3,1)+c_bw(2,2)+c_bw(1,3)+c_bw(0,4) 'graustufen +' colors[i] := c_col(3,0,2)+c_col(2,3,2)+c_col(1,6,2)+c_col(0,9,2) + colors[i] := $00001010 * (i<<1+4) & $F + $0D060D02 + + 'init tile screen + repeat dx from 0 to tv_hc - 1 + repeat dy from 0 to tv_vc - 1 + screen[dy * tv_hc + dx] := display_base >> 6 + dy + dx * tv_vc + ((dy & $3F) << 10) + + 'start and setup graphics + gr.start + gr.setup(tv_hc, tv_vc, 0, 0, bitmap_base) + + 'mouse + mouse.start(19, 18) + +PRI c_hsat(bnr,cnr):col 'tool: erzeugt einen gesättigten farbwert +' bnr : bytenummer +' cnr : 0..15 farbnummer + col := (%0000_1_000 + (cnr<<4))<<(bnr*8) + +PRI c_bw(bnr,cnr):col 'tool: erzeugt einen monochromwert +' bnr : bytenummer +' cnr : 0..5 graustufen + col := (%0000_0_000 + cnr+2)<<(bnr*8) + +PRI c_col(bnr,chroma,lumi):col 'tool: erzeugt einen farbwert +' bnr : bytenummer +' croma : 0..15 chroma +' lumi : 0..5 luminanz + col := (%0000_1_000+(lumi+2)+(chroma<<4))<<(bnr*8) + +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 + + +DAT 'tv-parameter + +tvparams long 0 'status + long 1 'enable + long %010_0101 'pins New Board + long %0000 'mode + long 0 'screen + long 0 'colors + long x_tiles 'hc - horizontale tiles + long y_tiles 'vc - vertikale tiles + long 10 'hx + long 1 'vx + long 0 'ho + long 0 'vo + long 60_000_000 '_xinfreq<<4 'broadcast + long 0 'auralcog + +DAT 'vektorobjekte + +vecdef1 word $4000+$2000/3*0 'triangle + word 50 + word $8000+$2000/3*1+1 + word 50 + word $8000+$2000/3*2-1 + word 50 + word $8000+$2000/3*0 + word 50 + word 0 + +vecdef2 word $4000+$2000/12*0 'star + word 50 + word $8000+$2000/12*1 + word 20 + word $8000+$2000/12*2 + word 50 + word $8000+$2000/12*3 + word 20 + word $8000+$2000/12*4 + word 50 + word $8000+$2000/12*5 + word 20 + word $8000+$2000/12*6 + word 50 + word $8000+$2000/12*7 + word 20 + word $8000+$2000/12*8 + word 50 + word $8000+$2000/12*9 + word 20 + word $8000+$2000/12*10 + word 50 + word $8000+$2000/12*11 + word 20 + word $8000+$2000/12*0 + word 50 + word 0 + +vecdef3 word $4000+$2000/4*0 'box + word 50 + word $8000+$2000/4*1 + word 30 + word $8000+$2000/4*2 + word 50 + word $8000+$2000/4*3 + word 30 + word $8000+$2000/4*0 + word 50 + word 0 + diff --git a/source/regnatix/15-sid1.spin b/source/regnatix/15-sid1.spin new file mode 100644 index 0000000..9c72844 --- /dev/null +++ b/source/regnatix/15-sid1.spin @@ -0,0 +1,638 @@ +' +' SIDcog demonstartion. +' A minimalistic and stupid play routine playing a stupid little tune. ;) +' + +OBJ + ios: "reg-ios" + +CON + +_CLKMODE = XTAL1 + PLL16X +_XINFREQ = 5_000_000 + +SIDMASK = %00000000_00000000_00000000_00010000 +playRate = 26 'Hz + + +VAR + + + +DAT 'PARAMETER + +PUB main + + ios.start 'ios initialisieren + if (ios.admgetspec & SIDMASK) + play + else + ios.print(@err1) + ios.stop + +PRI play|i, note, channel, musicPointer + 'Lp, Bp, Hp + ios.sid1_setFilterType(true,false,false) 'Enable lowpass filter + + 'Ch1, Ch2, Ch3 + ios.sid1_setFilterMask(true,false,false) 'Enable filter on the bass channel (channel1) + + ios.sid1_setWaveform(0,ios#scog_square) 'Set waveform type on channel1 to Square wave + ios.sid1_setPWM(0,1928) 'Set the pulse width on channel1 to 47:53 + ios.sid1_setADSR(0,2,5,9,6) 'Set Envelope on channel1 + ios.sid1_setWaveform(1,ios#scog_noise) 'Set waveform type on channel2 to Noise (drum sound) + ios.sid1_setADSR(1,0,8,4,7) 'Set Envelope on channel2 + ios.sid1_setWaveform(2,ios#scog_saw) 'Set waveform type on channel2 to Saw wave + ios.sid1_setADSR(2,7,4,8,9) 'Set Envelope on channel3 + ios.sid1_setVolume(15) 'Set volume to max + + musicPointer := -1 + + ios.printnl + repeat + waitcnt(cnt+(clkfreq/playRate)) + repeat channel from 0 to 2 + note := music[++musicPointer] + ios.printhex(note,2) + ios.printchar(":") + + if note == 255 ' Restart tune if note =255 + note := music[musicPointer := 0] + if note ' Note on if note >0 + ios.sid1_noteOn(channel,note2freq(note)) + else + ios.sid1_noteOff(channel) ' Note off if note =0 + + ios.printhex(music[++musicPointer],2) + ios.sid1_setCutoff(music[musicPointer]<<3) ' Update cutoff frequency + ios.printnl + until ios.key + ios.sid_mute(1) + +PUB note2freq(note) | octave + octave := note/12 + note -= octave*12 + return (noteTable[note]>>(8-octave)) + +DAT + +err1 byte 13,"Administra-Code unterstützt keine SID-Emulation!",13,0 + +DAT +noteTable word 16350, 17320, 18350, 19450, 20600, 21830, 23120, 24500, 25960, 27500, 29140, 30870 + +DAT 'sounddaten + + 'Ch1,Ch2,Ch3,cutoff + +music byte 50, 0 , 0, 0 + byte 50, 0 , 0, 1 + byte 50, 0 , 0, 2 + byte 0 , 0 , 0, 3 + byte 50, 0 , 0, 4 + byte 0 , 0 , 0, 5 + byte 0 , 0 , 0, 6 + byte 0 , 0 , 0, 7 + byte 62, 0 , 0, 8 + byte 0 , 0 , 0, 9 + byte 0 , 0 , 0, 10 + byte 0 , 0 , 0, 11 + byte 50, 0 , 0, 12 + byte 50, 0 , 0, 13 + byte 0 , 0 , 0, 14 + byte 0 , 0 , 0, 15 + byte 50, 0 , 0, 16 + byte 0 , 0 , 0, 17 + byte 0 , 0 , 0, 18 + byte 0 , 0 , 0, 19 + byte 62, 0 , 0, 20 + byte 0 , 0 , 0, 21 + byte 0 , 0 , 0, 22 + byte 0 , 0 , 0, 23 + byte 50, 0 , 0, 24 + byte 50, 0 , 0, 25 + byte 0 , 0 , 0, 26 + byte 0 , 0 , 0, 27 + byte 62, 0 , 0, 28 + byte 0 , 0 , 0, 29 + byte 62, 0 , 0, 30 + byte 0 , 0 , 0, 31 + + byte 55, 0 , 0, 32 + byte 55, 0 , 0, 33 + byte 55, 0 , 0, 34 + byte 0 , 0 , 0, 35 + byte 55, 0 , 0, 36 + byte 0 , 0 , 0, 37 + byte 0 , 0 , 0, 38 + byte 0 , 0 , 0, 39 + byte 65, 0 , 0, 40 + byte 0 , 0 , 0, 41 + byte 0 , 0 , 0, 42 + byte 0 , 0 , 0, 43 + byte 55, 0 , 0, 44 + byte 55, 0 , 0, 45 + byte 0 , 0 , 0, 46 + byte 0 , 0 , 0, 47 + byte 55, 0 , 0, 48 + byte 0 , 0 , 0, 49 + byte 0 , 0 , 0, 50 + byte 0 , 0 , 0, 51 + byte 65, 0 , 0, 52 + byte 0 , 0 , 0, 53 + byte 0 , 0 , 0, 54 + byte 0 , 0 , 0, 55 + byte 55, 0 , 0, 56 + byte 55, 0 , 0, 57 + byte 0 , 0 , 0, 58 + byte 0 , 0 , 0, 59 + byte 62, 0 , 0, 60 + byte 0 , 0 , 0, 61 + byte 55, 0 , 0, 62 + byte 0 , 0 , 0, 63 + + byte 50, 0 , 0, 64 + byte 0 , 0 , 0, 65 + byte 50, 0 , 0, 66 + byte 0 , 0 , 0, 67 + byte 50, 0 , 0, 68 + byte 0 , 0 , 0, 69 + byte 0 , 0 , 0, 70 + byte 0 , 0 , 0, 71 + byte 62, 0 , 0, 72 + byte 0 , 0 , 0, 73 + byte 0 , 0 , 0, 74 + byte 0 , 0 , 0, 75 + byte 50, 0 , 0, 76 + byte 50, 0 , 0, 77 + byte 0 , 0 , 0, 78 + byte 0 , 0 , 0, 79 + byte 50, 0 , 0, 80 + byte 0 , 0 , 0, 81 + byte 0 , 0 , 0, 82 + byte 0 , 0 , 0, 83 + byte 62, 0 , 0, 84 + byte 0 , 0 , 0, 85 + byte 0 , 0 , 0, 86 + byte 0 , 0 , 0, 87 + byte 50, 0 , 0, 88 + byte 50, 0 , 0, 89 + byte 0 , 0 , 0, 90 + byte 0 , 0 , 0, 91 + byte 62, 0 , 0, 92 + byte 0 , 0 , 0, 93 + byte 62, 0 , 0, 94 + byte 0 , 0 , 0, 95 + + byte 60, 0 , 0, 96 + byte 60, 0 , 0, 97 + byte 60, 0 , 0, 98 + byte 0 , 0 , 0, 99 + byte 60, 0 , 0, 100 + byte 0 , 0 , 0, 101 + byte 0 , 0 , 0, 102 + byte 0 , 0 , 0, 103 + byte 67, 0 , 0, 104 + byte 0 , 0 , 0, 105 + byte 0 , 0 , 0, 106 + byte 0 , 0 , 0, 107 + byte 60, 0 , 0, 108 + byte 60, 0 , 0, 109 + byte 0 , 0 , 0, 110 + byte 0 , 0 , 0, 111 + byte 55, 0 , 0, 112 + byte 0 , 0 , 0, 113 + byte 0 , 0 , 0, 114 + byte 0 , 0 , 0, 115 + byte 67, 0 , 0, 116 + byte 0 , 0 , 0, 117 + byte 0 , 0 , 0, 118 + byte 0 , 0 , 0, 119 + byte 55, 0 , 0, 120 + byte 55, 0 , 0, 121 + byte 0 , 0 , 0, 122 + byte 0 , 0 , 0, 123 + byte 67, 0 , 0, 124 + byte 0 , 0 , 0, 125 + byte 67, 0 , 0, 126 + byte 0 , 0 , 0, 127 +'------------------------------------ + byte 50, 60, 0, 128 + byte 50, 60, 0, 129 + byte 50, 0 , 0, 130 + byte 0 , 0 , 0, 131 + byte 50, 0 , 0, 132 + byte 0 , 0 , 0, 133 + byte 0 , 0 , 0, 134 + byte 0 , 0 , 0, 135 + byte 62, 80, 0, 136 + byte 0 , 0 , 0, 137 + byte 0 , 0 , 0, 138 + byte 0 , 0 , 0, 139 + byte 50, 0 , 0, 140 + byte 50, 0 , 0, 141 + byte 0 , 0 , 0, 142 + byte 0 , 0 , 0, 143 + byte 50, 60, 0, 144 + byte 0 , 60, 0, 145 + byte 0 , 0 , 0, 146 + byte 0 , 0 , 0, 147 + byte 62, 60, 0, 148 + byte 0 , 60, 0, 149 + byte 0 , 0 , 0, 150 + byte 0 , 0 , 0, 151 + byte 50, 80, 0, 152 + byte 50, 0 , 0, 153 + byte 0 , 0 , 0, 154 + byte 0 , 0 , 0, 155 + byte 62, 0 , 0, 156 + byte 0 , 0 , 0, 157 + byte 62, 0 , 0, 158 + byte 0 , 0 , 0, 159 + + byte 55, 60, 0, 160 + byte 55, 60, 0, 161 + byte 55, 0 , 0, 162 + byte 0 , 0 , 0, 163 + byte 55, 0 , 0, 164 + byte 0 , 0 , 0, 165 + byte 0 , 0 , 0, 166 + byte 0 , 0 , 0, 167 + byte 65, 80, 0, 168 + byte 0 , 0 , 0, 169 + byte 0 , 0 , 0, 170 + byte 0 , 0 , 0, 171 + byte 55, 0 , 0, 172 + byte 55, 0 , 0, 173 + byte 0 , 0 , 0, 174 + byte 0 , 0 , 0, 175 + byte 55, 60, 0, 176 + byte 0 , 60, 0, 177 + byte 0 , 0 , 0, 178 + byte 0 , 0 , 0, 179 + byte 65, 60, 0, 180 + byte 0 , 60, 0, 181 + byte 0 , 0 , 0, 182 + byte 0 , 0 , 0, 183 + byte 55, 80, 0, 184 + byte 55, 0 , 0, 185 + byte 0 , 0 , 0, 186 + byte 0 , 0 , 0, 187 + byte 62, 80, 0, 188 + byte 0 , 0 , 0, 189 + byte 55, 80, 0, 190 + byte 0 , 0 , 0, 191 + + byte 50, 60, 0, 192 + byte 0 , 60, 0, 193 + byte 50, 0 , 0, 194 + byte 0 , 0 , 0, 195 + byte 50, 0 , 0, 196 + byte 0 , 0 , 0, 197 + byte 0 , 0 , 0, 198 + byte 0 , 0 , 0, 199 + byte 62, 80, 0, 200 + byte 0 , 0 , 0, 201 + byte 0 , 0 , 0, 202 + byte 0 , 0 , 0, 203 + byte 50, 0 , 0, 204 + byte 50, 0 , 0, 205 + byte 0 , 0 , 0, 206 + byte 0 , 0 , 0, 207 + byte 50, 60, 0, 208 + byte 0 , 60, 0, 209 + byte 0 , 0 , 0, 210 + byte 0 , 0 , 0, 211 + byte 62, 60, 0, 212 + byte 0 , 60, 0, 213 + byte 0 , 0 , 0, 214 + byte 0 , 0 , 0, 215 + byte 50, 80, 0, 216 + byte 50, 0 , 0, 217 + byte 0 , 0 , 0, 218 + byte 0 , 0 , 0, 219 + byte 62, 0 , 0, 220 + byte 0 , 0 , 0, 221 + byte 62, 0 , 0, 222 + byte 0 , 0 , 0, 223 + + byte 60, 60, 0, 224 + byte 60, 60, 0, 225 + byte 60, 0 , 0, 226 + byte 0 , 0 , 0, 227 + byte 60, 0 , 0, 228 + byte 0 , 0 , 0, 229 + byte 0 , 0 , 0, 230 + byte 0 , 0 , 0, 231 + byte 67, 80, 0, 232 + byte 0 , 0 , 0, 233 + byte 0 , 0 , 0, 234 + byte 0 , 0 , 0, 235 + byte 60, 0 , 0, 236 + byte 60, 0 , 0, 237 + byte 0 , 0 , 0, 238 + byte 0 , 0 , 0, 239 + byte 55, 60, 0, 240 + byte 0 , 60, 0, 241 + byte 0 , 0 , 0, 242 + byte 0 , 0 , 0, 243 + byte 67, 0 , 0, 244 + byte 0 , 0 , 0, 245 + byte 0 , 60, 0, 246 + byte 0 , 0 , 0, 247 + byte 55, 80, 0, 248 + byte 55, 0 , 0, 249 + byte 0 , 60, 0, 250 + byte 0 , 0 , 0, 251 + byte 67, 80, 0, 252 + byte 0 , 0 , 0, 253 + byte 67, 80, 0, 254 + byte 0 , 0 , 0, 255 +'------------------------------------ + byte 50, 60, 0 , 255 + byte 50, 60, 0 , 128 + byte 50, 0 , 0 , 64 + byte 0 , 0 , 0 , 32 + byte 50, 0 , 0 , 255 + byte 0 , 0 , 0 , 128 + byte 0 , 0 , 0 , 64 + byte 0 , 0 , 0 , 32 + byte 62, 80, 86, 255 + byte 0 , 0 , 86, 128 + byte 0 , 0 , 86, 64 + byte 0 , 0 , 86, 32 + byte 50, 0 , 0 , 255 + byte 50, 0 , 0 , 128 + byte 0 , 0 , 0 , 64 + byte 0 , 0 , 0 , 32 + byte 50, 60, 86, 255 + byte 0 , 60, 86, 128 + byte 0 , 0 , 0 , 64 + byte 0 , 0 , 0 , 32 + byte 62, 60, 93, 255 + byte 0 , 60, 93, 128 + byte 0 , 0 , 93, 64 + byte 0 , 0 , 93, 32 + byte 50, 80, 93, 255 + byte 50, 0 , 93, 128 + byte 0 , 0 , 93, 64 + byte 0 , 0 , 93, 32 + byte 62, 0 , 93, 255 + byte 0 , 0 , 93, 128 + byte 62, 0 , 0 , 255 + byte 0 , 0 , 0 , 128 + + byte 55, 60, 79, 255 + byte 55, 60, 79, 128 + byte 55, 0 , 79, 64 + byte 0 , 0 , 79, 32 + byte 55, 0 , 79, 255 + byte 0 , 0 , 79, 128 + byte 0 , 0 , 79, 64 + byte 0 , 0 , 79, 32 + byte 65, 80, 0 , 255 + byte 0 , 0 , 0 , 128 + byte 0 , 0 , 0 , 64 + byte 0 , 0 , 0 , 32 + byte 55, 0 , 0 , 255 + byte 55, 0 , 0 , 128 + byte 0 , 0 , 0 , 64 + byte 0 , 0 , 0 , 32 + byte 55, 60, 77, 255 + byte 0 , 60, 77, 128 + byte 0 , 0 , 77, 64 + byte 0 , 0 , 77, 32 + byte 65, 60, 77, 255 + byte 0 , 60, 77, 128 + byte 0 , 0 , 0 , 64 + byte 0 , 0 , 0 , 32 + byte 55, 80, 83, 255 + byte 55, 0 , 83, 128 + byte 0 , 0 , 83, 64 + byte 0 , 0 , 83, 32 + byte 62, 80, 0 , 255 + byte 0 , 0 , 0 , 128 + byte 55, 80, 0 , 255 + byte 0 , 0 , 0 , 128 + + byte 50, 60, 81, 255 + byte 0 , 60, 81, 128 + byte 50, 0 , 81, 255 + byte 0 , 0 , 81, 128 + byte 50, 0 , 81, 255 + byte 0 , 0 , 81, 128 + byte 0 , 0 , 81, 64 + byte 0 , 0 , 81, 32 + byte 62, 80, 81, 255 + byte 0 , 0 , 0 , 128 + byte 0 , 0 , 0 , 64 + byte 0 , 0 , 0 , 32 + byte 50, 0 , 79, 255 + byte 50, 0 , 79, 128 + byte 0 , 0 , 79, 64 + byte 0 , 0 , 79, 32 + byte 50, 60, 0 , 255 + byte 0 , 60, 0 , 128 + byte 0 , 0 , 0 , 64 + byte 0 , 0 , 0 , 32 + byte 62, 60, 77, 255 + byte 0 , 60, 77, 128 + byte 0 , 0 , 77, 64 + byte 0 , 0 , 77, 32 + byte 50, 80, 0 , 255 + byte 50, 0 , 0 , 128 + byte 0 , 0 , 0 , 64 + byte 0 , 0 , 0 , 32 + byte 62, 0 , 84, 255 + byte 0 , 0 , 84, 128 + byte 62, 0 , 0 , 255 + byte 0 , 0 , 0 , 128 + + byte 60, 60, 86, 255 + byte 60, 60, 86, 128 + byte 60, 0 , 86, 64 + byte 0 , 0 , 86, 32 + byte 60, 60, 86, 255 + byte 0 , 60, 86, 128 + byte 0 , 0 , 0 , 64 + byte 0 , 0 , 0 , 32 + byte 67, 80, 86, 128 + byte 0 , 0 , 86, 64 + byte 0 , 0 , 0 , 32 + byte 0 , 0 , 0 , 16 + byte 60, 0 , 0 , 255 + byte 60, 0 , 0 , 128 + byte 0 , 0 , 0 , 64 + byte 0 , 0 , 0 , 32 + byte 55, 60, 89, 255 + byte 0 , 60, 89, 128 + byte 0 , 0 , 89, 64 + byte 0 , 0 , 89, 32 + byte 67, 0 , 0 , 255 + byte 0 , 0 , 0 , 128 + byte 0 , 0 , 0 , 64 + byte 0 , 0 , 0 , 32 + byte 55, 80, 88, 255 + byte 55, 0 , 88, 128 + byte 0 , 60, 88, 64 + byte 0 , 0 , 88, 32 + byte 67, 80, 88, 255 + byte 0 , 0 , 88, 128 + byte 67, 80, 88, 255 + byte 0 , 0 , 88, 128 + +'------------------------------------------ + byte 50, 60, 88, 128 + byte 50, 60, 88, 64 + byte 50, 0 , 0 , 32 + byte 0 , 0 , 0 , 16 + byte 50, 0 , 81, 128 + byte 0 , 0 , 81, 64 + byte 0 , 0 , 81, 32 + byte 0 , 0 , 81, 16 + byte 62, 80, 90, 128 + byte 0 , 0 , 89, 64 + byte 0 , 0 , 0 , 32 + byte 0 , 0 , 0 , 16 + byte 50, 0 , 81, 128 + byte 50, 0 , 81, 64 + byte 0 , 0 , 0 , 32 + byte 0 , 0 , 0 , 16 + byte 50, 60, 89, 128 + byte 0 , 60, 88, 64 + byte 0 , 0 , 0 , 32 + byte 0 , 0 , 0 , 16 + byte 62, 60, 89, 128 + byte 0 , 60, 89, 64 + byte 0 , 0 , 0 , 32 + byte 0 , 0 , 0 , 16 + byte 50, 80, 81, 128 + byte 50, 0 , 81, 64 + byte 0 , 0 , 81, 32 + byte 0 , 0 , 81, 16 + byte 62, 0 , 81, 128 + byte 0 , 0 , 81, 64 + byte 62, 0 , 0 , 32 + byte 0 , 0 , 0 , 16 + + byte 55, 60, 84, 128 + byte 55, 60, 84, 64 + byte 55, 0 , 84, 32 + byte 0 , 0 , 84, 16 + byte 55, 0 , 84, 128 + byte 0 , 0 , 84, 64 + byte 0 , 0 , 84, 32 + byte 0 , 0 , 84, 16 + byte 65, 80, 84, 128 + byte 0 , 0 , 0 , 64 + byte 0 , 0 , 0 , 32 + byte 0 , 0 , 0 , 16 + byte 55, 0 , 0 , 128 + byte 55, 0 , 0 , 64 + byte 0 , 0 , 0 , 32 + byte 0 , 0 , 0 , 16 + byte 55, 60, 83, 128 + byte 0 , 60, 83, 64 + byte 0 , 0 , 0 , 32 + byte 0 , 0 , 0 , 16 + byte 65, 60, 0 , 128 + byte 0 , 60, 0 , 64 + byte 0 , 0 , 0 , 32 + byte 0 , 0 , 0 , 16 + byte 55, 80, 79, 128 + byte 55, 0 , 79, 64 + byte 0 , 0 , 0 , 32 + byte 0 , 0 , 0 , 16 + byte 62, 80, 0 , 128 + byte 0 , 0 , 0 , 64 + byte 55, 80, 0 , 128 + byte 0 , 0 , 0 , 64 + + byte 50, 60, 86, 255 + byte 0 , 60, 86, 64 ' + byte 50, 0 , 86, 255 + byte 0 , 0 , 86, 64 + byte 50, 0 , 86, 255 + byte 0 , 0 , 86, 128 + byte 0 , 0 , 86, 64 + byte 0 , 0 , 86, 32 + byte 62, 80, 86, 16 + byte 0 , 0 , 86, 8 + byte 0 , 0 , 86, 4 + byte 0 , 0 , 86, 2 + byte 50, 0 , 0 , 2 + byte 50, 0 , 0 , 4 + byte 0 , 0 , 0 , 16 + byte 0 , 0 , 0 , 32 + byte 50, 60, 0 , 64 + byte 0 , 60, 0 , 128 + byte 0 , 0 , 0 , 192 + byte 0 , 0 , 0 , 255 + byte 62, 60, 82, 255 + byte 0 , 60, 81, 192 + byte 0 , 0 , 81, 150 + byte 0 , 0 , 81, 120 + byte 50, 80, 0 , 100 + byte 50, 0 , 0 , 80 + byte 0 , 0 , 80, 100 + byte 0 , 0 , 79, 120 + byte 62, 0 , 79, 150 + byte 0 , 0 , 79, 192 + byte 62, 0 , 0 , 230 + byte 0 , 0 , 0 , 255 + + byte 60, 60, 82, 255 + byte 60, 60, 81, 248 + byte 60, 0 , 81, 240 + byte 0 , 0 , 81, 232 + byte 60, 60, 81, 224 + byte 0 , 60, 0 , 216 + byte 0 , 0 , 0 , 208 + byte 0 , 0 , 0 , 200 + byte 67, 80, 84, 192 + byte 0 , 0 , 84, 184 + byte 0 , 0 , 0 , 176 + byte 0 , 0 , 0 , 168 + byte 60, 0 , 80, 160 + byte 60, 0 , 79, 152 + byte 0 , 0 , 79, 144 + byte 0 , 0 , 79, 136 + byte 55, 60, 0 , 128 + byte 0 , 60, 0 , 120 + byte 0 , 0 , 0 , 112 + byte 0 , 0 , 0 , 104 + byte 67, 0 , 79, 96 + byte 0 , 0 , 79, 88 + byte 0 , 0 , 0 , 80 + byte 0 , 0 , 0 , 72 + byte 55, 80, 77, 64 + byte 55, 0 , 77, 56 + byte 0 , 60, 0 , 48 + byte 0 , 0 , 0 , 40 + byte 67, 80, 72, 32 + byte 0 , 0 , 72, 24 + byte 67, 80, 72, 16 + byte 0 , 0 , 72, 8 + + byte 255' Song end + +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. │ +└──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ +}} diff --git a/source/regnatix/15-sid2.spin b/source/regnatix/15-sid2.spin new file mode 100644 index 0000000..b6a4953 --- /dev/null +++ b/source/regnatix/15-sid2.spin @@ -0,0 +1,638 @@ +' +' SIDcog demonstartion. +' A minimalistic and stupid play routine playing a stupid little tune. ;) +' + +OBJ + ios: "reg-ios" + +CON + +_CLKMODE = XTAL1 + PLL16X +_XINFREQ = 5_000_000 + +SIDMASK = %00000000_00000000_00000000_00010000 +playRate = 26 'Hz + + +VAR + + + +DAT 'PARAMETER + +PUB main + + ios.start 'ios initialisieren + if (ios.admgetspec & SIDMASK) + play + else + ios.print(@err1) + ios.stop + +PRI play|i, note, channel, musicPointer + 'Lp, Bp, Hp + ios.sid2_setFilterType(true,false,false) 'Enable lowpass filter + + 'Ch1, Ch2, Ch3 + ios.sid2_setFilterMask(true,false,false) 'Enable filter on the bass channel (channel1) + + ios.sid2_setWaveform(0,ios#scog_square) 'Set waveform type on channel1 to Square wave + ios.sid2_setPWM(0,1928) 'Set the pulse width on channel1 to 47:53 + ios.sid2_setADSR(0,2,5,9,6) 'Set Envelope on channel1 + ios.sid2_setWaveform(1,ios#scog_noise) 'Set waveform type on channel2 to Noise (drum sound) + ios.sid2_setADSR(1,0,8,4,7) 'Set Envelope on channel2 + ios.sid2_setWaveform(2,ios#scog_saw) 'Set waveform type on channel2 to Saw wave + ios.sid2_setADSR(2,7,4,8,9) 'Set Envelope on channel3 + ios.sid2_setVolume(15) 'Set volume to max + + musicPointer := -1 + + ios.printnl + repeat + waitcnt(cnt+(clkfreq/playRate)) + repeat channel from 0 to 2 + note := music[++musicPointer] + ios.printhex(note,2) + ios.printchar(":") + + if note == 255 ' Restart tune if note =255 + note := music[musicPointer := 0] + if note ' Note on if note >0 + ios.sid2_noteOn(channel,note2freq(note)) + else + ios.sid2_noteOff(channel) ' Note off if note =0 + + ios.printhex(music[++musicPointer],2) + ios.sid2_setCutoff(music[musicPointer]<<3) ' Update cutoff frequency + ios.printnl + until ios.key + ios.sid_mute(2) + +PUB note2freq(note) | octave + octave := note/12 + note -= octave*12 + return (noteTable[note]>>(8-octave)) + +DAT + +err1 byte 13,"Administra-Code unterstützt keine SID-Emulation!",13,0 + +DAT +noteTable word 16350, 17320, 18350, 19450, 20600, 21830, 23120, 24500, 25960, 27500, 29140, 30870 + +DAT 'sounddaten + + 'Ch1,Ch2,Ch3,cutoff + +music byte 50, 0 , 0, 0 + byte 50, 0 , 0, 1 + byte 50, 0 , 0, 2 + byte 0 , 0 , 0, 3 + byte 50, 0 , 0, 4 + byte 0 , 0 , 0, 5 + byte 0 , 0 , 0, 6 + byte 0 , 0 , 0, 7 + byte 62, 0 , 0, 8 + byte 0 , 0 , 0, 9 + byte 0 , 0 , 0, 10 + byte 0 , 0 , 0, 11 + byte 50, 0 , 0, 12 + byte 50, 0 , 0, 13 + byte 0 , 0 , 0, 14 + byte 0 , 0 , 0, 15 + byte 50, 0 , 0, 16 + byte 0 , 0 , 0, 17 + byte 0 , 0 , 0, 18 + byte 0 , 0 , 0, 19 + byte 62, 0 , 0, 20 + byte 0 , 0 , 0, 21 + byte 0 , 0 , 0, 22 + byte 0 , 0 , 0, 23 + byte 50, 0 , 0, 24 + byte 50, 0 , 0, 25 + byte 0 , 0 , 0, 26 + byte 0 , 0 , 0, 27 + byte 62, 0 , 0, 28 + byte 0 , 0 , 0, 29 + byte 62, 0 , 0, 30 + byte 0 , 0 , 0, 31 + + byte 55, 0 , 0, 32 + byte 55, 0 , 0, 33 + byte 55, 0 , 0, 34 + byte 0 , 0 , 0, 35 + byte 55, 0 , 0, 36 + byte 0 , 0 , 0, 37 + byte 0 , 0 , 0, 38 + byte 0 , 0 , 0, 39 + byte 65, 0 , 0, 40 + byte 0 , 0 , 0, 41 + byte 0 , 0 , 0, 42 + byte 0 , 0 , 0, 43 + byte 55, 0 , 0, 44 + byte 55, 0 , 0, 45 + byte 0 , 0 , 0, 46 + byte 0 , 0 , 0, 47 + byte 55, 0 , 0, 48 + byte 0 , 0 , 0, 49 + byte 0 , 0 , 0, 50 + byte 0 , 0 , 0, 51 + byte 65, 0 , 0, 52 + byte 0 , 0 , 0, 53 + byte 0 , 0 , 0, 54 + byte 0 , 0 , 0, 55 + byte 55, 0 , 0, 56 + byte 55, 0 , 0, 57 + byte 0 , 0 , 0, 58 + byte 0 , 0 , 0, 59 + byte 62, 0 , 0, 60 + byte 0 , 0 , 0, 61 + byte 55, 0 , 0, 62 + byte 0 , 0 , 0, 63 + + byte 50, 0 , 0, 64 + byte 0 , 0 , 0, 65 + byte 50, 0 , 0, 66 + byte 0 , 0 , 0, 67 + byte 50, 0 , 0, 68 + byte 0 , 0 , 0, 69 + byte 0 , 0 , 0, 70 + byte 0 , 0 , 0, 71 + byte 62, 0 , 0, 72 + byte 0 , 0 , 0, 73 + byte 0 , 0 , 0, 74 + byte 0 , 0 , 0, 75 + byte 50, 0 , 0, 76 + byte 50, 0 , 0, 77 + byte 0 , 0 , 0, 78 + byte 0 , 0 , 0, 79 + byte 50, 0 , 0, 80 + byte 0 , 0 , 0, 81 + byte 0 , 0 , 0, 82 + byte 0 , 0 , 0, 83 + byte 62, 0 , 0, 84 + byte 0 , 0 , 0, 85 + byte 0 , 0 , 0, 86 + byte 0 , 0 , 0, 87 + byte 50, 0 , 0, 88 + byte 50, 0 , 0, 89 + byte 0 , 0 , 0, 90 + byte 0 , 0 , 0, 91 + byte 62, 0 , 0, 92 + byte 0 , 0 , 0, 93 + byte 62, 0 , 0, 94 + byte 0 , 0 , 0, 95 + + byte 60, 0 , 0, 96 + byte 60, 0 , 0, 97 + byte 60, 0 , 0, 98 + byte 0 , 0 , 0, 99 + byte 60, 0 , 0, 100 + byte 0 , 0 , 0, 101 + byte 0 , 0 , 0, 102 + byte 0 , 0 , 0, 103 + byte 67, 0 , 0, 104 + byte 0 , 0 , 0, 105 + byte 0 , 0 , 0, 106 + byte 0 , 0 , 0, 107 + byte 60, 0 , 0, 108 + byte 60, 0 , 0, 109 + byte 0 , 0 , 0, 110 + byte 0 , 0 , 0, 111 + byte 55, 0 , 0, 112 + byte 0 , 0 , 0, 113 + byte 0 , 0 , 0, 114 + byte 0 , 0 , 0, 115 + byte 67, 0 , 0, 116 + byte 0 , 0 , 0, 117 + byte 0 , 0 , 0, 118 + byte 0 , 0 , 0, 119 + byte 55, 0 , 0, 120 + byte 55, 0 , 0, 121 + byte 0 , 0 , 0, 122 + byte 0 , 0 , 0, 123 + byte 67, 0 , 0, 124 + byte 0 , 0 , 0, 125 + byte 67, 0 , 0, 126 + byte 0 , 0 , 0, 127 +'------------------------------------ + byte 50, 60, 0, 128 + byte 50, 60, 0, 129 + byte 50, 0 , 0, 130 + byte 0 , 0 , 0, 131 + byte 50, 0 , 0, 132 + byte 0 , 0 , 0, 133 + byte 0 , 0 , 0, 134 + byte 0 , 0 , 0, 135 + byte 62, 80, 0, 136 + byte 0 , 0 , 0, 137 + byte 0 , 0 , 0, 138 + byte 0 , 0 , 0, 139 + byte 50, 0 , 0, 140 + byte 50, 0 , 0, 141 + byte 0 , 0 , 0, 142 + byte 0 , 0 , 0, 143 + byte 50, 60, 0, 144 + byte 0 , 60, 0, 145 + byte 0 , 0 , 0, 146 + byte 0 , 0 , 0, 147 + byte 62, 60, 0, 148 + byte 0 , 60, 0, 149 + byte 0 , 0 , 0, 150 + byte 0 , 0 , 0, 151 + byte 50, 80, 0, 152 + byte 50, 0 , 0, 153 + byte 0 , 0 , 0, 154 + byte 0 , 0 , 0, 155 + byte 62, 0 , 0, 156 + byte 0 , 0 , 0, 157 + byte 62, 0 , 0, 158 + byte 0 , 0 , 0, 159 + + byte 55, 60, 0, 160 + byte 55, 60, 0, 161 + byte 55, 0 , 0, 162 + byte 0 , 0 , 0, 163 + byte 55, 0 , 0, 164 + byte 0 , 0 , 0, 165 + byte 0 , 0 , 0, 166 + byte 0 , 0 , 0, 167 + byte 65, 80, 0, 168 + byte 0 , 0 , 0, 169 + byte 0 , 0 , 0, 170 + byte 0 , 0 , 0, 171 + byte 55, 0 , 0, 172 + byte 55, 0 , 0, 173 + byte 0 , 0 , 0, 174 + byte 0 , 0 , 0, 175 + byte 55, 60, 0, 176 + byte 0 , 60, 0, 177 + byte 0 , 0 , 0, 178 + byte 0 , 0 , 0, 179 + byte 65, 60, 0, 180 + byte 0 , 60, 0, 181 + byte 0 , 0 , 0, 182 + byte 0 , 0 , 0, 183 + byte 55, 80, 0, 184 + byte 55, 0 , 0, 185 + byte 0 , 0 , 0, 186 + byte 0 , 0 , 0, 187 + byte 62, 80, 0, 188 + byte 0 , 0 , 0, 189 + byte 55, 80, 0, 190 + byte 0 , 0 , 0, 191 + + byte 50, 60, 0, 192 + byte 0 , 60, 0, 193 + byte 50, 0 , 0, 194 + byte 0 , 0 , 0, 195 + byte 50, 0 , 0, 196 + byte 0 , 0 , 0, 197 + byte 0 , 0 , 0, 198 + byte 0 , 0 , 0, 199 + byte 62, 80, 0, 200 + byte 0 , 0 , 0, 201 + byte 0 , 0 , 0, 202 + byte 0 , 0 , 0, 203 + byte 50, 0 , 0, 204 + byte 50, 0 , 0, 205 + byte 0 , 0 , 0, 206 + byte 0 , 0 , 0, 207 + byte 50, 60, 0, 208 + byte 0 , 60, 0, 209 + byte 0 , 0 , 0, 210 + byte 0 , 0 , 0, 211 + byte 62, 60, 0, 212 + byte 0 , 60, 0, 213 + byte 0 , 0 , 0, 214 + byte 0 , 0 , 0, 215 + byte 50, 80, 0, 216 + byte 50, 0 , 0, 217 + byte 0 , 0 , 0, 218 + byte 0 , 0 , 0, 219 + byte 62, 0 , 0, 220 + byte 0 , 0 , 0, 221 + byte 62, 0 , 0, 222 + byte 0 , 0 , 0, 223 + + byte 60, 60, 0, 224 + byte 60, 60, 0, 225 + byte 60, 0 , 0, 226 + byte 0 , 0 , 0, 227 + byte 60, 0 , 0, 228 + byte 0 , 0 , 0, 229 + byte 0 , 0 , 0, 230 + byte 0 , 0 , 0, 231 + byte 67, 80, 0, 232 + byte 0 , 0 , 0, 233 + byte 0 , 0 , 0, 234 + byte 0 , 0 , 0, 235 + byte 60, 0 , 0, 236 + byte 60, 0 , 0, 237 + byte 0 , 0 , 0, 238 + byte 0 , 0 , 0, 239 + byte 55, 60, 0, 240 + byte 0 , 60, 0, 241 + byte 0 , 0 , 0, 242 + byte 0 , 0 , 0, 243 + byte 67, 0 , 0, 244 + byte 0 , 0 , 0, 245 + byte 0 , 60, 0, 246 + byte 0 , 0 , 0, 247 + byte 55, 80, 0, 248 + byte 55, 0 , 0, 249 + byte 0 , 60, 0, 250 + byte 0 , 0 , 0, 251 + byte 67, 80, 0, 252 + byte 0 , 0 , 0, 253 + byte 67, 80, 0, 254 + byte 0 , 0 , 0, 255 +'------------------------------------ + byte 50, 60, 0 , 255 + byte 50, 60, 0 , 128 + byte 50, 0 , 0 , 64 + byte 0 , 0 , 0 , 32 + byte 50, 0 , 0 , 255 + byte 0 , 0 , 0 , 128 + byte 0 , 0 , 0 , 64 + byte 0 , 0 , 0 , 32 + byte 62, 80, 86, 255 + byte 0 , 0 , 86, 128 + byte 0 , 0 , 86, 64 + byte 0 , 0 , 86, 32 + byte 50, 0 , 0 , 255 + byte 50, 0 , 0 , 128 + byte 0 , 0 , 0 , 64 + byte 0 , 0 , 0 , 32 + byte 50, 60, 86, 255 + byte 0 , 60, 86, 128 + byte 0 , 0 , 0 , 64 + byte 0 , 0 , 0 , 32 + byte 62, 60, 93, 255 + byte 0 , 60, 93, 128 + byte 0 , 0 , 93, 64 + byte 0 , 0 , 93, 32 + byte 50, 80, 93, 255 + byte 50, 0 , 93, 128 + byte 0 , 0 , 93, 64 + byte 0 , 0 , 93, 32 + byte 62, 0 , 93, 255 + byte 0 , 0 , 93, 128 + byte 62, 0 , 0 , 255 + byte 0 , 0 , 0 , 128 + + byte 55, 60, 79, 255 + byte 55, 60, 79, 128 + byte 55, 0 , 79, 64 + byte 0 , 0 , 79, 32 + byte 55, 0 , 79, 255 + byte 0 , 0 , 79, 128 + byte 0 , 0 , 79, 64 + byte 0 , 0 , 79, 32 + byte 65, 80, 0 , 255 + byte 0 , 0 , 0 , 128 + byte 0 , 0 , 0 , 64 + byte 0 , 0 , 0 , 32 + byte 55, 0 , 0 , 255 + byte 55, 0 , 0 , 128 + byte 0 , 0 , 0 , 64 + byte 0 , 0 , 0 , 32 + byte 55, 60, 77, 255 + byte 0 , 60, 77, 128 + byte 0 , 0 , 77, 64 + byte 0 , 0 , 77, 32 + byte 65, 60, 77, 255 + byte 0 , 60, 77, 128 + byte 0 , 0 , 0 , 64 + byte 0 , 0 , 0 , 32 + byte 55, 80, 83, 255 + byte 55, 0 , 83, 128 + byte 0 , 0 , 83, 64 + byte 0 , 0 , 83, 32 + byte 62, 80, 0 , 255 + byte 0 , 0 , 0 , 128 + byte 55, 80, 0 , 255 + byte 0 , 0 , 0 , 128 + + byte 50, 60, 81, 255 + byte 0 , 60, 81, 128 + byte 50, 0 , 81, 255 + byte 0 , 0 , 81, 128 + byte 50, 0 , 81, 255 + byte 0 , 0 , 81, 128 + byte 0 , 0 , 81, 64 + byte 0 , 0 , 81, 32 + byte 62, 80, 81, 255 + byte 0 , 0 , 0 , 128 + byte 0 , 0 , 0 , 64 + byte 0 , 0 , 0 , 32 + byte 50, 0 , 79, 255 + byte 50, 0 , 79, 128 + byte 0 , 0 , 79, 64 + byte 0 , 0 , 79, 32 + byte 50, 60, 0 , 255 + byte 0 , 60, 0 , 128 + byte 0 , 0 , 0 , 64 + byte 0 , 0 , 0 , 32 + byte 62, 60, 77, 255 + byte 0 , 60, 77, 128 + byte 0 , 0 , 77, 64 + byte 0 , 0 , 77, 32 + byte 50, 80, 0 , 255 + byte 50, 0 , 0 , 128 + byte 0 , 0 , 0 , 64 + byte 0 , 0 , 0 , 32 + byte 62, 0 , 84, 255 + byte 0 , 0 , 84, 128 + byte 62, 0 , 0 , 255 + byte 0 , 0 , 0 , 128 + + byte 60, 60, 86, 255 + byte 60, 60, 86, 128 + byte 60, 0 , 86, 64 + byte 0 , 0 , 86, 32 + byte 60, 60, 86, 255 + byte 0 , 60, 86, 128 + byte 0 , 0 , 0 , 64 + byte 0 , 0 , 0 , 32 + byte 67, 80, 86, 128 + byte 0 , 0 , 86, 64 + byte 0 , 0 , 0 , 32 + byte 0 , 0 , 0 , 16 + byte 60, 0 , 0 , 255 + byte 60, 0 , 0 , 128 + byte 0 , 0 , 0 , 64 + byte 0 , 0 , 0 , 32 + byte 55, 60, 89, 255 + byte 0 , 60, 89, 128 + byte 0 , 0 , 89, 64 + byte 0 , 0 , 89, 32 + byte 67, 0 , 0 , 255 + byte 0 , 0 , 0 , 128 + byte 0 , 0 , 0 , 64 + byte 0 , 0 , 0 , 32 + byte 55, 80, 88, 255 + byte 55, 0 , 88, 128 + byte 0 , 60, 88, 64 + byte 0 , 0 , 88, 32 + byte 67, 80, 88, 255 + byte 0 , 0 , 88, 128 + byte 67, 80, 88, 255 + byte 0 , 0 , 88, 128 + +'------------------------------------------ + byte 50, 60, 88, 128 + byte 50, 60, 88, 64 + byte 50, 0 , 0 , 32 + byte 0 , 0 , 0 , 16 + byte 50, 0 , 81, 128 + byte 0 , 0 , 81, 64 + byte 0 , 0 , 81, 32 + byte 0 , 0 , 81, 16 + byte 62, 80, 90, 128 + byte 0 , 0 , 89, 64 + byte 0 , 0 , 0 , 32 + byte 0 , 0 , 0 , 16 + byte 50, 0 , 81, 128 + byte 50, 0 , 81, 64 + byte 0 , 0 , 0 , 32 + byte 0 , 0 , 0 , 16 + byte 50, 60, 89, 128 + byte 0 , 60, 88, 64 + byte 0 , 0 , 0 , 32 + byte 0 , 0 , 0 , 16 + byte 62, 60, 89, 128 + byte 0 , 60, 89, 64 + byte 0 , 0 , 0 , 32 + byte 0 , 0 , 0 , 16 + byte 50, 80, 81, 128 + byte 50, 0 , 81, 64 + byte 0 , 0 , 81, 32 + byte 0 , 0 , 81, 16 + byte 62, 0 , 81, 128 + byte 0 , 0 , 81, 64 + byte 62, 0 , 0 , 32 + byte 0 , 0 , 0 , 16 + + byte 55, 60, 84, 128 + byte 55, 60, 84, 64 + byte 55, 0 , 84, 32 + byte 0 , 0 , 84, 16 + byte 55, 0 , 84, 128 + byte 0 , 0 , 84, 64 + byte 0 , 0 , 84, 32 + byte 0 , 0 , 84, 16 + byte 65, 80, 84, 128 + byte 0 , 0 , 0 , 64 + byte 0 , 0 , 0 , 32 + byte 0 , 0 , 0 , 16 + byte 55, 0 , 0 , 128 + byte 55, 0 , 0 , 64 + byte 0 , 0 , 0 , 32 + byte 0 , 0 , 0 , 16 + byte 55, 60, 83, 128 + byte 0 , 60, 83, 64 + byte 0 , 0 , 0 , 32 + byte 0 , 0 , 0 , 16 + byte 65, 60, 0 , 128 + byte 0 , 60, 0 , 64 + byte 0 , 0 , 0 , 32 + byte 0 , 0 , 0 , 16 + byte 55, 80, 79, 128 + byte 55, 0 , 79, 64 + byte 0 , 0 , 0 , 32 + byte 0 , 0 , 0 , 16 + byte 62, 80, 0 , 128 + byte 0 , 0 , 0 , 64 + byte 55, 80, 0 , 128 + byte 0 , 0 , 0 , 64 + + byte 50, 60, 86, 255 + byte 0 , 60, 86, 64 ' + byte 50, 0 , 86, 255 + byte 0 , 0 , 86, 64 + byte 50, 0 , 86, 255 + byte 0 , 0 , 86, 128 + byte 0 , 0 , 86, 64 + byte 0 , 0 , 86, 32 + byte 62, 80, 86, 16 + byte 0 , 0 , 86, 8 + byte 0 , 0 , 86, 4 + byte 0 , 0 , 86, 2 + byte 50, 0 , 0 , 2 + byte 50, 0 , 0 , 4 + byte 0 , 0 , 0 , 16 + byte 0 , 0 , 0 , 32 + byte 50, 60, 0 , 64 + byte 0 , 60, 0 , 128 + byte 0 , 0 , 0 , 192 + byte 0 , 0 , 0 , 255 + byte 62, 60, 82, 255 + byte 0 , 60, 81, 192 + byte 0 , 0 , 81, 150 + byte 0 , 0 , 81, 120 + byte 50, 80, 0 , 100 + byte 50, 0 , 0 , 80 + byte 0 , 0 , 80, 100 + byte 0 , 0 , 79, 120 + byte 62, 0 , 79, 150 + byte 0 , 0 , 79, 192 + byte 62, 0 , 0 , 230 + byte 0 , 0 , 0 , 255 + + byte 60, 60, 82, 255 + byte 60, 60, 81, 248 + byte 60, 0 , 81, 240 + byte 0 , 0 , 81, 232 + byte 60, 60, 81, 224 + byte 0 , 60, 0 , 216 + byte 0 , 0 , 0 , 208 + byte 0 , 0 , 0 , 200 + byte 67, 80, 84, 192 + byte 0 , 0 , 84, 184 + byte 0 , 0 , 0 , 176 + byte 0 , 0 , 0 , 168 + byte 60, 0 , 80, 160 + byte 60, 0 , 79, 152 + byte 0 , 0 , 79, 144 + byte 0 , 0 , 79, 136 + byte 55, 60, 0 , 128 + byte 0 , 60, 0 , 120 + byte 0 , 0 , 0 , 112 + byte 0 , 0 , 0 , 104 + byte 67, 0 , 79, 96 + byte 0 , 0 , 79, 88 + byte 0 , 0 , 0 , 80 + byte 0 , 0 , 0 , 72 + byte 55, 80, 77, 64 + byte 55, 0 , 77, 56 + byte 0 , 60, 0 , 48 + byte 0 , 0 , 0 , 40 + byte 67, 80, 72, 32 + byte 0 , 0 , 72, 24 + byte 67, 80, 72, 16 + byte 0 , 0 , 72, 8 + + byte 255' Song end + +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. │ +└──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ +}} diff --git a/source/regnatix/16-hallo.spin b/source/regnatix/16-hallo.spin new file mode 100644 index 0000000..e6cd2fb --- /dev/null +++ b/source/regnatix/16-hallo.spin @@ -0,0 +1,60 @@ +{{ +┌──────────────────────────────────────────────────────────────────────────────────────────────────────┐ +│ 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 : Hallo Hive! +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 + +PUB main | key + + ios.start +' ios.startram 'code für test im ram, sollte bei bin-datei auskommentiert werden + ios.print(string("Wir sind Borg. Widerstand ist zwecklos.")) + ios.stop + +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. │ +└──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ +}} diff --git a/source/regnatix/17-para.spin b/source/regnatix/17-para.spin new file mode 100644 index 0000000..789d198 --- /dev/null +++ b/source/regnatix/17-para.spin @@ -0,0 +1,76 @@ +{{ +┌──────────────────────────────────────────────────────────────────────────────────────────────────────┐ +│ 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 : +Chip : Regnatix +Typ : Programm +Version : +Subversion : +Funktion : Demo der Parameterübergabe +Komponenten : - +COG's : - +Logbuch : +Kommandoliste : +Notizen : + +}} + +OBJ + ios: "reg-ios" + +CON + +_CLKMODE = XTAL1 + PLL16X +_XINFREQ = 5_000_000 + +VAR + +byte parastr[64] + +PUB main | i + + ios.start + ios.parastart + parastr[0] := 0 + i := 0 + repeat while ios.paranext(@parastr) + ios.print(@msg1) + ios.printdec(i++) + ios.print(@msg2) + ios.print(@parastr) + ios.printnl + ios.stop + +DAT + +msg1 byte "Parameter ", 0 +msg2 byte " : ", 0 + +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. │ +└──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ +}} diff --git a/source/regnatix/18-tdemo.spin b/source/regnatix/18-tdemo.spin new file mode 100644 index 0000000..6b76462 --- /dev/null +++ b/source/regnatix/18-tdemo.spin @@ -0,0 +1,82 @@ +CON + + +OBJ + + ios : "reg-ios" + + +PUB start | c,i,j + + ios.start + + ios.printcls + ios.printnl + ios.print(string(" 0123456789ABCDEF0123456789ABCDEF")) + ios.printnl + ios.print(string(" ┌────────────────────────────────┐")) + + repeat i from 0 to 7 + ios.printnl + ios.printhex(i*j,2) + ios.printchar("│") + repeat j from 0 to 31 + ios.printqchar((i*31)+j) + ios.printchar("│") + ios.printnl + ios.print(string(" └────────────────────────────────┘")) + ios.printnl + + ios.curoff + repeat + ios.setcolor(1) + ios.cursetx(3) + ios.cursety(12) + ios.printhex(i++,8) + + ios.setcolor(2) + ios.cursetx(15) + ios.cursety(12) + ios.printhex(cnt,8) + + ios.setcolor(3) + ios.cursetx(27) + ios.cursety(12) + ios.printhex(cnt>>8,8) + + ios.setcolor(5) + ios.cursetx(3) + ios.cursety(13) + ios.printhex(cnt>>2,8) + + ios.setcolor(6) + ios.cursetx(15) + ios.cursety(13) + ios.printhex(cnt>>4,8) + + ios.setcolor(7) + ios.cursetx(27) + ios.cursety(13) + ios.printhex(cnt>>6,8) + + ios.setcolor(4) + ios.printnl + ios.printnl + ios.printtab + ios.print(string("Dec : ")) + ios.printdec(i) + ios.printnl + ios.printtab + ios.print(string("Hex : ")) + ios.printhex(i,8) + ios.printnl + ios.printtab + ios.print(string("Bin : ")) + ios.printbin(i,32) + until ios.key + + ios.setcolor(0) + ios.curon + ios.stop + +