Posts

Showing posts with the label msdos

FP epsilon estimation in Basic

Image
Floating-point epsilon in retro GW-Basic (MS-DOS) back in the early '80s. This very short code demonstrates how easy it is to get the actual FP accuracy, i.e., the significant decimal digits in FP arithmetic operations. It can be included as-is in any program when needed. The result in GW-Basic is seven FP digits, which is consistent with 4-byte float types used in other programming languages of that era like Fortran and C. Enable captions for more details and walk-through. Source code available at the Github repository (see channel info). Tags: #ambient #coding #programming #notalking #basic #retro #msdos #dosbox

Factorization of a number in GW-Basic

Image
The factorization of an integer in retro GW-Basic no talking, in emulated 80286 / MS-DOS machine in DOSbox. This tutorial is a taste of how home programming looked like in the early '80s, while also showing how notoriously slow GW-Basic was with arithmetic calculations. Enable captions for more details and walk-through. Source code available at the Github repository (see channel info). #ambient #coding #programming #notalking #basic #retro #msdos #dosbox

FP epsilon estimation in Fortran

Image
Floating-point epsilon estimation in retro Fortran no-talking, in emulated 80286 / MS-DOS machine in DOSbox. This program implements floating-point 'epsilon' estimation in retro Fortran no-talking, in emulated 80286 / MS-DOS machine in DOSbox. This very short code demonstrates how easy it is to get the actual FP accuracy, i.e., the significant decimal digits in FP arithmetic operations. The result in Fortran 77 is seven FP digits for REAL type and 15 digits for DOUBLE PRECISION type, which are consistent with 2-byte and 4-byte float types, correspondingly, used in other programming languages of that era like C. Warning: In some older versions of Microsoft's Fortran 77, the batch process 'FORT.BAT' assumed that the input filename is given as argument *without* the '.FOR' extension. If it is given, then the output is unpredictable and usually results in a corrupted *original* (source) file! Make sure to always keep backup before compiling - I had to write th...

Pi value estimation in Pascal

Image
This is an example code for estimating the value of 'pi'. The method is a trivial Monte-Carlo sampling upon a quarter-circle using built-in 'random'. Two different estimations are impleneted: (a) the average area under curve (AUC), which is the (randomized) integral of y=f(x)=sqrt(1-x*x) in [0,1], and (b) the area ratio between the quarter-circle and its bounding box. Since the AUC uses twice the number of samples, it should produce consistently better estimations. Turbo Pascal 3.0 was one of those programming artworks of the early '80s, fitting an editor (external), a compiler, debugger and plenty of room to work with in just 64 KB of RAM. Similarly, it was one of the first programming tools (besides x86 Assemblers) to produce .COM executables directly, since the 'tiny' memory model was the default option at that time. Enable captions for more details and walk-through. Source code available at the Github repository (see channel info). Tags: #asmr #...

Linear regression in Matlab

Image
Linear Regression (LSE) fit in retro Matlab 3.5 (MS-DOS) back in the early '90s. The purpose of this tutorial is to demonstrate elementary data processing and statistics via non-iterative coding paradigms, i.e., based on matrix operations only. Matlab was one of the first programming platforms to adopt such a matrix-based 'algebraic' data manipulation procedure as the core part of the language, like R and Python (numpy, pandas) do today. Although its functionality and toolboxes some three decades ago were nowhere near today's status and richness, it still was one of the most powerful platform for linear Algebra, signal processing and visual data exploration. The most common and almost 100% compatible open-source alternative is Octave, which is also in use today in many Universities around the world. Enable captions for more details and walk-through. Source code available at the Github repository (see channel info). Tags: #ambient #coding #programming #notalking...

Bricks and towers in Prolog

Image
This program is a simple demonstration for illustrating how classic declarative programming can provide very intuitive and compact solution generators for logic problems and combinatorial tasks. In this example, a set of bricks with three sizes and a stability constraint ("do not put larger above") is coded to provide solution searching on all possible ways to build a stable tower of a specific height. Prolog's main advantage over other declarative programming languages is that even in the early '80s came with a rich library of common functionalities that made real-world application development easy. Turbo Prolog was probably the best option for PC machines, with efficient memory enhancements via more strict typing and other syntax shortcuts to limit the tree search in manageable space/time requirements for these platforms. Although now depricated by constrained and fuzzy logic paradigms, Prolog-style programming is still the most intuitive way to design simple expe...

Multiplication tables in COBOL

Image
This program is a simple demonstration of basic user I/O and arithmetic operations in one of the earliest versions of COBOL that was made available for home computers in the early '80s. The "executable" was actually an intermediate binary format created as the compiler output, which could then be executed by another program, not very differently than today's Just-In-Time (JIT) compilers or pre-compiled interpreted languages. The language is the creation of Grace Hopper, a pivotal figure in the evolution of programming and the design of the first trully general-purpose languages. The two main strengths of COBOL was the rich I/O functionality for data file handling and the screen handling routines for creating terminal-based user I/O via forms and tables. Although functionally limited and with loquacious syntax by the programming standards of later language generations, COBOL was deemed extremely reliable and understandable by the programmers of those early days. So m...

PRNG function in Fortran

Image
Pseudo-random number generator function in retro Fortran no-talking, in emulated 80286 / MS-DOS machine in DOSbox. This program implements a pseudo-random number generator (PRNG) by using the classic Mixed-Congruential Sequence (linear) method, as it was described by D. Knuth (1972) regarding proper parameter choices for high-entropy output. The general rules for parameter choice are: M (modulo) must be at most half the available bits width of the integer type used. C (increment) should be chosen close to the value: M * (1/2 - sqrt(3)/6) = 0.2113248654051871... For example: M=2^8 gives C=54 (54.09916...) A (multiplier) should be chosen as to satisfy the following three requirements: A mod 8 = 5 , A between M/100 and M-sqrt(M) , A must not have trivial bit pattern value. Then these three values, along with a user-provided seed value X0, can be used iteratively with: X(n+1) = (A * X(n) + C) mod M , X(0)=X0. Provided that all constraints are satisfied, there are various ...

Pi value estimation in Pascal

Image
This is an example code for estimating the value of 'pi'. The method is a trivial Monte-Carlo sampling upon a quarter-circle using built-in 'random'. Two different estimations are impleneted: (a) the average area under curve (AUC), which is the (randomized) integral of y=f(x)=sqrt(1-x*x) in [0,1], and (b) the area ratio between the quarter-circle and its bounding box. Since the AUC uses twice the number of samples, it should produce consistently better estimations. Turbo Pascal 3.0 was one of those programming artworks of the early '80s, fitting an editor (external), a compiler, debugger and plenty of room to work with in just 64 KB of RAM. Similarly, it was one of the first programming tools (besides x86 Assemblers) to produce .COM executables directly, since the 'tiny' memory model was the default option at that time. Enable captions for more details and walk-through. Source code available at the Github repository (see channel info). Tags: #asmr #coding...

Quadratic equation solver in GW-Basic

Image
Quadratic equation (ax^2+bx+c=0) solver in retro GW-Basic no-talking, in emulated 80286 / MS-DOS machine in DOSbox. This tutorial is a taste of how home programming looked like in the early '80s, while also showing how difficult it was to correctly pre-plan all 'goto' conditional jumps beforehand when line numbering and editing was the only way to actually edit the source code. Enable captions for more details and walk-through. Source code available at the Github repository (see channel info). Tags: #ambient #coding #programming #notalking #basic #retro #msdos #dosbox

Channel Updates