Improve program description.
authorSvjatoslav Agejenko <svjatoslav@svjatoslav.eu>
Mon, 23 Sep 2024 23:04:02 +0000 (02:04 +0300)
committerSvjatoslav Agejenko <svjatoslav@svjatoslav.eu>
Mon, 23 Sep 2024 23:04:02 +0000 (02:04 +0300)
Graphics/Presentations/Artifical Intelligence/tehis.bas
Graphics/Presentations/joulud.bas
Math/valem.bas
run_dosbox.sh

index 876ba9e..6a54940 100644 (file)
@@ -1,12 +1,3 @@
-CHDIR ".\qbasicapps\graphics\presentations\Artificial Intelligence"\r
-\r
-\r
-' AI presentation\r
-' made by Svjatoslav Agejenko\r
-' in 2002\r
-' homepage: svjatoslav.eu\r
-' email:       svjatoslav@svjatoslav.eu\r
\r
 DECLARE SUB sc10 ()\r
 DECLARE SUB sc9 ()\r
 DECLARE SUB sc8 ()\r
@@ -20,16 +11,22 @@ DECLARE SUB getfnt ()
 DECLARE SUB sc4 ()\r
 DECLARE SUB mkback ()\r
 DECLARE SUB sc3 ()\r
-DECLARE SUB calc (x1!, y1!, z1!, x2!, y2!, z2!, x3!, y3!, z3!, c!)\r
+DECLARE SUB calc (tx1!, ty1!, tz1!, tx2!, ty2!, tz2!, tx3!, ty3!, tz3!, c!)\r
 DECLARE SUB getan (x1!, y1!, x2!, y2!, N!)\r
 DECLARE SUB rot (zx!, zy!, x1!, y1!, N!)\r
-DECLARE SUB getcol (x1!, y1!, z1!, x2!, y2!, z2!, x3!, y3!, z3!, c!)\r
-DECLARE SUB fp1 (x1!, y1!, x2!, y2!, x3!, c!)\r
 DECLARE SUB fp (x1!, y1!, x2!, y2!, x3!, y3!, c!)\r
 DECLARE SUB sc2 ()\r
 DECLARE SUB pal (r!, g!, b!, c!)\r
 DECLARE SUB sc1 ()\r
 DECLARE SUB start ()\r
+\r
+\r
+' AI presentation\r
+' made by Svjatoslav Agejenko\r
+' in 2002\r
+' homepage: svjatoslav.eu\r
+' email:        svjatoslav@svjatoslav.eu\r
\r
 DIM SHARED pii\r
 DIM SHARED pi\r
 DIM SHARED angl1, angl2\r
index 0885f09..7dec158 100755 (executable)
-DECLARE SUB playsound (a$)
-DECLARE SUB turnon ()
-DECLARE SUB ellips (x!, y!, s!, v!, t!)
-DECLARE SUB prn (x!, y!, msg$, siz!, col1!)
-DECLARE SUB timerAdd (element!, time!, value!)
-DECLARE SUB timerdisp ()
-DECLARE SUB timerinit ()
-DECLARE SUB timerprocess ()
-DECLARE SUB mo (x!, y!, an!, s!, w!)
-DIM SHARED depth
-DIM SHARED pi
-
-DIM SHARED sh1, sh2, sv1, sv2, hp, vp
-DIM SHARED timerTime(0 TO 50, 0 TO 100)
-DIM SHARED timerValue(0 TO 50, 0 TO 100)
-
-DIM SHARED timerCplace(0 TO 50)
-DIM SHARED timerCtime(0 TO 50)
-DIM SHARED timerCvalue(0 TO 50)
-DIM SHARED timerLast
-
-pi = 3.14128
-
-turnon
-
-SCREEN 7, , , 1
-
-timerinit
-s = 50
-' Main loop label
-2
-s1 = SIN(timerCvalue(1) * 1.3) * .5 + 1.1
-s2 = COS(timerCvalue(1) * 1.3) * .5 + 1.1
-
-frm = frm + 1
-sv1 = 5 * s1
-sv2 = 2
-vp = SIN(timerCvalue(1) * 1.3)
-
-sh1 = 2 * s2
-sh2 = 1.4
-hp = SIN(timerCvalue(1)) * .7
-
-' Draw main object
-mo timerCvalue(2), timerCvalue(3), timerCvalue(4), timerCvalue(0), 0
-
-' Draw ellipses
-ellips 100, timerCvalue(6), timerCvalue(7) + 4, 14, .5
-ellips 100, timerCvalue(6), timerCvalue(7) + 2, 10, .5
-ellips 100, timerCvalue(6), timerCvalue(7), 0, .5
-prn timerCvalue(5), 10, "KHK", 7, 250
-
-' Print messages
-prn timerCvalue(8), 130, "Infotehno-", 2, 0
-prn timerCvalue(8), 150, "   loogia", 2, 0
-
-timerprocess
-LOCATE 1, 1
-'PRINT timerCtime(0)
-IF timerCtime(0) > 26 THEN CHAIN "ray.bas"
-PCOPY 0, 1
-LINE (0, 0)-(319, 199), 15, BF
-GOTO 2
-
-SUB ellips (x, y, s, v, t)
-    ' Draw an ellipse if x and y are positive
-    IF x > 0 THEN
-        IF y > 0 THEN
-            CIRCLE (x, y), s, v, , , t
-            PAINT (x, y), v
-        END IF
-    END IF
-END SUB
-
-SUB mo (x, y, an, s, w)
-    depth = depth + 1
-
-    ' If size is less than .2, skip drawing
-    IF s < .2 THEN GOTO 1
-
-    ' Determine color based on depth
-    IF depth / 2 = depth \ 2 THEN c = 1 ELSE c = 3
-
-    CIRCLE (x, y), s, c
-    PAINT (x, y), c
-
-    IF w <> 1 THEN
-        x1 = SIN(an) * s * 2.5 + x
-        y1 = COS(an) * s * 2.5 + y
-
-        ' Change size based on the value of w
-        IF w = 3 THEN ns = s / sv2 ELSE ns = s / sv1
-
-        mo x1, y1, an + vp, ns, 3
-    END IF
-
-    IF w <> 2 THEN
-        x1 = SIN(an - pi / 2) * s * 2.5 + x
-        y1 = COS(an - pi / 2) * s * 2.5 + y
-
-        ' Change size based on the value of w
-        IF w = 4 THEN ns = s / sh2 ELSE ns = s / sh1
-
-        mo x1, y1, an + hp, ns, 4
-    END IF
-
-    IF w <> 3 THEN
-        x1 = SIN(an - pi) * s * 2.5 + x
-        y1 = COS(an - pi) * s * 2.5 + y
-
-        ' Change size based on the value of w
-        IF w = 1 THEN ns = s / sv2 ELSE ns = s / sv1
-
-        mo x1, y1, an + vp, ns, 1
-    END IF
-
-    IF w <> 4 THEN
-        x1 = SIN(an - pi * 1.5) * s * 2.5 + x
-        y1 = COS(an - pi * 1.5) * s * 2.5 + y
-
-        ' Change size based on the value of w
-        IF w = 2 THEN ns = s / sh2 ELSE ns = s / sh1
-
-        mo x1, y1, an + hp, ns, 2
-    END IF
-
-1
-    depth = depth - 1
-END SUB
-
-SUB playsound (a$)
-    SHELL "c:\progra~1\winamp\winamp.exe " + a$
-    ' Temporarily switch to text mode
-    SCREEN 0
-    ' Switch back to graphics mode
-    SCREEN 7, , , 1
-END SUB
-
-SUB prn (x, y, msg$, siz, col1)
-    IF x < 0 THEN GOTO prn1
-    IF x > 319 THEN GOTO prn1
-
-    DIM bck(10000)
-
-    ' Save a portion of the screen to buffer
-    GET (0, 0)-(100, 7), bck
-
-    LOCATE 1, 1
-    PRINT msg$
-
-    col = col1
-
-    FOR x1 = 0 TO LEN(msg$) * 8 - 1
-        FOR y1 = 0 TO 7
-            IF POINT(x1, y1) > 0 THEN
-                ' Calculate the coordinates for the enlarged character
-                rx = x1 * siz + x
-                ry = y1 * siz + y
-
-                IF col1 > 100 THEN
-                    col = RND * 4 + 10
-
-                    ' Draw a solid box or outlined box based on the color value
-                    IF col1 > 200 THEN
-                        LINE (rx, ry)-(rx + siz - 1, ry + siz - 1), col, B
-                    ELSE
-                        LINE (rx, ry)-(rx + siz - 1, ry + siz - 1), col, BF
-                    END IF
-                END IF
-            END IF
-        NEXT y1
-    NEXT x1
-
-    ' Restore the saved portion of the screen
-    PUT (0, 0), bck, PSET
-prn1:
-END SUB
-
-SUB timerAdd (element, time, value)
-
-    FOR a = 0 TO 100
-        IF (timerTime(element, a) = 0) AND (timerValue(element, a) = 0) THEN GOTO timer3
-    NEXT a
-
-timer3:
-
-    timerTime(element, a) = time
-    timerValue(element, a) = value
-
-END SUB
-
-SUB timerdisp
-    LOCATE 1, 1
-
-    ' Display the current state of timers
-    FOR a = 0 TO 10
-        PRINT timerCplace(a), timerCtime(a), timerCvalue(a)
-    NEXT a
-
-END SUB
-
-SUB timerinit
-    timerLast = TIMER
-
-    paus = 24
-
-    ' Initialize stuff size
-    timerAdd 0, 0, 50
-    timerAdd 0, 7, 10
-    timerAdd 0, 20, 10
-    timerAdd 0, 24, 0
-    timerAdd 0, 1000, 0
-
-    ' Initialize stuff speed
-    timerAdd 1, 0, .1
-    timerAdd 1, 1000, 1000
-
-    ' Initialize stuff X & Y
-    timerAdd 2, 0, 160
-    timerAdd 3, 0, 100
-
-    timerAdd 2, 5, 160
-    timerAdd 3, 5, 100
-
-    timerAdd 2, 9, 280
-    timerAdd 3, 9, 160
-
-    timerAdd 2, 10, 280
-    timerAdd 3, 10, 160
-
-    timerAdd 2, 20, 40
-    timerAdd 3, 20, 160
-
-    timerAdd 2, 1000, 40
-    timerAdd 3, 1000, 160
-
-    ' Initialize stuff rotations
-    timerAdd 4, 0, .1
-    timerAdd 4, 10, .1
-    timerAdd 4, 22, 18
-    timerAdd 4, 2000, 10000
-
-    ' Initialize KHK message X
-
-    timerAdd 5, 0, -1
-    timerAdd 5, 5, -1
-    timerAdd 5, 9, 50
-    timerAdd 5, 10, 30
-    timerAdd 5, paus, 30
-    timerAdd 5, paus + 2, 321
-
-    ' Initialize Ellips Y & radius
-    timerAdd 6, 0, -1
-    timerAdd 6, 4, -1
-    timerAdd 6, 10, 30
-    timerAdd 6, 1000, 50
-
-    timerAdd 7, 0, 1
-    timerAdd 7, 6, 1
-    timerAdd 7, 12, 130
-
-    timerAdd 7, paus, 130
-    timerAdd 7, paus + 2, 1
-
-    ' Initialize "Infotehnoloogia" message
-
-    timerAdd 8, 0, 320
-    timerAdd 8, 11, 320
-    timerAdd 8, 20, 100
-    timerAdd 8, paus, 100
-    timerAdd 8, paus + 1, -1
-
-END SUB
-
-SUB timerprocess
-    timerCurrent = TIMER
-    timerDiff = timerCurrent - timerLast
-    timerLast = timerCurrent
-
-    FOR a = 0 TO 50
-        ctim = timerCtime(a) + timerDiff
-        Cplace = timerCplace(a)
-timer2:
-        IF timerTime(a, Cplace + 1) = -1 THEN
-            ctim = 0
-            Cplace = 0
-        END IF
-
-        ' Update the current time and value of each element
-        IF timerTime(a, Cplace + 1) < ctim THEN
-            IF timerTime(a, Cplace + 1) = 0 THEN
-                timerCvalue(a) = timerValue(a, Cplace)
-                GOTO timer1
-            END IF
-
-            Cplace = Cplace + 1
-            GOTO timer2
-        END IF
-
-        v1 = timerValue(a, Cplace)
-        t1 = timerTime(a, Cplace)
-        v2 = timerValue(a, Cplace + 1)
-        t2 = timerTime(a, Cplace + 1)
-
-        IF v1 = v2 THEN
-            timerCvalue(a) = v1
-        ELSE
-            Tdiff1 = t2 - t1
-            Tdiff2 = ctim - t1
-            Vdiff = v2 - v1
-
-            ' Interpolate the current value
-            timerCvalue(a) = Tdiff2 / Tdiff1 * Vdiff + v1
-        END IF
-timer1:
-        timerCplace(a) = Cplace
-        timerCtime(a) = ctim
-    NEXT a
-
-END SUB
-
-SUB turnon
-    ' Read user input
-    a$ = INPUT$(1)
-
-    ' Play sound
-    playsound "marine.mp3"
-
-    SCREEN 7, , , 1
-
-    FOR x = 0 TO 160 STEP 15
-        LINE (160 - x - 5, 90 - 5)-(160 + x + 5, 110 + 5), 1, BF
-        LINE (160 - x - 3, 90 - 3)-(160 + x + 3, 110 + 3), 3, BF
-        LINE (160 - x, 90)-(160 + x, 110), 15, BF
-
-        PCOPY 0, 1
-        CLS
-        SOUND 0, .5
-    NEXT x
-
-    FOR y = 10 TO 100 STEP 15
-        CLS
-
-        LINE (160 - x - 5, 90 - y - 5)-(160 + x + 5, 110 + y + 5), 1, BF
-        LINE (160 - x - 3, 90 - y - 3)-(160 + x + 3, 110 + y + 3), 3, BF
-        LINE (160 - x, 90 - y)-(160 + x, 110 + y), 15, BF
-
-        PCOPY 0, 1
-        SOUND 0, .5
-    NEXT y
-
-    FOR a = 1 TO 25
-        prn RND * 250, RND * 180, STR$(INT(RND * 2)), 3, 0
-        PCOPY 0, 1
-        SOUND 0, 1
-    NEXT a
-
-    DIM buf(1 TO 1000)
-
-    FOR b = 1 TO 30
-        FOR a = 0 TO 195
-            t = ABS(100 - a)
-
-            IF RND * 50 < t THEN
-                GET (1, a)-(318, a + 1), buf
-
-                ' Randomly shift parts of the screen
-                IF a > 100 THEN
-                    PUT (0, a), buf, PSET
-                ELSE
-                    PUT (2, a), buf, PSET
-                END IF
-            END IF
-        NEXT a
-
-        PCOPY 0, 1
-    'SOUND 0, 1
-    NEXT b
-
-END SUB
\ No newline at end of file
+DECLARE SUB playsound (a$)\r
+DECLARE SUB turnon ()\r
+DECLARE SUB ellips (x!, y!, s!, v!, t!)\r
+DECLARE SUB prn (x!, y!, msg$, siz!, col1!)\r
+DECLARE SUB timerAdd (element!, time!, value!)\r
+DECLARE SUB timerdisp ()\r
+DECLARE SUB timerinit ()\r
+DECLARE SUB timerprocess ()\r
+DECLARE SUB mo (x!, y!, an!, s!, w!)\r
+DIM SHARED depth\r
+DIM SHARED pi\r
+\r
+DIM SHARED sh1, sh2, sv1, sv2, hp, vp\r
+DIM SHARED timerTime(0 TO 50, 0 TO 100)\r
+DIM SHARED timerValue(0 TO 50, 0 TO 100)\r
+\r
+DIM SHARED timerCplace(0 TO 50)\r
+DIM SHARED timerCtime(0 TO 50)\r
+DIM SHARED timerCvalue(0 TO 50)\r
+DIM SHARED timerLast\r
+\r
+pi = 3.14128\r
+\r
+turnon\r
+\r
+SCREEN 7, , , 1\r
+\r
+timerinit\r
+s = 50\r
+' Main loop label\r
+2\r
+s1 = SIN(timerCvalue(1) * 1.3) * .5 + 1.1\r
+s2 = COS(timerCvalue(1) * 1.3) * .5 + 1.1\r
+\r
+frm = frm + 1\r
+sv1 = 5 * s1\r
+sv2 = 2\r
+vp = SIN(timerCvalue(1) * 1.3)\r
+\r
+sh1 = 2 * s2\r
+sh2 = 1.4\r
+hp = SIN(timerCvalue(1)) * .7\r
+\r
+' Draw main object\r
+mo timerCvalue(2), timerCvalue(3), timerCvalue(4), timerCvalue(0), 0\r
+\r
+' Draw ellipses\r
+ellips 100, timerCvalue(6), timerCvalue(7) + 4, 14, .5\r
+ellips 100, timerCvalue(6), timerCvalue(7) + 2, 10, .5\r
+ellips 100, timerCvalue(6), timerCvalue(7), 0, .5\r
+prn timerCvalue(5), 10, "KHK", 7, 250\r
+\r
+' Print messages\r
+prn timerCvalue(8), 130, "Infotehno-", 2, 0\r
+prn timerCvalue(8), 150, "   loogia", 2, 0\r
+\r
+timerprocess\r
+LOCATE 1, 1\r
+'PRINT timerCtime(0)\r
+IF timerCtime(0) > 26 THEN SYSTEM\r
+PCOPY 0, 1\r
+LINE (0, 0)-(319, 199), 15, BF\r
+GOTO 2\r
+\r
+SUB ellips (x, y, s, v, t)\r
+    ' Draw an ellipse if x and y are positive\r
+    IF x > 0 THEN\r
+        IF y > 0 THEN\r
+            CIRCLE (x, y), s, v, , , t\r
+            PAINT (x, y), v\r
+        END IF\r
+    END IF\r
+END SUB\r
+\r
+SUB mo (x, y, an, s, w)\r
+    depth = depth + 1\r
+\r
+    ' If size is less than .2, skip drawing\r
+    IF s < .2 THEN GOTO 1\r
+\r
+    ' Determine color based on depth\r
+    IF depth / 2 = depth \ 2 THEN c = 1 ELSE c = 3\r
+\r
+    CIRCLE (x, y), s, c\r
+    PAINT (x, y), c\r
+\r
+    IF w <> 1 THEN\r
+        x1 = SIN(an) * s * 2.5 + x\r
+        y1 = COS(an) * s * 2.5 + y\r
+\r
+        ' Change size based on the value of w\r
+        IF w = 3 THEN ns = s / sv2 ELSE ns = s / sv1\r
+\r
+        mo x1, y1, an + vp, ns, 3\r
+    END IF\r
+\r
+    IF w <> 2 THEN\r
+        x1 = SIN(an - pi / 2) * s * 2.5 + x\r
+        y1 = COS(an - pi / 2) * s * 2.5 + y\r
+\r
+        ' Change size based on the value of w\r
+        IF w = 4 THEN ns = s / sh2 ELSE ns = s / sh1\r
+\r
+        mo x1, y1, an + hp, ns, 4\r
+    END IF\r
+\r
+    IF w <> 3 THEN\r
+        x1 = SIN(an - pi) * s * 2.5 + x\r
+        y1 = COS(an - pi) * s * 2.5 + y\r
+\r
+        ' Change size based on the value of w\r
+        IF w = 1 THEN ns = s / sv2 ELSE ns = s / sv1\r
+\r
+        mo x1, y1, an + vp, ns, 1\r
+    END IF\r
+\r
+    IF w <> 4 THEN\r
+        x1 = SIN(an - pi * 1.5) * s * 2.5 + x\r
+        y1 = COS(an - pi * 1.5) * s * 2.5 + y\r
+\r
+        ' Change size based on the value of w\r
+        IF w = 2 THEN ns = s / sh2 ELSE ns = s / sh1\r
+\r
+        mo x1, y1, an + hp, ns, 2\r
+    END IF\r
+\r
+1\r
+    depth = depth - 1\r
+END SUB\r
+\r
+SUB playsound (a$)\r
+    SHELL "c:\progra~1\winamp\winamp.exe " + a$\r
+    ' Temporarily switch to text mode\r
+    SCREEN 0\r
+    ' Switch back to graphics mode\r
+    SCREEN 7, , , 1\r
+END SUB\r
+\r
+SUB prn (x, y, msg$, siz, col1)\r
+    IF x < 0 THEN GOTO prn1\r
+    IF x > 319 THEN GOTO prn1\r
+\r
+    DIM bck(10000)\r
+\r
+    ' Save a portion of the screen to buffer\r
+    GET (0, 0)-(100, 7), bck\r
+\r
+    LOCATE 1, 1\r
+    PRINT msg$\r
+\r
+    col = col1\r
+\r
+    FOR x1 = 0 TO LEN(msg$) * 8 - 1\r
+        FOR y1 = 0 TO 7\r
+            IF POINT(x1, y1) > 0 THEN\r
+                ' Calculate the coordinates for the enlarged character\r
+                rx = x1 * siz + x\r
+                ry = y1 * siz + y\r
+\r
+                IF col1 > 100 THEN\r
+                    col = RND * 4 + 10\r
+\r
+                    ' Draw a solid box or outlined box based on the color value\r
+                    IF col1 > 200 THEN\r
+                        LINE (rx, ry)-(rx + siz - 1, ry + siz - 1), col, B\r
+                    ELSE\r
+                        LINE (rx, ry)-(rx + siz - 1, ry + siz - 1), col, BF\r
+                    END IF\r
+                END IF\r
+            END IF\r
+        NEXT y1\r
+    NEXT x1\r
+\r
+    ' Restore the saved portion of the screen\r
+    PUT (0, 0), bck, PSET\r
+prn1:\r
+END SUB\r
+\r
+SUB timerAdd (element, time, value)\r
+\r
+    FOR a = 0 TO 100\r
+        IF (timerTime(element, a) = 0) AND (timerValue(element, a) = 0) THEN GOTO timer3\r
+    NEXT a\r
+\r
+timer3:\r
+\r
+    timerTime(element, a) = time\r
+    timerValue(element, a) = value\r
+\r
+END SUB\r
+\r
+SUB timerdisp\r
+    LOCATE 1, 1\r
+\r
+    ' Display the current state of timers\r
+    FOR a = 0 TO 10\r
+        PRINT timerCplace(a), timerCtime(a), timerCvalue(a)\r
+    NEXT a\r
+\r
+END SUB\r
+\r
+SUB timerinit\r
+    timerLast = TIMER\r
+\r
+    paus = 24\r
+\r
+    ' Initialize stuff size\r
+    timerAdd 0, 0, 50\r
+    timerAdd 0, 7, 10\r
+    timerAdd 0, 20, 10\r
+    timerAdd 0, 24, 0\r
+    timerAdd 0, 1000, 0\r
+\r
+    ' Initialize stuff speed\r
+    timerAdd 1, 0, .1\r
+    timerAdd 1, 1000, 1000\r
+\r
+    ' Initialize stuff X & Y\r
+    timerAdd 2, 0, 160\r
+    timerAdd 3, 0, 100\r
+\r
+    timerAdd 2, 5, 160\r
+    timerAdd 3, 5, 100\r
+\r
+    timerAdd 2, 9, 280\r
+    timerAdd 3, 9, 160\r
+\r
+    timerAdd 2, 10, 280\r
+    timerAdd 3, 10, 160\r
+\r
+    timerAdd 2, 20, 40\r
+    timerAdd 3, 20, 160\r
+\r
+    timerAdd 2, 1000, 40\r
+    timerAdd 3, 1000, 160\r
+\r
+    ' Initialize stuff rotations\r
+    timerAdd 4, 0, .1\r
+    timerAdd 4, 10, .1\r
+    timerAdd 4, 22, 18\r
+    timerAdd 4, 2000, 10000\r
+\r
+    ' Initialize KHK message X\r
+\r
+    timerAdd 5, 0, -1\r
+    timerAdd 5, 5, -1\r
+    timerAdd 5, 9, 50\r
+    timerAdd 5, 10, 30\r
+    timerAdd 5, paus, 30\r
+    timerAdd 5, paus + 2, 321\r
+\r
+    ' Initialize Ellips Y & radius\r
+    timerAdd 6, 0, -1\r
+    timerAdd 6, 4, -1\r
+    timerAdd 6, 10, 30\r
+    timerAdd 6, 1000, 50\r
+\r
+    timerAdd 7, 0, 1\r
+    timerAdd 7, 6, 1\r
+    timerAdd 7, 12, 130\r
+\r
+    timerAdd 7, paus, 130\r
+    timerAdd 7, paus + 2, 1\r
+\r
+    ' Initialize "Infotehnoloogia" message\r
+\r
+    timerAdd 8, 0, 320\r
+    timerAdd 8, 11, 320\r
+    timerAdd 8, 20, 100\r
+    timerAdd 8, paus, 100\r
+    timerAdd 8, paus + 1, -1\r
+\r
+END SUB\r
+\r
+SUB timerprocess\r
+    timerCurrent = TIMER\r
+    timerDiff = timerCurrent - timerLast\r
+    timerLast = timerCurrent\r
+\r
+    FOR a = 0 TO 50\r
+        ctim = timerCtime(a) + timerDiff\r
+        Cplace = timerCplace(a)\r
+timer2:\r
+        IF timerTime(a, Cplace + 1) = -1 THEN\r
+            ctim = 0\r
+            Cplace = 0\r
+        END IF\r
+\r
+        ' Update the current time and value of each element\r
+        IF timerTime(a, Cplace + 1) < ctim THEN\r
+            IF timerTime(a, Cplace + 1) = 0 THEN\r
+                timerCvalue(a) = timerValue(a, Cplace)\r
+                GOTO timer1\r
+            END IF\r
+\r
+            Cplace = Cplace + 1\r
+            GOTO timer2\r
+        END IF\r
+\r
+        v1 = timerValue(a, Cplace)\r
+        t1 = timerTime(a, Cplace)\r
+        v2 = timerValue(a, Cplace + 1)\r
+        t2 = timerTime(a, Cplace + 1)\r
+\r
+        IF v1 = v2 THEN\r
+            timerCvalue(a) = v1\r
+        ELSE\r
+            Tdiff1 = t2 - t1\r
+            Tdiff2 = ctim - t1\r
+            Vdiff = v2 - v1\r
+\r
+            ' Interpolate the current value\r
+            timerCvalue(a) = Tdiff2 / Tdiff1 * Vdiff + v1\r
+        END IF\r
+timer1:\r
+        timerCplace(a) = Cplace\r
+        timerCtime(a) = ctim\r
+    NEXT a\r
+\r
+END SUB\r
+\r
+SUB turnon\r
+    ' Read user input\r
+    a$ = INPUT$(1)\r
+\r
+    ' Play sound\r
+    playsound "marine.mp3"\r
+\r
+    SCREEN 7, , , 1\r
+\r
+    FOR x = 0 TO 160 STEP 15\r
+        LINE (160 - x - 5, 90 - 5)-(160 + x + 5, 110 + 5), 1, BF\r
+        LINE (160 - x - 3, 90 - 3)-(160 + x + 3, 110 + 3), 3, BF\r
+        LINE (160 - x, 90)-(160 + x, 110), 15, BF\r
+\r
+        PCOPY 0, 1\r
+        CLS\r
+        SOUND 0, .5\r
+    NEXT x\r
+\r
+    FOR y = 10 TO 100 STEP 15\r
+        CLS\r
+\r
+        LINE (160 - x - 5, 90 - y - 5)-(160 + x + 5, 110 + y + 5), 1, BF\r
+        LINE (160 - x - 3, 90 - y - 3)-(160 + x + 3, 110 + y + 3), 3, BF\r
+        LINE (160 - x, 90 - y)-(160 + x, 110 + y), 15, BF\r
+\r
+        PCOPY 0, 1\r
+        SOUND 0, .5\r
+    NEXT y\r
+\r
+    FOR a = 1 TO 25\r
+        prn RND * 250, RND * 180, STR$(INT(RND * 2)), 3, 0\r
+        PCOPY 0, 1\r
+        SOUND 0, 1\r
+    NEXT a\r
+\r
+    DIM buf(1 TO 1000)\r
+\r
+    FOR b = 1 TO 30\r
+        FOR a = 0 TO 195\r
+            t = ABS(100 - a)\r
+\r
+            IF RND * 50 < t THEN\r
+                GET (1, a)-(318, a + 1), buf\r
+\r
+                ' Randomly shift parts of the screen\r
+                IF a > 100 THEN\r
+                    PUT (0, a), buf, PSET\r
+                ELSE\r
+                    PUT (2, a), buf, PSET\r
+                END IF\r
+            END IF\r
+        NEXT a\r
+\r
+        PCOPY 0, 1\r
+    'SOUND 0, 1\r
+    NEXT b\r
+\r
+END SUB\r
+\r
index 659c0f0..5f7ca22 100755 (executable)
@@ -1,4 +1,8 @@
 ' Program to perform mathematical computation.\r
+' It tries to compute surface area that is represented by mathematical function.\r
+' Area is divided into small slices and they are added together to form approximate solution.\r
+'\r
+'\r
 ' By Svjatoslav Agejenko.\r
 ' Email: svjatoslav@svjatoslav.eu\r
 ' Homepage: http://www.svjatoslav.eu\r
@@ -27,10 +31,15 @@ NEXT a
 LINE (0, 100)-(319, 100), 10\r
 ste = (p2 - p1) / 319\r
 o = 0\r
+\r
+' for increased precision we subdivide pixels by 20\r
 FOR x = p1 TO p2 STEP ste / 20\r
 \r
+    ' This is the function whose area we are computing.\r
+    ' You can change function here to your own.\r
     y = x ^ 2 - 3 * x\r
-\r
+   \r
+    ' there is also some clipping involved, I think better variable names are needed\r
     u = ABS(INT(x) - x)\r
     IF u >= lu THEN su = 1 ELSE su = 0\r
     lu = u\r
@@ -53,3 +62,4 @@ FOR x = p1 TO p2 STEP ste / 20
 NEXT x\r
 LOCATE 1, 1\r
 PRINT s / (1 / ste) / 20\r
+\r
index a632a8f..12c0b34 100755 (executable)
@@ -1,2 +1,4 @@
 #!/bin/bash
+
+# Run DOSBox with the current directory mounted as C: drive and switch to C: drive on startup.
 dosbox -c "MOUNT C: $(pwd)" -c "C:"