From: Svjatoslav Agejenko Date: Sun, 30 Aug 2026 01:16:24 +0000 (+0300) Subject: docs: caption all screenshots and screencasts with program context X-Git-Url: http://www2.svjatoslav.eu/gitweb/?a=commitdiff_plain;h=1e28b881a429741bc5c4b8c816d13ed80869f914;p=qbasicapps.git docs: caption all screenshots and screencasts with program context - Every gallery image and video in all 16 org files now carries a caption paragraph below it, written from the corresponding program source (algorithms, parameters, controls, exit conditions) - Fix broken media links left by the capture renaming (old "screenshot, N.png" / ".png" targets now point at the " - Screenshot N.png" / "- Screencast N.mp4" files): Interferogram, 3D graph, Galaxy explorer, Maze explorer, Game of life, Truth table, Multiplication trainer, Sine computation, Lottery, Windowing system, Mouse driver - List previously unlisted captures: 3D graph screenshots 0/1 + screencast, Galaxy/Maze explorer screencasts, Multiplication trainer screencast, mousedrv native-res screenshot, school-clock electronics photos (v1 README + v3 tutorial) - Add new gallery sections: Pressed key test (Misc), and a Tutorial category with the qsort3 quicksort visualization --- diff --git a/2D GFX/Animations/index.org b/2D GFX/Animations/index.org index f2a9d17..3389ef6 100644 --- a/2D GFX/Animations/index.org +++ b/2D GFX/Animations/index.org @@ -49,6 +49,15 @@ to surfaces without increasing geometric complexity. #+end_export +The square on the left is the raw height map: random raised dots plus +two diagonal ridges, drawn once in white. To its right the same +surface is re-rendered every frame as a bump-mapped animation — the +small red circle is the light source, whose position follows +overlapping sine waves, and each pixel's brightness (grayscale +palette entries 16-31) is derived from the distance to the light and +the local slope of the height map. The bumps appear to swell and +shade as the light wanders, until any key is pressed. + How It Works: 1. *Surface Generation* : The program starts by generating a height @@ -80,6 +89,16 @@ beautiful structures, reminiscent of natural tree growth patterns. #+attr_html: :class responsive-img [[file:Tree - Screenshot 0.png]] +A finished grayscale fractal tree on a black background. A fat, +bright trunk of overlapping filled circles near the lower right +splits into ever thinner curling branches that taper into tiny hooks. +The program starts from a single branch and doubles the population +six times, giving each offspring a random drift; every branch is then +drawn as a trail of filled circles whose radius decays slightly per +step while the heading slowly turns. The custom 16-step grayscale +palette makes thickness read as brightness, and the tint of each +circle follows the branch angle. + [[file:Tree.bas][Source code]] #+INCLUDE: "Tree.bas" src basic-qb45 @@ -104,6 +123,14 @@ representation of how sine and cosine functions can be used to achieve #+end_export +A tilted square lattice of small white dots on a black background — +a 21×21 grid of points caught mid-rotation. Each frame adds 0.01 +radians to the angle, applies the sine/cosine rotation matrix to +every grid point around the origin, scales the result by seven and +centers it on screen, then redraws each point in white after erasing +its previous position. The lattice keeps spinning smoothly until any +key is pressed. + [[file:2D rotation.bas][Source code]] #+INCLUDE: "2D rotation.bas" src basic-qb45 @@ -127,6 +154,15 @@ colors to create dynamic visual effects in a console environment. #+end_export +Four effects are layered on a single 80×50 text screen. The source +code of mkcircle.bas scrolls upward in dark red, a blue lattice of +asterisks wraps around the screen along sine-driven paths, a wobbling +circle filled with random multicolored characters pulses on the +right, and horizontal and vertical lines of green '#' characters +bounce between the edges, flashing brighter where they cross an +asterisk. The whole composition keeps running until any key is +pressed. + [[file:text mode animation.bas][Source code]] * Snowfall @@ -151,6 +187,15 @@ physics simulations and graphical programming. #+end_export +White snowflake pixels drift down a black sky and pile up on a giant +wobbly cyan "SNOW" sign at the bottom of the screen. The program +animates 500 particles, each falling one pixel per step with a small +random sideways jitter; a POINT-based collision check detects when a +flake lands on the sign, on a settled flake, or on the ground, at +which moment it turns bright white and a fresh flake respawns at the +top. The sign itself is built by printing "SNOW" in text mode and +re-rendering each letter pixel as a wavy cyan block. + What's in it for the Reader? @@ -192,6 +237,15 @@ engaging visual effects. #+end_export +Hundreds of thin rainbow-colored straight lines weave an elliptical, +eye-shaped string-art envelope on a black background. Each frame +draws about 200 lines between two points that travel along sine and +cosine curves at different speeds, so the envelope slowly morphs and +rotates; the line color cycles through the palette, producing the +rainbow gradient. Drawing happens on a hidden video page that is +copied to the screen with PCOPY, keeping the motion flicker-free +until any key is pressed. + [[file:Screensaver.bas][Source code]] #+INCLUDE: "Screensaver.bas" src basic-qb45 @@ -216,6 +270,15 @@ personal computing. #+end_export +Ten fan-shaped bundles of straight lines drift and twirl on a black +background, each fan radiating eleven spokes from a single moving +anchor point. Every anchor glides along its own sine/cosine path +while the spread and tilt of its spokes are modulated by further sine +waves, making the fans open, close and sweep like folding hand fans. +The VGA palette registers themselves are reprogrammed every frame, so +the colors continuously glide through greens, blues, yellows and +reds. Drawing is double-buffered with PCOPY; any key exits. + [[file:Screensaver, flying hand fans.bas][Source code]] #+INCLUDE: "Screensaver, flying hand fans.bas" src basic-qb45 @@ -239,6 +302,15 @@ rendering geometric shapes and handling randomness. #+end_export +The screen is gradually papered over with overlapping flat-shaded +triangles in vivid random colors — cyan, red, yellow, magenta and +olive among them. Every iteration picks three random vertices and +fills the triangle with a random palette color using a home-grown +scanline filler: each edge is walked vertically while its +x-coordinate is buffered per scanline, and horizontal spans are drawn +between the stored and the current edge position. Triangles keep +piling up at a steady pace until any key is pressed. + [[file:Polygon.bas][Source code]] #+INCLUDE: "Polygon.bas" src basic-qb45 @@ -262,6 +334,19 @@ textures are applied to polygons. #+end_export +A spirograph-like ring of triangles swept around the screen center: +the rotating demo draws one textured triangle per step, and because +the screen is never cleared between frames the traces accumulate into +a toothed wheel. Each triangle is filled not with a flat color but +with a sample texture of random colored circles prepared at startup, +stretched and sheared differently in every triangle. The mapper works +scanline by scanline — polygon edges are walked while texture +coordinates are interpolated alongside, then horizontal spans copy +pixels straight out of the texture image. Earlier frames of the +screencast show a single textured triangle jumping to random +positions; later ones keep the triangle fixed and rotate the texture +coordinates instead. + [[file:Polygon textured.bas][Source code]] * Yin and yang animation @@ -285,6 +370,15 @@ important for cohesion of the whole. #+end_export +The classic yin-yang symbol on a deep blue background, slowly +rotating. The symbol is composed from just two circles orbiting the +center in opposite phase, each drawn as a stack of concentric rings: +the outer half of the stack takes one color and the inner half the +opposite, so as the two circles sweep over the screen the +interlocking teardrop shapes emerge. One circle is black-on-white, +the other white-on-black, and the angle advances by 0.05 radians per +frame until any key is pressed. + [[file:Yin and yang.bas][Source code]] #+INCLUDE: "Yin and yang.bas" src basic-qb45 @@ -308,6 +402,16 @@ mesmerizing effect. #+end_export +A starburst of colored filled circles on a black background, each +tethered to the screen center by a thin line of the same color. +Fifty particles with random colors, radii and phases orbit the +middle: the horizontal position follows the sine of the particle's +angle while the circle's radius is scaled by the cosine of that same +angle, so a particle swells as it swings toward the viewer and +shrinks as it recedes — a cheap pseudo-3D orbit effect. Every angle +advances by 0.1 per frame and the animation runs until any key is +pressed. + [[file:Orbiting particles.bas][Source code]] #+INCLUDE: "Orbiting particles.bas" src basic-qb45 @@ -329,6 +433,16 @@ resembles animation as seen in the movies :) #+end_export +A cartoon DNA double helix on a black background: two intertwining +strands of cyan and red spheres twist down the screen, cross-linked +by white horizontal rungs. Each frame places twenty points per strand +along phase-shifted sine waves and rotates the pair by 0.1 radians; +a pseudo-depth value picks both the sphere's radius and the order in +which it is drawn, so closer spheres appear larger and overlap the +distant ones, faking 3D. The frame is assembled on a hidden video +page and flipped on screen with PCOPY; the helix keeps spinning until +any key is pressed. + [[file:DNA.bas][Source code]] #+INCLUDE: "DNA.bas" src basic-qb45 @@ -349,6 +463,15 @@ Effect inspired by "The Matrix" movie. #+end_export +Green angular glyphs rain down a black screen in vertical streams, +each stream head glowing bright while the trail behind fades through +darker greens. The glyphs are nine home-drawn rune shapes that the +program renders with LINE, anti-aliases with a recursive +pixel-smoothing pass and captures into sprite arrays with GET; eight +streams then walk down a 19×14 grid, and every cell ages through +three pre-rendered brightness variants before being erased. The +frame rate is throttled with a TIMER busy-wait; any key exits. + [[file:matrix.bas][Source code]] * Matrix - the opening scene @@ -371,6 +494,17 @@ sure the line is clear?" appear as the decoding progresses. #+end_export +A green-on-black terminal re-enacting the phone-trace scene: at the +top a number is decoded digit by digit — "11 4867" has been revealed +so far — next to the taunting message "Are you sure the line is +clear?", while the rest of the screen fills with endlessly cascading +random digits. Every hundred frames one more digit of the code is +locked into a random position and the remaining length shortens; the +message changes as the trace progresses, and once it has fully played +out the program exits. The cascade itself is just one fresh line of +random digits printed each frame at the bottom of a scrolling +viewport, accompanied by a pulsing high-pitch tone. + [[file:matrix2.bas][Source code]] * Hacker @@ -391,6 +525,18 @@ a waterfall of knowledge across thy monitor. #+end_export +A 40×25 wall of green alphanumeric gibberish scrolls downward in +several intensities of green, with single characters mutating as they +go — the essence of every movie hacking scene. Each frame shifts the +whole character buffer down one row and wraps the top row around to +the bottom, then cycles through eight actions: replacing random +characters, painting horizontal and vertical streaks in brighter +greens, letting colors decay one step, resetting every other row or +column, and peppering random cells with color. A custom five-shade +green palette is programmed straight into the VGA palette registers, +and a rotating sound array produces the clicking beeps. The +animation runs until any key is pressed. + [[file:hacker.bas][Source code]] * Circular patterns @@ -414,6 +560,15 @@ the circular pattern. #+end_export +A black-and-white field of concentric rings radiating from several +bright "atom" centers, their ripples interfering into moiré fringes. +The whole picture comes from a single formula evaluated per pixel — +sin((x² + y²) / 10) * 6 + 23, clamped to palette entries 16-31 — +with x and y measured in a coordinate window that shrinks every frame +as the zoom factor is divided by 1.1. The result is a continuous +dive into the circular interference pattern, and the program stops on +its own once the zoom factor drops below 5. + [[file:circular patterns.bas][Source code]] * Sun, earth and moon @@ -436,6 +591,17 @@ Z-sorting. #+end_export +A big red sun sits left of center on a black background while a +small blue earth circles it, an even smaller yellow moon in tow. The +earth follows a flattened elliptical orbit driven by sine and cosine +of a slowly advancing angle, and both its size and the moon's scale +with the y-coordinate to fake perspective — bodies nearer the bottom +of the screen are drawn larger. Instead of real Z-sorting the +program simply checks whether the earth is below or above the sun's +center line (and likewise moon versus earth) to pick the drawing +order, so the bodies correctly pass in front of and behind each +other. + [[file:sun&eart.bas][Source code]] * Maze @@ -459,6 +625,16 @@ are drawn. #+end_export +Colored wireframe segments streak across a black void — an early +frame of a 3D maze that grows one segment per frame. Each step +extends the path along a randomly chosen axis by a random amount and +gives the new segment a random color, while the camera position and +both rotation angles drift on sine waves. Every point is rotated +around two axes, projected with perspective division, and any segment +with an endpoint behind the viewer is skipped entirely. Frames are +drawn on a hidden video page and flipped with PCOPY; the program +stops by itself after 1200 frames. + [[file:maze.BAS][Source code]] * Fancy text mode animations @@ -482,4 +658,14 @@ horizontal lines bouncing between the screen edges. #+end_export +An 80×50 text screen layered with several effects at once: the +program's own source code scrolls upward in dark red, a woven blue +lattice of asterisks crawls across the screen along sine-driven +paths, and horizontal plus vertical lines of green '#' characters +bounce between the screen edges, glowing brighter where they cross an +asterisk. A wobbling circle filled with random multicolored +characters periodically swells into view on top of it all. Each frame +is composed in an off-screen buffer and printed in a single pass; any +key exits. + [[file:mkcircle.bas][Source code]] diff --git a/2D GFX/Fractals/index.org b/2D GFX/Fractals/index.org index 27d94c8..6a85c32 100644 --- a/2D GFX/Fractals/index.org +++ b/2D GFX/Fractals/index.org @@ -42,6 +42,15 @@ geometry, recursive programming, and graphical design. #+attr_latex: :width 1000px [[file:fractal circles.bas][file:fractal%20circles%20-%20Screenshot%200.png]] +A single finished spiral fractal. The recursion starts with the large +white circle in the center; every circle then sprouts up to three +child circles (the direction pointing back at the parent is skipped), +placed 2.5 radii away at a steadily increasing angle, which is what +curls the chains into spirals. Children shrink by a +direction-dependent divisor (5, 2 or 1.4), colors alternate between +white on even recursion depths and light green on odd ones, and the +recursion stops once the radius drops below 0.2 pixels. + - Color and Depth :: The color of each circle alternates based on the recursion depth, adding visual complexity to the fractal. - Termination Condition :: The recursion terminates when the size of @@ -67,6 +76,18 @@ system to control the animation's progression. #+end_export + +The same circle-spiral recursion as the static version, but here every +parameter is animated by a keyframe timer system: arrays of (time, +value) pairs are linearly interpolated each frame (processTimers) and +drive the spiral's position, size and twist angle, the sine-modulated +branch scale factors, the two stacked ellipses in the upper left +(yellow rim, green and dark cores), and the sliding "KHK" and +"Infotehno-loogia" labels built from small colored squares. Each frame +is drawn on an off-screen video page and flipped in with PCOPY onto a +solid white background; the demo terminates by itself when its +timeline runs past 26 seconds. + [[file:fractal circles animated.bas][Source code]] * Fractal of squares @@ -80,10 +101,21 @@ This QBasic program generates and displays a fractal pattern composed of squares #+attr_latex: :width 1000px [[file:fractal squares.bas][file:fractal%20squares%20-%20Screenshot%200.png]] +The first phase of the program: a single square fractal in one light +green color. Every outlined square recursively places another square +at each of its four corners with the size divided by 2.3, and the +recursion continues until the squares shrink below one pixel. + #+attr_html: :class responsive-img #+attr_latex: :width 1000px [[file:fractal squares.bas][file:fractal%20squares%20-%20Screenshot%201.png]] +The second phase: after clearing the screen, the program overlays 26 +of these square fractals on the same spot, growing the root size from +1 to 128 in steps of 5 and picking a new random color (in the 7-14 +range) for each pass. The superimposed corner-recursions interfere +with each other and produce the dense rainbow moiré cloud. + * Fractal of squares animated :PROPERTIES: :CUSTOM_ID: fractal-of-squares-animated @@ -103,6 +135,14 @@ resulting in a dynamic and ever-changing geometric pattern. #+end_export +Every frame redraws the corner-recursing square fractal with filled +boxes whose color encodes the current recursion depth. The four corner +divisors are independent sine waves with different periods (19, 12, 17 +and 22 frames), so each diagonal branch shrinks at its own slowly +changing rate and the pattern keeps pulsing and leaning +asymmetrically. Frames are double-buffered with PCOPY in SCREEN 7, and +any key press exits the program. + [[file:fractal squares animated.bas][Source code]] * Fractal of trees @@ -123,5 +163,14 @@ resembles a tree, with branches that grow and change over time. #+end_export +An animated ternary tree drawn with plain white lines on black: every +node sprouts three branches (up-left, up-right and straight up) and +recurses into the three tips with reduced length. Three sine-driven +modifiers with different periods (19, 12 and 17 frames) control how +fast each branch shrinks, while six additional sine oscillators +continuously bend the two side-branch vectors, so the whole tree +sways, folds and regrows like in wind. Double-buffered with PCOPY; any +key press exits. + [[file:fractal trees.bas][Source code]] diff --git a/2D GFX/Spirals/index.org b/2D GFX/Spirals/index.org index cb8a4ff..361f8d7 100644 --- a/2D GFX/Spirals/index.org +++ b/2D GFX/Spirals/index.org @@ -95,6 +95,16 @@ then in the next step the points are connected using lines: #+attr_latex: :width 1000px [[file:spiral, 4 - Screenshot 0.png]] +The screenshot shows the first stage of the program: a point +cloud plotted with PSET before any key is pressed. Four spiral +arms are generated one after another, each with a halved scale +factor (InitialSize divided by 1, 2, 4 and 8) and its own +vertical offset, so the dots trace nested spherical shells +stacked on top of each other, with small ellipses at the poles. +After a key press the screen is cleared and every stored point +is connected with LINE to its neighbor and to the point 42 +positions ahead, turning the cloud into a wireframe mesh. + [[file:spiral, 4.bas]] #+INCLUDE: "spiral, 4.bas" src basic-qb45 diff --git a/2D GFX/Textures/index.org b/2D GFX/Textures/index.org index 1bc383f..1ac18ab 100644 --- a/2D GFX/Textures/index.org +++ b/2D GFX/Textures/index.org @@ -52,6 +52,16 @@ algorithms can produce intricate and visually appealing results. #+attr_html: :class responsive-img #+attr_latex: :width 1000px [[file:Circular waves - Screenshot 0.png]] + +The screen is filled with a repeating grid of concentric rings, +like ripples tiled across the surface. Each pixel's color comes +from SIN((x^2 + y^2) / 10) * 10, clamped to the 0-15 range and +shifted by 16 to reach into the upper palette. Because the +squared distance grows quickly, the sine oscillates faster and +faster away from the origin, and the discrete pixel grid aliases +these rapid oscillations into the regular moire-like clusters of +rings seen here. + [[file:Circular waves.bas][Source code]] #+INCLUDE: "Circular waves.bas" src basic-qb45 @@ -69,6 +79,17 @@ textures in computer graphics. #+attr_html: :class responsive-img #+attr_latex: :width 1000px [[file:Diamond square clouds - Screenshot 0.png]] + +Soft bluish cloud blotches emerge from the black background, +their bright misty cores fading into darkness. The palette is +custom-programmed so that blue dominates while red and green are +scaled down, giving the fractal its cold, smoky tone. The +algorithm starts with a coarse 256-pixel grid and halves the +scale on every pass: each midpoint and edge center receives the +average of its neighbors plus a random displacement proportional +to the current scale, clamped to a maximum lightness of 127, so +large features appear first and finer detail layers on top. + [[file:Diamond square clouds.bas][Source code]] #+INCLUDE: "Diamond square clouds.bas" src basic-qb45 @@ -95,6 +116,17 @@ randomness, mimicking the fibrous texture of paper. #+attr_html: :class responsive-img #+attr_latex: :width 1000px [[file:Old paper - Screenshot 0.png]] + +The surface reads as aged paper: a smooth gray gradient that +darkens towards the bottom, with fibrous vertical streaks along +the left side. A grayscale palette of 64 shades is programmed +first. Every pixel then averages the pixel directly above it +with the previously computed color, adds a small random jitter, +and periodically subtracts a fresh random noise offset roughly +every ten steps. This feedback loop keeps the tones continuous +from row to row while the accumulated noise produces the rough, +fibrous grain of worn paper. + [[file:Old paper.bas][Source code]] #+INCLUDE: "Old paper.bas" src basic-qb45 @@ -111,6 +143,17 @@ using simple graphical techniques. #+attr_html: :class responsive-img #+attr_latex: :width 1000px [[file:Wood - Screenshot 1.png]] + +Overlapping wooden boards fill the screen, each showing wavy +horizontal grain, vertical plank seams and bright beveled edges. +A sixteen-color palette ramps from black to warm orange, with +blue fixed at zero. Each board is framed by nested black, gray +and white rectangles, then filled pixel by pixel: the new color +is a weighted average of the pixels above and behind plus the +previous result and a pinch of noise, while a sine-wave counter +SIN((y + phaseOffset) / 100) bends the grain into waves. The +main loop keeps drawing new boards at random positions forever. + [[file:Wood.bas][Source code]] #+INCLUDE: "Wood.bas" src basic-qb45 @@ -136,6 +179,17 @@ natural, flickering effect. #+attr_html: :class responsive-img #+attr_latex: :width 1000px [[file:Yellow flame - Screenshot 0.png]] + +The texture glows like fire: bright yellow-white tongues at the +bottom cool into orange and deep red swirls towards the top. +The palette itself is built from three sine waves with different +periods (21, 34 and 10 for red, green and blue), producing a +smooth flame-like color gradient. Every pixel averages four +already-drawn neighbors, the ones above, left, diagonally +up-left and two to the left, and adds a random jitter between +-2 and +2, so the heat appears to diffuse and flicker as it +rises across the screen. + [[file:Yellow flame.bas][Source code]] #+INCLUDE: "Yellow flame.bas" src basic-qb45 diff --git a/3D GFX/3D Synthezier/doc/index.org b/3D GFX/3D Synthezier/doc/index.org index d48cbcc..7fb6cbb 100644 --- a/3D GFX/3D Synthezier/doc/index.org +++ b/3D GFX/3D Synthezier/doc/index.org @@ -67,13 +67,38 @@ They were produced by importing generated [[https://en.wikipedia.org/wiki/Wavefr #+attr_latex: :width 1000px [[file:rectangular city, 1.jpeg]] +An oblique aerial view over the generated rectangular city: boxy +high-rise blocks with gridded window strips, octagonal rooftop +structures and small vehicles scattered between the towers, all +bathed in warm orange light. The scene was described entirely in +the scene language - the city1.3d script stamps out copies of the +maja (building) and cars sub-objects with obj commands, offsetting +and rotating each instance - then parsed into a Wavefront OBJ file +and rendered in Blender. + #+attr_html: :class responsive-img #+attr_latex: :width 1000px [[file:rectangular city, 2.jpeg]] +A night-time canyon view from street level between the rectangular +towers, their facades glowing with rows of lit windows against a +deep blue haze. Because buildings are composed from shared +sub-objects, every tower inherits the same window geometry; the +parser expands each obj reference, applies the requested +translations and rotations, and emits the resulting polygons into +the OBJ file with materials taken from the shared result.mtl +library. + #+attr_html: :class responsive-img #+attr_latex: :width 1000px [[file:rectangular city, 3.jpeg]] + +Looking down at the rooftops of the rectangular city in a cool +teal light: octagonal roof caps, rooftop clutter and vehicles +perched at different heights are clearly visible. The scene script +places cars at several altitude layers - some parked on the +ground, others floating high above the streets - simply by adding +different y offsets to instances of the same cars sub-object. ** Hexagonal city :PROPERTIES: :CUSTOM_ID: hexagonal-city @@ -83,13 +108,35 @@ They were produced by importing generated [[https://en.wikipedia.org/wiki/Wavefr #+attr_latex: :width 1000px [[file:hexagonal city, 1.jpeg]] +A distant view of the hexagonal city at dusk: a cluster of +hexagonal towers crowned with translucent domes rises from a +low-poly plain under an orange sky. The city2.3d script builds +this by stacking block sub-objects and placing stone ring and +glass kuppel (dome) objects at hexagon vertex offsets - multiples +of sin and cos of 30 degrees - scaled twentyfold with the x*20 +z*20 size modifiers. + #+attr_html: :class responsive-img #+attr_latex: :width 1000px [[file:hexagonal city, 2.jpeg]] +A closer aerial look at the hexagonal tower cluster, showing the +blue-tinted glass domes sitting on their stone rings with roads +threading between the towers. Each dome and ring is a separate +sub-object pulled from the include directory and positioned by the +obj command, while materials are switched between kivi (stone) and +glass_transp with mtl commands before each placement. + #+attr_html: :class responsive-img #+attr_latex: :width 1000px [[file:hexagonal city, 3.jpeg]] + +Street-level view inside the hexagonal city: low-poly cars in +blue, yellow and red dot the roads between the towers. The +vehicles are the same car sub-objects reused dozens of times with +different x, z and y offsets and xz rotations, illustrating how +the language composes complex scenes from a handful of cached +primitive objects. * Scene description language :PROPERTIES: :CUSTOM_ID: scene-description-language @@ -149,6 +196,12 @@ See also examples. 500 lines files. [[file:rotation.png]] + +The diagram illustrates the three rotation planes available to the +obj command: X-Z, Y-Z and X-Y, each drawn as a curved arrow +sweeping around the green axis. Suffixes like xz45 or xy20 on an +obj line rotate the included sub-object by the given number of +degrees in the named plane before it is merged into the scene. ** rnd :PROPERTIES: :CUSTOM_ID: rnd diff --git a/3D GFX/Miscellaneous/index.org b/3D GFX/Miscellaneous/index.org index 5dc6d57..1e5b86a 100644 --- a/3D GFX/Miscellaneous/index.org +++ b/3D GFX/Miscellaneous/index.org @@ -44,6 +44,14 @@ Wireframe 3D model of a rotating exclamation mark. #+end_export +A white wireframe exclamation mark tumbles against the black +screen, its beveled bar and dot alternately foreshortening and +opening up as they turn. The model is defined by DATA statements: +32 vertices describing front and back faces plus the lines joining +them. Each frame rotates every vertex with precomputed sine and +cosine lookup tables and connects the projected points with lines. +Arrow keys and w/z steer the rotation, space slows it down. + [[file:!.bas][Source code]] * 3D bouncing ball @@ -64,6 +72,15 @@ of early computer graphics techniques. #+end_export +A sphere woven from 500 glowing points bounces around the dark +screen, tumbling as it travels and kicking off in a new direction +with every impact. Each point is rotated by three successive 2D +rotations, perspective-projected, and then offset by the ball's +position. Gravity accelerates the ball downward each frame; when +it crosses the floor or a side wall its velocity is inverted, a +random horizontal kick is added, and new spin velocities are +chosen for the point cloud. + [[file:3D%20ball.bas][Source code]] * 3D text in a room @@ -83,6 +100,14 @@ fly around in all directions. #+end_export +The camera glides through a wireframe room whose floor is paved +with octagonal tiles, while green wireframe text hangs floating in +the middle of the space. The scenery is assembled point by point: +a large rectangle forms the walls, octagons and small squares tile +the floor, and glyph outlines are read from a vector font file and +laid out in the room as line segments. Cursor keys steer the view, ++ and - move up and down, and space slows the flight. + [[file:3D%20text.bas][Source code]] * 3D bouncing cubes on grid floor @@ -102,6 +127,14 @@ dynamic visual effect. #+end_export +Wireframe cubes leap and bounce above a glowing green grid floor +while the camera drifts among them. The floor is a lattice of +points joined into a mesh; each cube is a separate point set with +its own velocity vector that is integrated every frame and +inverted by the collider logic whenever a cube hits the ground. +Arrow keys fly the camera around the scene, the numeric keys +2/4/6/8 turn the view, and +/- adjust its altitude. + [[file:Bouncing%20cubes.bas][Source code]] * Matrix math for rotation in 3D space @@ -121,6 +154,14 @@ rotated by using matrix multiplications. #+end_export +A rippling white surface made of a point grid twists into new +orientations between frames. The height of each grid point is +computed as a sine wave of its Manhattan distance from the center, +producing concentric dunes. Instead of chained 2D rotors, every +point is transformed in a single step by a 3x3 rotation matrix +built from the alpha, beta and gamma angles, then +perspective-projected; keys 7/9, 4/6 and 1/3 nudge each angle. + [[file:Matrix%20math.bas][Source code]] * Maze explorer @@ -136,7 +177,34 @@ changes as they navigate through it. #+attr_html: :class responsive-img #+attr_latex: :width 1000px -[[file:Maze%20explorer.bas][file:Maze%20explorer.png]] +[[file:Maze%20explorer.bas][file:Maze%20explorer%20-%20Screenshot%200.png]] + +A tangle of brightly colored line segments stretches into the +darkness: the maze is a single 3D random walk in which each new +segment picks a random color and a random displacement along one +axis. Only 500 points exist at a time, so as the walk continues +the oldest geometry is recycled and the labyrinth appears to grow +and rebuild itself endlessly around the viewer. Navigation uses +WASD plus the TSR mouse driver: dragging looks around, and mouse +button combinations slide the camera along the axes. + +#+begin_export html +
+ +
+#+end_export + +The viewpoint plunges down a corridor of brightly colored line +segments that stretches away in one-point perspective, fresh +geometry appearing ahead as the flight continues. Each frame the +random walk appends another point and a randomly colored line +along one axis, up to a 500-point cap; every vertex is then +rotated, perspective-projected and joined with LINE. Mouse +drags steer the view while WASD slides the camera through the +maze. [[file:Maze explorer.bas][Source code]] @@ -157,6 +225,14 @@ look and fly around in all directions. #+end_export +A green wireframe tank shuttles back and forth across a long +wireframe bridge, its track links visibly churning in sync with +the movement. The tank, bridge and track segments are all built +from DATA statement coordinates; the track animation recycles a +pool of small segments around the wheels as the tank drives. +Rotation uses precomputed sine/cosine lookup tables, and the arrow +keys plus +/- provide a freely flying camera around the scene. + [[file:Tank.bas][Source code]] * Tiled room @@ -176,4 +252,13 @@ around. #+end_export +The camera sweeps through a spacious wireframe room decorated with +geometric tiles: square and hexagonal outlines pattern the floor +and walls in green and white. The tiles are generated +procedurally - helper subroutines stamp out squares, hexagons and +cube edges as point-and-line data - then every vertex is rotated +with precomputed trigonometric tables and perspective-projected. +Cursor keys fly the camera, 2/4/6/8 tilt the view, and space slows +the movement. + [[file:Tiled%20room.bas][Source code]] diff --git a/3D GFX/Space/index.org b/3D GFX/Space/index.org index 91a1def..6181f4f 100644 --- a/3D GFX/Space/index.org +++ b/3D GFX/Space/index.org @@ -40,7 +40,33 @@ galaxy with stars distributed in a spiral pattern. #+attr_html: :class responsive-img #+attr_latex: :width 1000px -[[file:Galaxy%20explorer.bas][file:Galaxy%20explorer.png]] +[[file:Galaxy%20explorer.bas][file:Galaxy%20explorer%20-%20Screenshot%200.png]] + +A spiral galaxy of thousands of colored points - red, green, cyan +and violet stars - floats against the black void, its swirling +disk clearly visible from this tilted viewpoint. The galaxy is +generated as a point cloud of up to 12000 stars with per-star +colors, then rotated by three angles and perspective-projected +each frame. WASD keys and the TSR mouse driver fly the viewer +freely through the swarm. + +#+begin_export html +
+ +
+#+end_export + +The camera glides through the swarm as the whole spiral galaxy +wheels past: thousands of individually colored stars thicken +toward the glowing core and trail off into spiral arms. The +point cloud is generated once by the mkGalaxy routine with +random spiral offsets, then every frame each star is rotated by +the camera angles, perspective-projected and plotted with PSET. +WASD keys and mouse-button drags accelerate the viewer freely +through the cloud. [[file:Galaxy%20explorer.bas][Source code]] @@ -63,6 +89,15 @@ observe the rocket's trajectory from various angles. #+end_export +A green wireframe globe built from latitude and longitude rings +fills the lower half of the screen while a small wireframe rocket +climbs away from its surface, leaving a growing dotted trail +behind it; diagnostic counters flicker at the top. The planet and +rocket are procedural point-and-line models, and each frame +integrates the rocket's velocity, appends fresh trail points, and +re-projects the whole scene. Arrow keys fly the camera, 2/4/6/8 +turn the view, and +/- change altitude. + [[file:Rocket simulator.bas][Source code]] * Stars @@ -98,6 +133,15 @@ How the Program Works: #+end_export +Hundreds of white stars stream outward across the screen, +brightening as they approach, giving the sensation of flying +through space while the view gently sways. Each star's 3D position +is perspective-projected, rotated by a slowly oscillating camera +angle, and nudged by sinusoidal offsets. Stars are pulled toward +the viewer every frame; any star that gets too close is respawned +in the far distance, and its brightness is computed as 3000/z, +capped at palette color 31. + [[file:Stars.bas][Source code]] * Universe explorer @@ -137,12 +181,34 @@ What's in it for the Reader? #+attr_latex: :width 1000px [[file:Universe%20explorer/Universe%20explorer.bas][file:Universe%20explorer/1.png]] +A dense, multicolored ball of stars - a whole galaxy seen from the +outside - dominates the view, surrounded by the sparse specks of +neighboring systems. The program builds the universe as clusters +of galaxies made of individual stars, but only nearby regions are +materialized at full detail; distant ones stay as coarse clouds, +keeping the rendered star count within limits while the user flies +freely with mouse and keyboard. + #+attr_html: :class responsive-img #+attr_latex: :width 1000px [[file:Universe%20explorer/Universe%20explorer.bas][file:Universe%20explorer/2.png]] +Here the camera sits inside a galaxy: stars form a luminous ring +around a bright core, with colorful specks drifting past at close +range. This is the level-of-detail algorithm at work - the region +surrounding the viewer has been refined into thousands of +individually placed and colored stars, while farther regions +remain compressed into simple point clouds until approached. + #+attr_html: :class responsive-img #+attr_latex: :width 1000px [[file:Universe%20explorer/Universe%20explorer.bas][file:Universe%20explorer/3.png]] +Deep intergalactic space: only a single compact star cluster and a +handful of faint distant specks remain visible in the void. At +this range the universe is rendered at its coarsest level - whole +galaxies collapse into tiny point groups - demonstrating how the +program sheds detail with distance so that even an astronomically +large universe stays navigable in real time. + [[file:Universe%20explorer/Universe%20explorer.bas][Source code]] diff --git a/Math/Plotting/index.org b/Math/Plotting/index.org index 7512bc5..14de44c 100644 --- a/Math/Plotting/index.org +++ b/Math/Plotting/index.org @@ -46,6 +46,14 @@ based on a user-defined mathematical function. #+attr_latex: :width 1000px [[file:2D%20graph%20plot.bas][file:2D%20graph%20plot%20-%20Screenshot%200.png]] +The function y = 1 - cos(2x) + sin(2x) plotted in yellow across the +range x = -3.2 .. 3.2 at 100 pixels per unit. Dark blue grid lines +mark every unit and the cyan axes cross at the origin. The curve +oscillates around the line y = 1, dipping toward the x-axis +wherever the sine and cosine terms momentarily cancel each other, +and each segment is drawn only when both of its endpoints fall +inside the screen. + [[file:2D%20graph%20plot.bas][Source code]] * 3D graph @@ -78,7 +86,60 @@ grid. #+attr_html: :class responsive-img #+attr_latex: :width 1000px -[[file:3D%20graph.bas][file:3D%20graph.png]] +[[file:3D%20graph.bas][file:3D%20graph%20-%20Screenshot%200.png]] + +The heightmap as seen from the camera's starting position, floating +outside the grid volume and looking in at an oblique angle. The +yellow wireframe dome is the spherical cap SQR((15+v)*(15-v))-10, +its surface rippled by the diagonal SIN(x+y) waves that are also +enabled in the formula subroutine. Cyan measuring grids line the +three axis planes behind and below the surface, and the light red +3D cross marks the zero point at the center of the scene. + +#+attr_html: :class responsive-img +#+attr_latex: :width 1000px +[[file:3D%20graph.bas][file:3D%20graph%20-%20Screenshot%201.png]] + +The same dome after flying the camera closer and lower with the +cursor keys, so the cap's rim and the crests of the diagonal waves +fill the frame. The wave term SIN(x+y)*SIN(tm/10) is modulated by +the frame counter tm, so the ripples slowly grow and shrink as the +program runs. Every frame the graaf subroutine re-evaluates the +formula on the 21 by 21 point grid and reconnects neighboring +points into the yellow mesh. + +#+attr_html: :class responsive-img +#+attr_latex: :width 1000px +[[file:3D%20graph.bas][file:3D%20graph%20-%20Screenshot%202.png]] + +The yellow wireframe is the heightmap of the two formulas currently +enabled in the "formula" subroutine: a spherical cap +SQR((15+v)*(15-v))-10, where v is the distance from the center, +plus diagonal waves SIN(x+y) that the frame counter slowly +modulates over time. Cyan measuring grids along the three axis +planes and the light red 3D cross mark the scale and the zero +point. The camera is flown with the cursor keys, + and - climb and +sink, 4/6/8/2 spin the view, and space halves all motion. + +#+begin_export html +
+ +
+#+end_export + +A flight through the scene in real time. The recording opens on +the wide establishing view of the dome inside its three cyan grid +planes, then the camera is steered around and finally right up +against the surface, ending with a close-up of the rippling +wireframe mesh from beneath. The cursor keys move the camera +forward and sideways, + and - make it climb and sink, 4/6/8/2 +spin the view, and space halves all motion for finer control. +Meanwhile the diagonal waves pulse on their own as SIN(tm/10) +modulates their amplitude, and each frame every line of the mesh +is erased at its previous position and redrawn at the new one. [[file:3D%20graph.bas][Source code]] @@ -99,6 +160,14 @@ visualized. #+attr_latex: :width 1000px [[file:Deriviative%20calculator.bas][file:Deriviative%20calculator%20-%20Screenshot%200.png]] +The light green curve plots f(x) = x^3 - 3x with its two turning +points; the yellow curve beneath is the derivative, computed +numerically as the per-step difference of the function and scaled +back up by the scale factor, forming the parabola 3x^2 - 3 that +crosses zero exactly under the function's extrema. Blue grid lines +mark single units, red lines every fifth unit, and the cyan axes +cross at the origin; the scale is 50 pixels per unit. + [[file:Deriviative%20calculator.bas][Source code]] * Sine and cosine table @@ -115,4 +184,12 @@ visual representation of these fundamental trigonometric functions. #+attr_latex: :width 1000px [[file:Sine%20and%20cosine%20table.bas][file:Sine%20and%20cosine%20table%20-%20Screenshot%200.png]] +Sine (white) and cosine (light red) plotted together over 0 to 10 +radians in steps of 0.05, each labeled "sin" and "cos" where its +curve ends. Dark gray grid lines divide the screen into ten columns +numbered 1-10 along the bottom edge, yellow lines mark the central +axes, and the -1, 0 and 1 labels at the right give the vertical +scale, so the plot doubles as a graphical lookup table for the two +functions. + [[file:Sine%20and%20cosine%20table.bas][Source code]] diff --git a/Math/Simulation/index.org b/Math/Simulation/index.org index 4e49fca..2bf5b58 100644 --- a/Math/Simulation/index.org +++ b/Math/Simulation/index.org @@ -59,6 +59,15 @@ conditions by setting velocities to zero at wall boundaries. #+end_export +The 100x100 pressure grid drawn pixel-by-pixel in the top-left +corner: the quiet gas shows as gray, and the high-pressure block +seeded on the left detonates into a shock front that sweeps right +in red, green and yellow bands. The dark red frame and the diagonal +lines are solid walls that zero the local velocities, so the wave +reflects off the boundary and funnels through the obstacle field +before diffusing. The number printed at the bottom is the +negative-pressure residual the correction loop is damping out. + [[file:Explosion%20simulator.bas][Source code]] * Gravity in 2D @@ -82,6 +91,14 @@ educational tool for understanding basic orbital mechanics. #+end_export +The large cyan circle is the central mass and the tiny yellow dot +the orbiting object, which leaves a dotted trail as it loops +around. A dark blue line connects the object to the center every +frame. Because the pull falls off as 1/distance rather than +1/distance^2, the orbit never closes: it precesses into a slowly +rotating three-lobed rosette, and the accumulated radius lines +weave the dense blue web filling the interior. Any key press exits. + [[file:Gravity%20in%202D.bas][Source code]] * Gravity in 3D @@ -111,6 +128,15 @@ will reach stable configuration. #+end_export +Thirty white circles — perspective-projected spheres whose drawn +radius shrinks with depth — start at random positions and fall +toward each other. The pairwise force follows 1/(d-1), so it +attracts at range but flips into a strong repulsion once two +spheres close in past the critical distance, and dividing the +velocities by 1.01 every step bleeds off energy. The swarm +collapses, bounces, and settles into the compact overlapping +cluster seen at the center of the screen. + [[file:Gravity%20in%203D.bas][Source code]] * Interference @@ -136,6 +162,14 @@ displayed as a third waveform. #+end_export +Two traveling sine waves scroll across the upper part of the +screen: the blue one is a plain SIN(frame + x/4), while the green +one carries an extra phase shift that grows with x, so the two +slide in and out of phase along the axis. The white waveform below +is their point-by-point sum, and its periodically swelling and +collapsing amplitude envelope is the classic beating pattern of two +slightly detuned frequencies. + [[file:Interference.bas][Source code]] * Interferogram @@ -150,7 +184,16 @@ used in physics and engineering to analyze wave interactions. #+attr_html: :class responsive-img #+attr_latex: :width 1000px -[[file:Interferogram.bas][file:Interferogram.png]] +[[file:Interferogram.bas][file:Interferogram%20-%20Screenshot%200.png]] + +A single white line on black. For every horizontal pixel the +program sums |SIN(t) + SIN(k*t)| over 5000 time steps, with the +detune factor k sweeping linearly around 1 from left to right. +Where the frequencies differ, the sum settles into a low, finely +rippled baseline; at the exact center k = 1 and the two waves +coincide perfectly, so the accumulated amplitude spikes into a tall +narrow pulse with symmetric ringing side lobes — the signature +shape of an interferogram. [[file:Interferogram.bas][Source code]] @@ -183,6 +226,14 @@ water cell if surrounded by a high density of water cells. #+end_export +An 80x50 text-mode screen where "#" cells are water and "." cells +are empty. The simulation starts from pure random noise, and the +Moore-neighborhood rules — a water cell survives only with more +than three neighbors, an empty cell fills in with more than four — +act like surface tension: isolated specks evaporate, ragged edges +get smoothed, and the liquid gathers into the rounded, slowly +wandering blobs visible here. + [[file:Surface%20tension.bas][Source code]] * Wave 1 @@ -208,6 +259,14 @@ loss. #+end_export +A filled white water column on a black background, initially given +a rectangular bump in the middle. The bump collapses under the +neighbor-averaging update and sends ripples racing out toward both +walls; with the velocity damped by 1.01 per step, the sloshing +gradually calms and the surface settles back toward flat. The +height array drives both the black clearing lines above the surface +and the white fill below it. + [[file:Wave%201.bas][Source code]] * Wave 2 @@ -231,4 +290,11 @@ understanding wave mechanics. #+end_export +A thin white wave line across a black screen, drawn point by point +from the surface height array. Random rain droplets keep kicking +the surface: each impact injects a half-sine splash of random width +and amplitude, and the neighbor-averaging propagation with light +damping spreads the disturbance into clean traveling ripples that +cross, superimpose, and fade. + [[file:Wave%202.bas][Source code]] diff --git a/Miscellaneous/Automated school clock/v1/README.org b/Miscellaneous/Automated school clock/v1/README.org index 4fa68d3..7ed7316 100644 --- a/Miscellaneous/Automated school clock/v1/README.org +++ b/Miscellaneous/Automated school clock/v1/README.org @@ -26,6 +26,38 @@ nummerdatud nuppu paigutusega: <3> #+END_VERSE +#+attr_html: :class responsive-img +[[file:Electronics/skeem.png]] + +Liidese elektriskeem. Printeri pesa (LPT1) andmeliinid D0–D7 +juhivad KT3102 transistoride kaudu kahe seitsmesegmendilise +LED-indikaatori segmente: ülemine indikaator näitab tunde ja +alumine minuteid. Liinidele 16, 17 ja 18 on dioodide kaudu +ühendatud klaviatuuri kolm nuppu ning liin 4 juhib releed, mille +kontaktid (88) lülitavad kella 220 V vooluahelat. Paremal on +toodud printeri pesa jalgade numbrid ja komponentide nimistu +(takistid 500 Ω ja 10 kΩ, transistor KT3102, diood, relee). + +#+attr_html: :class responsive-img +[[file:Electronics/3%20key%20keyboard.png]] + +Kolmeklahviline klaviatuur käsitsi ehitatud trükkplaadil. Kolm +mikrolüklit vastavad juhendis kirjeldatud paigutusele <1>, <2> +ja <3>, millega saab kella käsitsi lasta, aega muuta ja uuendatud +graafikuid tööle võtta. Üleval servas on näha kaks dioodi, mis +eraldavad nuppude signaalid printeri pesa liinidel 16, 17 ja 18 +(vt skeemi); kollased ja tumedad juhtmed viivad signaalid liidese +plaadile. + +#+attr_html: :class responsive-img +[[file:Electronics/4.png]] + +Liidese trükkplaat relee poolelt: vasakul on printeri pessa +(LPT1) minev DB-25 pistik, üleval kahekohaline seitsmesegmendiline +LED-indikaator tundide ja minutite näitamiseks ning paremal 220 V +kellaahelat lülitav relee. Pistikule joodetud takistid ja +transistorid juhivad indikaatori segmente vastavalt skeemile. + Programm on ettenähtud iseseisvalt töötama, kuid on ka võimalus erandkorras kгitsi kella lasta, aega muuta jne.. Programm eristab tavalisi nupuvajutusi ja topeltklõpse. Eesmärgiga suurendada diff --git a/Miscellaneous/Automated school clock/v3/tutorial.org b/Miscellaneous/Automated school clock/v3/tutorial.org index 7cc898d..ecd0d8d 100644 --- a/Miscellaneous/Automated school clock/v3/tutorial.org +++ b/Miscellaneous/Automated school clock/v3/tutorial.org @@ -42,6 +42,17 @@ mõeldud kella ja toiteallikaga vooluahelasse jadamisi paralleelselt, siis saab kella lasta nii endisest nupust kui ka arvutiga. +#+attr_html: :class responsive-img +[[file:skeem.png]] + +Liidese skeem kella vooluahelaga ühendamiseks. Printeri pesa +(LPT1) liin 4 juhib transistori KT3102 kaudu releed, mille +kontaktid (88) on ühendatud jadamisi kella ja toiteallika 220 V +ahelasse. Releega rööbiti olev diood kaitseb transistorit +induktiivse pingepülve eest. Liides ise voolu ei anna — relee +toimib vaid lülitina, mistõttu võib selle ühendada ka olemasoleva +käsitsi kella laskmise nupuga paralleelselt. + Programm on ettenähtud iseseisvalt töötama, kuid on ka võimalus erandkorras k2sitsi kella lasta, aega muuta jne. Selleks tuleb vajutada erinevaid klahve klaviatuuril. K2ivitudes kuvab programm diff --git a/Miscellaneous/Mouse driver/index.org b/Miscellaneous/Mouse driver/index.org index 41a9bec..28e6502 100644 --- a/Miscellaneous/Mouse driver/index.org +++ b/Miscellaneous/Mouse driver/index.org @@ -135,6 +135,29 @@ are printed as they occur. Press any key to exit. #+attr_latex: :width 1000px [[file:mousedrv.bas][file:screenshot.png]] +The demonstration program running in 320x200 256-color graphics +mode (SCREEN 13). The green circle is the mouse cursor: on every +frame the program reads the accumulated X and Y movement deltas +from the TSR's shared memory table with PEEK (and resets them back +to zero with POKE), clamps each step to at most 50 pixels, erases +the old circle and redraws it at the updated position. The top +line shows the current cursor coordinates together with a running +frame counter, while button presses read from the latched Button +Status field would be printed below as they occur. + +#+attr_html: :class responsive-img +#+attr_latex: :width 1000px +[[file:mousedrv.bas][file:mousedrv%20-%20Screenshot%200.png]] + +The same demonstration program, captured at the native 320x200 +resolution of SCREEN 13. The top line shows the cursor position +(X: 56, Y: 109) beside the running frame counter, and the green +circle on the left follows the mouse. The lone 0 on line five is +the Button Status word read from the TSR's shared table: the demo +prints it every frame and immediately resets the field with POKE, +so a nonzero value appears only in the frame where a button was +pressed. + [[file:mousedrv.bas][mousedrv.bas - source code]] Here are more practical examples where this mouse driver is being diff --git a/Networking/Digital data over analog audio/index.org b/Networking/Digital data over analog audio/index.org index bc3472c..ca48243 100755 --- a/Networking/Digital data over analog audio/index.org +++ b/Networking/Digital data over analog audio/index.org @@ -68,6 +68,17 @@ transmitted over telephone lines. [[file:screenshot.png]] +The *xi2msg* decoder at work in 640x480 graphics mode (SCREEN 12). +The status pane on the left traces the decoding stages: searching +for the header tone, locking onto the beginning point, and running +the statistical analysis that measures ten peak distances to derive +the threshold separating '0' bits (long gaps) from '1' bits (short +gaps). The top-right pane scrolls the incoming bit stream, showing +each completed byte as bits, decimal, hexadecimal and character. +The lower-left pane plots the audio waveform itself, with detected +peaks marked and vertical cursors tracking the analysis window, +while the bottom line prints the decoded message as it emerges: +"This is a sample encoded message ! ..." Download source code: [[file:xi2msg.bas][Source code]] diff --git a/Networking/LPT communication driver/index.org b/Networking/LPT communication driver/index.org index 4e58eff..beefe9b 100755 --- a/Networking/LPT communication driver/index.org +++ b/Networking/LPT communication driver/index.org @@ -33,6 +33,16 @@ Out of [[https://en.wikipedia.org/wiki/Parallel_port][25 physical wires in LPT p [[file:diagram.png]] +Wiring diagram of the cable, drawn as the front view of a male +DB-25 parallel port connector. Of the 25 pins only three matter: +pin 14 (highlighted blue) carries the synchronization clock, pin +17 (highlighted green) is the bidirectional serial data line, and +pin 18 is the common ground. The connection is straight-through — +pin 14 to 14, 17 to 17 and 18 to 18 between the two computers — +so both ends run the same unmodified driver, taking turns +bit-banging bytes over the single data wire in half-duplex +fashion. + By utilizing only three wires and software controlled bit-banging algorithm, custom, comparatively simple, cheap and long cable can be built to connect 2 computers in a DIY network setup. diff --git a/index.org b/index.org index 25166fd..3f424a9 100644 --- a/index.org +++ b/index.org @@ -58,6 +58,13 @@ algorithms and getting fun looking results quite easily. #+attr_latex: :width 1000px [[file:2D%20GFX/Animations/index.html][file:2D%20GFX/Animations/logo.png]] +A four-panel teaser of the collection: an interference moiré of +overlapping circle rings, a DNA-style double helix assembled from +marching circles, a starfield snowfall spelling "SNOW", and a +rotating yin-yang symbol. Each demo in the collection is a small +self-contained experiment in 2D animation -- trigonometric motion, +particle systems and palette effects rendered in real time. + [[file:2D%20GFX/Animations/index.html][See entire animations collection]] ** Fractals @@ -70,6 +77,13 @@ algorithms and getting fun looking results quite easily. #+attr_latex: :width 1000px [[file:2D%20GFX/Fractals/index.html][file:2D%20GFX/Fractals/fractal%20squares%20-%20Screenshot%200.png]] +A single completed square fractal from the fractal squares program. +The recursion starts from one large outlined square; every square +then spawns a child square at each of its four corners with the size +divided by 2.3, and the process repeats until the squares shrink +below one pixel. The result is a self-similar lattice of light green +outlines on a white background. + [[file:2D GFX/Fractals/index.html][See entire fractals collection]] ** Spiral series @@ -86,6 +100,13 @@ screen. Every iteration built upon previous result. #+attr_latex: :width 1000px [[file:2D%20GFX/Spirals/index.html][file:2D%20GFX/Spirals/logo.png]] +Four stages of the spiral series: a sweeping wireframe ribbon +spiral, a spiral sheet twisted into a rising vortex, spirals plotted +from scattered points, and a checkered sphere built entirely from +spiral bands. What began as a single flat spiral on the screen grew, +iteration by iteration, into shaded and textured spherical spirals +rendered in 3D perspective. + [[file:2D%20GFX/Spirals/index.html][See entire spiral collection]] ** Algorithmic textures @@ -98,6 +119,12 @@ screen. Every iteration built upon previous result. #+attr_latex: :width 1000px [[file:2D%20GFX/Textures/index.html][file:2D%20GFX/Textures/logo.png]] +A four-panel sampler of the generated textures: soft diamond-square +clouds, a brushed streak pattern, a wooden plank floor and +marble-like veining. Every texture is produced purely +algorithmically -- noise fields, circular wave interference and +recursive subdivision turned into pixel patterns. + [[file:2D%20GFX/Textures/index.html][See entire texture collection]] ** Miscellaneous @@ -117,6 +144,12 @@ as pixel manipulation, geometric shapes, and simple animations. #+attr_latex: :width 1000px [[file:2D%20GFX/Hello%20friend.bas][file:2D%20GFX/Hello%20friend%20-%20Screenshot%200.png]] +The greeting screen of the program: a large blue chevron triangle +points down at the "Hello friend!" message, underlined by a solid +blue bar. Behind this simple composition the code exercises the +basics of QBasic graphics -- plotting pixels, drawing geometric +shapes and animating them frame by frame. + Download source code: [[file:2D%20GFX/Hello%20friend.bas][Hello friend.bas]] #+INCLUDE: "2D GFX/Hello friend.bas" src basic-qb45 @@ -138,6 +171,12 @@ animated transitions and effects. #+end_export +The opening slide of the presentation: a glowing green "HEADER" +title hovers over five color-coded stick figures while the ground +under them ripples like a wave. The program plays a sequence of such +slides, animating each scene and moving between them with transition +effects. + Download source code: [[file:2D%20GFX/People.bas][People.bas]] *** Stroboscope @@ -155,10 +194,22 @@ diagrams. #+attr_latex: :width 1000px [[file:2D%20GFX/Stroboscope.bas][file:2D%20GFX/Stroboscope%20-%20Screenshot%200.png]] +The title slide of the presentation: "Presentation about:" on a +magenta banner, followed by the word "STROBOSCOPE" in large letters +with a red-to-yellow gradient fill, signed by the author at the +bottom. Animated transitions like this lead the viewer through the +slides. + #+attr_html: :class responsive-img #+attr_latex: :width 1000px [[file:2D%20GFX/Stroboscope%20-%20Screenshot%201.png]] +The "Principal schematic" slide: a cyan circuit diagram on a black +background showing the stroboscope's parts -- resistors, a D336B +diode, a high-voltage capacitor, a trimmer and the trigger +transformer. The program draws the whole schematic with line and +shape primitives and annotates each component value. + Download source code: [[file:2D%20GFX/Stroboscope.bas][Stroboscope.bas]] *** Truncated cone @@ -176,6 +227,12 @@ the viability of generating images of 3D shapes using code. #+attr_latex: :width 1000px [[file:2D%20GFX/Truncated%20cone.bas][file:2D%20GFX/Truncated%20cone%20-%20Screenshot%200.png]] +The finished drawing: a top cylinder with diagonal hatching on its +end face, a tapering frustum in the middle and a smaller cylinder at +the bottom, all outlined against the black screen. Vertical gradient +bands across each surface fake the shading, testing how convincingly +a 3D solid can be suggested with plain 2D line and fill primitives. + Download source code: [[file:2D%20GFX/Truncated%20cone.bas][Truncated cone.bas]] #+INCLUDE: "2D GFX/Truncated cone.bas" src basic-qb45 @@ -195,6 +252,13 @@ Download source code: [[file:2D%20GFX/Truncated%20cone.bas][Truncated cone.bas]] #+attr_latex: :width 1000px [[file:3D%20GFX/Miscellaneous/index.html][file:3D%20GFX/Miscellaneous/logo.png]] +A four-panel wireframe sampler of the 3D demo collection: cubes +resting on a grid floor, a tilted plane propped on supports, an +intersecting girder-like structure and an open box with a tiled +floor. All of it is rendered by the same homegrown 3D pipeline -- +vertices transformed, edges projected and drawn as lines in real +time. + [[file:3D GFX/Miscellaneous/index.html][See entire miscellaneous 3D demo applications collection]] ** Space related animations @@ -207,6 +271,13 @@ Download source code: [[file:2D%20GFX/Truncated%20cone.bas][Truncated cone.bas]] #+attr_latex: :width 1000px [[file:3D%20GFX/Space/index.html][file:3D%20GFX/Space/logo.png]] +Four scenes from the space programs: a globular star cluster, a +spiral galaxy trailing debris, a deep starfield with a small comet, +and a wireframe parabolic antenna dish with raw numeric readouts +ticking above it. Each program simulates a piece of space -- from +orbiting stars to a flying rocket -- with simple physics and +projected 3D graphics. + [[file:3D GFX/Space/index.html][See entire space themed applications collection]] ** 3D Synthezier @@ -225,6 +296,13 @@ See directory: #+attr_latex: :width 1000px [[file:3D%20GFX/3D%20Synthezier/doc/index.html][file:3D%20GFX/3D%20Synthezier/doc/hexagonal%20city,%202.jpeg]] +A ray-traced rendering of the generated "hexagonal city" scene: a +cluster of glass hexagonal towers with dark domed roofs and lit +windows, small colored cubes floating between them, all standing on +a reflective floor. The scene was described in the program's own +scene definition language, exported as a Wavefront obj file and then +rendered with an external renderer. + [[file:3D%20GFX/3D%20Synthezier/doc/index.html][Read more]] ** Helicopter demo @@ -251,6 +329,13 @@ moves across the terrain and picks up objects. #+end_export +The demo opens with a glowing "HELICOPTER" title over the terrain, +then the flight begins: a blue wireframe helicopter skims over a +green wireframe landscape whose hills were grown by a fractal +subdivision algorithm, dipping down to pick up the yellow objects +scattered across the ridges. Terrain, craft and cargo are all +transformed and projected in real time. + [[https://www2.svjatoslav.eu/gitweb/?p=qbasicapps.git;a=tree;f=3D+GFX/Helicopter;hb=HEAD][Project files]] ** Swapping 3D engine @@ -273,10 +358,24 @@ into RAM, allowing for the potential rendering of very large worlds. #+attr_latex: :width 1000px [[file:3D%20GFX/Swapping%203D%20engine/screenshot.png]] +Inside the wireframe world: the blue perspective lattice is the +partitioning grid -- the world is chopped into cube-shaped fragments +that are paged between disk and RAM as the viewer moves. Colored +wireframe objects (green letters, red and cyan shapes) inhabit the +cells, and the counters in the top corners report the engine's +position and loaded-fragment state. + #+attr_html: :class responsive-img #+attr_latex: :width 1000px [[file:3D%20GFX/Swapping%203D%20engine/screenshot,%202.png]] +A top-down view across the same world: the dense blue grid of +partition cubes stretches to the horizon with wireframe objects +embedded in it. Only the cubes near the viewer are kept in memory; +the rest stay on disk until needed, which is what lets the engine +present a potentially endless world on a machine with very little +RAM. + Download source code: [[file:3D%20GFX/Swapping%203D%20engine/engine.bas][engine.bas]] ** 3D land @@ -304,6 +403,13 @@ filled with colors that alternate to create a checkerboard pattern. #+end_export +A yellow-and-black checkerboard sheet bulges into a smooth hill at +its center and settles back again. The program walks a grid of +points, displaces each one with a cosine of its distance from the +center, applies a perspective projection and fills the resulting +quadrilaterals in alternating colors, animating the distortion over +time. + Download source code: [[file:3D%20GFX/3D%20land.bas][3D land.bas]] #+INCLUDE: "3D GFX/3D land.bas" src basic-qb45 @@ -334,6 +440,13 @@ in stereoscopy and 3D visualization. #+end_export +Wireframe cubes tumble and bounce above a spherical grid arena, +every edge drawn twice -- once in red, once in cyan -- with the +offset between the two copies encoding depth. Viewed through +red/cyan glasses the double image fuses into a stereoscopic scene; +without them the colored fringes show exactly how the anaglyph +parallax is constructed. + [[file:3D%20GFX/Anaglyph.bas][Anaglyph.bas]] ** Ray casting engine @@ -362,10 +475,22 @@ specified keys to turn, look up/down, and even jump. #+end_export +A first-person walk through the ray-cast world: a blue checkerboard +floor, rainbow-striped pyramids and towers, colored pillars and +hills ringed with contour bands. The engine casts rays through a +height map and adapts its rendering resolution on the fly to hold a +steady 10 frames per second, which is why surfaces smear into coarse +stripes when the camera gets close. + #+attr_html: :class responsive-img #+attr_latex: :width 1000px [[file:3D%20GFX/Ray%20casting%20engine%20-%20Screenshot%200.png]] +The engine's frozen welcome screen: "Press any key to continue..." +hangs above a still render of the same landscape -- a +rainbow-striped wall on the left, a contour-ringed mound on the +right and the checkered ground plane stretching between them. + Download source code: [[file:3D%20GFX/Ray%20casting%20engine.bas][Ray casting engine.bas]] * Games @@ -391,6 +516,12 @@ between screens. Player has to avoid contact with evil hedgehogs. #+end_export +Gameplay of the first Pomppu Paavo: the little character hops across +purple block platforms outlined in cyan, past trees and pink bushes, +gathering coins while white hedgehogs patrol the ledges. The top +line tracks collected coins and remaining lives; touching a hedgehog +costs a life, and clearing a screen opens the way to the next one. + [[file:Games/Pomppu%20Paavo/Pomppu%20Paavo.bas][Source code]] ** Pomppu Paavo 2 @@ -412,10 +543,22 @@ between screens. Player has to avoid contact with evil snails. #+end_export +The sequel trades the dark maze for daylight: blue sky with dithered +clouds, grey brick platforms and green bushes. The hero in the red +cap jumps between ledges collecting golden coins laid out in arcs, +while red snails crawl along the bricks. The bottom line shows the +coin purse and the remaining lives. + #+attr_html: :class responsive-img #+attr_latex: :width 1000px [[file:Games/Pomppu%20Paavo%202/Pomppu%20Paavo%20-%20Screenshot%200.png]] +A mid-game still: coins arc over a gap between brick platforms, +trees and bushes decorate the skyline, and the small red character +stands at the left edge planning the next jump. The icons at the +bottom left count collected coins and the three spare lives. Level +graphics are loaded from separate image asset files at startup. + [[https://www2.svjatoslav.eu/gitweb/?p=qbasicapps.git;a=tree;f=Games/Pomppu+Paavo+2][Source code]] Source code organization: @@ -448,6 +591,13 @@ it loses one life. #+end_export +A multiplayer match in progress on the blue grid arena inside a +green brick wall: dotted worms in white, yellow, red and green weave +around each other hunting the fruit. The side panel shows the +current level, every player's score and remaining lives, including +the AI-controlled worms; eating enough fruit advances everyone to +the next level. + [[file:Games/Worm/worm.bas][Source code]] Levels are stored in [[https://www2.svjatoslav.eu/gitweb/?p=qbasicapps.git;a=tree;f=Games/Worm;hb=HEAD]['lvl' files]] that are directly editable using text @@ -471,6 +621,13 @@ utilize when possible. #+attr_latex: :width 1000px [[file:Games/checkers.bas][file:Games/checkers%20-%20Screenshot%200.png]] +The monochrome 10x10 board in high-resolution two-color graphics, +partway through a game, with the "From where?" prompt waiting for +input. Moves are made with an arrow-key cursor and the ENTER key -- +pick up a piece, place it on a reachable square -- while the program +enforces the capture rules and the pattern-driven AI plans its +reply. + ** Checkers 2 :PROPERTIES: :CUSTOM_ID: checkers-2 @@ -493,6 +650,13 @@ larder board size. #+attr_latex: :width 1000px [[file:Games/checkers2.bas][file:Games/checkers2%20-%20Screenshot%200.png]] +The 6x6 board of the second checkers program, with green column +letters A-F and row numbers 1-6 along the edges. The transcript on +the right is the AI thinking out loud: "positions processed: 428057" +-- hundreds of thousands of board positions evaluated by the +recursive lookahead before each computer move, followed by prompts +like "You may eat." when a capture is available. + * Math :PROPERTIES: :CUSTOM_ID: math @@ -521,12 +685,19 @@ scene is rendered frame by frame. #+begin_export html
#+end_export +Clusters of white and green wireframe cubes hang in dark space while +the camera slowly orbits around them. Each cube is one live cell of +Conway's Game of Life; on every step the grid is updated by the +classic neighbor rules and the scene is redrawn, so whole +constellations of cubes blink in and out of existence as the pattern +evolves. + Download source code: [[file:Math/Game%20of%20life%20in%203D.bas][Source code]] ** Game of life studio @@ -541,7 +712,23 @@ configurations of the Game of Life. #+attr_html: :class responsive-img #+attr_latex: :width 1000px -[[file:Math/Game%20of%20life/Game%20of%20life.bas][file:Math/Game%20of%20life/screenshot.png]] +[[file:Math/Game%20of%20life/Game%20of%20life.bas][file:Math/Game%20of%20life/Game%20of%20life%20-%20Screenshot%200.png]] + +A running simulation on the blue editing grid: green cells form +gliders, oscillators and still lifes scattered across the field, +while the "frame: 4" counter in the corner tracks the current +generation. Patterns evolve automatically once the simulation is +started. + +#+attr_html: :class responsive-img +#+attr_latex: :width 1000px +[[file:Math/Game%20of%20life/Game%20of%20life%20-%20Screenshot%201.png]] + +Editing mode: a white selection rectangle is drawn around a stored +pattern at the bottom of the grid while a larger structure sits at +the top. Configurations can be painted cell by cell, moved, saved +and reloaded, turning the program into a small studio for +experimenting with Game of Life patterns. [[https://www2.svjatoslav.eu/gitweb/?p=qbasicapps.git;a=tree;f=Math/Game+of+life;hb=HEAD][Source code]] @@ -557,6 +744,12 @@ functions. #+attr_latex: :width 1000px [[file:Math/Plotting/index.html][file:Math/Plotting/logo.png]] +A collage of the plotting programs at work: a 2D function graph with +its tangent line, a 3D wireframe surface rising into a central +spike, layered polynomial curves, and a labeled sine/cosine table +plot. Each program sweeps a mathematical function across the screen, +scaling axes and drawing grid lines along the way. + [[file:Math/Plotting/index.html][See entire collection of mathematical plots]] ** Simulations @@ -571,6 +764,13 @@ mathematical and physical effects. #+attr_latex: :width 1000px [[file:Math/Simulation/index.html][file:Math/Simulation/logo.png]] +Four of the physics and math simulations: a sharp impulse waveform, +a spirograph-like rosette of nested dotted circles, a field of +random dots from a cellular-style process, and paired oscillating +waves. The collection covers gravity in 2D and 3D, wave +interference, surface tension and explosions -- each one a small +numerical model animated step by step. + [[file:Math/Simulation/index.html][See entire collection of simulations]] ** Truth table calculator @@ -584,7 +784,20 @@ table). #+attr_html: :class responsive-img #+attr_latex: :width 1000px -[[file:Math/Truth%20table/index.html][file:Math/Truth%20table/img/screenshot,%202.png]] +[[file:Math/Truth%20table/index.html][file:Math/Truth%20table/truth%20-%20Screenshot%202.png]] + +The equation entry screen: the prompt lists the numeric keys that +insert logical operators (equivalence, implication, OR, AND, NOT) +together with an example formula, and the user has typed in a +three-variable equation ready to be evaluated. + +#+attr_html: :class responsive-img +#+attr_latex: :width 1000px +[[file:Math/Truth%20table/truth%20-%20Screenshot%203.png]] + +The computed truth table for the entered formula: one row per +combination of the variables, with color-coded t/f values for every +input column and the final result column on the right. [[file:Math/Truth%20table/index.html][Read more about truth table calculator]] @@ -610,7 +823,29 @@ assigns a grade based on the percentage of correct answers. #+attr_html: :class responsive-img #+attr_latex: :width 1000px -[[file:Math/Multiplication%20trainer.bas][file:Math/Multiplication%20trainer.png]] +[[file:Math/Multiplication%20trainer.bas][file:Math/Multiplication%20trainer%20-%20Screenshot%200.png]] + +A training session in progress: the program asks "How much is: 8 X +8", rejects the answer 3 with "Wrong!" and shows the correct +product, then accepts 12 for 3 X 4 with "Correct!". Questions are +random pairs of single digits, and after the run the program scores +the answers and assigns a grade. + +#+begin_export html +
+ +
+#+end_export + +A full session from greeting to quiz: the "Math teaching program" +banner sits over a gradient backdrop while an animated red light bar +sweeps the bottom of the screen and the program asks for the +player's name and the number of questions (10). The drill then +begins with "How much is: 1 X 5 ?" -- the answer 5 earns a +"Correct !" before the next pair, 6 X 8, is presented. [[file:Math/Multiplication%20trainer.bas][Source code]] @@ -625,9 +860,15 @@ function to compare results. 1 pixel vertical shift is intentional. #+attr_html: :class responsive-img #+attr_latex: :width 1000px -[[file:Math/Sine%20computation.bas][file:Math/Sine%20computation.png]] +[[file:Math/Sine%20computation.bas][file:Math/Sine%20computation%20-%20Screenshot%200.png]] -[[file:Math/Multiplication%20trainer.bas][Source code]] +One full period of the sine wave plotted twice: one curve is the +built-in SIN function and the fringe hugging it is the custom finite +formula, deliberately shifted one pixel so the two can be compared. +The near-perfect overlap shows how closely the invented +approximation tracks the real thing. + +[[file:Math/Sine%20computation.bas][Source code]] ** Lottery analysis :PROPERTIES: @@ -647,7 +888,12 @@ become easily detectable in visual graphs. #+attr_html: :class responsive-img #+attr_latex: :width 1000px -[[file:Math/Lottery/Lottery%20analysis.bas][file:Math/Lottery/screenshot,%203.png]] +[[file:Math/Lottery/Lottery%20analysis.bas][file:Math/Lottery/Lottery%20analysis%20-%20Screenshot%200.png]] + +The dot graph view: every draw becomes a vertical column of green +dots, one dot per drawn number, with the dense band of all +historical draws packed across the top. Deliberately repeated +patterns in the example data show up as matching columns. Graphical Representations: @@ -657,7 +903,12 @@ Graphical Representations: #+attr_html: :class responsive-img #+attr_latex: :width 1000px -[[file:Math/Lottery/Lottery%20analysis.bas][file:Math/Lottery/screenshot,%202.png]] +[[file:Math/Lottery/Lottery%20analysis.bas][file:Math/Lottery/Lottery%20analysis%20-%20Screenshot%201.png]] + +The main menu and the statistics view: the program offers dot graph, +line graph, combinatorics and statistics modes, and here it lists +how often each number appeared in the recent draws and how many +draws ago it was last seen. - Line Graph :: Shows a dynamic line graph connecting consecutive lottery numbers, providing a visual representation of number trends @@ -669,9 +920,20 @@ Graphical Representations: visible at a single resolution. This feature introduces the concept of combinatorics and pattern recognition in data visualization. -#+attr_html: :class responsive-img -#+attr_latex: :width 1000px -[[file:Math/Lottery/Lottery%20analysis.bas][file:Math/Lottery/screenshot,%201.png]] +#+begin_export html +
+ +
+#+end_export + +The combinatorics view being drawn: the same draw data is re-fitted +at every possible resolution, sweeping from a tiny mesh squeezed +into the corner up to full-screen columns of colored segments. +Watching the graph rebuild at each scale makes hidden repetitions in +the data pop out at whatever resolution they live on. [[file:Math/Lottery/Lottery%20analysis.bas][Source code]] @@ -696,6 +958,12 @@ written in x86 assembly and a QBasic demonstration program. #+attr_latex: :width 1000px [[file:Miscellaneous/Mouse%20driver/index.html][file:Miscellaneous/Mouse%20driver/screenshot.png]] +The demo program running under the TSR mouse driver: the green +circle is the mouse cursor gliding across the graphics screen, and +the readout in the corner ("X: 218 Y: 143", plus a frame counter) +tracks its live position. The assembly TSR hooks the mouse interrupt +and hands coordinates and button state to plain QBasic code. + [[file:Miscellaneous/Mouse%20driver/index.html][Read more about mouse driver for QBasic]] ** Alien font @@ -714,6 +982,12 @@ abstract art. #+attr_latex: :width 1000px [[file:Miscellaneous/Alien%20font.bas][file:Miscellaneous/Alien%20font%20-%20Screenshot%200.png]] +A page of the generated alien script: every glyph is a square +subdivided into four triangles, some filled black and some left +white, so each character reads as an abstract triangular mosaic. +Strung together in dense rows, the procedural glyphs form a +convincing but completely imaginary writing system. + ** Custom palette :PROPERTIES: :CUSTOM_ID: custom-palette @@ -737,10 +1011,22 @@ palette, providing a visual representation of all available colors: #+attr_latex: :width 1000px [[file:Miscellaneous/Custom%20palette.bas][file:Miscellaneous/Custom%20palette%20-%20Screenshot%200.png]] +The generated 6x6x6 palette shown as vertical gradient strips: each +column fixes two of the RGB components and sweeps the third from +dark to bright, walking through greens, cyans, blues, magentas, reds +and white. The 216 register values are written straight to the VGA +palette ports. + #+attr_html: :class responsive-img #+attr_latex: :width 1000px [[file:Miscellaneous/Custom%20palette.bas][file:Miscellaneous/Custom%20palette%20-%20Screenshot%201.png]] +The palette in action: six tiles filled with concentric circle +fills, one tile per color family -- greyscale, pastels and saturated +primaries. Because every ring picks its color from the same +216-entry palette, the demo doubles as a visual index of what the +palette can express. + The dithering process helps to mitigate the limitations of the 256-color palette, making the gradients appear smoother to the eye: @@ -748,6 +1034,12 @@ The dithering process helps to mitigate the limitations of the #+attr_latex: :width 1000px [[file:Miscellaneous/Custom%20palette.bas][file:Miscellaneous/Custom%20palette%20-%20Screenshot%202.png]] +The same tiles re-rendered with dithering: radial gradients now +blend smoothly from the center outward, mixing palette colors in +checkerboard pixels to fake the shades in between. The eye averages +the speckles into continuous color, stretching the 256-color limit +much further than flat fills could. + ** Alarm 1 :PROPERTIES: :CUSTOM_ID: alarm-1 @@ -907,6 +1199,12 @@ see multiple overlayed 3D shapes at the same time. #+attr_latex: :width 1000px [[file:Miscellaneous/4D%20engine.bas][file:Miscellaneous/4D%20engine%20-%20Screenshot%200.png]] +The engine's help screen: the full control map for four dimensions. +Keys rotate the pentatope in each of the six 4D planes (qw, as, zx +for the familiar XZ/YZ/XY planes, er, df, cv for the novel QX/QY/QZ +ones), other key pairs move the viewer along the x, y, z and q axes, +and ESC quits. + #+attr_html: :class responsive-img #+attr_latex: :width 1000px [[file:Miscellaneous/4D%20engine%20-%20Screenshot%201.png]] @@ -938,13 +1236,19 @@ of the active window, creating a dynamic visual effect. #+begin_export html
#+end_export -Download source code: [[file:Miscellaneous/Windowing%20system.bas][Windowing system.bas]] +Overlapping text windows on a dark blue desktop: one window scrolls +the demo's own description, others display BASIC source code, each +framed with a cyan border and a title bar. The program loads text +files into windows, supports horizontal and vertical scrolling and +animates the active window's content. + +Download source code: [[file:Miscellaneous/wsystem.bas][Windowing system.bas]] ** Password lock :PROPERTIES: @@ -979,12 +1283,48 @@ message. #+end_export +The rocket ground control desktop comes up: an oscilloscope window +traces a green waveform, a stack-dump window scrolls binary digits +above the words "Running rocket ground control system", and the +central dialog demands "ENTER PASSWORD:". Windows with yellow title +bars sit on a grey grid backdrop while the program waits for input. + #+attr_html: :class responsive-img #+attr_latex: :width 1000px [[file:Miscellaneous/Password%20lock/passw.bas][file:Miscellaneous/Password%20lock/screenshot,%202.png]] +Three wrong guesses later: the central dialog reports "Wrong +password / 0 chances left / SYSTEM HALTED SUCCESSFULLY!!" while the +oscilloscope and stack-dump windows freeze in the background. The +password itself lives in an external passw.dat file, and each failed +attempt decrements the remaining-tries counter. + Download source code: [[file:Miscellaneous/Password%20lock/passw.bas][passw.bas]] +** Pressed key test +:PROPERTIES: +:CUSTOM_ID: pressed-key-test +:END: + +This tiny QBasic utility shows what the keyboard actually delivers to +a program: it waits for a key press with INKEY$, echoes the typed +character, and prints the ASCII value of the first and the last +character of the returned string -- handy for discovering the +two-byte codes that extended keys produce. + +#+attr_html: :class responsive-img +#+attr_latex: :width 1000px +[[file:Miscellaneous/Pressed%20key%20test.bas][file:Miscellaneous/Pressed%20key%20test%20-%20Screenshot%200.png]] + +The utility echoing keys as they are pressed: each "You typed:" line +repeats the character (o, e, u, then H, e, l, l, o as "Hello" is +entered), followed by the ASCII value of the first and last +character of the returned string -- 72 for 'H'. For ordinary keys +the two values match, while extended keys arrive as two-character +strings whose codes the program reports separately. + +[[file:Miscellaneous/Pressed%20key%20test.bas][Source code]] + * Networking :PROPERTIES: :CUSTOM_ID: networking @@ -1012,6 +1352,12 @@ The program uses bit manipulation to control individual pins. #+attr_latex: :width 1000px [[file:Networking/LPT%20pin%20control.bas][file:Networking/LPT%20pin%20control.png]] +The pin control panel: eight numbered positions for the parallel +port's data pins, with blue squares lit above the pins that are +currently driven high. Pressing keys 1-8 flips the matching bit in +the port's data register, raising or dropping the voltage on the +corresponding physical pin. + Download source code: [[file:Networking/LPT%20pin%20control.bas][LPT pin control.bas]] ** COM port text terminal @@ -1103,6 +1449,13 @@ Utilities to encode digital data to sound file and back. #+attr_latex: :width 1000px [[file:Networking/Digital%20data%20over%20analog%20audio/index.html][file:Networking/Digital%20data%20over%20analog%20audio/screenshot.png]] +The decoder at work: columns list each recovered byte as binary, +decimal, hexadecimal and character while the program searches the +digitized audio for the sync pattern ("searching for beginning... +Beginning point found!") and completes its statistical analyze pass. +On the right a crosshair walks the recovered bit grid, and the +decoded sample message prints at the bottom. + [[file:Networking/Digital%20data%20over%20analog%20audio/index.html][Read more]] ** Morse @@ -1128,8 +1481,52 @@ represented by short beeps, and dashes by longer beeps. #+attr_latex: :width 1000px [[file:Networking/Morse.bas][file:Networking/Morse%20-%20Screenshot%200.png]] +A Morse session in the text screen: after the "Type '.bye' to quit" +hint, each typed line ("Hello", "What a nice day !") is echoed back +while the PC speaker beeps out every character's dot and dash +pattern looked up from Morse.txt -- short beeps for dots, long ones +for dashes. + Download source code: [[file:Networking/Morse.bas][Morse.bas]] +* Tutorial +:PROPERTIES: +:CUSTOM_ID: tutorial +:END: + +** Quicksort visualization +:PROPERTIES: +:CUSTOM_ID: quicksort-visualization +:END: + +This QBasic program visualizes a recursive quicksort on 45 random +values in an 80x50 text screen, highlighting the active partition +range, the scanning pointers and the split point as the sort +progresses, and re-checks the result after every run. + +#+begin_export html +
+ +
+#+end_export + +Each row shows one array element (value and index). Instead of a +median pivot the program splits each range at the midpoint between +its minimum and maximum, shown at the top right (49.5, then 80.5 as +the upper partition is sorted). The blue bars mark the two scanning +pointers that walk towards each other swapping out-of-place +elements, the red bar marks the range endpoints of the active +partition, and the split index flashes yellow before the recursion +descends into the two halves. When a run finishes, the program +verifies the array is ordered and, on any failure, restores the +original data and re-sorts it step by step waiting for a keypress +per redraw. + +Download source code: [[file:Tutorial/qsort3.bas][qsort3.bas]] + * Download :PROPERTIES: :CUSTOM_ID: download