![]() |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Technical Reference ManualQ-CODE
Please note: The Q-Code for commands that are new to the LZ
are NOT listed. I will include them as soon as I get the information. OPERANDSEach operand stacks either a constant value or a pointer to a variable. There are a number of types of operands. Operands are named after their type, the types are:
These operands take the following word, add it to RTA_FP (see section Language Pointers) and stack the variable at that address.
These operands take the following word, adds it to RTA_FP to get the start of the array. The required element number is dropped off the stack and checked against the maximum size of the array. The address of the element is then calculated and the variable stacked.
This operand gives access to the calculators memories, M0 to M9. The operand is followed by the offset to the memory required.
These operands take the following word, add it to RTA_FP, load the address at that address and stack the variable at that address.
These operands take the following word, adds it to RTA_FP, loads the address at that address to get the start of the array. The element of the array required is dropped off the stack, it is then checked against the maximum size of the array. The address of the element is then calculated and the variable stacked.
These operands correspond to their right side equivalents. In the case of strings the maximum length is stacked first. Then, in all cases, the address of the variable is stacked. The field flag byte is then stacked, in all these cases it is zero to show that it is not a field reference.
These operands are followed by a logical file name, 0,1,2 or 3, which says which logical file to use. First it looks for the field name in the Field Name Symbol Table. If it is found the corresponding field is split from the corresponding File Buffer. If it is a string it is immediately placed on the stack. If it is numeric it is converted from ')"; onMouseout="hideddrivetip()"> ASCII to the relevant format and placed on the stack.
These operands stacks the logical file, the byte following the operand, and the field flag which in this case is non-zero. All the work is done by the assign.
Stacks the following byte or word. QI_STK_LIT_WORD is identical to QI_INT_CON.
Stacks the constant value following. OPERATORSOperators generally do things to the variables already on the stack. ERRORS, CALLS AND PARAMETERSIn the following section if an operand cannot return an error then no errors are listed. Any access to a device can result in the following errors. They are no given explicitly as error for that operand/operator:
When writing to a pack the following are always possible:
If the operator calls an operating system then that is listed. If no calls are given then the run time code handles it all itself. In general there is no difference between call with a $ and with an _, the $ calls are called through SWIs whereas the _ calls are made directly. Direct calls are faster, but SWIs can be redirected for the addition of extra features. If there is more than one parameter they are listed. The values are stacked in order. So para1 is stacked before para2 - when the operator is called the last parameter is the one pointed to by the RTA_SP. LOGICAL AND ARITHMETIC COMPARE OPERATORS
The compares drop whatever is on the stack and return an integer either TRUE(-1) or FALSE(0). The string compares are case sensitive. COMMAND OPERATORSQCO_ATPositions the cursor.
Clears RTB_CRFL, the carriage return flag. QCO_BEEPBeeps with a frequency of 460800/(39+para2).
QCO_BREAKBreak the execution of OPL. Note that this is not equivalent to the OPL word BREAK.
QCO_CLSClears the screen. The cursor is homed to the top left.
QCO_CURSORSet the cursor on or off.
Gets byte after operator, sets or clears most significant bit of DPB_CUST. QCO_ESCAPEEnables or disables the ON/CLEAR key freeze and quit.
Gets byte after operator, sets or clears RTA_ESCF. QCO_GOTOJump RTA_PC to a new location in the same procedure.
Adds word after the operator to RTA_PC. See QCO_BRA_FALSE. QCO_OFFTurns off the machine. Does not terminate language execution.
This is exactly the same state as when the machine is turned off at the top level. The drain on the battery is minimal. QCO_ONERRSet up error handling.
The following word contains the offset to the address to jump to in the event of an error being detected. ONERR OFF is the same operator followed by a zero word. The ONERR address is saved in the procedure header. QCO_PAUSEIf positive it pauses for that many 50 millisecond units, if negative it pauses for that many 50 millisecond units or until the first key press. If it is zero it waits for the next key press.
Uses the 'SLP' processor instruction, so less power is used when PAUSEd compared to normal operation. It does however use more power than being switched off. QCO_POKEBPokes a byte into memory.
Reports an error if para2 is not a byte. If the address is in the protected range $00 to $3F or $282 to $400 then it does nothing. QCO_POKEWPokes a word into memory.
If the address is in the protected range $00 to $3F or $282 to $400 then it does nothing. QCO_RAISEGenerates an error condition.
If integer on the stack is not a byte it reports error. Otherwise it has exactly the same effect as if that error was generated. Errors generated by RAISE are handled in the normal way by ONERR. Using this command and ONERR the programmer can completely take-over the handling and reporting of errors. If the error is out of the range normally reported by the OS the message "*** ERROR ***" is reported. RAISE 0 is special as it does not report an error. QCO_RANDOMIZESet the seed of the random number generator. The sequence numbers generated by RND becomes repeatable.
QCO_SPECIALSpecial operator used to vector to machine code.
Vectors via the contents of the location RTA_1VCT to machine code. The machine code should return with the carry flag set to report an error. If the ')"; onMouseout="hideddrivetip()"> ASCII value 1 is encountered in the OPL source code it is taken to be a SPECIAL call which returns an integer. A 2 is for a floating point return and 3 for a string. It is impossible to get these values into the source code from the editor, it must be generated by another program. QCO_STOPStops executing the language.
Resets RTA_SP, zeroes the file buffers by calling AL_ZERO and leaves the language. QCO_TRAPDisables the reporting of any error arising from the execution of the following operator. Instead the error number is saved in RTB_EROR which can be read by the function ERR.
Clears RTB_EROR and sets the trap flag RTB_TRAP. The following operators can be used with TRAP:
If no error occurs these operators clear RTB_TRAP. Most of these are file-related operator. The programmer will frequently either need to report errors arising from the operators himself or handle them in a discriminating way. For example: TRAP OPEN "B:XYZ",A,A$
IF ERR
TRAP OPEN "C:XYZ",A,A$
IF ERR
CLS :PRINT "FILE XYZ NOT" :PRINT "FOUND"
BEEP 100,100 :GET :STOP
ENDIF
ENDIF
INPUT and EDIT are different. TRAP changes the conditions under which they exit. "EDIT A$" will not exit on the ON/CLEAR key, "TRAP EDIT A$" will exit with RTB_EROR set to ER_RT_BK. When inputting a number without the TRAP option, the routine will not exit until a valid number is input; however with TRAP any input will be accepted and the corresponding error condition placed in RTB_EROR. See QCO_INPUT_INT, QCO_INPUT_NUM, QCO_INPUT_STR, QCO_EDIT. FILE OPERATORSQCO_APPENDAdds the current record buffer to the current file as a new record.
The contents of the file buffer are saved at the end of the current device. The first byte of the buffer is the length of the buffer. QCO_CLOSECloses the current file.
CLOSE has no effect on the file itself, it checks that the file is open, clears the record type in RTT_FIL, and zeroes the two cells. QCO_COPYCopies a file from one device to another. If the target already exists the data is appended.
QCO_CREATECreates a file.
QCO_DELETEDeletes a file.
Checks that the file is not open. Deletes all records, starting with the first, and finally the file name record of the file. QCO_ERASEErases the current record of the current file.
QCO_FIRSTGoes to the first record of the current file.
QCO_LASTGoes to the last record of the current file.
QCO_NEXTGoes to the next record.
QCO_BACKSteps back one record.
QCO_OPENOpen a file.
OPEN has exactly the same form as CREATE. QCO_POSITIONPosition at that record.
QCO_RENAMERenames a file.
Erases the file name record and writes a new one. QCO_UPDATEUpdates a record.
It deletes the current record in the current file and then APPENDs the contents of the buffer. QCO_USEChanges the current file.
Takes the byte following the operator and after checking it makes it the new current logical file. See logical file names. OTHER OPERATORSQCO_KSTATSet the shift state of the keyboard.
Use KSTAT to change the upper/lower alpha/numeric case:
QCO_EDITEdits a string.
If the string to be edited is a field then the maximum length of the string is 252. Otherwise the maximum length allowed is the length of the string as defined in the LOCAL or GLOBAL statement. The string to be edited is copied into RTT_BUF. Once the string is edited it is assigned to the source. If the EDIT is preceded by TRAP then the edit will exit on the ON/CLEAR key with the error condition ER_RT_BK. The string remains unchanged. Before execution of this operator RTB_CRFL is tested and, if set, a carriage return is sent to the screen and the flag cleared. QCO_INPUT_INTInput an integer.
If the INPUT is preceded by TRAP then the input will exit on the ON/CLEAR key with the error condition ER_RT_BK. It will also exit if an invalid integer is input, e.g. 99999 or $1. If there is no TRAP then the INPUT will not exit on the ON/CLEAR key and invalid integers generate a '?' on the next line and the INPUT is repeated. Up to 6 characters, including leading spaces, are allowed. Before execution of this operator RTB_CRFL is tested and, if set, a carriage return is sent to the screen and the flag cleared. QCO_INPUT_NUMInputs a floating point number.
If the INPUT is preceded by TRAP then the input will exit on the ON/CLEAR key with the error condition ER_RT_BK. It will also exit if an invalid floating point number is input, e.g. 999999999999999 or $1. If there is no TRAP then the INPUT will not exit on the ON/CLEAR key and invalid integers generate a '?' on the next line and the INPUT is repeated. Up to 15 characters, including leading spaces, are allowed. Before execution of this operator RTB_CRFL is tested and, if set, a carriage return is sent to the screen and the flag cleared. QCO_INPUT_STRInputs a string.
QCO_INPUT_STR is exactly equivalent to QCO_EDIT with an initial null string. QCO_PRINT_INTPrints an integer to the screen.
Before execution of this operator RTB_CRFL is tested and, if set, a carriage return is sent to the screen and the flag cleared. QCO_PRINT_NUMPrints a floating point number to the screen.
Before execution of this operator RTB_CRFL is tested and, if set, a carriage return is sent to the screen and the flag cleared. The format in which a number is displayed is integer, decimal or scientific in that order of precedence. QCO_PRINT_STRPrint a string to the screen.
Before execution of this operator RTB_CRFL is tested and, if set, a carriage return is sent to the screen and the flag cleared. QCO_PRINT_SPPrints a space to the screen.
This operator is generated by use of the ',' separator in a PRINT statement. Before execution of this operator RTB_CRFL is tested and, if set, a carriage return is sent to the screen and the flag cleared. QCO_PRINT_CRPrint a carriage return to the screen.
If a PRINT, INPUT or EDIT statement is not followed by a ';' or ',' then this operator is automatically inserted. It is not acted on immediately; it sets the flag RTB_CRFL. Before execution of this operator RTB_CRFL is tested and, if set, a carriage return is sent to the screen and the flag cleared. Note that if a carriage return results in scrolling the screen there is an automatic delay; the length of this delay is defined by DPW_DELY which is in 50 millisecond units, the default being 10. QCO_LPRINT_INTSends an integer to the RS232.
Exactly as PRINT_INT, except the CR flag is not tested. QCO_LPRINT_NUMSend a floating point number to the RS232.
Exactly as PRINT_NUM, except the CR flag is not tested. QCO_LPRINT_STRSend a string to the RS232.
Exactly as PRINT_STR, except the CR flag is not tested. QCO_LPRINT_SPSend a space character to the RS232.
Exactly as PRINT_SP, except the CR flag is not tested. QCO_LPRINT_CRSend a carriage return to the RS232.
As PRINT_CR except it is acted on immediately. QCO_RETURNReturn from a procedure.
This operator follows the operator which stacks the return value. All procedures return a value. If no explicit value is returned then it will return integer zero for integer procedures, floating point zero for floating point procedures or a null string for string procedures. QCO_RETURN_NOUGHTFor an integer procedure this is the default return.
Stacks default return value, then exactly the same as QCO_RETURN. QCO_RETURN_ZEROFor an floating point procedure this is the default return.
Stacks default return value, then exactly the same as QCO_RETURN. QCO_RETURN_NULLFor a string procedure this is the default return.
Stacks default return value, on the stack, then exactly the same as QCO_RETURN. QCO_PROCCall a procedure.
First checks to see if a language extension of that name has been booted into memory. If not it searches the 4 devices for an OPL procedure of the right name. It starts with the default device. So if the procedure called was on C: then it searches in the order C:, D:, A: and B:. If a language extension has been found (for example LINPUT) it calls the relevant vector and the device is then responsible for checking the parameters and handling the stack. See language extensions. If it is an OPL procedure the header information is read in and the memory required checked. The external references are then checked and the fixups on the strings and arrays performed. The Q code is then read in, and RTA_PC and RTA_SP are set to their new values. QCO_BRA_FALSEBranches if the integer on the stack is false.
Adds the integer following the operator to RTA_PC if the value on the stack is zero. QCO_ASS_INTAssign an integer to a variable.
At the start of the operand the stack looks like: High memory Address of integer variable
0 (field flag)
Low memory Integer
or:
High memory Field name
Logical file name (0,1,2 or 4)
1 (field flag)
Low memory Integer
If the assign is to a field, it checks that the file is open, checks the field name and saves the value. If not a field it simply saves the integer to the address. QCO_ASS_NUMAssigns a floating point number.
Exactly the same as QCO_ASS_INT except it handles floating point numbers. QCO_ASS_STRAssigns a string.
Exactly the same as QCO_ASS_INT except it handles strings. QCO_DROP_BYTEDrops a byte off stack.
QCO_DROP_WORDDrops a word off the stack.
Used internally to drop unwanted results off the stack, for example a statement "GET" which translates into RTF_GET,QCO_DROP_WORD. QCO_DROP_NUMDrops a floating point number off the stack.
Used internally to OPL when, for example, a floating point procedure returns a value that is not required. QCO_DROP_STRDrops a string off the stack.
Used internally to OPL when, for example, a string procedure returns a string that is not required. QCO_INT_TO_NUMConverts an integer into a floating point number.
Used for automatic type conversion. QCO_NUM_TO_INTConverts a floating point number to integer.
Used for automatic type conversion. QCO_END_FIELDSIndicates where the field names end.
Only used internally at the end of an OPEN or CREATE command. QCO_RUN_ASSEMRuns machine code immediately after operator.
Runs the code immediately after the operator as machine code. On return if there are no errors carry must be clear and the B register must be the number of bytes for RTA_PC to jump. If there is an error carry must be set and the B register should contain the number of the error to be reported. This cannot be generated from the editor. INTEGER FUNCTIONSThese functions return integer values. RTF_ADDRReturns the address of a numeric variable.
In the case of arrays ADDR returns the address of the first element which is immediately after the word giving the size of the array. So "PRINT PEEKW(ADDR(A%))" is exactly the same as "PRINT A%" and "PRINT PEEKW(ADDR(A%())) is the same as "PRINT A%(1)". RTF_ASCReturns the ')"; onMouseout="hideddrivetip()"> ASCII value of the first character of the string.
RTF_DAYReturns the current day of the month - in the range 1 to 31.
RTF_DISPDisplays a string, a record or the last string displayed, using cursor keys for viewing and waiting for any other key to exit.
The display used is the same as that used by FIND in the top level. Each field, delimited by a TAB character, is on a different line. There is no limit to the number of fields. RTF_ERRReturns the current error value.
When the language starts running the value of RTB_EROR is zero. If an error is encountered and handled by a TRAP or ONERR the value remains until the next error or a TRAP command. RTF_FINDFinds a string in the current file.
RTF_FREEReturns the amount of free memory.
Calculates the amount of free memory by subtracting ALA_FREE from RTA_SP and then subtracting $100. RTF_GETGet a single character.
If there is a key in the buffer it gets that key first. If no key is received the Organiser will turn itself off after the timeout. RTF_HOURReturns the current hour of the day - in the range 0 to 23.
RTF_IABSDoes an ABS on an integer.
Converts a negative integer to a positive integer. If ABS is used in place of IABS the result would be the same but the function would require two unnecessary type conversions. IABS is significantly faster than ABS. RTF_INTConverts a floating point number to an integer.
Identical to QCO_NUM_TO_INT. RTF_KEYReturns any key in the input buffer. Zero if no key is waiting.
RTF_LENReturns the length of the string.
RTF_LOCLocates one string in another, returns zero if not found.
RTF_MENUGives a menu of options.
The normal input is a string with each menu item delimited by a comma. An item is selected either by a unique first letter or by positioning on that item and pressing the EXE key. If the menu exits by the ON/CLEAR key it returns zero. RTF_MINUTEReturns the current minute of the hour - in the range 0 to 59.
RTF_MONTHReturns the current month of the year - in the range 0 to 11.
RTF_PEEKBPeeks a byte at the given address.
If the address is in the ranges $00-$3F and $282-$400 then it returns zero. These ranges are the processor registers and the custom chip's control addresses. The informed user may access these addresses via machine code. RTF_PEEKWPeeks a word at the given address.
See the comments after RTF_PEEKB. RTF_RECSIZEReturns the size of the current record.
See Records and Fields for more details. RTF_SECONDReturns the current second of the minute - in the range 0 to 59.
RTF_IUSRCalls machine code.
RTF_SADDRReturns the address of a string.
Returns the address of the length byte, the byte after the the maximum length. In the case of an array it returns the address of the length byte of the first element of the array. So "ADDR(A$())-2" is the address of the size the array (a word) and "ADDR(A$())-3" is the address of the maximum string length (a byte). RTF_VIEWView a string, or the last string viewed.
If the string is null it re-displays the last string VIEWed (which is held in RTT_BUF). RTF_YEARReturns the current year - in the range 0 to 99.
RTF_COUNTReturns the number of records in the current file.
RTF_EOFReturns TRUE if the position in the file is at the end of file. If the current record is the last record of the file, EOF returns FALSE.
Returns TRUE if the current record buffer is zero. When OPL appends a record with zero length it adds a TAB ($09) character so that it never actually saves a null string. RTF_EXISTReturns TRUE is the file exists.
RTF_POSReturns the current record number in the current file.
FLOATING POINT FUNCTIONSThese functions return a floating point value. RTF_ABSDoes an ABS on a floating point number.
RTF_ATANReturns the arctangent of the input in radians.
RTF_COSReturns the cosine of the input, the input being in radians.
RTF_DEGConverts the input from radians to degrees.
RTF_EXPReturns the value of e raise to the specified power.
RTF_FLTConverts an integer to floating point format.
Exactly the same effect as QCO_INT_TO_NUM. RTF_INTFRounds a floating point number down to a whole number.
Essential to use INTF rather than INT if the number is out of the integer range. RTF_LNReturns the natural logarithm of the input.
RTF_LOGReturns the base 10 logarithm of the input.
RTF_PIReturns the number pi = 3.14159265359.
RTF_RADConverts the input number to radians. The inverse of DEG.
RTF_RNDReturns a pseudo-random number in the range 0(inclusive) to 1(exclusive).
RTF_SINReturns the sine of the input, the input being in radians.
RTF_SQRReturns the square root of the input.
RTF_TANReturns the tangent of the input, the input being in radians.
RTF_VALReturns the input string as a number.
RTF_SPACEReturns the amount of space on the current device.
STRING FUNCTIONSRTF_DIRReturns the name of the first/next file on a device.
If the string is non-null it checks that it is of the form "A:" or "A". It splits out the device name and returns the first file name preceded by the device name. If the string is null it returns the next file name, on the device already specified. When there are no more file it returns a null string. RTF_CHRConverts the integer input to a one character string.
RTF_DATIMReturns the date-time string in the form: "TUE 04 NOV 1986 10:44:29"
RTF_SERRReturns the error string associated with the integer error number.
RTF_FIXReturns the floating point number as a string with a fixed number of decimal places.
RTF_GENReturns the floating point number as a string. This is the same format as used by QCO_PRINT_NUM.
The format in which the number is displayed is integer, decimal or scientific in that order of precedence. RTF_SGETGet a character and return it as a one character string.
RTF_HEXConverts the integer into a hexadecimal string.
RTF_SKEYReturns any keys in the input buffer as a string. Returns the null string if no key is waiting.
RTF_LEFTReturns the first n characters of the string.
RTF_LOWERConverts the string to lower case.
RTF_MIDReturns the middle of a string.
You can get all the characters after the n'th by the statement: MID$(a$,n,255) RTF_NUMConverts a number to an integer string.
RTF_RIGHTReturns the last n characters of a string.
RTF_REPTRepeats the string n times.
RTF_SCIReturns the floating point number as a string in scientific form.
RTF_UPPERConverts the string to upper case.
RTF_SUSRCalls machine code.
INDEX OF OPERANDS00 QI_INT_SIM_FP 0D QI_LS_INT_SIM_FP 1A QI_INT_FLD 01 QI_NUM_SIM_FP 0E QI_LS_NUM_SIM_FP 1B QI_NUM_FLD 02 QI_STR_SIM_FP 0F QI_LS_STR_SIM_FP 1C QI_STR_FLD 03 QI_INT_ARR_FP 10 QI_LS_INT_ARR_FP 1D QI_LS_INT_FLD 04 QI_NUM_ARR_FP 11 QI_LS_NUM_ARR_FP 1E QI_LS_NUM_FLD 05 QI_STR_ARR_FP 12 QI_LS_STR_ARR_FP 1F QI_LS_STR_FLD 06 QI_NUM_SIM_ABS 13 QI_LS_NUM_SIM_ABS 20 QI_STK_LIT_BYTE 07 QI_INT_SIM_IND 14 QI_LS_INT_SIM_IND 21 QI_STK_LIT_WORD 08 QI_NUM_SIM_IND 15 QI_LS_NUM_SIM_IND 22 QI_INT_CON 09 QI_STR_SIM_IND 16 QI_LS_STR_SIM_IND 23 QI_NUM_CON 0A QI_INT_SIM_IND 17 QI_LS_INT_SIM_IND 24 QI_STR_CON 0B QI_NUM_SIM_IND 18 QI_LS_NUM_SIM_IND 0C QI_STR_SIM_IND 19 QI_LS_STR_SIM_IND INDEX OF OPERATORS25 QCO_SPECIAL 47 QCO_GT_STR 69 QCO_USE 26 QCO_BREAK 48 QCO_GTE_STR 6A QCO_KSTAT 27 QCO_LT_INT 49 QCO_NE_STR 6B QCO_EDIT 28 QCO_LTE_INT 4A QCO_EQ_STR 6C QCO_INPUT_INT 29 QCO_GT_INT 4B QCO_ADD_STR 6D QCO_INPUT_NUM 2A QCO_GTE_INT 4C QCO_AT 6E QCO_INPUT_STR 2B QCO_NE_INT 4D QCO_BEEP 6F QCO_PRINT_INT 2C QCO_EQ_INT 4E QCO_CLS 70 QCO_PRINT_NUM 2D QCO_ADD_INT 4F QCO_CURSOR 71 QCO_PRINT_STR 2E QCO_SUB_INT 50 QCO_ESCAPE 72 QCO_PRINT_SP 2F QCO_MUL_INT 51 QCO_GOTO 73 QCO_PRINT_CR 30 QCO_DIV_INT 52 QCO_OFF 74 QCO_LPRINT_INT 31 QCO_POW_INT 53 QCO_ONERR 75 QCO_LPRINT_NUM 32 QCO_UMIN_INT 54 QCO_PAUSE 76 QCO_LPRINT_STR 33 QCO_NOT_INT 55 QCO_POKEB 77 QCO_LPRINT_SP 34 QCO_AND_INT 56 QCO_POKEW 78 QCO_LPRINT_CR 35 QCO_OR_INT 57 QCO_RAISE 79 QCO_RETURN 36 QCO_LT_NUM 58 QCO_RANDOMIZE 7A QCO_RETURN_NOUGHT 37 QCO_LTE_NUM 59 QCO_STOP 7B QCO_RETURN_ZERO 38 QCO_GT_NUM 5A QCO_TRAP 7C QCO_RETURN_NULL 39 QCO_GTE_NUM 5B QCO_APPEND 7D QCO_PROC 3A QCO_NE_NUM 5C QCO_CLOSE 7E QCO_BRA_FALSE 3B QCO_EQ_NUM 5D QCO_COPY 7F QCO_ASS_INT 3C QCO_ADD_NUM 5E QCO_CREATE 80 QCO_ASS_NUM 3D QCO_SUB_NUM 5F QCO_DELETE 81 QCO_ASS_STR 3E QCO_MUL_NUM 60 QCO_ERASE 82 QCO_DROP_BYTE 3F QCO_DIV_NUM 61 QCO_FIRST 83 QCO_DROP_WORD 40 QCO_POW_NUM 62 QCO_LAST 84 QCO_DROP_NUM 41 QCO_UMIN_NUM 63 QCO_NEXT 85 QCO_DROP_STR 42 QCO_NOT_NUM 64 QCO_BACK 86 QCO_INT_TO_NUM 43 QCO_AND_NUM 65 QCO_OPEN 87 QCO_NUM_TO_INT 44 QCO_OR_NUM 66 QCO_POSITION 88 QCO_END_FIELDS 45 QCO_LT_STR 67 QCO_RENAME 89 QCO_RUN_ASSEM 46 QCO_LTE_STR 68 QCO_UPDATE
INDEX OF FUNCTIONS8A RTF_ADDR A0 RTF_VIEW B6 RTF_SPACE 8B RTF_ASC A1 RTF_YEAR B7 RTF_DIR 8C RTF_DAY A2 RTF_COUNT B8 RTF_CHR 8D RTF_DISP A3 RTF_EOF B9 RTF_DATIM 8E RTF_ERR A4 RTF_EXIST BA RTF_SERR 8F RTF_FIND A5 RTF_POS BB RTF_FIX 90 RTF_FREE A6 RTF_ABS BC RTF_GEN 91 RTF_GET A7 RTF_ATAN BD RTF_SGET 92 RTF_HOUR A8 RTF_COS BE RTF_HEX 93 RTF_IABS A9 RTF_DEG BF RTF_SKEY 94 RTF_INT AA RTF_EXP C0 RTF_LEFT 95 RTF_KEY AB RTF_FLT C1 RTF_LOWER 96 RTF_LEN AC RTF_INTF C2 RTF_MID 97 RTF_LOC AD RTF_LN C3 RTF_NUM 98 RTF_MENU AE RTF_LOG C4 RTF_RIGHT 99 RTF_MINUTE AF RTF_PI C5 RTF_REPT 9A RTF_MONTH B0 RTF_RAD C6 RTF_SCI 9B RTF_PEEKB B1 RTF_RND C7 RTF_UPPER 9C RTF_PEEKW B2 RTF_SIN C8 RTF_SUSR 9D RTF_RECSIZE B3 RTF_SQR C9 RTF_SADDR 9E RTF_SECOND B4 RTF_TAN 9F RTF_IUSR B5 RTF_VAL EXAMPLESIn these examples all values are given in hexadecimal; word values are given as 4 digits, bytes as 2 digits each one separated by a space. If values are undefined they are written as **. EXAMPLE 1Source code: EX1:
LOCAL A$(5)
A$="ABC"
The Q code header is: High memory 0009 size of the variables on stack
000A length of Q code
00 number of parameters
type of parameter
0000 size of global area
global name
global type
offset
0000 size of externals
external name
external type
0003 bytes of string fix-ups
FFF7 string fix-up offset (from FP)
05 max length of string
Low memory 0000 bytes of array fix-ups
array fix-up offset (from FP)
size of array
The Q code is: 0F FFF8 QI_LS_STR_SIM_FP
24 QI_STR_CON
03 41 42 43 "ABC"
81 QCO_ASS_STR
7B QCO_RETURN_ZERO
If this program is run on a CM the stack looks like: Initially Left Side Constant Assign On Return 3EFF '1' '1' '1' '1' '1' 3EFE 'X' 'X' 'X' 'X' 'X' 3EFD 'E' 'E' 'E' 'E' 'E' 3EFC ':' ':' ':' ':' ':' 3EFB 'A' 'A' 'A' 'A' 'A' 3EFA 05 05 05 05 05 3EF9 00 - Top proc 00 00 00 00 3EF8 00 - No. paras 00 00 00 00 3EF6 3EF9 - Return PC 3EF9 3EF9 3EF9 3EF9 3EF4 0000 - ONERR 0000 0000 0000 0000 3EF2 3EDB - BASE SP 3EDB 3EDB 3EDB 3EDB 3EF0 0000 - FP 0000 0000 0000 0000 3EEE 3EEE - Global table 3EEE 3EEE 3EEE 3EEE 3EED 00 00 00 00 00 3EEC 00 00 00 00 00 3EEB 00 00 'C' 'C' 'C' 3EEA 00 00 'B' 'B' 'B' 3EE9 00 00 'A' 'A' 'A' 3EE8 00 00 03 03 03 3EE7 05 05 05 05 05 3EE6 ** ** ** ** ** 3EE5 ** ** ** ** ** 3EE4 QCO_RETURN_ZERO 7B 7B 7B 7B 3EE3 QCO_ASS_STR 81 81 81 81 3EE2 'C' 'C' 'C' 'C' 'C' 3EE1 'B' 'B' 'B' 'B' 'B' 3EE0 'A' 'A' 'A' 'A' 'A' 3EDF 03 03 03 03 03 3EDE QI_STR_CON 24 24 24 24 3EDC FFF8 FFF8 FFF8 FFF8 FFF8 3EDB QI_LS_STR_SIM_FP 0F 0F 0F 0F 3EDA ** 3EE8 3EE8 ** 00 3ED9 ** 05 05 ** 00 3ED8 ** 00 00 ** 00 3ED7 ** ** 'C' ** 00 3ED6 ** ** 'B' ** 00 3ED5 ** ** 'A' ** 00 3ED4 ** ** 03 ** 00 3ED3 ** ** ** ** 00 3ED2 ** ** ** ** 00 FP 3EF0 3 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||