History of Microsoft (1987)
youtube.com1 pointsby fm770 comments
const NaN = $FF shl 23;
var x, t: longint;
f: single absolute x;
begin
t := 0;
x := 0;
repeat
inc(t, ord((x and NaN <> NaN) and (0<=f) and (f<=1)));
inc(x);
until x = 0;
WriteLn('total: ', t);
end.
total: 1065353218 (in ca. 40 seconds) *) https://github.com/michaelforney/cproc
*) programming language used for the compiler: C
*) using QBE as a backend - https://c9x.me/compile/ *) https://github.com/rui314/chibicc
*) programming language used for the compiler: C
*) emits assembly text (x86-64) function add(a,b:integer):integer; { far; in Turbo Pascal }
begin
add := a + b;
end;
type MyFunc = function (a,b:integer):integer;
var f:MyFunc;
x:integer;
begin
f := add; { here we assigning a function to a variable }
x := f(3,4);
end;
> Some dialects - notably, Turbo Pascal - don't allow pointers to local functions at all. procedure MyProc;
{ a local function }
function sub(a,b:integer):integer; { far; in TP }
begin
sub := a - b;
end;
type MyFuncHidden = function (a,b:integer; hidden:word):integer;
var p:pointer;
x:integer;
begin
p := @sub; { assigning a local function to a variable }
x := MyFuncHidden(p)(7,8,0);
end;
The problem here, now you as a programmer are in charge of handling the parameter passing. type
ItemPtr = ^Item;
SomeOtherType = record
a,b,c:integer;
end;
Item = record
Data:string;
Next:ItemPtr;
end;
The first time the parser hits "Item", its not defined. Program PowerPascal;
{$X+}
{
Who: Michael Warot
When: November 12,1989 (my 26'th Birthday!)
What: The beginnings of a language compiler,
takes source from STDIN, and generates
Assembler Source for STDOUT
}
pp002.zip Power Pascal v0.002 (c) 1993 by Mike Warot
Its a very old OS2-oriented Pascal compiler.
Source: .pas (Borland Pascal)
Output: .asm (32-bit => Masm 6.0 + Link386 = > lx .exe)
Documentation: comments in English
[1] http://www.exmortis.narod.ru/comp_src/pp002.zip Borland Pascal v7.0 27th October 1992
Turbo Pascal for Windows v1.5 8th June 1992
Turbo Pascal for Windows v1.0 13th February 1991
Turbo Pascal v6.0 23rd October 1990
Turbo Pascal v5.5 2nd May 1989
Turbo Pascal v5.0 24th August 1988
Turbo Pascal v4.0 20th November 1987
Turbo Pascal v3.0 17th September 1986
Turbo Pascal v2.0 17th April 1984
Turbo Pascal v1.0 20th November 1983
Anyhow, I downloaded your ZIP file and looked into the disassembly. It seems that the disassembler simply disassembled byte by byte not taking into account that TURBO.COM is both, code and data. Since the x86 instruction set is very tense, pretty much every byte sequence turns into legal instructions. Even the ASCII strings were disassembled. Look at address hex4864 in the file for example - it should be the string "Write block to file" but got disassembled. I wonder how AI managed that obscure file.