mirror of
https://github.com/byteworksinc/ORCA-Pascal.git
synced 2024-11-27 17:51:12 +00:00
963 lines
31 KiB
Plaintext
963 lines
31 KiB
Plaintext
{-- Misc. pcodes -----------------------------------------------}
|
|
{ }
|
|
{ dc_cns - generate a constant value }
|
|
{ }
|
|
{ GenL1(dc_cns, lval, count); }
|
|
{ GenR1t(dc_cns, rval, count, type); }
|
|
{ Gen2t(dc_cns, ival, count, type); }
|
|
{ GenS(dc_cns, sptr); }
|
|
{ }
|
|
{ Creates COUNT occurrances of the constant lval, rval or }
|
|
{ ival, based on the type. In Gen2t can accept byte or word }
|
|
{ types. In the case of GenS, the operand is a string }
|
|
{ constant, and no repeat count is allowed. }
|
|
{ }
|
|
{ }
|
|
{ dc_glb - generate global label }
|
|
{ }
|
|
{ Gen2Name(dc_glb, r, q, lab) }
|
|
{ }
|
|
{ Creates a global label in the current segment with the name }
|
|
{ LAB^. If Q is 1, the label is marked as private to the }
|
|
{ current segment, otherwise it is marked as public. R bytes }
|
|
{ of space are reserved. }
|
|
{ }
|
|
{ }
|
|
{ dc_dst - generate global storage }
|
|
{ }
|
|
{ Gen1(dc_dst, q) }
|
|
{ }
|
|
{ Creates q bytes of storage (initialized to 0) at the }
|
|
{ current location. }
|
|
{ }
|
|
{ }
|
|
{ pc_lnm - line number }
|
|
{ }
|
|
{ Gen2(pc_lnm, lc, flag) }
|
|
{ }
|
|
{ Sets the current line number for the traceback facility and }
|
|
{ debugger. This p-code should only be generated after the }
|
|
{ pc_ent and pc_nam (if any), and should not be generated }
|
|
{ outside of a subroutine. Lc is the line number, while flag }
|
|
{ indicates the type of debugging action on this line: }
|
|
{ }
|
|
{ 0 - step/trace }
|
|
{ 1 - break point }
|
|
{ 2 - auto-go }
|
|
{ }
|
|
{ }
|
|
{ pc_mov - move memory }
|
|
{ }
|
|
{ Gen2(pc_mov, banks, bytes) }
|
|
{ }
|
|
{ The top of stack contains a source address, and TOS-1 has a }
|
|
{ destination address. The destination address is removed, }
|
|
{ and BYTES bytes are moved from the source to the }
|
|
{ destination. BANKS is the number of full banks to move; it }
|
|
{ is used when 64K or more must be moved. The memory areas }
|
|
{ must not overlap. }
|
|
{ }
|
|
{ }
|
|
{ pc_nam - subroutine name }
|
|
{ }
|
|
{ GenPS(pc_nam, str) }
|
|
{ }
|
|
{ Sets the subroutine name for the traceback facility, }
|
|
{ debugger, and profiler. Str is a pointer to the subroutine }
|
|
{ name. The following global variables should be set to }
|
|
{ appropriate values when this p-code is used: }
|
|
{ }
|
|
{ debugFlag - are we generating debug code? }
|
|
{ profileFlag - are we profiling? }
|
|
{ traceBack - are we doing tracebacks? }
|
|
{ includeFile - current source file name }
|
|
{ }
|
|
{-- Pcodes involved expressions --------------------------------}
|
|
{ }
|
|
{ pc_abi - integer absolute value }
|
|
{ pc_abl - longint absolute value }
|
|
{ pc_abr - real absolute value }
|
|
{ }
|
|
{ Gen0(pc_abi) cgByte,cgUByte,cgWord,cgUWord }
|
|
{ Gen0(pc_abl) cgLong,cgULong }
|
|
{ Gen0(pc_abr) cgReal,cgDouble,cgComp,cgExtended }
|
|
{ }
|
|
{ The value on the top of the evaluation stack is replaced }
|
|
{ by its absolute value. }
|
|
{ }
|
|
{ }
|
|
{ pc_acs - arc cosine }
|
|
{ }
|
|
{ Gen0 (pc_acs) }
|
|
{ }
|
|
{ Replace the top of stack with its arc cosine. }
|
|
{ }
|
|
{ }
|
|
{ pc_adi - integer addition }
|
|
{ pc_adl - long addition }
|
|
{ pc_adr - real addition }
|
|
{ }
|
|
{ Gen0(pc_adi) cgByte,cgUByte,cgWord,cgUWord }
|
|
{ Gen0(pc_adl) cgLong,cgULong }
|
|
{ Gen0(pc_adr) cgReal,cgDouble,cgComp,cgExtended }
|
|
{ }
|
|
{ The two values on the top of the evaluation stack are }
|
|
{ removed and added. The result is placed back on the stack. }
|
|
{ }
|
|
{ }
|
|
{ pc_and - logical and }
|
|
{ pc_lnd - long logical and }
|
|
{ }
|
|
{ Gen0(pc_and) cgByte,cgUByte,cgWord,cgUWord }
|
|
{ Gen0(pc_lnd) cgLong,cgULong }
|
|
{ }
|
|
{ The two values on the top of the evaluation stack are }
|
|
{ removed and anded. The result is placed back on the stack. }
|
|
{ Zero is treated as false, and any other value as true. The }
|
|
{ and is a logical and. See pc_bnd for a bitwise and. }
|
|
{ }
|
|
{ If the first operand is false, the second operand is not }
|
|
{ evaluated. }
|
|
{ }
|
|
{ }
|
|
{ pc_asn - arc sine }
|
|
{ }
|
|
{ Gen0 (pc_asn) }
|
|
{ }
|
|
{ Replace the top of stack with its arc sine. }
|
|
{ }
|
|
{ }
|
|
{ pc_atn - arc tangent }
|
|
{ }
|
|
{ Gen0 (pc_atn) }
|
|
{ }
|
|
{ Replace the top of stack with its arc tangent. }
|
|
{ }
|
|
{ }
|
|
{ pc_at2 - two argument arc tangent }
|
|
{ }
|
|
{ Gen0 (pc_at2) }
|
|
{ }
|
|
{ Removes two real arguments from the stack, replacing then }
|
|
{ with their two-argument arc-tangent. }
|
|
{ }
|
|
{ }
|
|
{ pc_bnd - bitwise and }
|
|
{ pc_bal - long bitwise and }
|
|
{ }
|
|
{ Gen0(pc_bnd) cgByte,cgUByte,cgWord,cgUWord }
|
|
{ Gen0(pc_bal) cgLong,cgULong }
|
|
{ }
|
|
{ The two values on the top of the evaluation stack are }
|
|
{ removed and anded. The result is placed back on the stack. }
|
|
{ }
|
|
{ }
|
|
{ pc_bno - binary operand no-operation }
|
|
{ }
|
|
{ Gen0t(pc_bno, type) }
|
|
{ }
|
|
{ The left operand is evaluated and discarded, followed by }
|
|
{ the evaluation of the right operand. The type is the type }
|
|
{ of the right operand; it is used in case a pc_pop is }
|
|
{ attached to remove a result left on the stack. This }
|
|
{ instruction is used by C for the comma operator and for }
|
|
{ parameter lists for function and procedure calls, and by }
|
|
{ pc_tri to hold the two expressions. }
|
|
{ }
|
|
{ }
|
|
{ pc_bnt - bitwise negation }
|
|
{ pc_bnl - long bitwise negation }
|
|
{ }
|
|
{ Gen0(pc_bnt) cgByte,cgUByte,cgWord,cgUWord }
|
|
{ Gen0(pc_bnl) cgLong,cgULong }
|
|
{ }
|
|
{ The value on the top of the evaluation stack is removed, }
|
|
{ exclusive ored with $FFFF, and replaced. (One's compliment.)}
|
|
{ }
|
|
{ }
|
|
{ pc_bor - bitwise or }
|
|
{ pc_blr - long bitwise or }
|
|
{ }
|
|
{ Gen0(pc_bor) cgByte,cgUByte,cgWord,cgUWord }
|
|
{ Gen0(pc_blr) cgLong,cgULong }
|
|
{ }
|
|
{ The two values on the top of the evaluation stack are }
|
|
{ removed and ored. The result is placed back on the stack. }
|
|
{ }
|
|
{ }
|
|
{ pc_bxr - exclusive or }
|
|
{ pc_blx - long exclusive or }
|
|
{ }
|
|
{ Gen0(pc_bxr) cgByte,cgUByte,cgWord,cgUWord }
|
|
{ Gen0(pc_blx) cgLong,cgULong }
|
|
{ }
|
|
{ The two values on the top of the evaluation stack are }
|
|
{ removed and exclusive ored. The result is placed back on }
|
|
{ the stack. }
|
|
{ }
|
|
{ }
|
|
{ pc_cbf - copy bit field }
|
|
{ }
|
|
{ pc_chk - check subrange }
|
|
{ }
|
|
{ Gen2t(pc_chk, low, high, type) cgByte,cgUByte,cgWord, }
|
|
{ cgUWord }
|
|
{ GenL2t(pc_chk, low, high, type) cgLong,cgULong }
|
|
{ }
|
|
{ Make sure the value on the top of stack is in [low..high]. }
|
|
{ }
|
|
{ }
|
|
{ pc_cop - copy to a local variable }
|
|
{ }
|
|
{ Gen2t(pc_cop, label, disp, type) }
|
|
{ }
|
|
{ Saves the value on the top of the evaluation stack to DISP }
|
|
{ bytes past the local label LABEL. TYPE is the type of the }
|
|
{ value being saved. }
|
|
{ }
|
|
{ }
|
|
{ pc_cos - cosine }
|
|
{ }
|
|
{ Gen0 (pc_cos) }
|
|
{ }
|
|
{ Replace the top of stack with its cosine. }
|
|
{ }
|
|
{ }
|
|
{ pc_cnv - convert from one scalar type to another }
|
|
{ pc_cnn - convert from one scalar type to another }
|
|
{ }
|
|
{ Gen2(pc_cnv, from, to) }
|
|
{ Gen2(pc_cnn, from, to) }
|
|
{ }
|
|
{ Converts from one scalar type to another. The from and to }
|
|
{ parameters are ordinal values of type baseTypeEnum. The }
|
|
{ table below shows what from values (along the left edge) and }
|
|
{ to values (along the top) are allowed, and what action is }
|
|
{ taken for each combination. CgDouble, cgComp or cgExtended }
|
|
{ may be used anywhere that cgReal is used, with the same }
|
|
{ results. }
|
|
{ }
|
|
{ The pc_cnn form converts the value at tos-1. The value at }
|
|
{ tos is assumed to be the same size as the result type. }
|
|
{ }
|
|
{ cgByte cgUByte cgWord cgUWord cgLong cgULong cgReal }
|
|
{ cgByte extend extend float }
|
|
{ cgUByte padd padd float }
|
|
{ cgWord extend extend float }
|
|
{ cgUWord extend extend float }
|
|
{ cgLong discard discard discard discard float }
|
|
{ cgULong discard discard discard discard float }
|
|
{ cgReal trunc trunc trunc trunc trunc trunc }
|
|
{ }
|
|
{ The meaning of the operationd shown in the table is: }
|
|
{ }
|
|
{ (blank) No action is taken, but the instruction is }
|
|
{ accepted by the code generator. }
|
|
{ extend The value is sign extended to the proper length.}
|
|
{ padd The value is padded on the left with zero bits }
|
|
{ to extend it to the proper length. }
|
|
{ discard Extra bits are discarded to reach the proper }
|
|
{ length, starting with the most significant bit. }
|
|
{ float An integer value is converted to a real value. }
|
|
{ trunc A real value is converted to the largest }
|
|
{ integer value that is less than or equal to the }
|
|
{ real value. }
|
|
{ }
|
|
{ }
|
|
{ pc_cpo - copy to a global variable }
|
|
{ }
|
|
{ Gen1tName (pc_cpo, disp, type, name) }
|
|
{ }
|
|
{ Saves the value on the top of the evaluation stack to the }
|
|
{ global label NAME. DISP is a fixed displacement past the }
|
|
{ names label to load from. (Used for records.) TYPE is }
|
|
{ the type of the value being loaded. }
|
|
{ }
|
|
{ }
|
|
{ pc_dec - decrement }
|
|
{ }
|
|
{ Gen1t(pc_dec, val, type) }
|
|
{ }
|
|
{ The value on the top of the stack is removed, decremented by }
|
|
{ VAL and returned to the stack. Type may be cgByte, cgUByte, }
|
|
{ cgWord, cgUWord, cgLong or cgULong. In all cases, the }
|
|
{ amount to decrement by is a positive signed integer. }
|
|
{ }
|
|
{ }
|
|
{ pc_dif - set difference }
|
|
{ }
|
|
{ Gen0(pc_dif) }
|
|
{ }
|
|
{ Two sets are removed from the top of stack. All elements }
|
|
{ in the set at TOS are removed from the set at TOS-1, and the }
|
|
{ resulting set is pushed. }
|
|
{ }
|
|
{ }
|
|
{ pc_dvi - integer divide }
|
|
{ pc_udi - unsigned integer divide }
|
|
{ pc_dvl - long integer divide }
|
|
{ pc_udl - unsigned long divide }
|
|
{ pc_dvr - real divide }
|
|
{ }
|
|
{ Gen0(pc_dvi) cgByte,cgWord }
|
|
{ Gen0(pc_udi) cgUByte,cgUWord }
|
|
{ Gen0(pc_dvl) cgLong }
|
|
{ Gen0(pc_udl) cgULong }
|
|
{ Gen0(pc_dvr) cgReal,cgDouble,cgComp,cgExtended }
|
|
{ }
|
|
{ The two values on the top of the evaluation stack are }
|
|
{ removed and divided. The result is placed back on the }
|
|
{ stack. The result type is the same as the argument type. }
|
|
{ }
|
|
{ }
|
|
{ pc_equ,pc_geq,pc_grt,pc_leq,pc_les,pc_neq - compares }
|
|
{ }
|
|
{ Gen0t(pc_equ, type) }
|
|
{ Gen2t(pc_equ, size1, size2, type) }
|
|
{ }
|
|
{ The two values on the top of the evaluation stack are }
|
|
{ removed and compared. A boolean result is placed back on }
|
|
{ the stack. The second form is used to compare strings; the }
|
|
{ two parameters are the size of the Standard Pascal string }
|
|
{ array, or -1 for p-Strings. }
|
|
{ }
|
|
{ }
|
|
{ pc_exp - exponent }
|
|
{ }
|
|
{ Gen0 (pc_exp) }
|
|
{ }
|
|
{ Replace the top of stack with its exponent. }
|
|
{ }
|
|
{ }
|
|
{ pc_fix - fix a floating-point variable }
|
|
{ }
|
|
{ Gen1t(pc_fix, lab, type) }
|
|
{ }
|
|
{ Change a floating-point value (generally a passed parameter) }
|
|
{ from extended to either cgReal or cgDouble. }
|
|
{ }
|
|
{ }
|
|
{ pc_inc - increment }
|
|
{ }
|
|
{ Gen1t(pc_inc, val, type) }
|
|
{ }
|
|
{ The value on the top of the stack is removed, incremented by }
|
|
{ VAL and returned to the stack. Type may be cgByte, cgUByte, }
|
|
{ cgWord, cgUWord, cgLong or cgULong. In all cases, the }
|
|
{ amount to increment by is a positive signed integer. }
|
|
{ }
|
|
{ }
|
|
{ pc_ind - load indirect }
|
|
{ }
|
|
{ Gen1t (pc_ind, disp, type) }
|
|
{ Gen2t (pc_ind, disp, size, type) }
|
|
{ }
|
|
{ A value of type TYPE is loaded from DISP bytes past the }
|
|
{ address that is on the evaluation stack. The address is }
|
|
{ removed from the stack and replaced with the value. }
|
|
{ }
|
|
{ Gen2t is used for sets, where SIZE is the size of the set. }
|
|
{ }
|
|
{ }
|
|
{ pc_inn - set inclusion }
|
|
{ }
|
|
{ Gen0 (pc_inn) }
|
|
{ }
|
|
{ The top of stack is a set, and the next value on the stack }
|
|
{ is a word. The values are pulled. TRUE is pushed if the }
|
|
{ word value is in the set; FALSE is pushed if not. }
|
|
{ }
|
|
{ }
|
|
{ pc_int - set intersection }
|
|
{ }
|
|
{ Gen0(pc_int) }
|
|
{ }
|
|
{ Two sets are removed from the top of stack. The }
|
|
{ intersection of the two sets is pushed. }
|
|
{ }
|
|
{ }
|
|
{ pc_ior - logical or }
|
|
{ pc_lor - long logical or }
|
|
{ }
|
|
{ Gen0(pc_ior) cgByte,cgUByte,cgWord,cgUWord }
|
|
{ Gen0(pc_lor) cgLong,cgULong }
|
|
{ }
|
|
{ The two values on the top of the evaluation stack are }
|
|
{ removed and ored. The result is placed back on the stack. }
|
|
{ Zero is treated as false, and any other value as true. The }
|
|
{ or is a logical or. See pc_bor for a bitwise or. }
|
|
{ }
|
|
{ }
|
|
{ pc_ixa - integer indexed address }
|
|
{ }
|
|
{ Gen0t(pc_ixa, type) }
|
|
{ }
|
|
{ TOS is an integer, which is added to TOS-1, which is a long }
|
|
{ integer. This instruction is generally used for computing }
|
|
{ short array indexes. }
|
|
{ }
|
|
{ TYPE can be cgWord or cgUWord; the type indicates whether }
|
|
{ the addition is signed or unsigned. }
|
|
{ }
|
|
{ }
|
|
{ pc_lad - load the address of a subroutine }
|
|
{ }
|
|
{ Gen0Name(pc_lad, name); }
|
|
{ }
|
|
{ Loads the address of the subroutine NAME. }
|
|
{ }
|
|
{ }
|
|
{ pc_lao - load a global address }
|
|
{ }
|
|
{ Gen1Name(pc_lao, disp, name); }
|
|
{ }
|
|
{ Loads the address of DISP bytes past the global variable }
|
|
{ NAME onto the stack. }
|
|
{ }
|
|
{ }
|
|
{ pc_lca - load a string constant address }
|
|
{ }
|
|
{ GenPS(pc_lca, str) }
|
|
{ }
|
|
{ Loads the address of a string onto the stack. Str is a }
|
|
{ pointer to a string constant. }
|
|
{ }
|
|
{ }
|
|
{ pc_lda - load a local address }
|
|
{ }
|
|
{ Gen3(pc_lda, label, level, disp) }
|
|
{ }
|
|
{ Loads the address of DISP bytes past the local label LABEL. }
|
|
{ LEVEL is the number of stack frames to traverse. }
|
|
{ }
|
|
{ }
|
|
{ pc_ldc - load a constant }
|
|
{ }
|
|
{ Gen1t(pc_ldc, val, type) }
|
|
{ GenLdcLong(val) }
|
|
{ GenLdcReal(val) }
|
|
{ }
|
|
{ Loads a constant value. Special calls for long and real }
|
|
{ values are provided due to the unique parameter requirements.}
|
|
{ }
|
|
{ }
|
|
{ pc_ldo - load from a global variable }
|
|
{ }
|
|
{ Gen1tName (pc_ldo, disp, type, name) }
|
|
{ Gen2tName (pc_ldo, disp, size, type, name) }
|
|
{ }
|
|
{ Loads a value from the global label NAME and places it on }
|
|
{ the evaluation stack. DISP is a fixed displacement past the }
|
|
{ names label to load from. (Used for records.) TYPE is }
|
|
{ the type of the value being loaded. }
|
|
{ }
|
|
{ Gen2tName is used for sets, where SIZE is the size of the }
|
|
{ set. }
|
|
{ }
|
|
{ }
|
|
{ pc_lla - load the address of a local label }
|
|
{ }
|
|
{ Gen1(pc_lda, label) }
|
|
{ }
|
|
{ Loads the address LABEL. This is generally used to load the }
|
|
{ address of a procedure. }
|
|
{ }
|
|
{ }
|
|
{ pc_lsl - load static link }
|
|
{ }
|
|
{ Gen1(pc_lsl, level) }
|
|
{ }
|
|
{ Loads the address of the stack frame LEVEL static links }
|
|
{ back. }
|
|
{ }
|
|
{ }
|
|
{ pc_lod - load from a local variable }
|
|
{ }
|
|
{ Gen3t(pc_lod, label, disp, level, type) }
|
|
{ Gen4t(pc_lod, label, disp, level, size, type) }
|
|
{ }
|
|
{ Loads a value from DISP bytes past the local label LABEL and }
|
|
{ places it on the evaluation stack. TYPE is the type is the }
|
|
{ value being loaded. LEVEL is the number of stack frames to }
|
|
{ skip; it is 0 for the local stack frame. }
|
|
{ }
|
|
{ Gen4t is used for sets, where SIZE is the size of the set. }
|
|
{ }
|
|
{ }
|
|
{ pc_log - logarithm }
|
|
{ }
|
|
{ Gen0 (pc_log) }
|
|
{ }
|
|
{ Replace the top of stack with its log. }
|
|
{ }
|
|
{ }
|
|
{ pc_mod - integer modulus }
|
|
{ pc_uim - unsigned integer modulus }
|
|
{ pc_mdl - long modulus }
|
|
{ pc_ulm - unsigned long modulus }
|
|
{ }
|
|
{ Gen0(pc_mod) cgByte,cgWord }
|
|
{ Gen0(pc_uim) cgUByte,cgUWord }
|
|
{ Gen0(pc_mdl) cgLong }
|
|
{ Gen0(pc_ulm) cgULong }
|
|
{ }
|
|
{ The two values on the top of the evaluation stack are }
|
|
{ removed and a molulus operation is performed. The result is }
|
|
{ placed back on the stack. The result, like the arguments, }
|
|
{ is an integer. }
|
|
{ }
|
|
{ }
|
|
{ pc_mpi - integer multiply }
|
|
{ pc_umi - unsigned integer multiply }
|
|
{ pc_mpl - long integer multiply }
|
|
{ pc_uml - unsigned long multiply }
|
|
{ pc_mpr - real multiply }
|
|
{ }
|
|
{ Gen0(pc_mpi) cgByte,cgWord }
|
|
{ Gen0(pc_umi) cgUByte,cgUWord }
|
|
{ Gen0(pc_mpl) cgLong }
|
|
{ Gen0(pc_uml) cgULong }
|
|
{ Gen0(pc_mpr) cgReal,cgDouble,cgComp,cgExtended }
|
|
{ }
|
|
{ The two values on the top of the evaluation stack are }
|
|
{ removed and multiplied. The result is placed back on the }
|
|
{ stack. The result type is the same as the argument type. }
|
|
{ }
|
|
{ }
|
|
{ pc_ngi - integer negation }
|
|
{ pc_ngl - long negation }
|
|
{ pc_ngr - real negation }
|
|
{ }
|
|
{ Gen0(pc_ngi) cgByte,cgUByte,cgWord,cgUWord }
|
|
{ Gen0(pc_ngl) cgLong,cgULong }
|
|
{ Gen0(pc_ngr) cgReal,cgDouble,cgComp,cgExtended }
|
|
{ }
|
|
{ The value on the top of the evaluation stack is removed, }
|
|
{ subtracted from 0, and replaced. (Two's compliment.) }
|
|
{ }
|
|
{ }
|
|
{ Gen0(pc_nop) }
|
|
{ }
|
|
{ This operand is a leaf node. It does nothing. It is used }
|
|
{ to create a null expression tree for functions and }
|
|
{ procedures that have no parameters. }
|
|
{ }
|
|
{ }
|
|
{ pc_not - logical negation }
|
|
{ }
|
|
{ Gen0(pc_not) }
|
|
{ }
|
|
{ The value on the top of the evaluation stack is removed, }
|
|
{ logically negated, and replaced. }
|
|
{ }
|
|
{ }
|
|
{ pc_odd - is an integer odd? }
|
|
{ pc_odl - is a long integer odd? }
|
|
{ }
|
|
{ Gen0 (pc_odd) }
|
|
{ Gen0 (pc_odl) }
|
|
{ }
|
|
{ The top of stack is an integer. It is removed, and replaced }
|
|
{ with a boolean TRUE if the integer is odd, or FALSE if the }
|
|
{ integer is even. }
|
|
{ }
|
|
{ }
|
|
{ pc_pop - pop a value from the stack }
|
|
{ }
|
|
{ Gen0t(pc_pop, type) }
|
|
{ }
|
|
{ The value on the top of the evaluation stack is removed. }
|
|
{ }
|
|
{ }
|
|
{ pc_rnd - round }
|
|
{ pc_rn4 - round }
|
|
{ }
|
|
{ Gen0 (pc_rnd) returns cgWord }
|
|
{ Gen0 (pc_rn4) returns cgLong }
|
|
{ }
|
|
{ TOP is a real value; it is removed and replaced with the }
|
|
{ closest integer value. }
|
|
{ }
|
|
{ }
|
|
{ pc_sbi - integer subtraction }
|
|
{ pc_sbl - long subtraction }
|
|
{ pc_sbr - real subtraction }
|
|
{ }
|
|
{ Gen0(pc_sbi) cgByte,cgUByte,cgWord,cgUWord }
|
|
{ Gen0(pc_sbl) cgLong,cgULong }
|
|
{ Gen0(pc_sbr) cgReal,cgDouble,cgComp,cgExtended }
|
|
{ }
|
|
{ The two values on the top of the evaluation stack are }
|
|
{ removed. TOS-1 - TOS is placed back on the stack. }
|
|
{ }
|
|
{ }
|
|
{ pc_sgs - singleton set }
|
|
{ }
|
|
{ Gen0(pc_sgs) }
|
|
{ }
|
|
{ Two integer values on the top of stack for a subrange of }
|
|
{ TOS-1..TOS. The integers are removed, and a set with the }
|
|
{ equivalent elements is pushed. }
|
|
{ }
|
|
{ }
|
|
{ pc_shl - shift left }
|
|
{ pc_sll - shift left long }
|
|
{ }
|
|
{ Gen0(pc_shl) cgByte,cgUByte,cgWord,cgUWord }
|
|
{ Gen0(pc_sll) cgLong,cgULong }
|
|
{ }
|
|
{ The value at tos-1 is shifted left by the number of bits }
|
|
{ specified by tos. The result is an integer, which replaces }
|
|
{ the operands on the stack. The right bit positions are }
|
|
{ filled with zeros. }
|
|
{ }
|
|
{ }
|
|
{ pc_shr - shift right }
|
|
{ pc_usr - unsigned shift right }
|
|
{ pc_slr - long shift right }
|
|
{ pc_vsr - unsigned long shift right }
|
|
{ }
|
|
{ Gen0(pc_shr) cgByte,cgWord }
|
|
{ Gen0(pc_usr) cgUByte,cgUWord }
|
|
{ Gen0(pc_slr) cgLong }
|
|
{ Gen0(pc_vsr) cgULong }
|
|
{ }
|
|
{ The value at tos-1 is shifted right by the number of bits }
|
|
{ specified by tos. The result is an integer, which replaces }
|
|
{ the operands on the stack. This is a signed shift: the }
|
|
{ leftmost bit position is filled in with a copy of the }
|
|
{ orignial leftmost bit. }
|
|
{ }
|
|
{ Pc_usr is the unsigned form. The operation is the same, }
|
|
{ except that the leftmost bit is replaced with a zero. }
|
|
{ Pc_vsr is used for unsigned long operations. }
|
|
{ }
|
|
{ }
|
|
{ pc_sin - sine }
|
|
{ }
|
|
{ Gen0 (pc_sin) }
|
|
{ }
|
|
{ Replace the top of stack with its sine. }
|
|
{ }
|
|
{ }
|
|
{ pc_siz - set the size of a set }
|
|
{ }
|
|
{ Gen1(pc_siz, size) }
|
|
{ }
|
|
{ The top of stack is a set; it is forces to the specified }
|
|
{ size. }
|
|
{ }
|
|
{ }
|
|
{ pc_stk - stack an operand }
|
|
{ }
|
|
{ Gen0t(pc_stk, type) }
|
|
{ }
|
|
{ The value on top of the evaluation stack is to be left there }
|
|
{ as a parameter to a subsequent procedure or function call. }
|
|
{ This p-code "caps" the expression tree, giving the code }
|
|
{ generator something to do with the expression result. }
|
|
{ }
|
|
{ }
|
|
{ pc_sro - store to a global variable }
|
|
{ }
|
|
{ Gen1tName (pc_sro, disp, type, name) }
|
|
{ Gen2tName (pc_sro, disp, size, type, name) }
|
|
{ }
|
|
{ Saves the value from the top of the evaluation stack to the }
|
|
{ global label NAME. DISP is a fixed displacement past the }
|
|
{ names label to load from. (Used for records.) TYPE is }
|
|
{ the type of the value being loaded. }
|
|
{ }
|
|
{ Gen2tName is used for sets, where SIZE is the size of the }
|
|
{ set. }
|
|
{ }
|
|
{ }
|
|
{ pc_sto - store indirect }
|
|
{ }
|
|
{ Gen0t(pc_sto, type) }
|
|
{ Gen1t(pc_sto, size, type) }
|
|
{ }
|
|
{ Two values are removed from the evaluation stack. TOS is of }
|
|
{ type TYPE, while TOS-1 is a pointer. The value is stored at }
|
|
{ the location pointed to by the pointer. }
|
|
{ }
|
|
{ Gen1t is used for sets, where SIZE is the size of the set. }
|
|
{ }
|
|
{ }
|
|
{ pc_str - store to a local variable }
|
|
{ }
|
|
{ Gen3t(pc_str, label, disp, level, type) }
|
|
{ Gen4t(pc_str, label, disp, level, size, type) }
|
|
{ }
|
|
{ Saves the value on the top of the evaluation stack to DISP }
|
|
{ bytes past the local label LABEL. TYPE is the type of the }
|
|
{ value being saved. }
|
|
{ }
|
|
{ Gen4t is used for sets, where SIZE is the size of the set. }
|
|
{ }
|
|
{ }
|
|
{ pc_sqr - square a real number }
|
|
{ pc_sqi - square an integer }
|
|
{ pc_sql - square a long integer }
|
|
{ }
|
|
{ Gen0 (pc_sqr) }
|
|
{ Gen0 (pc_sqi) }
|
|
{ Gen0 (pc_sql) }
|
|
{ }
|
|
{ Replace the top of stack with its square. }
|
|
{ }
|
|
{ }
|
|
{ pc_sqt - square root of a real number }
|
|
{ }
|
|
{ Gen0 (pc_sqt) }
|
|
{ }
|
|
{ Replace the top of stack with its square root. }
|
|
{ }
|
|
{ }
|
|
{ pc_tan - tangent }
|
|
{ }
|
|
{ Gen0 (pc_tan) }
|
|
{ }
|
|
{ Replace the top of stack with its tangent. }
|
|
{ }
|
|
{ }
|
|
{ pc_uni - set union }
|
|
{ }
|
|
{ Gen0(pc_uni) }
|
|
{ }
|
|
{ Two sets are removed from the top of stack. The union of }
|
|
{ the two sets is pushed. }
|
|
{ }
|
|
{-- Flow of control --------------------------------------------}
|
|
{ }
|
|
{ dc_lab - define a label }
|
|
{ }
|
|
{ Gen1(pc_lab, lab) }
|
|
{ }
|
|
{ Defines label number lab at the current location. }
|
|
{ }
|
|
{ }
|
|
{ pc_add - address }
|
|
{ }
|
|
{ Gen1(pc_add, lab) }
|
|
{ }
|
|
{ Generates a two-byte address that points to the label lab. }
|
|
{ This is used to create branch tables for pc_xjp }
|
|
{ instructions. }
|
|
{ }
|
|
{ }
|
|
{ pc_fjp - jump if false }
|
|
{ }
|
|
{ Gen1(pc_fjp, lab) }
|
|
{ }
|
|
{ A boolean value is removed from the top of the evaluation }
|
|
{ stack. If the value is false, execution continues with the }
|
|
{ instruction after the label lab; otherwise execution }
|
|
{ continues with the instruction after this one. }
|
|
{ }
|
|
{ }
|
|
{ pc_tjp - jump if true }
|
|
{ }
|
|
{ Gen1(pc_tjp, lab) }
|
|
{ }
|
|
{ A boolean value is removed from the top of the evaluation }
|
|
{ stack. If the value is true, execution continues with the }
|
|
{ instruction after the label lab; otherwise execution }
|
|
{ continues with the instruction after this one. }
|
|
{ }
|
|
{ }
|
|
{ pc_prs - pop return stack }
|
|
{ }
|
|
{ Gen0(pc_prs) }
|
|
{ }
|
|
{ Pop one static frame (and any intervening dynamic frames) }
|
|
{ from the return stack. This is used for pc_ujp instructions }
|
|
{ that branch outside the current subroutine. }
|
|
{ }
|
|
{ }
|
|
{ pc_pwr - raise a number to a power. }
|
|
{ }
|
|
{ Gen0 (pc_pwr) }
|
|
{ }
|
|
{ Replace the top of stack with TOS-1 raised to the TOS power. }
|
|
{ }
|
|
{ }
|
|
{ pc_ujp - jump }
|
|
{ }
|
|
{ Gen1(pc_ujp, lab) }
|
|
{ Gen0Name(pc_ujp, lab) }
|
|
{ }
|
|
{ Execution continues with the instruction after the label }
|
|
{ LAB. This can be a numbered, local label (Gen1) or a named, }
|
|
{ global label (Gen0Name). }
|
|
{ }
|
|
{ }
|
|
{ pc_xjp - indexed jump }
|
|
{ }
|
|
{ Gen1(pc_xjp, val) }
|
|
{ }
|
|
{ The top of stack contains an integer, which is removed. If }
|
|
{ it is less than zero or greater than VAL, it is replaced by }
|
|
{ VAL. The result is then used to index into a jump table, }
|
|
{ formed using pc_add instructions, which follows immediately }
|
|
{ after the pc_xjp instruction. }
|
|
{ }
|
|
{-- Pcodes involved with calling and defining procedures -------}
|
|
{ }
|
|
{ dc_str - start a segment }
|
|
{ }
|
|
{ Gen2Name(dc_str, p1, p2, name) }
|
|
{ }
|
|
{ Starts a new object segment with the name name^. P1 is the }
|
|
{ segment kind, while p2 is the length code (1 for data, 0 for }
|
|
{ code segments). }
|
|
{ }
|
|
{ }
|
|
{ dc_pin - procedure entry point }
|
|
{ }
|
|
{ Gen0(dc_pin) }
|
|
{ }
|
|
{ A code segment does not have to be entered at the first byte }
|
|
{ when called. This directive is used one time in each code }
|
|
{ segment to indicate the actual entry point. }
|
|
{ }
|
|
{ }
|
|
{ dc_enp - end a segment }
|
|
{ }
|
|
{ Gen0(dc_enp) }
|
|
{ }
|
|
{ This directive closes the current segment. }
|
|
{ }
|
|
{ }
|
|
{ pc_ent - enter a subroutine }
|
|
{ }
|
|
{ Gen0(pc_ent) }
|
|
{ }
|
|
{ This pcode is used at the beginning of every subroutine. It }
|
|
{ marks the beginning of a new stack frame definition. }
|
|
{ Subsequent dc_loc and dc_prm cause space to be allocated }
|
|
{ from this stack frame. }
|
|
{ }
|
|
{ }
|
|
{ pc_ret - return from a subroutine }
|
|
{ }
|
|
{ Gen0t(pc_ret, type) }
|
|
{ }
|
|
{ This pcode is used to return from a function or a procedure. }
|
|
{ The type is the type of the function, and is used to tell }
|
|
{ the code generator what type of value to return. The value }
|
|
{ to return is assumed to be stored defaultStackSize bytes }
|
|
{ into the stack frame. }
|
|
{ }
|
|
{ }
|
|
{ pc_cui - call user procedure, indirect }
|
|
{ }
|
|
{ Gen0t(pc_cui, ftype) }
|
|
{ }
|
|
{ TOS-1 is the address of a procedure or function to call. }
|
|
{ TOS is the static level for the procedure. These values are }
|
|
{ removed from the stack, and the procedure is called. }
|
|
{ }
|
|
{ }
|
|
{ pc_cum - call user method }
|
|
{ }
|
|
{ GenL1t(pc_cum, disp, ftype) }
|
|
{ }
|
|
{ A series of parameters is on the stack; the first is the }
|
|
{ SELF parameter. DISP is a displacement into the object }
|
|
{ where the address of the method to call can be found. }
|
|
{ }
|
|
{ }
|
|
{ pc_cup - call user procedure }
|
|
{ }
|
|
{ Gen1tName(pc_cup, level, ftype, name) }
|
|
{ Gen2t(pc_cup, label, level, ftype) }
|
|
{ }
|
|
{ Calls a user procedure or function. FTYPE is the return }
|
|
{ type. NAME is the name of a global procedure; LABEL is used }
|
|
{ for local procedures. LEVEL is the ??? }
|
|
{ }
|
|
{ }
|
|
{ pc_csp - call standard procedure }
|
|
{ }
|
|
{ Gen1(pc_csp, proc) }
|
|
{ }
|
|
{ Calls a standard procedure or function. PROC is the }
|
|
{ procedure or function name. }
|
|
{ }
|
|
{ }
|
|
{ dc_loc - define local label }
|
|
{ }
|
|
{ Gen2(dc_loc, label, size) }
|
|
{ }
|
|
{ Defines a local label using the label parameter as a label }
|
|
{ number. Size bytes are reserved on the stack frame. Label }
|
|
{ numbers should be assigned by the compiler, starting with }
|
|
{ number 1. Label 0 is reserved for refering to the return }
|
|
{ value of a function (if any). }
|
|
{ }
|
|
{ }
|
|
{ dc_prm - define parameter }
|
|
{ }
|
|
{ Gen3(dc_prm, label, size, disp) }
|
|
{ }
|
|
{ Defines a label used to refer to a parameter. See dc_loc }
|
|
{ for a discussion of the label and size parameters. The disp }
|
|
{ parameter is the number of bytes of parameter that will be }
|
|
{ pushed after this one; i.e., the disp from the return addr }
|
|
{ to this parameter. }
|
|
{ }
|
|
{ }
|
|
{ dc_fun - define function variable }
|
|
{ }
|
|
{ Gen2(dc_fun, label, size) }
|
|
{ }
|
|
{ Defines a label used to refer to the function return value. }
|
|
{ This works like dc_loc, but requires special tracking so the }
|
|
{ pc_ret statement can find the value. }
|
|
{ }
|
|
{ }
|
|
{ pc_pds - call ProDOS }
|
|
{ }
|
|
{ Gen1(pc_pds, callNum) }
|
|
{ }
|
|
{ Calls ProDOS. CALLNUM is the ProDOS call number. The }
|
|
{ address of the parameter block is on the stack. }
|
|
{ }
|
|
{ }
|
|
{ pc_tl1 - call a tool }
|
|
{ pc_tl2 - call a tool }
|
|
{ }
|
|
{ Gen2t(pc_tl1, toolNum, callNum, type) }
|
|
{ }
|
|
{ Calls a tool. The tool number is TOOLNUM; the tool call }
|
|
{ is CALLNUM. TYPE is the return type, which must be one of }
|
|
{ the integer types or cgVoid. pc_tl1 calls the system entry }
|
|
{ point, while pc_tl2 calls the user tool entry point. }
|
|
{ }
|
|
{ }
|
|
{ pc_vct - call a tool through a vector }
|
|
{ }
|
|
{ Gen1L1t(pc_vct, call, vector, type) }
|
|
{ }
|
|
{ Generates a call using toolbox conventions. TOS contains }
|
|
{ the parameters. Space for the returned value of type TYPE }
|
|
{ is pushed on the stack, CALL is loaded into the X register, }
|
|
{ and a JSL VECTOR is performed. On return, A is saved at }
|
|
{ ~TOOLERROR and any function value is loaded into the }
|
|
{ registers. }
|
|
{ }
|
|
{ }
|
|
{ dc_sym - generate a symbol table }
|
|
{ }
|
|
{ Gen1Name(dc_sym, doGLobals, pointer(table) }
|
|
{ }
|
|
{ Generates a symbol table for the debugger. TABLE is the }
|
|
{ address of the sybol table, which will be passed back to a }
|
|
{ subroutine called GenSymbols, which must be supplied by the }
|
|
{ compiler. DOGLOBALS is a flag the compiler can set for its }
|
|
{ own purposes. C uses the flag to note that the symbol }
|
|
{ table being created is for main, so global symbols should be }
|
|
{ included. }
|
|
{ }
|