diff --git a/Microsoft Pascal v1/C86.EXE b/Microsoft Pascal v1/C86.EXE new file mode 100644 index 0000000..1a588ba Binary files /dev/null and b/Microsoft Pascal v1/C86.EXE differ diff --git a/Microsoft Pascal v1/E.PAS b/Microsoft Pascal v1/E.PAS new file mode 100644 index 0000000..af2ff86 --- /dev/null +++ b/Microsoft Pascal v1/E.PAS @@ -0,0 +1,42 @@ +(*$DEBUG- added, of course *) +program e; + +const + DIGITS = 200; + +type + arrayType = array[ 0..DIGITS ] of integer; + +var + high, n, x : integer; + a : arrayType; + +begin + high := DIGITS; + x := 0; + + n := high - 1; + while n > 0 do begin + a[ n ] := 1; + n := n - 1; + end; + + a[ 1 ] := 2; + a[ 0 ] := 0; + + while high > 9 do begin + high := high - 1; + n := high; + while 0 <> n do begin + a[ n ] := x MOD n; + x := 10 * a[ n - 1 ] + x DIV n; + n := n - 1; + end; + + Write( x ); + end; + + writeln; + writeln( 'done' ); +end. + diff --git a/Microsoft Pascal v1/ENTX6L.ASM b/Microsoft Pascal v1/ENTX6L.ASM new file mode 100644 index 0000000..29b8015 --- /dev/null +++ b/Microsoft Pascal v1/ENTX6L.ASM @@ -0,0 +1,205 @@ +NAME ENTX + +; Microsoft MS-DOS Computer Pascal runtime system control +; Version 1.00 (C) Copyright 1981 by Microsoft Corp + +;Memory Layout: +; +; Hi -> COMMAND (may be overlayed) +; CONST segment +; DATA segment +; STACK segment +; MEMORY segment +; HEAP segment +; CODE segments +; Lo -> DOS code and data (fixed) +; +;The linker is told to load low and use DS allocation. Only 512 bytes +;of initial stack are allocated, and no heap at all. BEGXQQ moves all +;data to high memory, creating a gap in which the stack grows downward +;and the heap grows upward. The heap can grow downward over code too. + +EXTRN ENTGQQ:FAR ;Main program entry point +EXTRN INIUQQ:FAR,ENDUQQ:FAR ;file system initialize/terminate +EXTRN ENDYQQ:FAR ;file system, close files +EXTRN BEGOQQ:FAR,ENDOQQ:FAR ;user system initialize/terminate + +;First dummy code segment tells linker to load code lowest +; +INIXQQ SEGMENT 'CODE' +INIXQQ ENDS + +;Heap segment definition (lowest of the data segments) +; +HEAP SEGMENT PUBLIC 'MEMORY' +MEMLO EQU THIS BYTE ;lowest data byte address +HEAP ENDS + +;Memory segment definition (special purpose zero length) +; +MEMORY SEGMENT PUBLIC 'MEMORY' +MEMORY ENDS + +;Stack segment definition (fixed initial minimal length) +; +STACK SEGMENT STACK 'STACK' + DB 256 DUP (?) +SKTOP EQU THIS BYTE +STACK ENDS + +;FIRST resident public data +; +DATA SEGMENT PUBLIC 'DATA' +PUBLIC CSXEQQ ;pointer to sourcef context list +CSXEQQ DW 0 +PUBLIC CLNEQQ ;last line number encountered +CLNEQQ DW 0 +PUBLIC PNUXQQ ;pointer to unit initialization list +PNUXQQ DW 0 +PUBLIC HDRFQQ ;Pascal open file list header +HDRFQQ DW 0 +PUBLIC HDRVQQ ;Unit V open file list header +HDRVQQ DW 0 +PUBLIC RESEQQ ;machine error context, stack ptr +RESEQQ DW 0 +PUBLIC REFEQQ ;machine error context, frame ptr +REFEQQ DW 0 +PUBLIC REPEQQ ;machine error context, program offset +REPEQQ DW 0 +PUBLIC RECEQQ ;machine error context, program segment +RECEQQ DW 0 +PUBLIC BEGHQQ ;first header word in heap +BEGHQQ DW 0 +PUBLIC CURHQQ ;pointer to current heap item +CURHQQ DW 0 +PUBLIC ENDHQQ ;just past end of the heap +ENDHQQ DW 0 +PUBLIC STKBQQ ;stack start, to fix long GOTO +STKBQQ DW 0 +PUBLIC STKHQQ ;stack limit, to check overflow +STKHQQ DW 0 +PUBLIC CRCXQQ ;value of CX for DOS call +CRCXQQ DW 0 +PUBLIC CRDXQQ ;value of DX for DOS call +CRDXQQ DW 0 +PUBLIC CESXQQ ;DOS saved ES value (for command line) +DOSOFF DW 0 ;DOS exit offset, 0 +CESXQQ DW 0 ;DOS saved ES value +DATA ENDS + +;Constant segment definition +; +CONST SEGMENT PUBLIC 'CONST' +CONST ENDS + +;Code for this module +; +ENTXQQ SEGMENT 'CODE' +DGROUP GROUP DATA,STACK,CONST,HEAP,MEMORY + ASSUME CS:ENTXQQ,DS:DGROUP,ES:DGROUP,SS:DGROUP + +PUBLIC BEGXQQ,ENDXQQ,DOSXQQ ;main entry and exit points + +;BEGXQQ: Initialization code +; - move DGROUP up as much as possible to get gap +; - set initial stackpointer, framepointer, STKBQQ +; - clear RESEQQ (machine error context) +; - clear CSXEQQ (sourcef error context) +; - clear PNUXQQ (unit init list header) +; - clear HDRFQQ and HDRVQQ (open file headers) +; - set BEGHQQ, CURHQQ, ENDHQQ, STKHQQ (heap init) +; - call INIUQQ (file initialization) +; - call BEGOQQ (user initialization) +; - call ENTGQQ (main program entry) +; +BEGXQQ PROC FAR + MOV AX,DGROUP ;get assumed data segment value + MOV DS,AX ;only need to address CESXQQ + MOV CESXQQ,ES ;save incomming ES value + MOV DX,OFFSET DGROUP:MEMLO ;DS offset to lowest data + SHR DX,1 ;make into word offset address + MOV CX,32768 ;highest word address possible + SUB CX,DX ;count of words in data segment + SHR DX,1 ;make count + SHR DX,1 ; into paragraph + SHR DX,1 ; (segment) address + INC DX ;round to next paragraph address + ADD DX,AX ;DX is start-of-data paragraph + MOV BX,2 ;[assembler rejects ES:2] + MOV BP,ES:[BX] ;DOS end paragraph + MOV BX,DX ;save to initialize heap later + ADD DX,4096 ;optimal end-of-data paragraph + CMP DX,BP ;enough memory for 64K data ? + JLE MEMA ;yes, can use optimal address + MOV DX,BP ;no, must use highest address +MEMA: SUB DX,4096 ;DX is final DS (may be negative) + STD ;set direction flag + MOV DS,AX ;source segment + MOV SI,65534 ;source offset + MOV ES,DX ;target segment + MOV DI,SI ;target offset + REP MOVSW ;move DS:SI-- to ES:DI-- until CX-=0 + MOV DS,DX ;final DS value (may be negative) + CLI ;no interrupts (no stack) + MOV SS,DX ;initialize stack segment + MOV SP,OFFSET DGROUP:SKTOP ;set stackpointer + STI ;interrupts ok (stack ok) + MOV STKBQQ,SP ;to re-init SP after long GOTO + SUB BP,BP ;initial frame pointer zero + MOV RESEQQ,BP ;machine error context zero + MOV CSXEQQ,BP ;sourcef error context NIL + MOV PNUXQQ,BP ;unit init list header NIL + MOV HDRFQQ,BP ;Pascal open file header NIL + MOV HDRVQQ,BP ;Unit V open file header NIL + SUB BX,DX ;para addr of start of heap + SHL BX,1 ;make + SHL BX,1 ;into + SHL BX,1 ;offr + SHL BX,1 ;addr + MOV BEGHQQ,BX ;start of heap address + MOV CURHQQ,BX ;current heap item adr + MOV WORD PTR[BX],1 ;current header; free + ADD BX,2 ;byte after end of heap + MOV ENDHQQ,BX ;address after end of heap + ADD BX,384 ;comfortable boundary + MOV STKHQQ,BX ;stack overflow address + CALL INIUQQ ;initialize file system + CALL BEGOQQ ;initialize user system + CALL ENTGQQ ;call main program +;ENDXQQ: Termination code +; - call ENDOQQ (user termination) +; - call ENDYQQ (close open files) +; - call ENDUQQ (file termination) +; - return to operating system +; +ENDXQQ LABEL FAR ;termination entry point + CALL ENDOQQ ;user system termination + CALL ENDYQQ ;close all open files + CALL ENDUQQ ;file system termination + MOV DOSOFF,0 ;make sure jump offset zero + JMP DWORD PTR DOSOFF ;return to DOS +BEGXQQ ENDP + +;DOSXQQ: Call DOS Operating System +; +DOSXQQ PROC FAR + POP SI ;get return ads + POP DI ;get return ads + POP DX ;get address parameter + POP AX ;get function parameter + MOV AH,AL ;must be in high half + MOV CX,CRCXQQ ;need CX for some functions + PUSH DI ;save return ads + PUSH SI ;save return ads + PUSH BP ;have to save this one + INT 33 ;onward to DOS + MOV CRCXQQ,CX ;return CX value + MOV CRDXQQ,DX ;return DX value + POP BP ;restore frame pointer + RET ;return (DOS ret in AX) +DOSXQQ ENDP + +ENTXQQ ENDS + + END BEGXQQ + \ No newline at end of file diff --git a/Microsoft Pascal v1/FINK b/Microsoft Pascal v1/FINK new file mode 100644 index 0000000..9c1e8ab Binary files /dev/null and b/Microsoft Pascal v1/FINK differ diff --git a/Microsoft Pascal v1/FINKXM b/Microsoft Pascal v1/FINKXM new file mode 100644 index 0000000..de0d673 Binary files /dev/null and b/Microsoft Pascal v1/FINKXM differ diff --git a/Microsoft Pascal v1/FINU b/Microsoft Pascal v1/FINU new file mode 100644 index 0000000..4c9a1e7 Binary files /dev/null and b/Microsoft Pascal v1/FINU differ diff --git a/Microsoft Pascal v1/FLOAT.PAS b/Microsoft Pascal v1/FLOAT.PAS new file mode 100644 index 0000000..840208e --- /dev/null +++ b/Microsoft Pascal v1/FLOAT.PAS @@ -0,0 +1,52 @@ +program tf( INPUT, OUTPUT ); + +var + r, a, b, c : real; + i, x : integer; + +procedure phi; +var + prev2, prev1, i, next : integer; + v : real; +begin + writeln( 'should tend towards 1.618033988749...' ); + prev1 := 1; + prev2 := 1; + + for i := 1 to 21 do begin { integer overflow beyond this } + next := prev1 + prev2; + prev2 := prev1; + prev1 := next; + + v := prev1 / prev2; + writeln( ' at ', i, ' iterations: ', v ); + end; +end; + +begin { tf } + a := 1.1; + b := 2.2; + c := 3.3; + for i := 1 to 8 do begin + writeln( 'a, b, c, i: ', a, b, c, i ); + + a := b * c; + b := a * c; + r := arctan( a ); + r := cos( a ); + { r := exp( a ); } +{ r := frac( a ); } +{ if a <= 32727.0 then r := int( a ); } + r := ln( a ); + r := sin( a ); + r := sqr( a ); + r := sqrt( a ); + if a <= 32767.0 then x := round( a ); + if a <= 32767.0 then x := trunc( a ); + end; + + writeln; + writeln( 'a, b, c: ', a, b, c ); + + phi; +end. { tf } diff --git a/Microsoft Pascal v1/LINK.EXE b/Microsoft Pascal v1/LINK.EXE new file mode 100644 index 0000000..a025fdd Binary files /dev/null and b/Microsoft Pascal v1/LINK.EXE differ diff --git a/Microsoft Pascal v1/M86.EXE b/Microsoft Pascal v1/M86.EXE new file mode 100644 index 0000000..e58a077 Binary files /dev/null and b/Microsoft Pascal v1/M86.EXE differ diff --git a/Microsoft Pascal v1/NULL.LIB b/Microsoft Pascal v1/NULL.LIB new file mode 100644 index 0000000..e729af5 Binary files /dev/null and b/Microsoft Pascal v1/NULL.LIB differ diff --git a/Microsoft Pascal v1/PAS1.EXE b/Microsoft Pascal v1/PAS1.EXE new file mode 100644 index 0000000..abbf5c2 Binary files /dev/null and b/Microsoft Pascal v1/PAS1.EXE differ diff --git a/Microsoft Pascal v1/PAS2.EXE b/Microsoft Pascal v1/PAS2.EXE new file mode 100644 index 0000000..30d238d Binary files /dev/null and b/Microsoft Pascal v1/PAS2.EXE differ diff --git a/Microsoft Pascal v1/PASCAL.LIB b/Microsoft Pascal v1/PASCAL.LIB new file mode 100644 index 0000000..4d5c620 Binary files /dev/null and b/Microsoft Pascal v1/PASCAL.LIB differ diff --git a/Microsoft Pascal v1/PASCAL.MAP b/Microsoft Pascal v1/PASCAL.MAP new file mode 100644 index 0000000..28fde9b --- /dev/null +++ b/Microsoft Pascal v1/PASCAL.MAP @@ -0,0 +1,497 @@ + +ABSRQQ..........................REAR6 +ACSRQQ..........................RFAR +ADDRQQ..........................REAR6 +ADDSQQ..........................SETS +AINRQQ..........................RFAR +ALLHQQ..........................HEAH +ANNRQQ..........................RFAR +ASMGQQ..........................MISG6 +ASNEQQ..........................ERRE +ASNGQQ..........................MISG6 +ASNRQQ..........................RFAR +ASSFQQ..........................FILF +AT2RQQ..........................RFAR +ATNRQQ..........................TNSR +AVAGQQ..........................MISG6 +BEGHQQ..........................ENTX6S +BEGOQQ..........................MISO +BEGXQQ..........................ENTX6S +BRTEQQ..........................MISG6 +BUFFQQ..........................FILF +BUFUQQ..........................PASUXM +CEQRQQ..........................REAR6 +CEQSQQ..........................SETS +CESGQQ..........................MISG6 +CESXQQ..........................ENTX6S +CINSQQ..........................MISG6 +CISSQQ..........................SETS +CLDFQQ..........................FILF +CLDUQQ..........................FILUXM +CLERQQ..........................REAR6 +CLESQQ..........................SETS +CLNEQQ..........................ENTX6S +CLOFQQ..........................FILF +CLSGQQ..........................MISG6 +CLSUQQ..........................FILUXM +CLTRQQ..........................REAR6 +CLTSQQ..........................SETS +CNVEQQ..........................ERRE +CNVR............................CNVR +CODCQQ..........................CODC +CONLQQ..........................LSTL +COSRQQ..........................TNSR +CPLLQQ..........................LSTL +CPSLQQ..........................LSTL +CRCXQQ..........................ENTX6S +CRDXQQ..........................ENTX6S +CSHRQQ..........................RFAR +CSLEQQ..........................PASE +CSXEQQ..........................ENTX6S +CURHQQ..........................ENTX6S +CUTHQQ..........................MISHM +DATE............................TIDGS +DEBCQQ..........................CODC +DEBEQQ..........................DEBE +DEICQQ..........................CODC +DEJCQQ..........................CODC +DELLQQ..........................LSTL +DERCQQ..........................REAC +DEWCQQ..........................CODC +DEXCQQ..........................CODC +DIG2............................TIDGS +DISEQQ..........................PASE +DIVRQQ..........................REAR6 +DOSXQQ..........................ENTX6S +DXPRQQ..........................UTLR +DZIEQQ..........................ERRE +DZREQQ..........................ERRE +DZWEQQ..........................ERRE +EMSEQQ..........................ERRE +ENBCQQ..........................CODC +ENDHQQ..........................ENTX6S +ENDOQQ..........................MISO +ENDUQQ..........................FILUXM +ENDXQQ..........................ENTX6S +ENDYQQ..........................MISY +ENICQQ..........................CODC +ENRCQQ..........................REAC +ENTEQQ..........................DEBE +ENWCQQ..........................CODC +EOFFQQ..........................FILF +EOLFQQ..........................FILF +EQCLQQ..........................LSTL +EQDLQQ..........................LSTL +ERCFQQ..........................FILF +ERREQQ..........................ERRE +ERTEQQ..........................MISG6 +EXPEQQ..........................ERRE +EXPRQQ..........................TNSR +EXTEQQ..........................DEBE +FERFQQ..........................FILF +FILFQQ..........................FILF +FILKQQ..........................MISY +FILLC...........................MISG6 +FILLSC..........................MISG6 +FILUQQ..........................FILUXM +FLBUQQ..........................FILUXM +FLTRQQ..........................CNVR +FNSUQQ..........................FILUXM +GETFQQ..........................FILF +GETHQQ..........................HEAH +GETUQQ..........................FILUXM +GFNUQQ..........................FILUXM +GHIEQQ..........................ERRE +GHSEQQ..........................ERRE +GHVEQQ..........................ERRE +GROHQQ..........................MISHM +GTUFQQ..........................FILF +GTYUQQ..........................FILUXM +HDRFQQ..........................ENTX6S +HDRVQQ..........................ENTX6S +HEAHQQ..........................HEAH +INIEQQ..........................PASE +INIFQQ..........................FILF +INIUQQ..........................FILUXM +INJEQQ..........................PASE +INPFQQ..........................FILF +INPUQQ..........................FILUXM +INSLQQ..........................LSTL +INUEQQ..........................PASE +INUXQQ..........................PASE +LECLQQ..........................LSTL +LEDLQQ..........................LSTL +LNDRQQ..........................RFAR +LNEEQQ..........................ERRE +LNERQQ..........................TNSR +LNTEQQ..........................DEBE +LOCKED..........................MISG6 +LSLEQQ..........................PASE +LSTLQQ..........................LSTL +LTCLQQ..........................LSTL +LTDLQQ..........................LSTL +M10RQQ..........................UTLR +MAXRQQ..........................RFAR +MICEQQ..........................PASE +MIN.............................SETS +MIN8............................TIDGS +MINRQQ..........................RFAR +MISHQQ..........................MISHM +MISOQQ..........................MISO +MISYQQ..........................MISY +MOVEL...........................MISG6 +MOVER...........................MISG6 +MOVESL..........................MISG6 +MOVESR..........................MISG6 +MP2RQQ..........................REAR6 +MTBUQQ..........................MISG6 +MULRQQ..........................REAR6 +MULSQQ..........................SETS +NECLQQ..........................LSTL +NEDLQQ..........................LSTL +NEGRQQ..........................REAR6 +NEWFQQ..........................FILF +NEWUQQ..........................PASUXM +NILEQQ..........................PASE +NXTUQQ..........................FILUXM +ONESQQ..........................SETS +OPNUQQ..........................FILUXM +ORDFQQ..........................ORDF +OUTFQQ..........................FILF +OUTUQQ..........................FILUXM +OVIEQQ..........................ERRE +OVREQQ..........................ERRE +OVWEQQ..........................ERRE +PADFQQ..........................FILF +PASEQQ..........................PASE +PASUQQ..........................PASUXM +PBAFQQ..........................FILF +PBCFQQ..........................FILF +PBFFQQ..........................FILF +PBLFQQ..........................FILF +PCCUQQ..........................FILUXM +PCDEQQ..........................PASE +PERUQQ..........................FILUXM +PFNUQQ..........................FILUXM +PLYRQQ..........................TNSR +PLYUQQ..........................FILUXM +PNUXQQ..........................ENTX6S +POSLQQ..........................LSTL +PPAFQQ..........................FILF +PPEFQQ..........................FILF +PPLFQQ..........................FILF +PPMFQQ..........................FILF +PPMUQQ..........................FILUXM +PTUFQQ..........................FILF +PTYUQQ..........................FILUXM +PUTFQQ..........................FILF +PUTUQQ..........................FILUXM +RCIEQQ..........................PASE +RCWEQQ..........................PASE +REAC............................REAC +RECEQQ..........................ENTX6S +REFEQQ..........................ENTX6S +REPEQQ..........................ENTX6S +RESEQQ..........................ENTX6S +RESFQQ..........................FILF +REWFQQ..........................FILF +RFARQQ..........................RFAR +RIOFQQ..........................RIOF +RNPEQQ..........................ERRE +ROURQQ..........................CNVR +RSIRQQ..........................RFAR +RSRRQQ..........................RFAR +RSTFQQ..........................STRF +RTAFQQ..........................ORDF +RTBFQQ..........................ORDF +RTCFQQ..........................STRF +RTIFQQ..........................ORDF +RTJFQQ..........................ORDF +RTLFQQ..........................FILF +RTQFQQ..........................ORDF +RTRFQQ..........................RIOF +RTSFQQ..........................STRF +RTTFQQ..........................STRF +RTWFQQ..........................ORDF +RTXFQQ..........................ORDF +SADDOK..........................MISG6 +SAOGQQ..........................MISG6 +SCALQQ..........................LSTL +SDZGQQ..........................MISG6 +SEKFQQ..........................FILF +SEKUQQ..........................FILUXM +SELEQQ..........................PASE +SEQLQQ..........................LSTL +SETEQQ..........................PASE +SETSQQ..........................SETS +SINEQQ..........................ERRE +SINRQQ..........................TNSR +SMULOK..........................MISG6 +SNELQQ..........................LSTL +SNHRQQ..........................RFAR +SOVEQQ..........................ERRE +SOVGQQ..........................MISG6 +SQRRQQ..........................TNSR +SRTEQQ..........................ERRE +SRTRQQ..........................TNSR +STKBQQ..........................ENTX6S +STKHQQ..........................ENTX6S +STRFQQ..........................STRF +SUBRQQ..........................REAR6 +SUBSQQ..........................SETS +TANEQQ..........................ERRE +TANRQQ..........................RFAR +TFNUQQ..........................PASUXM +TICS............................TIDGS +TIDGQQ..........................TIDGS +TIME............................TIDGS +TNHRQQ..........................RFAR +TNSR............................TNSR +TRAEQQ..........................DEBE +TRNRQQ..........................CNVR +TWOSQQ..........................SETS +UADDOK..........................MISG6 +UAOGQQ..........................MISG6 +UDZGQQ..........................MISG6 +UM46OK..........................UTLX +UMULOK..........................MISG6 +UNLOCK..........................MISG6 +UTLR............................UTLR +UTLXQQ..........................UTLX +VASGQQ..........................MISG6 +WEFUQQ..........................FILUXM +WSBFQQ..........................FILF +WTBFQQ..........................ORDF +WTCFQQ..........................STRF +WTIFQQ..........................ORDF +WTLFQQ..........................FILF +WTPFQQ..........................FILF +WTRFQQ..........................RIOF +WTSFQQ..........................STRF +WTTFQQ..........................STRF +WTWFQQ..........................ORDF +ZERSQQ..........................SETS + + +CNVR (Length 0313H bytes) + + CNVR FLTRQQ + ROURQQ TRNRQQ + +CODC (Length 07C9H bytes) + + CODCQQ DEBCQQ + DEICQQ DEJCQQ + DEWCQQ DEXCQQ + ENBCQQ ENICQQ + ENWCQQ + +DEBE (Length 00FEH bytes) + + DEBEQQ ENTEQQ + EXTEQQ LNTEQQ + TRAEQQ + +ENTX6S (Length 01EBH bytes) + + BEGHQQ BEGXQQ + CESXQQ CLNEQQ + CRCXQQ CRDXQQ + CSXEQQ CURHQQ + DOSXQQ ENDHQQ + ENDXQQ HDRFQQ + HDRVQQ PNUXQQ + RECEQQ REFEQQ + REPEQQ RESEQQ + STKBQQ STKHQQ + +ERRE (Length 0785H bytes) + + ASNEQQ CNVEQQ + DZIEQQ DZREQQ + DZWEQQ EMSEQQ + ERREQQ EXPEQQ + GHIEQQ GHSEQQ + GHVEQQ LNEEQQ + OVIEQQ OVREQQ + OVWEQQ RNPEQQ + SINEQQ SOVEQQ + SRTEQQ TANEQQ + +FILF (Length 1557H bytes) + + ASSFQQ BUFFQQ + CLDFQQ CLOFQQ + EOFFQQ EOLFQQ + ERCFQQ FERFQQ + FILFQQ GETFQQ + GTUFQQ INIFQQ + INPFQQ NEWFQQ + OUTFQQ PADFQQ + PBAFQQ PBCFQQ + PBFFQQ PBLFQQ + PPAFQQ PPEFQQ + PPLFQQ PPMFQQ + PTUFQQ PUTFQQ + RESFQQ REWFQQ + RTLFQQ SEKFQQ + WSBFQQ WTLFQQ + WTPFQQ + +FILUXM (Length 11A7H bytes) + + CLDUQQ CLSUQQ + ENDUQQ FILUQQ + FLBUQQ FNSUQQ + GETUQQ GFNUQQ + GTYUQQ INIUQQ + INPUQQ NXTUQQ + OPNUQQ OUTUQQ + PCCUQQ PERUQQ + PFNUQQ PLYUQQ + PPMUQQ PTYUQQ + PUTUQQ SEKUQQ + WEFUQQ + +HEAH (Length 01CDH bytes) + + ALLHQQ GETHQQ + HEAHQQ + +LSTL (Length 0759H bytes) + + CONLQQ CPLLQQ + CPSLQQ DELLQQ + EQCLQQ EQDLQQ + INSLQQ LECLQQ + LEDLQQ LSTLQQ + LTCLQQ LTDLQQ + NECLQQ NEDLQQ + POSLQQ SCALQQ + SEQLQQ SNELQQ + +MISG6 (Length 0302H bytes) + + ASMGQQ ASNGQQ + AVAGQQ BRTEQQ + CESGQQ CINSQQ + CLSGQQ ERTEQQ + FILLC FILLSC + LOCKED MOVEL + MOVER MOVESL + MOVESR MTBUQQ + SADDOK SAOGQQ + SDZGQQ SMULOK + SOVGQQ UADDOK + UAOGQQ UDZGQQ + UMULOK UNLOCK + VASGQQ + +MISHM (Length 00BDH bytes) + + CUTHQQ GROHQQ + MISHQQ + +MISO (Length 0050H bytes) + + BEGOQQ ENDOQQ + MISOQQ + +MISY (Length 00F2H bytes) + + ENDYQQ FILKQQ + MISYQQ + +ORDF (Length 0653H bytes) + + ORDFQQ RTAFQQ + RTBFQQ RTIFQQ + RTJFQQ RTQFQQ + RTWFQQ RTXFQQ + WTBFQQ WTIFQQ + WTWFQQ + +PASE (Length 065BH bytes) + + CSLEQQ DISEQQ + INIEQQ INJEQQ + INUEQQ INUXQQ + LSLEQQ MICEQQ + NILEQQ PASEQQ + PCDEQQ RCIEQQ + RCWEQQ SELEQQ + SETEQQ + +PASUXM (Length 00EFH bytes) + + BUFUQQ NEWUQQ + PASUQQ TFNUQQ + +REAC (Length 0951H bytes) + + DERCQQ ENRCQQ + REAC + +REAR6 (Length 034AH bytes) + + ABSRQQ ADDRQQ + CEQRQQ CLERQQ + CLTRQQ DIVRQQ + MP2RQQ MULRQQ + NEGRQQ SUBRQQ + +RFAR (Length 0941H bytes) + + ACSRQQ AINRQQ + ANNRQQ ASNRQQ + AT2RQQ CSHRQQ + LNDRQQ MAXRQQ + MINRQQ RFARQQ + RSIRQQ RSRRQQ + SNHRQQ TANRQQ + TNHRQQ + +RIOF (Length 0125H bytes) + + RIOFQQ RTRFQQ + WTRFQQ + +SETS (Length 0586H bytes) + + ADDSQQ CEQSQQ + CISSQQ CLESQQ + CLTSQQ MIN + MULSQQ ONESQQ + SETSQQ SUBSQQ + TWOSQQ ZERSQQ + +STRF (Length 0399H bytes) + + RSTFQQ RTCFQQ + RTSFQQ RTTFQQ + STRFQQ WTCFQQ + WTSFQQ WTTFQQ + +TIDGS (Length 01C4H bytes) + + DATE DIG2 + MIN8 TICS + TIDGQQ TIME + +TNSR (Length 0805H bytes) + + ATNRQQ COSRQQ + EXPRQQ LNERQQ + PLYRQQ SINRQQ + SQRRQQ SRTRQQ + TNSR + +UTLR (Length 02D6H bytes) + + DXPRQQ M10RQQ + UTLR + +UTLX (Length 0143H bytes) + + UM46OK UTLXQQ + \ No newline at end of file diff --git a/Microsoft Pascal v1/PASKEY b/Microsoft Pascal v1/PASKEY new file mode 100644 index 0000000..065adb1 Binary files /dev/null and b/Microsoft Pascal v1/PASKEY differ diff --git a/Microsoft Pascal v1/PRIMES.PAS b/Microsoft Pascal v1/PRIMES.PAS new file mode 100644 index 0000000..e8669e4 --- /dev/null +++ b/Microsoft Pascal v1/PRIMES.PAS @@ -0,0 +1,32 @@ +(* Eratosthenes Sieve Prime Number Program in Pascal *) +(* From September, 1981 Byte magazine, page 182 *) +PROGRAM PRIME (OUTPUT); (*$DEBUG- added, of course *) +CONST + SIZE = 8190; + +VAR + FLAGS : ARRAY [0..SIZE] OF BOOLEAN; + I,PRIME,K,COUNT,ITER : INTEGER; + +PROCEDURE FILLC(LOC: ADRMEM; LEN: WORD; VAL: CHAR); EXTERN; + +BEGIN +WRITELN ('10 iterations'); +FOR ITER := 1 TO 10 DO BEGIN + COUNT := 0; + FILLC(ADR FLAGS,SIZEOF(FLAGS),CHR(TRUE)); + FOR I := 0 TO SIZE DO + IF FLAGS[I] THEN BEGIN + PRIME := I+I+3; + K := I + PRIME; + WHILE K <= SIZE DO BEGIN + FLAGS[K] := FALSE; + K := K + PRIME + END; + COUNT := COUNT + 1 + (* WRITELN(PRIME) *) + END; + END; +WRITELN(COUNT,' primes') +END. + \ No newline at end of file diff --git a/Microsoft Pascal v1/Pascal-Primer-for-the-IBM-PC_removed.pdf b/Microsoft Pascal v1/Pascal-Primer-for-the-IBM-PC_removed.pdf new file mode 100644 index 0000000..4cb4aab Binary files /dev/null and b/Microsoft Pascal v1/Pascal-Primer-for-the-IBM-PC_removed.pdf differ diff --git a/Microsoft Pascal v1/READ.ME b/Microsoft Pascal v1/READ.ME new file mode 100644 index 0000000..a205bb6 --- /dev/null +++ b/Microsoft Pascal v1/READ.ME @@ -0,0 +1,126 @@ +This describes the contents of the accompanying diskettes. A detailed +description of how to use the compiler and other utilities is given in +the appropriate User manuals. However, since these are still in +preparation and are not available, a brief outline is given below. + +Files on this distribution +-------------------------- + + Pascal Compiler + + READ.ME This Memo + PAS1.EXE Pascal Compiler Pass 1 + PAS2.EXE Compiler Pass 2 (Common to Fortran and Pascal) + + Pascal Run-Time + + LINK.EXE Microsoft Linker for .OBJ files + PASCAL.LIB The Pascal Library + +To use this distribution of Microsoft Pascal you need an MS-DOS +system with at least least 128K of contiguous main memory, and at least one +standard MS-DOS compatible floppy disk drive. + +These files are distributed on two disks because they won't all fit on one +single-density disk. Disk 1 has the compiler first pass, PAS1.EXE; the Pascal +library, PASCAL.LIB; and other assorted files. Disk 2 has the compiler second +pass, PAS2.EXE; and the linker, LINK.EXE. If you have a double-density disk +system, you will find it much more convenient to use the compiler if you copy +all these files onto one double-density disk. + +Compiling +--------- + +To use Microsoft Pascal please follow these instructions: + +Place the disk containing pass one of the compiler (PAS1.EXE) in a drive. + +Place a disk containing at least 160K free space in the default drive. +The intermediate files generated by the first pass of the compiler will be +put on this disk. If there is sufficient space on the disk with the first +pass of the compiler, it can be used to store the intermediate files. + +The source file can be on any drive. + +Initiate the first pass of the compiler by typing: + + d:PAS1 sourcefile,objectfile,sourcelist,objectlist + +You should note the following about the command line: + +1. Filemanes can appear on the command line, of (if not enough are +given) the user is prompted for filenames. + +2. Commas between filenames, and a trailing semicolon, are optional. +Lower case is always converted to upper case. + +3. Filesnames occure in the following order: + + source, object, source listing, object listing; + +4. The source extension defaults to .PAS. +The object extension defaults to source.OBJ, listing file extensions +to .LST for the source listing, and .COD for the object listing. +Default extensions are given in the prompt. + +5. There is no default source filename. Object filename defaults to +the same as the source, and listing filenames default to NUL except +that when a comma preceeds a missing listing filename it defaults to +the source filename as well: + + "d:PAS1 SS,,,;" read SS.PAS, write SS.OBJ, SS.LST, SS.COD + "d:PAS1 SS;" read SS.PAS, write SS.OBJ, listings to NUL. + +6. Blanks are permitted, except within filenames. + +7. If the trailing ";" is missing from the command line and more +files could follow, the prompt sequence starts, giving default to use. + +8. A new drive (as in "B:") or extension (as in ".REL") can be given +in any file position to override the default; does not affect the +filename itself. + +Examples: + +A:PAS1 pascalfn; +B:PAS1 +Source file [.PAS]: pascalfn +Object file [.OBJ]: A: +Source list [.LST]: /c/d +Object list [.COD]: ; + +Complete the compilation by inserting the disk with the compiler +second pass (PAS2.EXE) and typing: + + d:PAS2 + +PAS2 is the same for Microsoft Fortran and Pascal because both +languages have a common intermediate form. As PAS2 executes, +it will read the intermediate files created by PAS1 from the +default drive and create a new file on the default drive: PASIBF.TMP +as well as the object and listing files. PASIBF.TMP is a temporary +file used by PAS2 for scratch. All of the PASIBF files are +automatically deleted when PAS2 completes normally. The object file +is the relocatable binary object file for input to the Microsoft Linker. + +Linking +------- + +Link the object program by typing: + + LINK objectfile; + +The Linker links the object file(s) using PASCAL.LIB as the library. +The command line syntax is similar to that of the Pascal front end, +except that more than one .OBJ file can be specified as input using +"+" as a separator. There are other features as well. Read the +Linker Manual to find out about them. + +Running your Program +-------------------- + +Run the .EXE file by typing the name of the file without the +extension, e.g. to run A.EXE just type: + + A + \ No newline at end of file diff --git a/Microsoft Pascal v1/SIEVE.PAS b/Microsoft Pascal v1/SIEVE.PAS new file mode 100644 index 0000000..b9a42a6 --- /dev/null +++ b/Microsoft Pascal v1/SIEVE.PAS @@ -0,0 +1,32 @@ +(*$DEBUG- added, of course *) +program sieve( INPUT, OUTPUT ); + +const + size = 8190; + +type + flagType = array[ 0..size ] of boolean; + +var + i, k, prime, count, iter : integer; + flags : flagType; + +begin + for iter := 1 to 10 do begin + count := 0; + for i := 0 to size do flags[ i ] := true; + for i := 0 to size do begin + if flags[ i ] then begin + prime := i + i + 3; + k := i + prime; + while k <= size do begin + flags[ k ] := false; + k := k + prime; + end; + count := count + 1; + end; + end; + end; + + writeln( 'count of primes: ', count ); +end. diff --git a/Microsoft Pascal v1/TAP.PAS b/Microsoft Pascal v1/TAP.PAS new file mode 100644 index 0000000..4bf83e7 --- /dev/null +++ b/Microsoft Pascal v1/TAP.PAS @@ -0,0 +1,82 @@ +program tap( output ); + +var + loops, i, rsf, prev, total, greatest, a, b, c : integer; + v, ri, rtotal : real; + +function gcd( m : integer; n : integer ) : integer; +var + a, b, r : integer; +begin { gcd } + a := 0; + if ( m > n ) then begin + b := m; + r := n; + end + else begin + b := n; + r := m; + end; + + while ( 0 <> r ) do begin + a := b; + b := r; + r := a MOD b; + end; + + gcd := b; +end; { gcd } + +procedure first_implementation; +var + total, i, prev : integer; + sofar, ri, iq : real; +begin + total := 10000; + sofar := 0.0; + prev := 1; + + for i := 1 to total do begin + ri := i; + iq := ri * ri * ri; + sofar := sofar + ( 1.0 / iq ); + if ( i = ( prev * 10 ) ) then begin + prev := i; + write( ' at ', i ); + writeln( ' iterations: ', sofar ); + end; + end; +end; + +begin { tap } + writeln( 'tap starting, should tend towards 1.2020569031595942854...' ); + + writeln( 'first implementation...' ); + first_implementation; + +{ no Random + writeln( 'second implementation...' ); + loops := 10000; + total := 0; + prev := 1; + + for i := 1 to loops do begin + a := Random( 32767 ); + b := Random( 32767 ); + c := Random( 32767 ); + + greatest := gcd( a, gcd( b, c ) ); + if ( 1 = greatest ) then total := total + 1; + if ( i = ( prev * 10 ) ) then begin + prev := i; + rtotal := total; + ri := i; + v := ri / rtotal; + writeln( ' at ', i, ' iterations: ', v ); + end; + end; +} + + writeln( 'tap completed with great success' ); +end. { tap } + diff --git a/Microsoft Pascal v1/djldos.OBJ b/Microsoft Pascal v1/djldos.OBJ new file mode 100644 index 0000000..89721e6 Binary files /dev/null and b/Microsoft Pascal v1/djldos.OBJ differ diff --git a/Microsoft Pascal v1/djldos.asm b/Microsoft Pascal v1/djldos.asm new file mode 100644 index 0000000..275a5fc --- /dev/null +++ b/Microsoft Pascal v1/djldos.asm @@ -0,0 +1,121 @@ +; utility functions for calling into DOS from Microsoft Pascal v1 through v4 +; +; function dostime : word; External; +; var startTicks: word; +; startTicks := dostime; +; +; function getpsp : word; External; +; var psp : word; +; psp := getpsp; +; +; function pspbyte( offset : word ) : integer; External; +; var result : integer; +; result := pspbyte( 80 ); { get command tail length } +; + +.model large + +code segment +assume cs:code + +; returns a count of hundredths of a second in ax +; only uses hs, seconds, and the low digit of minutes since that's all that fits in two bytes +; 54000 = 9 * 60 * 100 +; + 5900 = 59 * 100 +; + 99 +; -------- +; 59999 + +public getticks +getticks PROC FAR + push bx + push cx + push dx + push di + push si + + mov ah, 2ch + int 21h + push dx + mov ah, 0 + mov al, dh + mov bx, 100 + mul bx + pop dx + mov dh, 0 + add ax, dx + + push ax + mov ax, cx + and ax, 0ffh + mov cx, 10 + mov dx, 0 + div cx + mov ax, dx + mov cx, 6000 + mul cx + pop bx + add ax, bx + + pop si + pop di + pop dx + pop cx + pop bx + ret +getticks ENDP + +public getpsp +getpsp PROC FAR + push bx + push cx + push dx + push di + push si + + mov ah, 062h + int 21h + mov ax, bx + + pop si + pop di + pop dx + pop cx + pop bx + ret +getpsp ENDP + +public pspbyte +pspbyte PROC FAR + push bx + push cx + push dx + push di + push si + push es + push bp + + mov bp, sp + mov ah, 062h + int 21h + mov es, bx + + ; the argument is here. 7 pushes above + 2 for the return address = 9 * 2 = 18. + + mov bx, word ptr[ bp + 18 ] + xor ah, ah + mov al, byte ptr es: [ bx ] + + pop bp + pop es + pop si + pop di + pop dx + pop cx + pop bx + ret +pspbyte ENDP + +code ends +end + diff --git a/Microsoft Pascal v1/m.bat b/Microsoft Pascal v1/m.bat new file mode 100644 index 0000000..4f8ca8b --- /dev/null +++ b/Microsoft Pascal v1/m.bat @@ -0,0 +1,12 @@ +rem -h flag is required for pas2 and generated apps so the top of ram is on a 64k-1 boundary +rem due to bugs in the apps that try to copy 64k-1 bytes of ram and wrap. + +del %1.exe + +ntvdm -c pas1 %1,%1,%1,%1 +del con.lst +ntvdm -h -c pas2 +ntvdm -c link %1 djldos,,,, + +ntvdm -h -p %1 + diff --git a/Microsoft Pascal v1/mm.pas b/Microsoft Pascal v1/mm.pas new file mode 100644 index 0000000..4d2d2eb --- /dev/null +++ b/Microsoft Pascal v1/mm.pas @@ -0,0 +1,76 @@ +{ BYTE magazine October 1982. Jerry Pournelle. } +{ various bugs not found because dimensions are square fixed by David Lee } +{ expected result: 4.65880E+05 } + +program matrix( output ); + +const + l = 20; { rows in A and resulting matrix C } + m = 20; { columns in A and rows in B (must be identical) } + n = 20; { columns in B and resulting matrix C } + +var + A : array [ 1 .. l, 1 .. m ] of real; { [row,col] } + B : array [ 1 .. m, 1 .. n ] of real; + C : array [ 1 .. l, 1 .. n ] of real; + + Summ: real; + +procedure filla; +var + i, j : integer; +begin { filla } + for i := 1 to l do + for j := 1 to m do + A[ i, j ] := i + j; +end; { filla } + +procedure fillb; +var + i, j : integer; +begin { fillb } + for i := 1 to m do + for j := 1 to n do + B[ i, j ] := trunc( ( i + j ) / j ); +end; { fillb } + +procedure fillc; +var + i, j : integer; +begin { fillc } + for i := 1 to l do + for j := 1 to n do + C[ i, j ] := 0; +end; { fillc } + +procedure matmult; +var + i, j, k : integer; +begin { matmult } + for i := 1 to l do + for j := 1 to n do + for k := 1 to m do + C[ i, j ] := C[ i, j ] + A[ i, k ] * B[ k, j ]; +end; { matmult } + +procedure summit; +var + i, j : integer; +begin { summit } + for i := 1 to l do + for j := 1 to n do + Summ := Summ + C[ i, j ]; +end; { summit } + +begin { matrix } + Summ := 0; + + filla; + fillb; + fillc; + matmult; + summit; + + Writeln( 'summ is :', Summ ); +end. { matrix } + diff --git a/Microsoft Pascal v1/msp1_10.exe b/Microsoft Pascal v1/msp1_10.exe new file mode 100644 index 0000000..6927e71 Binary files /dev/null and b/Microsoft Pascal v1/msp1_10.exe differ diff --git a/Microsoft Pascal v1/mspv1.exe b/Microsoft Pascal v1/mspv1.exe new file mode 100644 index 0000000..1e185b6 Binary files /dev/null and b/Microsoft Pascal v1/mspv1.exe differ diff --git a/Microsoft Pascal v1/ttt.pas b/Microsoft Pascal v1/ttt.pas new file mode 100644 index 0000000..7f5ec15 --- /dev/null +++ b/Microsoft Pascal v1/ttt.pas @@ -0,0 +1,297 @@ +{ App to prove you can't win at Tic-Tac-Toe } +{ coded for Microsoft Pascal. Tested on v1.0, v3.3, and v4.0. } +{ requires djldos.obj, built from djldos.asm } +(*$DEBUG- *) + +program ttt( output ); + +function getticks : word; External; +function pspbyte( offset : word ) : integer; External; + +const + scoreWin = 6; + scoreTie = 5; + scoreLose = 4; + scoreMax = 9; + scoreMin = 2; + scoreInvalid = 0; + + pieceBlank = 0; + pieceX = 1; + pieceO = 2; + + iterations = 1; + +type + boardType = array[ 0..8 ] of integer; + +var + evaluated: integer; + board: boardType; + +procedure dumpBoard; +var + i : integer; +begin + Write( '{' ); + for i := 0 to 8 do + Write( board[i] ); + Write( '}' ); +end; + +function lookForWinner : integer; +var + t, p : integer; +begin + { dumpBoard; } + p := pieceBlank; + t := board[ 0 ]; + + if pieceBlank <> t then + begin + if ( ( ( t = board[1] ) and ( t = board[2] ) ) or + ( ( t = board[3] ) and ( t = board[6] ) ) ) then + p := t; + end; + + if pieceBlank = p then + begin + t := board[1]; + if ( t = board[4] ) and ( t = board[7] ) then + p := t + else + begin + t := board[2]; + if ( t = board[5] ) and ( t = board[8] ) then + p := t + else + begin + t := board[3]; + if ( t = board[4] ) and ( t = board[5] ) then + p := t + else + begin + t := board[6]; + if ( t = board[7] ) and ( t = board[8] ) then + p := t + else + begin + t := board[4]; + if ( ( ( t = board[0] ) and ( t = board[8] ) ) or + ( ( t = board[2] ) and ( t = board[6] ) ) ) then + p := t + end; + end; + end; + end; + end; + + lookForWinner := p; +end; + +function winner2( move: integer ) : integer; +var + x : integer; +begin + case move of + 0: begin + x := board[ 0 ]; + if not ( ( ( x = board[1] ) and ( x = board[2] ) ) or + ( ( x = board[3] ) and ( x = board[6] ) ) or + ( ( x = board[4] ) and ( x = board[8] ) ) ) + then x := PieceBlank; + end; + 1: begin + x := board[ 1 ]; + if not ( ( ( x = board[0] ) and ( x = board[2] ) ) or + ( ( x = board[4] ) and ( x = board[7] ) ) ) + then x := PieceBlank; + end; + 2: begin + x := board[ 2 ]; + if not ( ( ( x = board[0] ) and ( x = board[1] ) ) or + ( ( x = board[5] ) and ( x = board[8] ) ) or + ( ( x = board[4] ) and ( x = board[6] ) ) ) + then x := PieceBlank; + end; + 3: begin + x := board[ 3 ]; + if not ( ( ( x = board[4] ) and ( x = board[5] ) ) or + ( ( x = board[0] ) and ( x = board[6] ) ) ) + then x := PieceBlank; + end; + 4: begin + x := board[ 4 ]; + if not ( ( ( x = board[0] ) and ( x = board[8] ) ) or + ( ( x = board[2] ) and ( x = board[6] ) ) or + ( ( x = board[1] ) and ( x = board[7] ) ) or + ( ( x = board[3] ) and ( x = board[5] ) ) ) + then x := PieceBlank; + end; + 5: begin + x := board[ 5 ]; + if not ( ( ( x = board[3] ) and ( x = board[4] ) ) or + ( ( x = board[2] ) and ( x = board[8] ) ) ) + then x := PieceBlank; + end; + 6: begin + x := board[ 6 ]; + if not ( ( ( x = board[7] ) and ( x = board[8] ) ) or + ( ( x = board[0] ) and ( x = board[3] ) ) or + ( ( x = board[4] ) and ( x = board[2] ) ) ) + then x := PieceBlank; + end; + 7: begin + x := board[ 7 ]; + if not ( ( ( x = board[6] ) and ( x = board[8] ) ) or + ( ( x = board[1] ) and ( x = board[4] ) ) ) + then x := PieceBlank; + end; + 8: begin + x := board[ 8 ]; + if not ( ( ( x = board[6] ) and ( x = board[7] ) ) or + ( ( x = board[2] ) and ( x = board[5] ) ) or + ( ( x = board[0] ) and ( x = board[4] ) ) ) + then x := PieceBlank; + end; + end; + + winner2 := x; +end; + +function minmax( alpha: integer; beta: integer; depth: integer; move: integer ): integer; +var + p, val, pieceMove, score : integer; +begin + evaluated := evaluated + 1; + val := scoreInvalid; + if depth >= 4 then + begin + p := winner2( move ); { lookForWinner; } + if p <> pieceBlank then + begin + if p = pieceX then + val := scoreWin + else + val := scoreLose + end + else if depth = 8 then + val := scoreTie; + end; + + if val = scoreInvalid then + begin + if Odd( depth ) then + begin + val := scoreMin; + pieceMove := pieceX; + end + else + begin + val := scoreMax; + pieceMove := pieceO; + end; + + p := 0; + repeat + if board[ p ] = pieceBlank then + begin + board[ p ] := pieceMove; + score := minmax( alpha, beta, depth + 1, p ); + board[ p ] := pieceBlank; + + if Odd( depth ) then + begin + if ( score > val ) then + begin + val := score; + if ( val = scoreWin ) or ( val >= beta ) then p := 10 + else if ( val > alpha ) then alpha := val; + end; + end + else + begin + if ( score < val ) then + begin + val := score; + if ( val = scoreLose ) or ( val <= alpha ) then p := 10 + else if ( val < beta ) then beta := val; + end; + end; + end; + p := p + 1; + until p > 8; + end; + + minmax := val; +end; + +function firstArgAsInt : integer; +var + psp, offset : word; + c, result : integer; + location : ads of byte; +begin + result := 0; + + offset := 128; + c := pspbyte( offset ); + if c > 0 then begin + offset := offset + 2; { past length and space } + c := pspbyte( offset ); + while ( ( c >= 48 ) and ( c <= 57 ) ) do + begin + result := result * 10; + result := result + c - 48; + offset := offset + 1; + c := pspbyte( offset ); + end; + end; + + firstArgAsInt := result; +end; + +procedure runit( move : integer ); +var + score: integer; +begin + board[move] := pieceX; + score := minmax( scoreMin, scoreMax, 0, move ); + board[move] := pieceBlank; +end; + +var + i, loops : integer; + startTicks, endTicks: word; +begin + i := firstArgAsInt; + if 0 <> i then loops := i + else loops := Iterations; + + for i := 0 to 8 do + board[i] := pieceBlank; + + WriteLn( 'begin' ); + startTicks := getticks; + + for i := 1 to loops do + begin + evaluated := 0; { once per loop to prevent overflow } + runit( 0 ); + runit( 1 ); + runit( 4 ); + end; + + endTicks := getticks; + WriteLn( 'end ticks: ', endTicks ); + WriteLn( 'start ticks: ', startTicks ); + WriteLn( 'difference in hs: ', endTicks - startTicks ); + + if startTicks > endTicks then begin { passed a 10 minute mark } + endTicks := endTicks + 60000; + WriteLn( 'corrected in hs: ', endTicks - startTicks ); + end; + + WriteLn( 'moves evaluated: ', evaluated ); + WriteLn( 'iterations: ', loops ); +end.