DIRECTORY Basics32 USING [BITLSHIFT, BITRSHIFT], Rope USING [ROPE]; IntCodeTarget: CEDAR DEFINITIONS IMPORTS Basics32 = BEGIN OPEN Rope; name: READONLY ROPE; bitsPerAU: READONLY NAT; logBitsPerAU: READONLY NAT; bytesPerAU: READONLY NAT; logBytesPerAU: READONLY NAT; bitOrder: READONLY BitOrder; BitOrder: TYPE = {msBit, lsBit}; maxBitsArgumentRecord: READONLY NAT; minBitsPerArgument: READONLY NAT; logMinBitsPerArgument: READONLY NAT; maxBitsReturnRecord: READONLY NAT; minBitsPerReturn: READONLY NAT; logMinBitsPerReturn: READONLY NAT; bitsPerGlobal: READONLY NAT; logBitsPerGlobal: READONLY NAT; firstGlobalOffset: READONLY NAT; directGlobals: READONLY BOOL; lastRegister: READONLY NAT; lastStack: READONLY NAT; bitsPerLocal: READONLY NAT; logBitsPerLocal: READONLY NAT; bitsPerLink: READONLY NAT; logBitsPerLink: READONLY NAT; ToUnits: PROC [bits: INT, minBits: NAT, logMinBits: NAT] RETURNS [INT] = INLINE { SELECT bits FROM <= 0 => RETURN [0]; <= minBits => RETURN [1]; ENDCASE => RETURN [Basics32.BITRSHIFT[bits+minBits-1, logMinBits]]; }; ToBits: PROC [units: INT, logBitsPerUnit: NAT] RETURNS [INT] = INLINE { SELECT units FROM <= 0 => RETURN [0]; ENDCASE => RETURN [Basics32.BITLSHIFT[units, logBitsPerUnit]]; }; END. J IntCodeTarget.mesa Copyright Σ 1986, 1987, 1991 by Xerox Corporation. All rights reserved. Russ Atkinson (RRA) September 18, 1987 5:59:39 pm PDT JKF July 27, 1988 8:12:07 am PDT Willie-s, September 23, 1991 5:57 pm PDT This file has definitions that allow us to be parameterized according to the target. Most of the variables are not constants to allow us to share more code without recompilation. Machine description Gives a human-readable name for the target machine. Useful for messages. Addressing units Bit order Arguments & returns gives the # of bits for the largest "fast" argument record Gives the minimum # of bits for an argument (to get the bits for an argument, round up & shift by logMinBitsPerArgument) gives the # of bits for the largest "fast" return record Gives the minimum # of bits for an return value Global frame Gives the minimum # of bits for an global variable First offset usable for global variables (in bits) TRUE => target supports direct use of global variables FALSE => target requires global frame pointer Local frame & stack Gives # of registers to be used for local variables Gives last stack location to be used for passing arguments Gives the minimum # of bits for an local variable Gives the minimum # of bits for a link (uniform for static link, global link, & frame extension if any). Utility routines Κ‘•NewlineDelimiter –(cedarcode) style™codešœ™Kšœ Οeœ=™HKšœΟkœ ž™5K™ K™(K˜šž ˜ Kšœ žœž œž œ˜&Kšœžœžœ˜——headšΟn œžœž ˜ Kšžœ ˜Kšœžœžœ˜K˜K™³K˜—head2™šœžœžœ˜KšœI™I—K˜—™šœ žœžœ˜Kšœžœžœ˜—šœ žœžœ˜Kšœžœžœ˜—K˜—™ Kšœ žœ ˜Kšœ žœ˜ K˜—™šœžœžœ˜$K™:—šœžœžœ˜!Kšœžœžœ˜$šœ+™+KšœL™L——šœžœžœ˜"K™8—šœžœžœ˜Kšœžœžœ˜"Kšœ/™/—K˜—™ šœžœžœ˜Kšœžœžœ˜Kšœ2™2K˜—šœžœžœ˜ Kšœ2™2K™—šœžœžœ˜Kšžœ2™6Kšžœ(™-—K˜—™šœžœžœ˜Kšœ3™3—šœ žœžœ˜Kšœ:™:K˜—šœžœžœ˜Kšœžœžœ˜Kšœ1™1K˜—šœ žœžœ˜Kšœžœžœ˜šœ&™&KšœA™A——K˜—™šŸœžœžœ žœžœžœžœžœ˜Qšžœž˜Kšœžœ˜Kšœžœ˜Kšžœžœ ž œ˜C—K˜K˜—šŸœžœ žœžœžœžœžœ˜Gšžœž˜Kšœžœ˜Kšžœžœ ž œ˜>—K˜K˜—K˜—Kšžœ˜˜K˜K˜—K˜—…—ΰ Λ