From 2329ed370e1c9614d3bfc16789324af64b6a3838 Mon Sep 17 00:00:00 2001 From: David Lee Date: Thu, 4 Jul 2024 09:37:15 -0700 Subject: [PATCH] linux build --- Microsoft C v1/{e.c => E.C} | 0 Microsoft C v1/{gettm.asm => GETTM.ASM} | 0 Microsoft C v1/{tm.c => TM.C} | 0 Microsoft C v1/{ttt.c => TTT.C} | 0 Microsoft C v1/m.sh | 12 +++ Microsoft C v1/tap.c | 99 ------------------------- Microsoft C v1/tpi.c | 46 ------------ 7 files changed, 12 insertions(+), 145 deletions(-) rename Microsoft C v1/{e.c => E.C} (100%) rename Microsoft C v1/{gettm.asm => GETTM.ASM} (100%) rename Microsoft C v1/{tm.c => TM.C} (100%) rename Microsoft C v1/{ttt.c => TTT.C} (100%) create mode 100644 Microsoft C v1/m.sh delete mode 100644 Microsoft C v1/tap.c delete mode 100644 Microsoft C v1/tpi.c diff --git a/Microsoft C v1/e.c b/Microsoft C v1/E.C similarity index 100% rename from Microsoft C v1/e.c rename to Microsoft C v1/E.C diff --git a/Microsoft C v1/gettm.asm b/Microsoft C v1/GETTM.ASM similarity index 100% rename from Microsoft C v1/gettm.asm rename to Microsoft C v1/GETTM.ASM diff --git a/Microsoft C v1/tm.c b/Microsoft C v1/TM.C similarity index 100% rename from Microsoft C v1/tm.c rename to Microsoft C v1/TM.C diff --git a/Microsoft C v1/ttt.c b/Microsoft C v1/TTT.C similarity index 100% rename from Microsoft C v1/ttt.c rename to Microsoft C v1/TTT.C diff --git a/Microsoft C v1/m.sh b/Microsoft C v1/m.sh new file mode 100644 index 0000000..df4ac32 --- /dev/null +++ b/Microsoft C v1/m.sh @@ -0,0 +1,12 @@ +str=$(tr '[a-z]' '[A-Z]' <<< $1) + +rm $str.OBJ 2>/dev/null +rm $str.MAP 2>/dev/null +rm $str.EXE 2>/dev/null + +ntvdm -r:. -u mc1 $str +ntvdm -r:. -u mc2 $str +ntvdm -r:. -u link $str + c + gettm,, $str.map, mc + +rm $str.OBJ 2>/dev/null +rm $str.MAP 2>/dev/null diff --git a/Microsoft C v1/tap.c b/Microsoft C v1/tap.c deleted file mode 100644 index d024b15..0000000 --- a/Microsoft C v1/tap.c +++ /dev/null @@ -1,99 +0,0 @@ -#include -/* -#include -#include -*/ - -#ifndef __max -#define __max( a, b ) (a) > (b) ? a : b -#define __min( a, b ) (a) < (b) ? a : b -#endif - -typedef /*unsigned*/ long ulong; - -ulong gcd( m, n ) ulong m, n; -{ - ulong a = 0; - ulong b = __max( m, n ); - ulong r = __min( m, n ); - - while ( 0 != r ) - { - a = b; - b = r; - r = a % b; - } - - return b; -} - -/* -ulong randi() -{ - return (ulong) rand() | ( ( (ulong) rand() ) << 16 ); -} -*/ - -/* https://en.wikipedia.org/wiki/Ap%C3%A9ry%27s_theorem */ - -int first_implementation() -{ - ulong total = 1000; - ulong i, iq; - double sofar = 0.0; - ulong prev = 1; - - for ( i = 1; i <= total; i++ ) - { - iq = i * i * i; - sofar += (double) 1.0 / (double) ( iq ); - /*printf( "i, iq, and sofar: %lu, %lu, %lf\n", i, iq, sofar );*/ - - if ( i == ( prev * 10 ) ) - { - prev = i; - printf( " at %12lu iterations: %lf\n", i, sofar ); - fflush( stdout ); - } - } -} - -int main() -{ - ulong totalEntries = 100000; - ulong i, prev, totalCoprimes, greatest, a, b, c; - - printf( "starting, should tend towards 1.2020569031595942854...\n" ); - - printf( "first implementation...\n" ); - first_implementation(); - -/* no rand - printf( "second implementation...\n" ); - - - totalCoprimes = 0; - prev = 1; - - for ( i = 1; i <= totalEntries; i++ ) - { - a = randi(); - b = randi(); - c = randi(); - - greatest = gcd( a, gcd( b, c ) ); - if ( 1 == greatest ) - totalCoprimes++; - - if ( i == ( prev * 10 ) ) - { - prev = i; - printf( " at %12lu iterations: %lf\n", i, (double) i / (double) totalCoprimes ); - fflush( stdout ); - } - } -*/ - - printf( "done\n" ); - return 1202; -} diff --git a/Microsoft C v1/tpi.c b/Microsoft C v1/tpi.c deleted file mode 100644 index 07055b0..0000000 --- a/Microsoft C v1/tpi.c +++ /dev/null @@ -1,46 +0,0 @@ -#include - -#define HIGH_MARK 500 /* 2800 */ - -static long r[HIGH_MARK + 1]; - -int main() { - long i, k, c; - long b, d; - long iter; - - int iterations = 1; - - for ( iter = 0; iter < iterations; iter++ ) { - c = 0; - - for (i = 0; i < HIGH_MARK; i++) { - r[i] = 2000; - } - - for (k = HIGH_MARK; k > 0; k -= 14) { - d = 0; - - i = k; - for (;;) { - d += r[i] * 10000; - b = 2 * i - 1; - - r[i] = d % b; - d /= b; - i--; - if (i == 0) break; - d *= i; - } - if ( iter == ( iterations - 1 ) ) - { - printf( "%.4d", c + d / 10000 ); - fflush( stdout ); - } - c = d % 10000; - } - } - - printf( "\n" ); - return 0; -}