Microsoft Fortran v4.1

This commit is contained in:
davidly 2024-07-23 11:59:37 -07:00
parent b95bffb2d1
commit 2c8484aaf4
32 changed files with 884 additions and 0 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,428 @@
G
W
4
0
0
maximum memory-allocation size exceeded
program too large for memory
%s : array bound used function call
%s : array bound used intrinsic call
%s : array bound used array reference
%s : array bound used illegal variable
%s : array bound used illegal variable
%s : already dimensioned
%s : array bounds missing
%s : more than 7 array bounds
%s : attributes illegal on array bounds
%s : * : not last array bound
%s : bound size too small
%s : adjustable-size array not in subprogram
%s : NEAR array bigger than segment
%s : %s attribute repeated
%s : %s illegal with attributes specified in same list
%s : %s attribute mismatch with earlier NEAR/FAR/HUGE
%s : %s illegal with attributes specified in earlier list
%s : NEAR/FAR/HUGE attribute mismatches default
%s : %s illegal on COMMON statements
%s : %s illegal on formal arguments
%s : %s illegal on ENTRY statements
%s : %s illegal on subprogram statements
%s : %s illegal on variable declarations
%s : %s illegal on type declarations
%s : language attributes illegal on formal arguments
%s : %s only legal on formal arguments
%s : illegal bound type
%s : bound not integer
%s : substring on noncharacter item
%s : upper substring bound exceeds string length
%s : lower substring bound exceeds upper bound
%s : lower substring bound not positive
concatenation with CHARACTER*(*)
cannot pass CHARACTER*(*) by value
label %ld : redefined in program unit
no ASSIGN statements for assigned %s
IF or ELSEIF missing
expression type not LOGICAL
statement stack underflow
statement-nesting limit exceeded
label %ld : used across blocks
no assigned GOTO or FMT= for ASSIGN statement
ASSIGN target not an INTEGER variable
%s : ASSIGN : variable not INTEGER
%s : ASSIGN : too many INTEGER*1 variables
DO-loop expression not INTEGER or REAL
zero illegal as increment
DO-loop variable : not a variable
%s : illegal use of active DO-loop variable
DO-loop variable not INTEGER or REAL
ENDIF missing
DO-loop label %ld : not seen
IF, ELSEIF, or ELSE missing
too many assigned GOTO statements
only variables allowed in assigned GOTO statements
assigned GOTO variable not INTEGER
computed GOTO variable not INTEGER
expression type not INTEGER or REAL
illegal statement after logical IF
label %ld : previously used as FORMAT label
label %ld : previously used as executable label
block label %ld : must not be referenced
label %ld : must not be referenced
DO-loop label %ld : out of order
assigned and unconditional GOTO illegal here
block and arithmetic IF illegal here
statement illegal as DO-loop termination
%s : maximum of 5 digits
%s : illegal expression
%s : EQUIVALENCE : enclosing class too big
%s : COMMON : attributes on items illegal
%s : EQUIVALENCE : formal argument illegal
%s : EQUIVALENCE : not array
%s : EQUIVALENCE : array subscripts missing
%s : EQUIVALENCE : nonconstant offset illegal
%s : EQUIVALENCE : nonconstant upper substring expression ignored
%s : nonconstant lower substring expression illegal
%s : COMMON : length specification illegal
%s : %s : %s name illegal
%s : %s : preinitialization illegal
%s : %s : formal argument illegal
%s : %s : not an array or variable
%s : COMMON : character and noncharacter items mixed
%s : COMMON : too big
%s : COMMON : array size nonconstant or zero
%s, %s : EQUIVALENCE : character and noncharacter items mixed
%s, %s : EQUIVALENCE : both in blank common block
%s, %s : EQUIVALENCE : both in common block %s
%s, %s : EQUIVALENCE : in different common blocks
%s : EQUIVALENCE : extends blank common block forward
%s : EQUIVALENCE : extends common block %s forward
%s, %s : EQUIVALENCE : conflicting offsets
%s : EQUIVALENCE : two different common blocks
%s : item in common block crosses segment
%s : COMMON : size changed
%s : NEAR common block has HUGE item
blank common can not be HUGE
%s : COMMON : too big to be NEAR
%s : COMMON : function or subroutine name
%s : already in COMMON
%s : EQUIVALENCE : needs at least two items
DATA : iteration count not positive
%s : DATA : illegal address expression
%s : cannot initialize formal argument
%s : cannot initialize item in blank common block
%s : can only initialize common block in BLOCK DATA subprogram
%s : DATA : not array or variable
%s : repeat count not positive integer
%s : DATA : nonconstant item in initializer list
%s : DATA : too few constants to initialize item
%s : nonstatic address illegal in initialization
%s : bound or increment not constant
%s : bound or increment not INTEGER
%s : DATA : zero increment
%s : DATA : active implied-DO variable
%s : DATA : implied-DO variable not INTEGER
%s : DATA : not array-element name
DATA : too few constants to initialize names
DATA : more constants than names
%s : already declared %s
%s : illegal use of %s
%s : already typed
%s : types illegal on BLOCK DATA/COMMON/PROGRAM/SUBROUTINE
%s : cannot initialize in type statements
DOUBLE PRECISION : length specifier illegal
%s : IMPLICIT : only single letter allowed
%c, %c : IMPLICIT : lower limit exceeds upper limit
%c : already IMPLICIT
%s : INTRINSIC : unknown name
%s : PARAMETER : nonconstant expression
too many symbols
%s : declared with wrong type
%s : intrinsic function illegal as actual argument
LEN : illegal expression
%s : multiple arguments
%s : cannot convert FAR address to NEAR
%s : cannot convert to %s
%s : incorrect use of intrinsic function
%c : illegal separator
%s : cannot open include file
octal value too big for byte
closing quote missing
CHARACTER constant too long
zero-length CHARACTER constant
empty escape sequence
integer string too long
alternate bases illegal
illegal base value
INTEGER constant must follow #
illegal REAL constant
%s : include file nested too deeply
INTEGER value overflow
FORMAT string too long
missing ] following attribute string
%s : attribute repeated
colon expected following ALIAS
opening quote missing
unrecognized attribute
%s : name too long; truncated
%s : already specified in $%sLARGE
$DEBUG:'<debug-list>' illegal with $FREEFORM
%c : nonalphabetic character in $DEBUG ignored
$DEBUG:'<debug-list>' : string expected
$DECMATH not supported
$INCLUDE:'<filename>' : string expected
$%sSIZE : integer constant out of range
$%sSIZE:<integer constant> : integer constant expected
$%sLARGE already set
$%sLARGE illegal in executable statements
$MESSAGE:'<message>' : string expected
$STORAGE:<number> : 2 or 4 expected
$SUBTITLE:'<subtitle>' : string expected
$TITLE:'<title>' : string expected
unrecognized metacommand
metacommand already set
metacommand must come before all FORTRAN statements
characters following metacommand ignored
Hollerith constant exceeds 1313 characters
zero-length Hollerith constant
Hollerith constant : text length disagrees with given length
Hollerith not allowed
%s : non-FORTRAN character
%s : error closing file
illegal label field
zero-value label field
free-form label too long
label on continuation line
first statement line must have ' ' or '0' in column 6
too many continuation lines
label on blank line
illegal %s flag, would overwrite %s with %s
too many %s flags, %s
%s : unknown option (%c)
%s : illegal number in switch
illegal command-line option
out of disk space for compiler internal file
write error on compiler internal file
%s : cannot open file
%s : name too long
cannot open internal files
-4Y and -4N : both options used for argument
-4Y and -4N : both options used; -4Y assumed
syntax error
END missing
%s : unrecognized option
-4I2 or -4I4 expected
illegal -A option
-W%d : illegal warning level ignored
program too large for memory
RETURN : integer or character expression required
%s : alternate RETURN missing
%s : DIMENSION : not array
statement illegal with INTERFACE
statement illegal in INTERFACE
statement illegal in BLOCK DATA
%s : formal argument not local variable
%s : formal argument not a variable
%s : repeated in formal-argument list
%s : statement function already declared
%s : statement function : too few actual arguments
%s : statement function : too many actual arguments
%s : formal argument %s : never used
%s : formal argument %s : subprogram passed by VALUE
%s : formal argument %s : symbol-class mismatch
%s : language attribute mismatch
%s : type redefined
%s : length redefined
%s : NEAR/FAR attribute mismatch
%s : VARYING attribute mismatch
%s : previously called near
%s : previously called far
%s : defined with different number of arguments
%s : formal argument %s : Hollerith passed to CHARACTER formal argument
%s : formal argument %s : VALUE/REFERENCE mismatch
%s : formal argument %s : NEAR/FAR/HUGE mismatch
%s : formal argument %s : previously passed by value, now by reference
%s : formal argument %s : previously passed by reference, now by value
%s : formal argument %s : previously passed with NEAR, now with FAR or HUGE
%s : formal argument %s : previously passed with FAR or HUGE, now with NEAR
%s : formal argument %s : CHARACTER *(*) cannot pass by value
%s : formal argument redefined
%s : illegal as formal argument
%s : formal argument previously initialized
%s : EQUIVALENCE : formal argument illegal
ENTRY : formal argument %s : attribute %s : mismatch
alternate RETURN only legal within SUBROUTINE
ENTRY seen before FUNCTION or SUBROUTINE
ENTRY not in function or subroutine
too many PROGRAM statements
%s : formal argument used as ENTRY
%s : PROGRAM : name redefined
%s : used or declared before ENTRY
%s : subprogram used or declared before INTERFACE
%s : already defined
%s : already used or declared with different symbol class
%s : ENTRY : CHARACTER lengths differ
%s : ENTRY : CHARACTER and non-CHARACTER types mixed in ENTRY statements
too many ENTRY statements
%s : INTERFACE : not formal argument
%s : assumed-size array : cannot pass by value
%s : adjustable-size array : cannot pass by value
statement out of order or END missing
statement out of order
no state transition for root of tree
%s : truncated to 6 characters
%s : not previously declared
label %ld : undefined
%s : FUNCTION : return variable not set
%s : assumed-size array : not reference argument
%s : adjustable-size array : not reference argument
%s : CHARACTER*(*) type illegal
%s : VARYING illegal on symbol class
%s : $ illegal in C name
%s : illegal length
value %ld : INTEGER : range error
integer constant expression expected
length specification illegal
length %ld : illegal type length
only C attribute legal on INTEGER type
attributes illegal on non-INTEGER types
DOUBLE PRECISION : length specifier illegal
illegal use of Hollerith constant
illegal type conversion
cannot convert between CHARACTER and non-CHARACTER constants
cannot convert type to %s
unknown primitive type
missing symbol reference
unknown constant type
%s : subscript %ld out of range
%s : subscript %ld out of range
%s : subscript %d : not integer
%s : too few array subscripts
%s : too many array subscripts
%s : array subscripts missing
%s : adjustable-size array : used before definition
%s : symbolic constant : subscript illegal
%s : symbolic constant : substring illegal
%s : variable : argument list illegal
%s : function : argument list missing
%s : not a variable
%s : function : substring operator illegal
left side of assignment illegal
%s : assignment using active DO variable illegal
incompatible types in assignment
%s : formal argument %s : Hollerith illegal with CHARACTER
%s : formal argument %s : type mismatch
%s : formal argument %s : type mismatch
%s : formal argument %s : length mismatch
%s : formal argument %s : length mismatch
%s : alternate RETURN statement missing
%s : formal argument * : actual not alternate-return label
%s : formal argument %s : not alternate-return label
%s : formal argument %s : actual not subprogram
%s : formal argument %s : subprogram mismatch
%s : formal argument %s : not subprogram
%s : NEAR formal argument %s : actual has FAR or HUGE address
%s : formal argument %s : length mismatch
%s : formal argument %s : type mismatch
%s : not function or subroutine
%s : illegal use of function or subroutine
%s : type redefined
%s : length redefined
%s : too few actual arguments
%s : too many actual arguments
%s : directly recursive
%s : Hollerith constant passed by value
%s : assumed-size array %s : cannot pass by value
%s : adjustable-size array %s : cannot pass by value
%s : value argument bigger than segment
%s : formal argument %s : CHARACTER expressions cannot be passed by VALUE
nonconstant CHARACTER length : cannot pass by value
incompatible types for formal and actual arguments
%s : FAR formal argument %s : passed HUGE array
%s : cannot use CHARACTER *(*) function
consecutive arithmetic operators illegal
negative exponent with zero base
division by zero
nonlogical operand
non-numeric operand
exponentiation of COMPLEX and DOUBLE PRECISION together illegal
non-numeric operand
operands of relation not numeric or character
one numeric, one character operand
only comparisons by .EQ. and .NE. allowed for complex items
concatenation of expressions illegal
noncharacter operand
consecutive relational operators illegal
illegal implied-DO list in expression
illegal Xxprep node type
%s : COMPLEX : type conversion error
%s : REAL : type conversion error
%s : operation error with COMPLEX operands
%s : operation error with REAL operands
%s : symbol class illegal here
DO : too many expressions
label %ld : not between 1 and 99999
I/O implied-DO list : list empty
I/O implied-DO list : too many expressions
I/O implied-DO list : illegal assignment
I/O implied-DO list : too few expressions
I/O implied-DO list : assigment missing
assignments in COMPLEX constant illegal
illegal assignment in parenthesized expression
numeric constant expected
%s : not symbolic constant
component of COMPLEX number not INTEGER or REAL
parser stack overflow, statement too complex
syntax error
%s : not %s
%s : noncharacter array nonstandard
%s : array subscript missing
%s : not a variable or array element
label %ld : not between 1 and 99999
UNIT = * illegal for this statement
illegal unit specifier
illegal format specifier
HUGE format illegal
FAR format illegal in medium model
%s : illegal statement label
%s : appears twice
I/O option %ld : <keyword>= missing
%s : option illegal for this statement
%s : option nonstandard
INQUIRE : either UNIT= or FILE= needed
UNIT= missing
END= : illegal when REC= present
REC= : illegal when FMT= *
illegal I/O formatting for internal unit
REC= illegal for internal unit
FORMAT : label missing
ASSIGN : too many format labels
no ASSIGN statements for FMT=<integer variable>
initial left parenthesis expected in format
repeat count on nonrepeatable descriptor
integer expected to precede H, X, or P edit descriptor
positive integer expected in format
missing N or Z after B in format
maximum nesting level for formats exceeded
%c or $ : nonstandard edit descriptor in format
Z : nonstandard edit descriptor in format
M field exceeds W field in I edit descriptor
'.' : expected in format
unexpected end of format encountered
'%c' : unexpected character in format
unexpected character in format
integer expected in format
separator expected in format
RECL= : out of range
UNIT= : not between -32767 and 32767
%s : unrecognized value in option
RECL= required to open direct-access file
illegal input list item
%s : * illegal with this option
%s : assumed-size array illegal here
%s : HUGE internal units illegal
%s : record length too large for internal unit
FAR or HUGE I/O item illegal in medium model
%s : cannot modify active DO variable
LOCKING : nonstandard
%s : lowercase in string nonstandard


Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,67 @@
/* fatals */
1001 "Internal Compiler Error\n\t\t(compiler file '%s', line %d)\n\t\tContact Microsoft Technical Support"
1002 "out of heap space"
1003 "error count exceeds %d; stopping compilation"
1004 "unexpected EOF"
1005 "string too big for buffer"
1006 "write error on compiler intermediate file"
1007 "unrecognized flag '%s' in '%s'"
1027 "DGROUP data allocation exceeds 64K"
1028 "infinite recursion in cnstrpush"
1029 "there are > 512 bytes of arguments"
1030 "there are > 512 bytes of local variables"
1031 "limit exceeded for nesting function calls"
1032 "cannot open object listing file '%s'"
1033 "cannot open assembly language output file '%s'"
1034 "cannot open source file '%s'"
1035 "expression too complex, please simplify"
1036 "cannot open source listing file '%s'"
1037 "cannot open object file '%s'"
1038 "unexpected end of file in Pass 3"
1039 "unrecoverable heap overflow in Pass 3"
1040 "unexpected EOF in source file '%s'"
1041 "cannot open compiler intermediate file - no more files"
1042 "cannot open compiler intermediate file - no such file or directory"
1043 "cannot open compiler intermediate file"
1044 "out of disk space for compiler intermediate file"
1045 "floating-point overflow"
1046 "bad %s flag, would overwrite '%s' with '%s'"
1047 "too many %s flags, '%s'"
1048 "unknown option '%c' in '%s'"
1049 "invalid numerical argument '%s'"
1050 "%s : code segment too large\n"
1051 "program too complex"
1000 "UNKNOWN FATAL ERROR\n\t\tContact Microsoft Technical Support"
/* errors */
2023 "divide by 0"
2024 "mod by 0"
2124 "CODE GENERATION ERROR\n\t\tContact Microsoft Technical Support"
2125 "%s : allocation exceeds 64K"
2126 "%s : automatic allocation exceeds %s"
2127 "parameter allocation exceeds 32K"
2128 "%s : huge array cannot be aligned to segment boundary"
2129 "static function '%s' not found\n"
2000 "UNKNOWN ERROR\n\t\tContact Microsoft Technical Support"
/* warnings */
4056 "overflow in constant arithmetic"
4057 "overflow in constant multiplication"
4058 "address of frame variable taken, DS != SS"
4059 "segment lost in conversion"
4060 "conversion of long address to short address"
4061 "long/short mismatch in argument : conversion supplied"
4062 "near/far mismatch in argument : conversion supplied"
4063 "%s : function too large for post-optimizer\n"
4064 "procedure too large, skipping %s optimization and continuing\n"
4065 "recoverable heap overflow in post-optimizer - some optimizations may be missed\n"
4066 "local symbol table overflow - some local symbols may be missing in listings\n"
4069 "conversion of near pointer to long integer"
4070 "function called as procedure"
4072 "Insufficient memory to process debugging information"
4073 "scoping too deep, deepest scoping merged when debugging"
4186 "string too long - truncated to %d characters"
4000 "UNKNOWN WARNING\n\t\tContact Microsoft Technical Support"

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,46 @@
/* fatal messages */
1001 "could not execute '%s'"
1000 "UNKNOWN COMMAND LINE FATAL ERROR\n\t\tContact Microsoft Technical Support"
/* error messages */
2002 "a previously defined model specification has been overridden"
2003 "missing source file name"
2007 "bad %s flag, would overwrite '%s' with '%s'"
2008 "too many %s flags, '%s'"
2009 "unknown option '%c' in '%s'"
2010 "unknown floating point option"
2011 "only one floating point model allowed"
2012 "too many linker flags on command line"
2013 "incomplete model specification"
/* 2014 "-ND not allowed with -Ad" */
2015 "assembly files are not handled"
2016 "-Gw and -ND %s are incompatible"
2017 "-Gw and -Au flags are incompatible"
2018 "cannot open linker cmd file"
2019 "cannot overwrite the source file, '%s'"
2021 "invalid numerical argument '%s'"
2022 "cannot open help file, '%s'"
2023 "invalid model specification - small model only"
2025 "missing argument"
2000 "UNKNOWN COMMAND LINE ERROR\n\t\tContact Microsoft Technical Support"
/* warning messages */
4001 "listing has precedence over assembly output"
4002 "ignoring unknown flag '%s'"
4003 "80186/286 selected over 8086 for code generation"
4004 "optimizing for time over space"
4005 "could not execute '%s';\nPlease enter new file name (full path) or Ctrl-C to quit: "
4008 "non-standard model -- defaulting to large model libraries"
4009 "threshold only for far/huge data, ignored"
4010 "-Gp not implemented, ignored"
4011 "preprocessing overrides source listing"
4012 "function declarations override source listing"
4013 "combined listing has precedence over object listing"
4014 "invalid value %d for '%s'. Default %d is used"
4017 "conflicting stack checking options - stack checking disabled"
4018 ".DEF files supported in protected mode only"
4019 "string too long - truncated to %d characters"
4000 "UNKNOWN COMMAND LINE WARNING\n\t\tContact Microsoft Technical Support"

Binary file not shown.

View File

@ -0,0 +1,66 @@
FORTRAN COMPILER OPTIONS
-METACOMMAND-
/4cc<string> conditional compilation
/4I{2|4} default integer size
/4{Y|N}6 fortran 66
/4{Y|N}f free-form format
/4{Y|N}b debug
/4{Y|N}t truncate variable names
/4{Y|N}s strict syntax
/4{Y|N}d declare
-SOURCE LISTINGS-
/Slnumber listing page width
/Sttitle Title
/Spnumber listing page size
/Sssub-title Sub_title
-MEMORY MODEL-
/AM medium model
/AL large model
/AH huge model
-OPTIMIZATION-
/O enable optimization (same as /Ot)
/Od disable optimizations
/Ol enable loop optimizations
/Op enable precision optimizations
/Os optimize for space
/Ot optimize for speed (default)
/Ox max. optimization (/Oalt /Gs)
-CODE GENERATION-
/G0 8086 instructions
/G1 186 instructions
/G2 286 instructions
/Ge enable stack checking
/Gs disable stack checking
/Gt[number] data size threshold
-OUTPUT FILES-
/Fa[assembly listing file]
/Fb[bound executable file]
/Fc[mixed object/source listing file]
/Fe<executable file>
/Fl[object listing file]
/Fm[map file]
/Fo<object file>
/Fs[source listing file]
-LANGUAGE-
/Zi symbolic debugging information
/Zl remove default library info
/Zs syntax check only
-FLOATING POINT-
/FPa calls with altmath
/FPc calls with emulator
/FPc87 calls with 8087 library
/FPi inline with emulator
/FPi87 inline with 8087
-MISCELLANEOUS-
/c compile only, no link
/H<number> external name length
/I<name> add "include file" path
/V<string> set version string
/W<number> warning level
/X ignore "standard places"
-LINKING-
/F<hex_number> stack size (hex. bytes)
/Lc link compatibility mode executable
/Lr link compatibility mode executable
/Lp link protect mode executable
/link [linker_options_and_libraries]

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,36 @@
program e
integer*2 high, n, x
integer*2 a(200)
high = 200
x = 0
n = high - 1
150 if ( n .le. 0 ) goto 200
a( n + 1 ) = 1
n = n - 1
goto 150
200 a( 2 ) = 2
a( 1 ) = 0
220 if ( high .le. 9 ) goto 400
high = high - 1
n = high
240 if ( n .eq. 0 ) goto 300
a( n + 1 ) = MOD( x, n )
x = ( 10 * a( n ) ) + ( x / n )
n = n - 1
goto 240
300 if ( x .ge. 10 ) goto 320
write( *, 2000 ) x
goto 220
320 write( *, 2001 ) x
goto 220
400 write( *, 2010 )
2000 format( '+', I1 )
2001 format( '+', I2 )
2010 format( ' done' )
end

Binary file not shown.

View File

@ -0,0 +1,28 @@
C Eratosthenes Sieve from BYTE magazine
program sieve
logical flags( 8191 )
integer*2 i, prime, k, count
integer*2 iter
write( *, 50 )
50 format( ' 10 iterations' )
do 92 iter = 1, 10
count = 0
do 10 i = 0, 8190
10 flags( i ) = .true.
do 91 i = 0, 8190
if ( .not. flags( i ) ) go to 91
prime = i + i + 3
k = i + prime
20 if ( k .gt. 8190 ) go to 90
flags( k ) = .false.
k = k + prime
go to 20
90 count = count + 1
91 continue
92 continue
write( *, 200 ) count
200 format( 1X, I6, ' primes' )
stop
100 format( 1X, I6 )
end

View File

@ -0,0 +1 @@
oo

View File

@ -0,0 +1,210 @@
C fortran version of proving you can't win at tic-tac-toe if the opponent is competent
C constants:
C score win: 6
C score tie: 5
C score lose: 4
C score max: 9
C score min: 2
C piece X: 1
C piece O: 2
C piece blank: 0
program ttt
integer*4 moves
integer*2 b(9), sp(10), sv(10), sa(10), sb(10), sm(10)
integer*2 mc, l
integer*2 alpha, beta, wi, st, sc, v, p, pm, m
common /area/ b,sp,sv,sa,sb,sm,mc,alpha,beta,wi,st,sc,v,p,pm,m
integer*2 system
do 6 l = 1, 9, 1
b( l ) = 0
6 continue
moves = 0
do 10 l = 1, 10, 1
C do 10 l = 1, 1, 1
mc = 0
m = 1
call runmm
m = 2
call runmm
m = 5
call runmm
moves = moves + mc
10 continue
write( *, 20 ) moves
20 format( ' moves: ', I6 )
end
1000 subroutine runmm
integer*2 b(9), sp(10), sv(10), sa(10), sb(10), sm(10)
integer*2 mc, l
integer*2 alpha, beta, wi, st, sc, v, p, pm, m
common /area/ b,sp,sv,sa,sb,sm,mc,alpha,beta,wi,st,sc,v,p,pm,m
alpha = 2
beta = 9
p = m
b(m) = 1
call minmax
b(m) = 0
return
end
2000 subroutine winner
integer*2 b(9), sp(10), sv(10), sa(10), sb(10), sm(10)
integer*2 mc, l
integer*2 alpha, beta, wi, st, sc, v, p, pm, m
common /area/ b,sp,sv,sa,sb,sm,mc,alpha,beta,wi,st,sc,v,p,pm,m
wi = b( 1 )
if ( 0 .eq. wi ) go to 2100
if ( ( wi .eq. b( 2 ) ) .and. ( wi .eq. b( 3 ) ) ) return
if ( ( wi .eq. b( 4 ) ) .and. ( wi .eq. b( 7 ) ) ) return
2100 wi = b( 4 )
if ( 0 .eq. wi ) go to 2200
if ( ( wi .eq. b( 5 ) ) .and. ( wi .eq. b( 6 ) ) ) return
2200 wi = b( 7 )
if ( 0 .eq. wi ) go to 2300
if ( ( wi .eq. b( 8 ) ) .and. ( wi .eq. b( 9 ) ) ) return
2300 wi = b( 2 )
if ( 0 .eq. wi ) go to 2400
if ( ( wi .eq. b( 5 ) ) .and. ( wi .eq. b( 8 ) ) ) return
2400 wi = b( 3 )
if ( 0 .eq. wi ) go to 2500
if ( ( wi .eq. b( 6 ) ) .and. ( wi .eq. b( 9 ) ) ) return
2500 wi = b( 5 )
if ( 0 .eq. wi ) return
if ( ( wi .eq. b( 1 ) ) .and. ( wi .eq. b( 9 ) ) ) return
if ( ( wi .eq. b( 3 ) ) .and. ( wi .eq. b( 7 ) ) ) return
wi = 0
end
4000 subroutine minmax
integer*2 b(9), sp(10), sv(10), sa(10), sb(10), sm(10)
integer*2 mc, l
integer*2 alpha, beta, wi, st, sc, v, p, pm, m
common /area/ b,sp,sv,sa,sb,sm,mc,alpha,beta,wi,st,sc,v,p,pm,m
st = 0
v = 0
4100 mc = mc + 1
if ( st .lt. 4 ) go to 4150
C the computed goto is about 20% faster than calling winner
C call winner
go to ( 5010, 5020, 5030, 5040, 5050, 5060, 5070, 5080, 5090 ), p
4110 if ( wi .eq. 0 ) go to 4140
if ( wi .ne. 1 ) go to 4130
sc = 6
go to 4280
4130 sc = 4
go to 4280
4140 if ( st .ne. 8 ) go to 4150
sc = 5
go to 4280
4150 if ( b( p ) .eq. 1 ) go to 4160
v = 2
pm = 1
go to 4170
4160 v = 9
pm = 2
4170 p = 1
4180 if ( b( p ) .ne. 0 ) go to 4500
b( p ) = pm
4182 st = st + 1
sp( st ) = p
sv( st ) = v
sa( st ) = alpha
sb( st ) = beta
sm( st ) = pm
go to 4100
4280 p = sp( st )
v = sv( st )
alpha = sa( st )
beta = sb( st )
pm = sm( st )
st = st - 1
b( p ) = 0
if ( pm .eq. 1 ) go to 4340
if ( sc .eq. 4 ) go to 4530
if ( sc .lt. v ) v = sc
if ( v .lt. beta ) beta = v
if ( beta .le. alpha ) go to 4520
go to 4500
4340 if ( sc .eq. 6 ) go to 4530
if ( sc .gt. v ) v = sc
if ( v .gt. alpha ) alpha = v
if ( alpha .ge. beta ) go to 4520
4500 p = p + 1
if ( p .lt. 10 ) go to 4180
4520 sc = v
4530 if ( st .eq. 0 ) return
go to 4280
5010 wi = b(1)
if ( ( wi .eq. b(2) ) .and. ( wi .eq. b(3) ) ) goto 4110
if ( ( wi .eq. b(4) ) .and. ( wi .eq. b(7) ) ) goto 4110
if ( ( wi .eq. b(5) ) .and. ( wi .eq. b(9) ) ) goto 4110
wi = 0
go to 4110
5020 wi = b(2)
if ( ( wi .eq. b(1) ) .and. ( wi .eq. b(3) ) ) goto 4110
if ( ( wi .eq. b(5) ) .and. ( wi .eq. b(8) ) ) goto 4110
wi = 0
go to 4110
5030 wi = b(3)
if ( ( wi .eq. b(1) ) .and. ( wi .eq. b(2) ) ) goto 4110
if ( ( wi .eq. b(6) ) .and. ( wi .eq. b(9) ) ) goto 4110
if ( ( wi .eq. b(5) ) .and. ( wi .eq. b(7) ) ) goto 4110
wi = 0
go to 4110
5040 wi = b(4)
if ( ( wi .eq. b(5) ) .and. ( wi .eq. b(6) ) ) goto 4110
if ( ( wi .eq. b(1) ) .and. ( wi .eq. b(7) ) ) goto 4110
wi = 0
go to 4110
5050 wi = b(5)
if ( ( wi .eq. b(1) ) .and. ( wi .eq. b(9) ) ) goto 4110
if ( ( wi .eq. b(3) ) .and. ( wi .eq. b(7) ) ) goto 4110
if ( ( wi .eq. b(2) ) .and. ( wi .eq. b(8) ) ) goto 4110
if ( ( wi .eq. b(4) ) .and. ( wi .eq. b(6) ) ) goto 4110
wi = 0
go to 4110
5060 wi = b(6)
if ( ( wi .eq. b(4) ) .and. ( wi .eq. b(5) ) ) goto 4110
if ( ( wi .eq. b(3) ) .and. ( wi .eq. b(9) ) ) goto 4110
wi = 0
go to 4110
5070 wi = b(7)
if ( ( wi .eq. b(8) ) .and. ( wi .eq. b(9) ) ) goto 4110
if ( ( wi .eq. b(1) ) .and. ( wi .eq. b(4) ) ) goto 4110
if ( ( wi .eq. b(5) ) .and. ( wi .eq. b(3) ) ) goto 4110
wi = 0
go to 4110
5080 wi = b(8)
if ( ( wi .eq. b(7) ) .and. ( wi .eq. b(9) ) ) goto 4110
if ( ( wi .eq. b(2) ) .and. ( wi .eq. b(5) ) ) goto 4110
wi = 0
go to 4110
5090 wi = b(9)
if ( ( wi .eq. b(7) ) .and. ( wi .eq. b(8) ) ) goto 4110
if ( ( wi .eq. b(3) ) .and. ( wi .eq. b(6) ) ) goto 4110
if ( ( wi .eq. b(1) ) .and. ( wi .eq. b(5) ) ) goto 4110
wi = 0
go to 4110
end

View File

@ -0,0 +1,2 @@
ntvdm -r:. -e:include=include,init=bin,path=bin,lib=lib,tmp=tmp bin\fl /FPc /Ox %1.for