User:RhoSigma/Test: Difference between revisions
Jump to navigation
Jump to search
QB64-PE port of an AmigaBasic example by a740g. German comments translated by RhoSigma.
No edit summary Tag: Reverted |
No edit summary Tag: Reverted |
||
Line 6: | Line 6: | ||
<nowiki> | <nowiki> | ||
{{Text| | {{Text|' Music - AmigaBasic Music/Graphic-Demo --- 20. July 1985|#919191}} | ||
{{Cl|DEFLNG}} A-Z | {{Cl|DEFLNG}} A-Z | ||
Line 21: | Line 21: | ||
{{Cl|GOSUB}} PlaySong | {{Cl|GOSUB}} PlaySong | ||
{{Text| | {{Text|' This ensures all voices have played completely before playing the song again|#919191}} | ||
{{Cl|WHILE}} {{Cl|PLAY (function)|PLAY}}({{Text|0|#F580B1}}) > {{Text|0|#F580B1}} {{Cl|_ORELSE}} {{Cl|PLAY (function)|PLAY}}({{Text|1|#F580B1}}) > {{Text|0|#F580B1}} {{Cl|_ORELSE}} {{Cl|PLAY (function)|PLAY}}({{Text|2|#F580B1}}) > {{Text|0|#F580B1}} {{Cl|_ORELSE}} {{Cl|PLAY (function)|PLAY}}({{Text|3|#F580B1}}) > {{Text|0|#F580B1}} | {{Cl|WHILE}} {{Cl|PLAY (function)|PLAY}}({{Text|0|#F580B1}}) > {{Text|0|#F580B1}} {{Cl|_ORELSE}} {{Cl|PLAY (function)|PLAY}}({{Text|1|#F580B1}}) > {{Text|0|#F580B1}} {{Cl|_ORELSE}} {{Cl|PLAY (function)|PLAY}}({{Text|2|#F580B1}}) > {{Text|0|#F580B1}} {{Cl|_ORELSE}} {{Cl|PLAY (function)|PLAY}}({{Text|3|#F580B1}}) > {{Text|0|#F580B1}} | ||
{{Cl|IF}} {{Cl|_KEYHIT}} = {{Text|27|#F580B1}} {{Cl|THEN}} {{Cl|END}} | {{Cl|IF}} {{Cl|_KEYHIT}} = {{Text|27|#F580B1}} {{Cl|THEN}} {{Cl|END}} | ||
Line 30: | Line 30: | ||
InitGraphics: | InitGraphics: | ||
{{Cl|SCREEN}} {{Text|12|#F580B1}} | {{Cl|SCREEN}} {{Text|12|#F580B1}} | ||
{{Cl|_TITLE}} {{Text| | {{Cl|_TITLE}} {{Text|"AmigaBasic Music/Graphic Demo (QB64-PE port by a740g)"|#FFB100}} | ||
iDraw = {{Text|30|#F580B1}} | iDraw = {{Text|30|#F580B1}} | ||
iErase = {{Text|0|#F580B1}} | iErase = {{Text|0|#F580B1}} | ||
Line 46: | Line 46: | ||
PlaySong: | PlaySong: | ||
{{Text| | {{Text|' Array VO contains the base octave for a voice.|#919191}} | ||
{{Cl|FOR}} v = {{Text|0|#F580B1}} {{Cl|TO}} {{Text|3|#F580B1}} | {{Cl|FOR}} v = {{Text|0|#F580B1}} {{Cl|TO}} {{Text|3|#F580B1}} | ||
{{Cl|READ}} VO(v) | {{Cl|READ}} VO(v) | ||
Line 58: | Line 58: | ||
Fi = {{Text|-1|#F580B1}} | Fi = {{Text|-1|#F580B1}} | ||
{{Cl|READ}} p$ | {{Cl|READ}} p$ | ||
{{Cl|IF}} p$ = {{Text| | {{Cl|IF}} p$ = {{Text|"x"|#FFB100}} {{Cl|THEN}} {{Cl|RETURN}} | ||
{{Cl|FOR}} I = {{Text|1|#F580B1}} {{Cl|TO}} {{Cl|LEN}}(p$) | {{Cl|FOR}} I = {{Text|1|#F580B1}} {{Cl|TO}} {{Cl|LEN}}(p$) | ||
Ci = {{Cl|INSTR}}(C$, {{Cl|MID$ (function)|MID$}}(p$, I, {{Text|1|#F580B1}})) | Ci = {{Cl|INSTR}}(C$, {{Cl|MID$ (function)|MID$}}(p$, I, {{Text|1|#F580B1}})) | ||
Line 64: | Line 64: | ||
{{Cl|IF}} Fi >= {{Text|0|#F580B1}} {{Cl|THEN}} {{Cl|SOUND}} F#(Fi), t#, VOLUME, , , , v: t# = VT#(v) | {{Cl|IF}} Fi >= {{Text|0|#F580B1}} {{Cl|THEN}} {{Cl|SOUND}} F#(Fi), t#, VOLUME, , , , v: t# = VT#(v) | ||
{{Cl|IF}} Ci = {{Text|8|#F580B1}} {{Cl|THEN}} Fi = {{Text|0|#F580B1}} {{Cl|ELSE}} Fi = CF(Ci) + VO(v) | {{Cl|IF}} Ci = {{Text|8|#F580B1}} {{Cl|THEN}} Fi = {{Text|0|#F580B1}} {{Cl|ELSE}} Fi = CF(Ci) + VO(v) | ||
{{Cl|ELSEIF}} Ci < {{Text|11|#F580B1}} {{Cl|THEN}} {{Text| | {{Cl|ELSEIF}} Ci < {{Text|11|#F580B1}} {{Cl|THEN}} {{Text|'# or -|#919191}} | ||
Fi = Fi + CF(Ci) | Fi = Fi + CF(Ci) | ||
{{Cl|ELSEIF}} Ci < {{Text|17|#F580B1}} {{Cl|THEN}} {{Text| | {{Cl|ELSEIF}} Ci < {{Text|17|#F580B1}} {{Cl|THEN}} {{Text|'1 through 8|#919191}} | ||
t# = CT#(Ci) | t# = CT#(Ci) | ||
{{Cl|ELSEIF}} Ci < {{Text|19|#F580B1}} {{Cl|THEN}} {{Text| | {{Cl|ELSEIF}} Ci < {{Text|19|#F580B1}} {{Cl|THEN}} {{Text|'< or >|#919191}} | ||
VO(v) = VO(v) + CF(Ci) | VO(v) = VO(v) + CF(Ci) | ||
{{Cl|ELSE}} {{Text| | {{Cl|ELSE}} {{Text|'ln|#919191}} | ||
I = I + {{Text|1|#F580B1}} | I = I + {{Text|1|#F580B1}} | ||
Ci = {{Cl|INSTR}}(C$, {{Cl|MID$ (function)|MID$}}(p$, I, {{Text|1|#F580B1}})) | Ci = {{Cl|INSTR}}(C$, {{Cl|MID$ (function)|MID$}}(p$, I, {{Text|1|#F580B1}})) | ||
Line 85: | Line 85: | ||
InitSound: | InitSound: | ||
{{Text| | {{Text|' F#() contains frequencies of the chromatic scale.|#919191}} | ||
{{Text| | {{Text|' Note A in octave 0 = F#(12) = 55 Hz.|#919191}} | ||
Log2of27.5# = {{Cl|LOG}}({{Text|27.5#|#F580B1}}) / {{Cl|LOG}}({{Text|2#|#F580B1}}) | Log2of27.5# = {{Cl|LOG}}({{Text|27.5#|#F580B1}}) / {{Cl|LOG}}({{Text|2#|#F580B1}}) | ||
{{Cl|FOR}} x = {{Text|1|#F580B1}} {{Cl|TO}} {{Text|88|#F580B1}} | {{Cl|FOR}} x = {{Text|1|#F580B1}} {{Cl|TO}} {{Text|88|#F580B1}} | ||
Line 92: | Line 92: | ||
{{Cl|NEXT}} x | {{Cl|NEXT}} x | ||
{{Text| | {{Text|' Create the waveform of tones,|#919191}} | ||
{{Text| | {{Text|' determines timbre.|#919191}} | ||
{{Cl|DIM}} Timbre({{Text|255|#F580B1}}) {{Cl|AS}} {{Cl|_BYTE}} | {{Cl|DIM}} Timbre({{Text|255|#F580B1}}) {{Cl|AS}} {{Cl|_BYTE}} | ||
{{Cl|FOR}} I = {{Text|0|#F580B1}} {{Cl|TO}} {{Text|255|#F580B1}} | {{Cl|FOR}} I = {{Text|0|#F580B1}} {{Cl|TO}} {{Text|255|#F580B1}} | ||
Line 99: | Line 99: | ||
{{Cl|NEXT}} I | {{Cl|NEXT}} I | ||
{{Text| | {{Text|' The following DATA rows were created using the following formula.|#919191}} | ||
{{Text| | {{Text|' Reading from these DATAs is faster than calculating the sine 1024 times.|#919191}} | ||
{{Text| | {{Text|' K# = 2 * 3.14159265/256|#919191}} | ||
{{Text| | {{Text|' FOR I = 0 TO 255|#919191}} | ||
{{Text| | {{Text|' Timbre(I) = 31 * (SIN(I * K#) + SIN(2 * I * K#) + SIN(3 * I * K#) + SIN( 4 * I * K#))|#919191}} | ||
{{Text| | {{Text|' NEXT I|#919191}} | ||
{{Cl|DATA}} {{Text|0|#F580B1}},{{Text|8|#F580B1}},{{Text|15|#F580B1}},{{Text|23|#F580B1}},{{Text|30|#F580B1}},{{Text|37|#F580B1}},{{Text|44|#F580B1}},{{Text|51|#F580B1}},{{Text|57|#F580B1}},{{Text|63|#F580B1}},{{Text|69|#F580B1}},{{Text|74|#F580B1}},{{Text|79|#F580B1}},{{Text|83|#F580B1}},{{Text|87|#F580B1}},{{Text|91|#F580B1}} | {{Cl|DATA}} {{Text|0|#F580B1}},{{Text|8|#F580B1}},{{Text|15|#F580B1}},{{Text|23|#F580B1}},{{Text|30|#F580B1}},{{Text|37|#F580B1}},{{Text|44|#F580B1}},{{Text|51|#F580B1}},{{Text|57|#F580B1}},{{Text|63|#F580B1}},{{Text|69|#F580B1}},{{Text|74|#F580B1}},{{Text|79|#F580B1}},{{Text|83|#F580B1}},{{Text|87|#F580B1}},{{Text|91|#F580B1}} | ||
{{Cl|DATA}} {{Text|93|#F580B1}},{{Text|96|#F580B1}},{{Text|98|#F580B1}},{{Text|99|#F580B1}},{{Text|100|#F580B1}},{{Text|100|#F580B1}},{{Text|100|#F580B1}},{{Text|99|#F580B1}},{{Text|98|#F580B1}},{{Text|97|#F580B1}},{{Text|95|#F580B1}},{{Text|92|#F580B1}},{{Text|89|#F580B1}},{{Text|86|#F580B1}},{{Text|83|#F580B1}},{{Text|79|#F580B1}} | {{Cl|DATA}} {{Text|93|#F580B1}},{{Text|96|#F580B1}},{{Text|98|#F580B1}},{{Text|99|#F580B1}},{{Text|100|#F580B1}},{{Text|100|#F580B1}},{{Text|100|#F580B1}},{{Text|99|#F580B1}},{{Text|98|#F580B1}},{{Text|97|#F580B1}},{{Text|95|#F580B1}},{{Text|92|#F580B1}},{{Text|89|#F580B1}},{{Text|86|#F580B1}},{{Text|83|#F580B1}},{{Text|79|#F580B1}} | ||
Line 122: | Line 122: | ||
{{Cl|DATA}} {{Text|-93|#F580B1}},{{Text|-91|#F580B1}},{{Text|-87|#F580B1}},{{Text|-83|#F580B1}},{{Text|-79|#F580B1}},{{Text|-74|#F580B1}},{{Text|-69|#F580B1}},{{Text|-63|#F580B1}},{{Text|-57|#F580B1}},{{Text|-51|#F580B1}},{{Text|-44|#F580B1}},{{Text|-37|#F580B1}},{{Text|-30|#F580B1}},{{Text|-23|#F580B1}},{{Text|-15|#F580B1}},{{Text|-8|#F580B1}} | {{Cl|DATA}} {{Text|-93|#F580B1}},{{Text|-91|#F580B1}},{{Text|-87|#F580B1}},{{Text|-83|#F580B1}},{{Text|-79|#F580B1}},{{Text|-74|#F580B1}},{{Text|-69|#F580B1}},{{Text|-63|#F580B1}},{{Text|-57|#F580B1}},{{Text|-51|#F580B1}},{{Text|-44|#F580B1}},{{Text|-37|#F580B1}},{{Text|-30|#F580B1}},{{Text|-23|#F580B1}},{{Text|-15|#F580B1}},{{Text|-8|#F580B1}} | ||
{{Text| | {{Text|' Set AMIGA PAULA like panning (well mostly)|#919191}} | ||
{{Cl|SOUND}} {{Text|0|#F580B1}}, {{Text|0|#F580B1}}, , {{Text|-0.75!|#F580B1}}, {{Text|10|#F580B1}}, , {{Text|0|#F580B1}} {{Text| | {{Cl|SOUND}} {{Text|0|#F580B1}}, {{Text|0|#F580B1}}, , {{Text|-0.75!|#F580B1}}, {{Text|10|#F580B1}}, , {{Text|0|#F580B1}} {{Text|' pan left|#919191}} | ||
{{Cl|SOUND}} {{Text|0|#F580B1}}, {{Text|0|#F580B1}}, , {{Text|0.75!|#F580B1}}, {{Text|10|#F580B1}}, , {{Text|1|#F580B1}} {{Text| | {{Cl|SOUND}} {{Text|0|#F580B1}}, {{Text|0|#F580B1}}, , {{Text|0.75!|#F580B1}}, {{Text|10|#F580B1}}, , {{Text|1|#F580B1}} {{Text|' pan right|#919191}} | ||
{{Cl|SOUND}} {{Text|0|#F580B1}}, {{Text|0|#F580B1}}, , {{Text|0.75!|#F580B1}}, {{Text|10|#F580B1}}, , {{Text|2|#F580B1}} {{Text| | {{Cl|SOUND}} {{Text|0|#F580B1}}, {{Text|0|#F580B1}}, , {{Text|0.75!|#F580B1}}, {{Text|10|#F580B1}}, , {{Text|2|#F580B1}} {{Text|' pan right|#919191}} | ||
{{Cl|SOUND}} {{Text|0|#F580B1}}, {{Text|0|#F580B1}}, , {{Text|-0.75!|#F580B1}}, {{Text|10|#F580B1}}, , {{Text|3|#F580B1}} {{Text| | {{Cl|SOUND}} {{Text|0|#F580B1}}, {{Text|0|#F580B1}}, , {{Text|-0.75!|#F580B1}}, {{Text|10|#F580B1}}, , {{Text|3|#F580B1}} {{Text|' pan left|#919191}} | ||
{{Cl|_WAVE}} {{Text|0|#F580B1}}, Timbre() | {{Cl|_WAVE}} {{Text|0|#F580B1}}, Timbre() | ||
Line 133: | Line 133: | ||
{{Cl|_WAVE}} {{Text|3|#F580B1}}, Timbre() | {{Cl|_WAVE}} {{Text|3|#F580B1}}, Timbre() | ||
{{Text| | {{Text|' Array CF maps MML commands to frequency indices.|#919191}} | ||
C$ = {{Text| | C$ = {{Text|"cdefgabp#-123468<>l"|#FFB100}} | ||
{{Cl|FOR}} I = {{Text|1|#F580B1}} {{Cl|TO}} {{Text|19|#F580B1}} | {{Cl|FOR}} I = {{Text|1|#F580B1}} {{Cl|TO}} {{Text|19|#F580B1}} | ||
{{Cl|READ}} CF(I) | {{Cl|READ}} CF(I) | ||
Line 140: | Line 140: | ||
{{Cl|DATA}} {{Text|0|#F580B1}},{{Text|2|#F580B1}},{{Text|4|#F580B1}},{{Text|5|#F580B1}},{{Text|7|#F580B1}},{{Text|9|#F580B1}},{{Text|11|#F580B1}},{{Text|0|#F580B1}},{{Text|1|#F580B1}},{{Text|-1|#F580B1}},{{Text|0|#F580B1}},{{Text|0|#F580B1}},{{Text|0|#F580B1}},{{Text|0|#F580B1}},{{Text|0|#F580B1}},{{Text|0|#F580B1}},{{Text|-12|#F580B1}},{{Text|12|#F580B1}},{{Text|0|#F580B1}} | {{Cl|DATA}} {{Text|0|#F580B1}},{{Text|2|#F580B1}},{{Text|4|#F580B1}},{{Text|5|#F580B1}},{{Text|7|#F580B1}},{{Text|9|#F580B1}},{{Text|11|#F580B1}},{{Text|0|#F580B1}},{{Text|1|#F580B1}},{{Text|-1|#F580B1}},{{Text|0|#F580B1}},{{Text|0|#F580B1}},{{Text|0|#F580B1}},{{Text|0|#F580B1}},{{Text|0|#F580B1}},{{Text|0|#F580B1}},{{Text|-12|#F580B1}},{{Text|12|#F580B1}},{{Text|0|#F580B1}} | ||
{{Text| | {{Text|' Array CT# assigns note lengths to MML commands.|#919191}} | ||
{{Cl|FOR}} I = {{Text|1|#F580B1}} {{Cl|TO}} {{Text|18|#F580B1}} | {{Cl|FOR}} I = {{Text|1|#F580B1}} {{Cl|TO}} {{Text|18|#F580B1}} | ||
{{Cl|READ}} CT#(I) | {{Cl|READ}} CT#(I) | ||
{{Cl|NEXT}} I | {{Cl|NEXT}} I | ||
{{Text| | {{Text|' MML commands p1,p2,p3,p4,p6,p8 correspond to pause times 36.4 ... 4.55 units|#919191}} | ||
{{Cl|DATA}} {{Text|0|#F580B1}},{{Text|0|#F580B1}},{{Text|0|#F580B1}},{{Text|0|#F580B1}},{{Text|0|#F580B1}},{{Text|0|#F580B1}},{{Text|0|#F580B1}},{{Text|0|#F580B1}},{{Text|0|#F580B1}},{{Text|0|#F580B1}},{{Text|36.4|#F580B1}},{{Text|18.2|#F580B1}},{{Text|12.133333|#F580B1}},{{Text|9.1|#F580B1}},{{Text|6.0666667|#F580B1}},{{Text|4.55|#F580B1}},{{Text|0|#F580B1}},{{Text|0|#F580B1}},{{Text|0|#F580B1}} | {{Cl|DATA}} {{Text|0|#F580B1}},{{Text|0|#F580B1}},{{Text|0|#F580B1}},{{Text|0|#F580B1}},{{Text|0|#F580B1}},{{Text|0|#F580B1}},{{Text|0|#F580B1}},{{Text|0|#F580B1}},{{Text|0|#F580B1}},{{Text|0|#F580B1}},{{Text|36.4|#F580B1}},{{Text|18.2|#F580B1}},{{Text|12.133333|#F580B1}},{{Text|9.1|#F580B1}},{{Text|6.0666667|#F580B1}},{{Text|4.55|#F580B1}},{{Text|0|#F580B1}},{{Text|0|#F580B1}},{{Text|0|#F580B1}} | ||
{{Cl|RETURN}} | {{Cl|RETURN}} | ||
{{Text| | {{Text|' The music is written in special commands (MML), but as per the Wiki page|#919191}} | ||
{{Text| | {{Text|' below MML not fully implemented here, missing o, v and t commands:|#919191}} | ||
{{Text| | {{Text|' https://en.wikipedia.org/wiki/Music_Macro_Language#Modern_MML|#919191}} | ||
{{Text| | {{Text|' The first 4 numbers are the base octaves (0-7) for each voice.|#919191}} | ||
{{Text| | {{Text|' ln - sets note length for the following notes of this voice:|#919191}} | ||
{{Text| | {{Text|' l1 = whole note, l2 = half note, l4 = quarter note, etc.|#919191}} | ||
{{Text| | {{Text|' > - selects the next higher octave for this voice.|#919191}} | ||
{{Text| | {{Text|' < - selects the next lower octave for this voice.|#919191}} | ||
{{Text| | {{Text|' a to g - play the respective note,|#919191}} | ||
{{Text| | {{Text|' # (sharp) or - (flat) may follow directly.|#919191}} | ||
{{Text| | {{Text|' It may also follow a number to determine the duration of this note.|#919191}} | ||
{{Text| | {{Text|' pn - make a rest/pause length as for note length (ln) above.|#919191}} | ||
Song: | Song: |
Revision as of 14:40, 23 November 2024
ATTENTION
Keep Out - This is my all things MediaWiki Nuke Test Site ...
{{Text|' Music - AmigaBasic Music/Graphic-Demo --- 20. July 1985|#919191}} {{Cl|DEFLNG}} A-Z {{Cl|CONST}} VOLUME! = {{Text|0.25!|#F580B1}} {{Cl|DIM}} F#({{Text|88|#F580B1}}), CF({{Text|19|#F580B1}}), CT#({{Text|19|#F580B1}}) {{Cl|GOSUB}} InitSound {{Cl|GOSUB}} InitGraphics {{Cl|DO}} {{Cl|SOUND|SOUND RESUME}} {{Cl|RESTORE}} Song {{Cl|GOSUB}} PlaySong {{Text|' This ensures all voices have played completely before playing the song again|#919191}} {{Cl|WHILE}} {{Cl|PLAY (function)|PLAY}}({{Text|0|#F580B1}}) > {{Text|0|#F580B1}} {{Cl|_ORELSE}} {{Cl|PLAY (function)|PLAY}}({{Text|1|#F580B1}}) > {{Text|0|#F580B1}} {{Cl|_ORELSE}} {{Cl|PLAY (function)|PLAY}}({{Text|2|#F580B1}}) > {{Text|0|#F580B1}} {{Cl|_ORELSE}} {{Cl|PLAY (function)|PLAY}}({{Text|3|#F580B1}}) > {{Text|0|#F580B1}} {{Cl|IF}} {{Cl|_KEYHIT}} = {{Text|27|#F580B1}} {{Cl|THEN}} {{Cl|END}} {{Cl|_LIMIT}} {{Text|60|#F580B1}} {{Cl|WEND}} {{Cl|LOOP}} InitGraphics: {{Cl|SCREEN}} {{Text|12|#F580B1}} {{Cl|_TITLE}} {{Text|"AmigaBasic Music/Graphic Demo (QB64-PE port by a740g)"|#FFB100}} iDraw = {{Text|30|#F580B1}} iErase = {{Text|0|#F580B1}} {{Cl|ON TIMER(n)|ON TIMER}}({{Text|1|#F580B1}}) {{Cl|GOSUB}} TimeSlice {{Cl|TIMER}} {{Cl|ON}} {{Cl|RETURN}} TimeSlice: {{Cl|FOR}} linestep = {{Text|1|#F580B1}} {{Cl|TO}} {{Text|15|#F580B1}} {{Text|DrawLine|#55FF55}} iDraw, {{Text|1|#F580B1}} {{Text|DrawLine|#55FF55}} iErase, {{Text|0|#F580B1}} {{Cl|_LIMIT}} {{Text|60|#F580B1}} {{Cl|NEXT}} linestep {{Cl|RETURN}} PlaySong: {{Text|' Array VO contains the base octave for a voice.|#919191}} {{Cl|FOR}} v = {{Text|0|#F580B1}} {{Cl|TO}} {{Text|3|#F580B1}} {{Cl|READ}} VO(v) VO(v) = {{Text|12|#F580B1}} * VO(v) + {{Text|3|#F580B1}} {{Cl|NEXT}} v {{Cl|DO}} {{Cl|SOUND|SOUND WAIT}} {{Cl|FOR}} v = {{Text|0|#F580B1}} {{Cl|TO}} {{Text|3|#F580B1}} t# = VT#(v) Fi = {{Text|-1|#F580B1}} {{Cl|READ}} p$ {{Cl|IF}} p$ = {{Text|"x"|#FFB100}} {{Cl|THEN}} {{Cl|RETURN}} {{Cl|FOR}} I = {{Text|1|#F580B1}} {{Cl|TO}} {{Cl|LEN}}(p$) Ci = {{Cl|INSTR}}(C$, {{Cl|MID$ (function)|MID$}}(p$, I, {{Text|1|#F580B1}})) {{Cl|IF}} Ci <= {{Text|8|#F580B1}} {{Cl|THEN}} {{Cl|IF}} Fi >= {{Text|0|#F580B1}} {{Cl|THEN}} {{Cl|SOUND}} F#(Fi), t#, VOLUME, , , , v: t# = VT#(v) {{Cl|IF}} Ci = {{Text|8|#F580B1}} {{Cl|THEN}} Fi = {{Text|0|#F580B1}} {{Cl|ELSE}} Fi = CF(Ci) + VO(v) {{Cl|ELSEIF}} Ci < {{Text|11|#F580B1}} {{Cl|THEN}} {{Text|'# or -|#919191}} Fi = Fi + CF(Ci) {{Cl|ELSEIF}} Ci < {{Text|17|#F580B1}} {{Cl|THEN}} {{Text|'1 through 8|#919191}} t# = CT#(Ci) {{Cl|ELSEIF}} Ci < {{Text|19|#F580B1}} {{Cl|THEN}} {{Text|'< or >|#919191}} VO(v) = VO(v) + CF(Ci) {{Cl|ELSE}} {{Text|'ln|#919191}} I = I + {{Text|1|#F580B1}} Ci = {{Cl|INSTR}}(C$, {{Cl|MID$ (function)|MID$}}(p$, I, {{Text|1|#F580B1}})) VT#(v) = CT#(Ci) {{Cl|IF}} Fi < {{Text|0|#F580B1}} {{Cl|THEN}} t# = VT#(v) {{Cl|END IF}} {{Cl|NEXT}} I {{Cl|IF}} Fi >= {{Text|0|#F580B1}} {{Cl|THEN}} {{Cl|SOUND}} F#(Fi), t#, VOLUME, , , , v {{Cl|NEXT}} v {{Cl|SOUND|SOUND RESUME}} {{Cl|IF}} {{Cl|_KEYHIT}} = {{Text|27|#F580B1}} {{Cl|THEN}} {{Cl|END}} {{Cl|_LIMIT}} {{Text|60|#F580B1}} {{Cl|LOOP}} InitSound: {{Text|' F#() contains frequencies of the chromatic scale.|#919191}} {{Text|' Note A in octave 0 = F#(12) = 55 Hz.|#919191}} Log2of27.5# = {{Cl|LOG}}({{Text|27.5#|#F580B1}}) / {{Cl|LOG}}({{Text|2#|#F580B1}}) {{Cl|FOR}} x = {{Text|1|#F580B1}} {{Cl|TO}} {{Text|88|#F580B1}} F#(x) = {{Text|2|#F580B1}} ^ (Log2of27.5# + x / {{Text|12#|#F580B1}}) {{Cl|NEXT}} x {{Text|' Create the waveform of tones,|#919191}} {{Text|' determines timbre.|#919191}} {{Cl|DIM}} Timbre({{Text|255|#F580B1}}) {{Cl|AS}} {{Cl|_BYTE}} {{Cl|FOR}} I = {{Text|0|#F580B1}} {{Cl|TO}} {{Text|255|#F580B1}} {{Cl|READ}} Timbre(I) {{Cl|NEXT}} I {{Text|' The following DATA rows were created using the following formula.|#919191}} {{Text|' Reading from these DATAs is faster than calculating the sine 1024 times.|#919191}} {{Text|' K# = 2 * 3.14159265/256|#919191}} {{Text|' FOR I = 0 TO 255|#919191}} {{Text|' Timbre(I) = 31 * (SIN(I * K#) + SIN(2 * I * K#) + SIN(3 * I * K#) + SIN( 4 * I * K#))|#919191}} {{Text|' NEXT I|#919191}} {{Cl|DATA}} {{Text|0|#F580B1}},{{Text|8|#F580B1}},{{Text|15|#F580B1}},{{Text|23|#F580B1}},{{Text|30|#F580B1}},{{Text|37|#F580B1}},{{Text|44|#F580B1}},{{Text|51|#F580B1}},{{Text|57|#F580B1}},{{Text|63|#F580B1}},{{Text|69|#F580B1}},{{Text|74|#F580B1}},{{Text|79|#F580B1}},{{Text|83|#F580B1}},{{Text|87|#F580B1}},{{Text|91|#F580B1}} {{Cl|DATA}} {{Text|93|#F580B1}},{{Text|96|#F580B1}},{{Text|98|#F580B1}},{{Text|99|#F580B1}},{{Text|100|#F580B1}},{{Text|100|#F580B1}},{{Text|100|#F580B1}},{{Text|99|#F580B1}},{{Text|98|#F580B1}},{{Text|97|#F580B1}},{{Text|95|#F580B1}},{{Text|92|#F580B1}},{{Text|89|#F580B1}},{{Text|86|#F580B1}},{{Text|83|#F580B1}},{{Text|79|#F580B1}} {{Cl|DATA}} {{Text|75|#F580B1}},{{Text|71|#F580B1}},{{Text|66|#F580B1}},{{Text|62|#F580B1}},{{Text|57|#F580B1}},{{Text|52|#F580B1}},{{Text|48|#F580B1}},{{Text|43|#F580B1}},{{Text|39|#F580B1}},{{Text|34|#F580B1}},{{Text|30|#F580B1}},{{Text|25|#F580B1}},{{Text|21|#F580B1}},{{Text|18|#F580B1}},{{Text|14|#F580B1}},{{Text|11|#F580B1}} {{Cl|DATA}} {{Text|8|#F580B1}},{{Text|5|#F580B1}},{{Text|3|#F580B1}},{{Text|0|#F580B1}},{{Text|-1|#F580B1}},{{Text|-3|#F580B1}},{{Text|-4|#F580B1}},{{Text|-5|#F580B1}},{{Text|-5|#F580B1}},{{Text|-6|#F580B1}},{{Text|-6|#F580B1}},{{Text|-5|#F580B1}},{{Text|-5|#F580B1}},{{Text|-4|#F580B1}},{{Text|-3|#F580B1}},{{Text|-1|#F580B1}} {{Cl|DATA}} {{Text|0|#F580B1}},{{Text|2|#F580B1}},{{Text|3|#F580B1}},{{Text|5|#F580B1}},{{Text|7|#F580B1}},{{Text|9|#F580B1}},{{Text|11|#F580B1}},{{Text|13|#F580B1}},{{Text|15|#F580B1}},{{Text|17|#F580B1}},{{Text|18|#F580B1}},{{Text|20|#F580B1}},{{Text|21|#F580B1}},{{Text|23|#F580B1}},{{Text|24|#F580B1}},{{Text|25|#F580B1}} {{Cl|DATA}} {{Text|26|#F580B1}},{{Text|26|#F580B1}},{{Text|27|#F580B1}},{{Text|27|#F580B1}},{{Text|27|#F580B1}},{{Text|27|#F580B1}},{{Text|27|#F580B1}},{{Text|26|#F580B1}},{{Text|25|#F580B1}},{{Text|24|#F580B1}},{{Text|23|#F580B1}},{{Text|22|#F580B1}},{{Text|20|#F580B1}},{{Text|18|#F580B1}},{{Text|17|#F580B1}},{{Text|15|#F580B1}} {{Cl|DATA}} {{Text|13|#F580B1}},{{Text|11|#F580B1}},{{Text|9|#F580B1}},{{Text|7|#F580B1}},{{Text|5|#F580B1}},{{Text|3|#F580B1}},{{Text|1|#F580B1}},{{Text|-1|#F580B1}},{{Text|-3|#F580B1}},{{Text|-5|#F580B1}},{{Text|-6|#F580B1}},{{Text|-8|#F580B1}},{{Text|-9|#F580B1}},{{Text|-10|#F580B1}},{{Text|-11|#F580B1}},{{Text|-12|#F580B1}} {{Cl|DATA}} {{Text|-12|#F580B1}},{{Text|-13|#F580B1}},{{Text|-13|#F580B1}},{{Text|-13|#F580B1}},{{Text|-13|#F580B1}},{{Text|-13|#F580B1}},{{Text|-12|#F580B1}},{{Text|-11|#F580B1}},{{Text|-11|#F580B1}},{{Text|-10|#F580B1}},{{Text|-8|#F580B1}},{{Text|-7|#F580B1}},{{Text|-6|#F580B1}},{{Text|-4|#F580B1}},{{Text|-3|#F580B1}},{{Text|-2|#F580B1}} {{Cl|DATA}} {{Text|0|#F580B1}},{{Text|2|#F580B1}},{{Text|3|#F580B1}},{{Text|4|#F580B1}},{{Text|6|#F580B1}},{{Text|7|#F580B1}},{{Text|8|#F580B1}},{{Text|10|#F580B1}},{{Text|11|#F580B1}},{{Text|11|#F580B1}},{{Text|12|#F580B1}},{{Text|13|#F580B1}},{{Text|13|#F580B1}},{{Text|13|#F580B1}},{{Text|13|#F580B1}},{{Text|13|#F580B1}} {{Cl|DATA}} {{Text|12|#F580B1}},{{Text|12|#F580B1}},{{Text|11|#F580B1}},{{Text|10|#F580B1}},{{Text|9|#F580B1}},{{Text|8|#F580B1}},{{Text|6|#F580B1}},{{Text|5|#F580B1}},{{Text|3|#F580B1}},{{Text|1|#F580B1}},{{Text|-1|#F580B1}},{{Text|-3|#F580B1}},{{Text|-5|#F580B1}},{{Text|-7|#F580B1}},{{Text|-9|#F580B1}},{{Text|-11|#F580B1}} {{Cl|DATA}} {{Text|-13|#F580B1}},{{Text|-15|#F580B1}},{{Text|-17|#F580B1}},{{Text|-18|#F580B1}},{{Text|-20|#F580B1}},{{Text|-22|#F580B1}},{{Text|-23|#F580B1}},{{Text|-24|#F580B1}},{{Text|-25|#F580B1}},{{Text|-26|#F580B1}},{{Text|-27|#F580B1}},{{Text|-27|#F580B1}},{{Text|-27|#F580B1}},{{Text|-27|#F580B1}},{{Text|-27|#F580B1}},{{Text|-26|#F580B1}} {{Cl|DATA}} {{Text|-26|#F580B1}},{{Text|-25|#F580B1}},{{Text|-24|#F580B1}},{{Text|-23|#F580B1}},{{Text|-21|#F580B1}},{{Text|-20|#F580B1}},{{Text|-18|#F580B1}},{{Text|-17|#F580B1}},{{Text|-15|#F580B1}},{{Text|-13|#F580B1}},{{Text|-11|#F580B1}},{{Text|-9|#F580B1}},{{Text|-7|#F580B1}},{{Text|-5|#F580B1}},{{Text|-3|#F580B1}},{{Text|-2|#F580B1}} {{Cl|DATA}} {{Text|0|#F580B1}},{{Text|1|#F580B1}},{{Text|3|#F580B1}},{{Text|4|#F580B1}},{{Text|5|#F580B1}},{{Text|5|#F580B1}},{{Text|6|#F580B1}},{{Text|6|#F580B1}},{{Text|5|#F580B1}},{{Text|5|#F580B1}},{{Text|4|#F580B1}},{{Text|3|#F580B1}},{{Text|1|#F580B1}},{{Text|0|#F580B1}},{{Text|-3|#F580B1}},{{Text|-5|#F580B1}} {{Cl|DATA}} {{Text|-8|#F580B1}},{{Text|-11|#F580B1}},{{Text|-14|#F580B1}},{{Text|-18|#F580B1}},{{Text|-21|#F580B1}},{{Text|-25|#F580B1}},{{Text|-30|#F580B1}},{{Text|-34|#F580B1}},{{Text|-39|#F580B1}},{{Text|-43|#F580B1}},{{Text|-48|#F580B1}},{{Text|-52|#F580B1}},{{Text|-57|#F580B1}},{{Text|-62|#F580B1}},{{Text|-66|#F580B1}},{{Text|-71|#F580B1}} {{Cl|DATA}} {{Text|-75|#F580B1}},{{Text|-79|#F580B1}},{{Text|-83|#F580B1}},{{Text|-86|#F580B1}},{{Text|-89|#F580B1}},{{Text|-92|#F580B1}},{{Text|-95|#F580B1}},{{Text|-97|#F580B1}},{{Text|-98|#F580B1}},{{Text|-99|#F580B1}},{{Text|-100|#F580B1}},{{Text|-100|#F580B1}},{{Text|-100|#F580B1}},{{Text|-99|#F580B1}},{{Text|-98|#F580B1}},{{Text|-96|#F580B1}} {{Cl|DATA}} {{Text|-93|#F580B1}},{{Text|-91|#F580B1}},{{Text|-87|#F580B1}},{{Text|-83|#F580B1}},{{Text|-79|#F580B1}},{{Text|-74|#F580B1}},{{Text|-69|#F580B1}},{{Text|-63|#F580B1}},{{Text|-57|#F580B1}},{{Text|-51|#F580B1}},{{Text|-44|#F580B1}},{{Text|-37|#F580B1}},{{Text|-30|#F580B1}},{{Text|-23|#F580B1}},{{Text|-15|#F580B1}},{{Text|-8|#F580B1}} {{Text|' Set AMIGA PAULA like panning (well mostly)|#919191}} {{Cl|SOUND}} {{Text|0|#F580B1}}, {{Text|0|#F580B1}}, , {{Text|-0.75!|#F580B1}}, {{Text|10|#F580B1}}, , {{Text|0|#F580B1}} {{Text|' pan left|#919191}} {{Cl|SOUND}} {{Text|0|#F580B1}}, {{Text|0|#F580B1}}, , {{Text|0.75!|#F580B1}}, {{Text|10|#F580B1}}, , {{Text|1|#F580B1}} {{Text|' pan right|#919191}} {{Cl|SOUND}} {{Text|0|#F580B1}}, {{Text|0|#F580B1}}, , {{Text|0.75!|#F580B1}}, {{Text|10|#F580B1}}, , {{Text|2|#F580B1}} {{Text|' pan right|#919191}} {{Cl|SOUND}} {{Text|0|#F580B1}}, {{Text|0|#F580B1}}, , {{Text|-0.75!|#F580B1}}, {{Text|10|#F580B1}}, , {{Text|3|#F580B1}} {{Text|' pan left|#919191}} {{Cl|_WAVE}} {{Text|0|#F580B1}}, Timbre() {{Cl|_WAVE}} {{Text|1|#F580B1}}, Timbre() {{Cl|_WAVE}} {{Text|2|#F580B1}}, Timbre() {{Cl|_WAVE}} {{Text|3|#F580B1}}, Timbre() {{Text|' Array CF maps MML commands to frequency indices.|#919191}} C$ = {{Text|"cdefgabp#-123468<>l"|#FFB100}} {{Cl|FOR}} I = {{Text|1|#F580B1}} {{Cl|TO}} {{Text|19|#F580B1}} {{Cl|READ}} CF(I) {{Cl|NEXT}} I {{Cl|DATA}} {{Text|0|#F580B1}},{{Text|2|#F580B1}},{{Text|4|#F580B1}},{{Text|5|#F580B1}},{{Text|7|#F580B1}},{{Text|9|#F580B1}},{{Text|11|#F580B1}},{{Text|0|#F580B1}},{{Text|1|#F580B1}},{{Text|-1|#F580B1}},{{Text|0|#F580B1}},{{Text|0|#F580B1}},{{Text|0|#F580B1}},{{Text|0|#F580B1}},{{Text|0|#F580B1}},{{Text|0|#F580B1}},{{Text|-12|#F580B1}},{{Text|12|#F580B1}},{{Text|0|#F580B1}} {{Text|' Array CT# assigns note lengths to MML commands.|#919191}} {{Cl|FOR}} I = {{Text|1|#F580B1}} {{Cl|TO}} {{Text|18|#F580B1}} {{Cl|READ}} CT#(I) {{Cl|NEXT}} I {{Text|' MML commands p1,p2,p3,p4,p6,p8 correspond to pause times 36.4 ... 4.55 units|#919191}} {{Cl|DATA}} {{Text|0|#F580B1}},{{Text|0|#F580B1}},{{Text|0|#F580B1}},{{Text|0|#F580B1}},{{Text|0|#F580B1}},{{Text|0|#F580B1}},{{Text|0|#F580B1}},{{Text|0|#F580B1}},{{Text|0|#F580B1}},{{Text|0|#F580B1}},{{Text|36.4|#F580B1}},{{Text|18.2|#F580B1}},{{Text|12.133333|#F580B1}},{{Text|9.1|#F580B1}},{{Text|6.0666667|#F580B1}},{{Text|4.55|#F580B1}},{{Text|0|#F580B1}},{{Text|0|#F580B1}},{{Text|0|#F580B1}} {{Cl|RETURN}} {{Text|' The music is written in special commands (MML), but as per the Wiki page|#919191}} {{Text|' below MML not fully implemented here, missing o, v and t commands:|#919191}} {{Text|' https://en.wikipedia.org/wiki/Music_Macro_Language#Modern_MML|#919191}} {{Text|' The first 4 numbers are the base octaves (0-7) for each voice.|#919191}} {{Text|' ln - sets note length for the following notes of this voice:|#919191}} {{Text|' l1 = whole note, l2 = half note, l4 = quarter note, etc.|#919191}} {{Text|' > - selects the next higher octave for this voice.|#919191}} {{Text|' < - selects the next lower octave for this voice.|#919191}} {{Text|' a to g - play the respective note,|#919191}} {{Text|' # (sharp) or - (flat) may follow directly.|#919191}} {{Text|' It may also follow a number to determine the duration of this note.|#919191}} {{Text|' pn - make a rest/pause length as for note length (ln) above.|#919191}} Song: {{Cl|DATA}} {{Text|1|#F580B1}},{{Text|3|#F580B1}},{{Text|3|#F580B1}},{{Text|3|#F580B1}} {{Cl|DATA}} l2g>ge,l2p2de,l2p2l6g3f#g3a,l6p6gab>dcced {{Cl|DATA}} <b>e<e,ge<b,b3ab3ge3d,dgf#gd<bgab {{Cl|DATA}} ab>c,a>dc,e3f#g3de3<b,>cdedc<babg {{Cl|DATA}} df#d,c<a>f#,a3>da3ga3f#,f#gadf#a>c<ba {{Cl|DATA}} gec,g<g>e,d3f#g3f#g3a,bgab>dcced {{Cl|DATA}} <b>ed,ge<b,b3ab3ge3g,dgf#gd<bgab {{Cl|DATA}} cc#d,>ced,a3f#g3e<a3>c,e>dc<bagdgf# {{Cl|DATA}} <gp3>g6d3<b6,dp2b3g6,<b3>gb3>dg3d,gb>dgd<bgb>d {{Cl|DATA}} g>f#e,d<gg,l2<g1g,l2<b1>c {{Cl|DATA}} f#ed,agf#,a1b,d1d {{Cl|DATA}} ef#g,gag,bag,c1<b {{Cl|DATA}} dp3d6d3d6,f#a3a6>d3d6,al6d3ef#3g,l6adef#aga>c<b {{Cl|DATA}} <d>p3d6d3d6,f#3a6f#3d6<a3>d6,a3>c<a3f#d3f#,>c<af#df#a>c<ba {{Cl|DATA}} gf#e,dde,g3dg3f#g3a,bgab>dcced {{Cl|DATA}} b<b>e,gd<b,b3ag3f#e3g,dgf#gd<bgab {{Cl|DATA}} cd<d,l4>c<a>d<b>c<al2,a3gf#3ga3c,e>dc<bagdgf# {{Cl|DATA}} g>ge,b>de,<b3>dg3f#g3a,gbab>dcced {{Cl|DATA}} <b>e<e,ge<b,b3ab3ge3d,dgf#gd<bgab {{Cl|DATA}} ab>c,a>dc,e3f#g3de3<b,>cdedc<babg {{Cl|DATA}} df#d,c<a>f#,a3>f#a3ga3f#,f#gadf#a>c<ba {{Cl|DATA}} gec,g<g>e,d3f#g3f#g3a,bgab>dcced {{Cl|DATA}} <b>ed,ge<b,b3ab3ge3g,dgf#gd<bgab {{Cl|DATA}} cc#d,>ced,a3f#g3e<a3>c,e>dc<bagdgf# {{Cl|DATA}} <g>f#e,d<gg,l2b1>c,l2g1g {{Cl|DATA}} f#ed,agf#,d1d,a1b {{Cl|DATA}} ef#g,gag,c1<b,bag {{Cl|DATA}} dp3d6d3d6,f#l6a3a>d3d,al6d3ef#3g,l6ddef#aga>c<b {{Cl|DATA}} <dp3>d6d3d6,f#3af#3d<a3>d,a3>c<a3f#d3f#,>c<af#df#a>c<ba {{Cl|DATA}} gf#e,l2dde,l2b1>c,bgab>dcced {{Cl|DATA}} b<b>e,gd<b,d1<b,dgf#gd<bgab {{Cl|DATA}} cd<d,l4>c<a>d<b>c<a,a4b8>c8<ba,e>dc<bagdgf# {{Cl|DATA}} g>ge,l2b>de,l6g3dg3f#g3a,gbab>dcced {{Cl|DATA}} <b>e<e,ge<b,b3ab3ge3d,dgf#gd<bgab {{Cl|DATA}} ab>c,a>dc,e3f#g3de3<b,>cdedc<babg {{Cl|DATA}} df#d,c<a>f#,a3>da3ga3f#,f#gadf#a>c<ba {{Cl|DATA}} gec,g<g>e,d3f#g3f#g3a,bgab>dcced {{Cl|DATA}} <b>ed,ge<b,b3ab3ge3g,dgf#gd<bgab {{Cl|DATA}} cc#d,>ced,a3f#g3e<a3>c,e>dc<bagdgf# {{Cl|DATA}} <gp3>g6f#3e6,dp3g6d3e6,<b3>gb3>dg3<g,gb>dgd<bdb>c# {{Cl|DATA}} dc<b,f#dd,l2a1b,d<def#ag#g#ba {{Cl|DATA}} a>a4g4f4e4,e<a>a,>c1c,a>c<b>c<aecde {{Cl|DATA}} d<b>e,aag#,<bb4>c8d8<b,f>dcd<bg#ef#g# {{Cl|DATA}} a>fd,e<a>f#,al6a3g#a3b,a>c<b>ceddfe {{Cl|DATA}} cfe,afc,>c3<b>c3<af3a,eag#aec<ab>c {{Cl|DATA}} dd#e,df#e,a3g#a3f#<b3>d,fedc<baeag# {{Cl|DATA}} <a>ab,c<ag,>l2c1d,a>ceap3l2d {{Cl|DATA}} >c<ae,>cag,e1e,l6ecdegfgb-a {{Cl|DATA}} fdg,df#g,dd4e8f8d,a>c<b>c<afdef {{Cl|DATA}} cec,geg,l6c3<g>c3<ge3d,egfgec<gab- {{Cl|DATA}} fdg,fag,c3ef3ab3>d,a>c<b>c<afdef {{Cl|DATA}} cp3c6<b3>d6,gp3d6d3d6,c3<g>c3<a>d3<f#,ecdegf#gba {{Cl|DATA}} <g>ge,dde,l2b1>c,bgab>dcced {{Cl|DATA}} <b>e<e,ge<b,d1d,dgf#gd<bgab {{Cl|DATA}} ab>c,a>dc,c<b1,>cdedc<babg {{Cl|DATA}} dp3d6d3d6,cl6<a3a>d3d,l6a3c#d3ef#3g,f#def#aga>c<b {{Cl|DATA}} <dp3>d6d3d6,f#3af#3d<a3>d,a3>c<a3f#d3f#,>c<af#df#a>c<ba {{Cl|DATA}} gf#e,l2dde,l2b1>c,bgab>dcced {{Cl|DATA}} b<b>e,gd<b,d1<b,dgf#gd<bgab {{Cl|DATA}} cd<d,l4>c<a>d<b>c<a,a4b8>c8<ba,e>dc<bagdgf# {{Cl|DATA}} g1g2,l2gp3>g6d3g6,gl6<b3>dg3d,gb>dgd<bgb>a {{Cl|DATA}} g1g2,dp3g6e3c6,<b3g>d3b>c2,fd<bgb>ded<a {{Cl|DATA}} g1g2,<ap3>d6<b3>e6,c3<ab2b3g,f#a>cd<bgegb {{Cl|DATA}} g1g2,<e3a6f#3>a6f#3d6,a2a3f#d3f#,>c<af#df#a>c<ba {{Cl|DATA}} g>ge,dde,g3dg3f#g3a,bgab>dcced {{Cl|DATA}} <b>e<e,ge<b,b3ab3ge3d,dgf#gd<bgab {{Cl|DATA}} ab>c,a>d<c,e3f#g3de3<b,>cdedc<babg {{Cl|DATA}} df#d,c<a>f#,a3>da3ga3f#,f#gadf#a>c<ba {{Cl|DATA}} gec,g<g>e,d3f#g3f#g3a,bgab>dcced {{Cl|DATA}} <b>ed,ge<d,b3ab3ge3g,dgf#gd<bgab {{Cl|DATA}} cc#d,d1d2,a3f#g3e<a3>c,e>dc<bagdgf# {{Cl|DATA}} <g1g2,p2,<b1b2,g1g2 {{Cl|DATA}} p1,p1,p1,p1 {{Cl|DATA}} x {{Cl|SUB}} {{Text|DrawLine|#55FF55}} (iStep, hue) {{Cl|STATIC}} winWidth = {{Cl|_WIDTH (function)|_WIDTH}} winHeight = {{Cl|_HEIGHT}} iStep = (iStep + {{Text|1|#F580B1}}) {{Cl|MOD}} {{Text|60|#F580B1}} side = iStep \ {{Text|15|#F580B1}} I! = (iStep {{Cl|MOD}} {{Text|15|#F580B1}}) / {{Text|15!|#F580B1}} i1! = {{Text|1!|#F580B1}} - I! {{Cl|ON}} side + {{Text|1|#F580B1}} {{Cl|GOSUB}} dl_top, dl_left, dl_bottom, dl_right {{Cl|EXIT SUB}} dl_top: {{Cl|LINE}} (winWidth * I!, {{Text|0|#F580B1}})-(winWidth, winHeight * I!), hue {{Cl|RETURN}} dl_left: {{Cl|LINE}} (winWidth, winHeight * I!)-(winWidth * i1!, winHeight), hue {{Cl|RETURN}} dl_bottom: {{Cl|LINE}} (winWidth * i1!, winHeight)-({{Text|0|#F580B1}}, winHeight * i1!), hue {{Cl|RETURN}} dl_right: {{Cl|LINE}} ({{Text|0|#F580B1}}, winHeight * i1!)-(winWidth * I!, {{Text|0|#F580B1}}), hue {{Cl|RETURN}} {{Cl|END SUB}} |
Something regular