~Editor Assembler Version 4.x~ ~Reference Manual~ Copyright (C) 1984 by MISOSYS, Inc., All rights reserved Reproduction in any manner, electronic, mechanical, magnetic, optical, chemical, manual, or otherwise, without written permission, is prohibited. ~MISOSYS, Inc.~ P. O. Box 239 Sterling, Virginia 22170-0239 703-450-4181 ~* * * N O T I C E * * *~ ~* * * L I M I T E D W A R R A N T Y * * *~ MISOSYS shall have no liability or responsibility to the purchaser or any other person, company, or entity with respect to any liability, loss, or damage caused or alleged to have been caused by this product, including but not limited to any interruption of service, loss of business and anticipatory profits, or consequential damages resulting from the operation or use of this program. Should this program recording or recording media prove to be defective in manufacture, labeling, or packaging, MISOSYS will replace the program upon return of the program package to MISOSYS within 90 days of the date of purchase. Except for this replacement policy, the sale or subsequent use of this program material is without warranty or liability. ~* * * W A R N I N G * * *~ This program package is copyrighted with all rights reserved. The distribution and sale of this program is intended for the personal use of the original purchaser only and for use only on the computer system noted herein. Furthermore, copying, duplicating, selling, or otherwise distributing this product is expressly forbidden. In accepting this product, the purchaser recognizes and accepts this agreement. MISOSYS, Inc. P. O. Box 239 Sterling, Virginia 22170-0239 703-450-4181 ~MISOSYS Editor Assembler Version 4.x~ ~Copyright 1984, by MISOSYS, Inc., All rights reserved~ ~Table of Contents~ Introduction ......................................... 1 -1 Notation Conventions ................................. 1 -2 Invoking EDAS ........................................ 2 -1 Invoking MAS ......................................... 2 -4 Invoking MED ......................................... 2 -4 Assembly Language Syntax ............................. 2 -5 Labels ............................................... 2 -5 Operands ............................................. 2 -6 Comments ............................................. 2 -6 Expressions .......................................... 2 -7 Z-80 Status Indicators (Flags) ....................... 2-12 Pseudo-Ops ........................................... 2-15 Assembler Directives ................................. 2-34 Macro Processor ...................................... 2-39 EDAS Commands ........................................ 2-51 Assemble ........................................ 2-51 Branch .......................................... 2-58 Change .......................................... 2-58 Copy ............................................ 2-60 Delete .......................................... 2-61 Edit ............................................ 2-61 Find ............................................ 2-63 Hardcopy ........................................ 2-63 Insert .......................................... 2-64 Load filespec.................................... 2-65 Move ............................................ 2-66 Renumber ........................................ 2-67 Print ........................................... 2-67 Query DOS ....................................... 2-68 Replace ......................................... 2-69 Switch Case ..................................... 2-69 Type ............................................ 2-70 Usage, Memory ................................... 2-71 View filespec.................................... 2-71 Write filespec................................... 2-72 eXtend .......................................... 2-73 One (1) ......................................... 2-74 Error Messages ....................................... 2-76 Technical Specifications ............................. 2-81 SAID Full Screen Text Editor ......................... 3 -1 Cross Reference Utility .............................. 4 -1 Tape To Disk Utility ................................. 4 -4 ~Seventh Edition - 1986~ ~MISOSYS Editor Assembler Version 4.x~ ~Copyright 1984 MISOSYS, Inc., All rights reserved~ Reference Manual This manual documents both the Model I/III assembler package entitled "EDAS" and the TRSDOS 6 compatible package entitled "PRO-CREATE". The package which you have acquired is denoted by the label affixed to the master diskette. Distribution Disk - Model I/III The Model I/III Editor Assembler Version 4.x and each of its utilities, are single programs that work on both the Model I and III under LDOS 5.x, DOSPLUS 3.5, TRSDOS 2.3, and TRSDOS 1.3. The package includes EDAS/CMD, MED/CMD, MAS/CMD, ADDCTLZ/TXT, XREF/CMD, TTD/CMD, SAID/CMD, and SAIDINS/CMD. It is distributed on a 35 track single density data diskette. Model III TRSDOS 1.3 users will need to use their CONVERT utility and a two-drive system to transfer the files from the master disk to a working system disk. Model I TRSDOS 2.3 users need to first modify their TRSDOS system via a one-byte patch prior to transferring the files from the master disk to a working system disk (see "Model I TRSDOS 2.3 Patch"). The master disk is readable by LDOS and DOSPLUS. Use under DOSPLUS 3.5 requires patches to EDAS, MED, MAS, and SAID! The patch files are DPEDAS/PAT, DPMED/PAT, DPMAS/PAT, and DPSAID/PAT. Distribution Disk - TRSDOS 6.x The TRSDOS 6.x Editor Assembler Version 4.x is distributed on a 40 track double density data diskette. The package includes EDAS/CMD, MED/CMD, MAS/CMD, ADDCTLZ/TXT, XREF/CMD, SAID/CMD, and SAIDINS/CMD. Making BACKUPs It is strongly recommended that before using your new Editor Assembler, you should make a BACKUP copy to use in a working environment and retain the release diskette as your MASTER copy. This "master" should be backed up to produce a "working" copy and the "master" archived. The BACKUP utility procedures are found in your DOS Owner's Manual in the section entitled "UTILITY PROGRAMS". Don't forget that the release diskette does NOT contain a DOS; thus, your BACKUP procedure is for a data diskette. After creating a BACKUP copy of the Editor Assembler diskette, store the MASTER diskette in a safe place. Use only your "working" copy for production. Model I TRSDOS 2.3 Patch Model I TRSDOS users will find difficulty in reading the distribution disk due to the data address mark used for the directory. Therefore, before making a BACKUP or copying EDAS files from the diskette, you will need to change one byte of the TRSDOS 2.3 disk driver using one of the following three methods. This change will not affect the operation of your TRSDOS. ~EDAS Introduction~ 1 - 1 ~MISOSYS Editor Assembler Version 4.x~ ~Copyright 1984 MISOSYS, Inc., All rights reserved~ Method (1) directly modifies the system diskette with a patch. To prepare for this patch, obtain a fresh BACKUP of your TRSDOS 2.3 to use for this operation. Then enter the following BASIC program and RUN it. After you RUN the program, re-BOOT your TRSDOS diskette to correct the byte in memory. 10 OPEN"R",1,"SYS0/SYS.WKIA:0" 20 FIELD 1,171 AS R1$, 1 AS RS$, 84 AS R2$ 30 GET 1,3: LSET RS$="<": PUT 1,3: CLOSE: END Method (2) uses DEBUG to change the byte in memory. Use this if you do not want to patch your TRSDOS system diskette and are familiar with DEBUG. 1. At TRSDOS Ready, type~DEBUG~followed by~. 2. Depress the~~key to enter the DEBUGger. 3. Type~M46B0~followed by the~~bar. 4. Type~3C~followed by~. 5. Type~G402D~followed by~. Method (3) uses a POKE from BASIC to change the value directly in memory. This procedure is as follows: 1. Enter BASIC (files = 0, protect no memory) 2. Type~POKE &H46B0,60~followed by~. 3. Type~CMD"S~followed by~. Now, after using any one of the methods noted above, COPY the EDAS files from the master diskette to your TRSDOS system diskette. The EDAS Facility The MISOSYS Editor Assembler 4.x includes the following files: ADDCTLZ/TXT~- a text file with followed by CTL-Z EDAS/CMD~ - a combined line editor and macro assembler MAS/CMD~ - a stand-alone macro assembler MED/CMD~ - a stand-alone line editor SAID/CMD~ - a stand-alone full-screen text editor SAIDINS/CMD~- SAID installation program TTD/CMD~ - (Model I/III) a source cassette Tape-to-Disk convertor XREF/CMD~ - a symbol cross-reference listing generator The MISOSYS Editor Assembler is a RAM-resident text editor and RAM resident or direct disk assembler. The Editor Assembler was designed to provide the maximum in user interface and ease of use while providing capabilities powerful enough for the expert Z-80 assembly language programmer. The text editing features of the Editor Assembler facilitate the manipulation of alphanumeric text files for both assembler source and compiler source languages. The most common use of the editing capability is in the creation and maintenance of assembly language source programs to be assembled by EDAS. Through full support of upper and lower case text entry, the Editor can serve as a line-oriented text processing tool. ~EDAS Introduction~ 1 - 2 ~MISOSYS Editor Assembler Version 4.x~ ~Copyright 1984 MISOSYS, Inc., All rights reserved~ The assembler portion of the Editor Assembler facilitates the translation of Z-80 symbolic language source code programs into machine executable code. This object code may then be executed directly from the DOS Ready prompt. Although EDAS could be used as an entry-level assembler, the scope of the documentation assumes a previous knowledge of assembler language and the hexadecimal number system. This is not a "learning" manual - it details the use of EDAS Version 4.x but in no way attempts to teach you how to program in the Z-80 assembly language. You should have available a standard reference handbook on the Z-80 code. Many texts are available. It is necessary that all source text to EDAS, MED, or MAS must have a Control-Z (1AH) as the last character of the text. This byte must immediately follow a CARRIAGE RETURN (0DH). If you are using an editor other than MED or SAID to prepare your source text, and that editor does not terminate the text file with a CONTROL-Z, you may have difficulty in using the file with the assembler. If such is the case, you can either (1) APPEND the file named ADDCTLZ/TXT to your file, or (2) load your file into SAID and resave it. Notation Conventions Braces "{}" Braces enclose optional information. The braces are never input in Editor Assembler commands (Note: braces are used in C language source code). Ellipses "..." The ellipses represents repetition of a previous item. Line number "line" "line" represents a number arbitrarily assigned to a statement for the purpose of identifying it to the editor functions. "Line" can be any decimal number ranging from <1 - 65529>. Period "." A period may be used in place of any line number. It represents a pointer to the current line of source code being assembled, printed, or edited. It is termed the "current line pointer" throughout this documentation. Top of Text "#" or "t" The pound sign character,"#", or the letter "t", may be used in place of any line number during a line number reference. It represents the beginning or top of the text buffer. Bottom of Text "*" or "b" ~EDAS Introduction~ 1 - 3 ~MISOSYS Editor Assembler Version 4.x~ ~Copyright 1984 MISOSYS, Inc., All rights reserved~ The asterisk character, "*", or the letter "b", may be used in place of any line number during a line number reference. It represents the bottom of the text buffer. Line Increment "inc" This is a number representing an increment between successive line numbers. Lower Case Entry Lower case is supported freely throughout EDAS for text and command entry. All Editor Assembler commands may be entered in lower case as well as upper case to facilitate its use as a general purpose text editor. Assembler source code can be entered in upper case or lower case. For lower case entry, the Editor must be in the case converted mode (see the witch case command). This mode automatically converts lower case entry to upper case except for text which is between single quotes (enabling lower case string constants) and for all text following a semicolon (permitting lower case comments). ~EDAS Introduction~ 1 - 4 ~MISOSYS Editor Assembler Version 4.x~ ~Copyright 1984 MISOSYS, Inc., All rights reserved~ Invoking EDAS EDAS is a directly executable command file. It is accessed in response to the DOS command prompt simply by entering: _____________________________________________________________ | | | EDAS (ECM,JCL,ABORT,LC,EXT="ext",Pn=val) | | EDAS * | | | | ~ECM~ Is used to specify the Extended Cursor Mode | | for LDOS 5.1. | | | | ~JCL~ is used when running from Job Control Language | | so that EDAS uses the @KEYIN routine for its | | keyboard input. | | | | ~ABORT~ if specified, EDAS will automatically abort | | after an assembly with errors. It will return | | to DOS Ready. | | | | ~LC~ is used when editing LC source files. It will | | set tabs to 4, default extension to "CCC", and | | invoke "lower case permitted". | | | | ~EXT="ext"~ provides a means by which the default source | | file extension can be altered to "ext". | | | | ~Pn=val~ can be used to pass symbol equates to the | | assembler from the command line. "n" can range | | from <1-4> permitting four symbol equates. | | | | ~*~ if specified, will reload EDAS and maintain | | the text buffer pointers. | | | | ~Note: Return to DOS from EDAS via the ranch command. | |_____________________________________________________________| The optional parameters shown in parentheses are used to alter the behavior of EDAS and give it greater flexibility. These options are as follows: ECM The Extended Cursor Mode (ECM) facility of the LDOS keyboard driver permits the differentiation of the UP-ARROW key versus the left bracket "[" to allow the input of both codes. The LDOS user may specify the ECM parameter to use this option on the LDOS KI/DVR. The default is normal KI operation. The ECM parameter is for LDOS users only; not for DOSPLUS or TRSDOS. JCL The JCL parameter is applicable only to LDOS. EDAS uses an internal line input routine to enable the parsing of certain characters. This hinders the ability of commanding EDAS from within the Job Control Language (JCL) of DOS. ~Running EDAS~ 2 - 1 ~MISOSYS Editor Assembler Version 4.x~ ~Copyright 1984 MISOSYS, Inc., All rights reserved~ If you want to control the assembly process from JCL, use the JCL parameter in the EDAS command line. If you are going to nsert text while in a JCL mode, then you must use the "%01" to simulate a in the JCL file. Don't forget, the "%01" can only be used if you are going to compile the JCL. For example, the following enters EDAS and inserts one line: edas (jcl) i This is a test %01 //stop ABORT This parameter will cause EDAS to abort and return to DOS upon an as- sembly or disk error, or one of the following errors: no text in buffer, line number too large, bad parameters, buffer full, no such line, *GET or *SEARCH error, *SEARCH file not a PaDS, PaDS member error. It is useful when running from a Job Control Language to inhibit erroneous jobs from continuing. LC This parameter is used when you are editing LC source files (C lang- uage). It will do three things for you: (1) change the source file default extension from "ASM" to "CCC" - "CCC" is used in the LC compiler, (2) change the tab stops from every eight columns to every four columns - more reason- able for LC source code, (3) invoke the witch case command to "lower case permitted" as LC source code is entered primarily in lower case. EXT="ext" The "EXT=ext" parameter is valid only for LDOS/TRSDOS 6 users. This parameter is available for those using the EDAS editor to edit and maintain files other than EDAS assembler source files. For instance, the M-80 assem- bler uses "MAC" as the standard extension. FORTRAN uses "FOR". You may be using EDAS to create or edit JCL files. Use this parameter to change the de- fault source file extension (that used with the oad and rite commands) to one of your choice. You must enter a full three characters if you use this parameter. For example: EDAS (EXT="MAC") specifies that "MAC" be used as the default extension (make sure the supplied extension is entered in UPPER CASE). Note that the override of "CCC" if the LC parameter is used takes pre- cedence. If LC is specified, the EXT= parameter is ignored. Pn=val This parameter provides the power of entering symbol table equates di- rectly from the EDAS command line. "Pn" is actually four parameters as "n" can range from <1-4>. Thus, you specify the parameter as either P1, P2, P3, or P4. These parameters are EDAS entry symbol table additions. By passing parameter values with these on the EDAS command line, you can alter four ~Running EDAS~ 2 - 2 ~MISOSYS Editor Assembler Version 4.x~ ~Copyright 1984 MISOSYS, Inc., All rights reserved~ symbol table entries. Thus, you can use these to control EQUate options, pass values to symbols, etc. The format usable is: _____________________________________________________________ | | | Pn sets @@n to TRUE. | | | | Pn=ddd sets @@n to decimal value ddd. | | | | Pn=X'hhhh' sets @@n to hexadecimal value hhhh. | |_____________________________________________________________| TRSDOS 1.3 users need to enter parameter values in the following hexadecimal format: 0xxxx, where "x" stands for a hexadecimal digit 0-9, A-F. The actual labels added to the symbol table as DEFLs are "@@n", where "n" is the same as the "n" of "Pn". This is depicted as follows: _____________________________________________________________ | | | P1 == @@1 P2 == @@2 P3 == @@3 P4 == @@4 | |_____________________________________________________________| The four symbols initially have a value of zero (logical FALSE). You can use these to externally set flags for use in conditional assembly (or what- ever else your heart desires). For example, say you have a program that uses two conditional symbols, MOD1 and MOD3. If your program has the statements: MOD1 EQU @@1 MOD3 EQU @@3 then an EDAS command line of ~EDAS (P1)~ will set "@@1" to TRUE and "@@3" defaults to FALSE. "MOD1" would be TRUE and "MOD3" would be FALSE since the two conditional symbols you are using are equated to the "@@n" parameters. You will find this parameter support a great feature when running EDAS from JCL. EDAS * The "EDAS *" is used to re-enter EDAS keeping the source program and variables intact. This permits you to recover after a re-boot providing the Editor Assembler region is not disturbed or in case you inadvertantly entered the ranch command without saving your source file. Remember to hold the key depressed during the RESET operation if your SYSTEM diskette contains an AUTO function. EDAS Command Mode Once "EDAS" is entered, the following message will appear on the video display screen: MISOSYS EDAS-n.n ~Running EDAS~ 2 - 3 ~MISOSYS Editor Assembler Version 4.x~ ~Copyright 1984 MISOSYS, Inc., All rights reserved~ The "n.n" is indicative of the current version number. This display is fol- lowed by a right caret ">" prompt. The prompting character is displayed whenever EDAS is ready to accept a command. Invoking MAS MAS can assemble a disk file directly from disk. Its syntax is: ________________________________________________________________ | | | MAS source/ASM [+L=listing/PRN +O=object/CMD +X=reference/REF | | +S=symbol/SYM +I=include/ASM ] [assembler switches] | | [(p1=value1,p2=value2,p3=value3,p4=value4,LINES=n)] | | | |~+L=listing/PRN~ - send listing to spec in lieu of *DO. | | Use -LP for printer (or +L=*PR if DOS | | supported). Will inhibit -NL and -LP. | | | |~+O=object/CMD~ - send object to spec in lieu of "source/CMD".| | Will inhibit -NO. | | | |~+X=reference/REF~- send cross reference data to spec in lieu | | of "source/REF" if -XR switch invoked. | | Will invoke -XR. | | | |~+S=symbol/SYM~ - send symbol table to spec in lieu of *DO or | | *PR depending on setting of -WS and -LP | | switches. Will invoke -WS. | | | |~+I=include/ASM~ - use spec for "*INCLUDE" assembler directive | | which is similar to "*GET". | | | | Assembler switches: | | -NL -WO -LP -WS -WE -NE -XR -NC -NM -CI -NH -SL -MF -NO | | | | Parms: | |~P1-P4~ - as in manual. | |~LINES=n~ - set printed lines per page to n (abbrev=L). | |________________________________________________________________| MAS is essentially the assembler portion of EDAS. It should react from the DOS command line just like the EDAS assembler would react from the EDAS command line. The DOS command line file redirection options permit you to easily control the routing of the various outputs. See the section on EDAS for the use of the Parameters (P1-P4). The Assembler Switches operate accor- ding to the documentation covering the "assemble" command. Invoking MED MED is the line editor portion of EDAS. It supports all EDAS commands except for the "A" command. It is invoked with the same syntax as EDAS; how- ever, it does not support the "Pn" parameters. ~Running EDAS~ 2 - 4 ~MISOSYS Editor Assembler Version 4.x~ ~Copyright 1984 MISOSYS, Inc., All rights reserved~ Syntax The basic format of an assembly language statement consists of up to four fields of information. These fields, in order, are: _____________________________________________________________ | | | {LABEL} {OPCODE} {OPERAND{S}} {;COMMENT} | | | | ~LABEL~ is a symbolic name assigned the address value | | of the first byte of the object instruction. | | | | ~OPCODE~ is the mnemonic of a specific Z-80 assembler | | instruction or pseudo-OPeration code. | | | | ~OPERANDS~ are arguments of the OPCODE. | | | | ~;COMMENT~ is an informative notation that is ignored by | | the assembler but aids in documenting the | | source code. | |_____________________________________________________________| As can be noted, none of the fields are required; however, each line should contain at least one field. If you want the comment field to occupy the entire line, start the line with a semi-colon in the first character position of the line - then, no other field is needed. A symbolic label can exist by itself on a line. There are some Z-80 operation codes that have no arguments; thus, an OPCODE could exist by itself on a line (in field 2). You will never have an argument by itself as an argument relates to an OPCODE. The statement line is considered to be freely formatted; meaning there are no columnar restrictions. Fields are separated by one or more tabs or spaces. If a tab is used, it makes for neater listings. Tabs are retained as tabs and thus will keep source files smaller than using multiple spaces. Symbolic Labels A label is the symbolic name of a line of code. Labels are always optional. A label is a string of no greater than 15 characters. The first character must be a letter (A-Z) or one of the special characters, "$", "_", and "@". A label may contain within character positions 2-15, letters (A-Z), decimal digits (0-9), or certain special characters: "@", "_", "?", or "$". The "$" appearing by itself is reserved for the value of the program counter of the current instruction. It cannot be used as a single character symbol. A symbol appearing by itself in the LABEL field of a line, will be interpreted as being equated to the current value of the program counter. Certain labels are reserved by the assembler for use in referring to registers. Others are reserved for branching conditions (condition codes) and may not be used for labels. (these conditions apply to status flags). The following labels are reserved and may not be used for other purposes: ~INFO - Syntax~ 2 - 5 ~MISOSYS Editor Assembler Version 4.x~ ~Copyright 1984 MISOSYS, Inc., All rights reserved~ _____________________________________________________________ | Reserved Labels | | | | A, B, C, D, E, H, L, I, R, IX, IY, SP, AF, BC, DE, HL | | C, NC, Z, NZ, M, P, PE, PO, ON, OFF | |_____________________________________________________________| Opcodes The OPCODES for the Editor Assembler Version 4.x correspond to those in the Z-80-ASSEMBLY LANGUAGE PROGRAMMING MANUAL, 3.0 D.S., REL 2.1, FEB 1977. Operands Operands are always one or two values separated by commas. Some instructions may have no operands at all. A value in parentheses "()" specifies indirect addressing when used with registers, or "contents of" otherwise. Constants are data declarations of fixed value. They are constructed as a sequence of one or more digits and an optional radix specification character. The digits must be valid for the radix used. The following table denotes aceptable constant composition: _____________________________________________________________ | | | ~Data Type~ ~Radix Char Digits~ ~Examples~ | | | | hexadecimal H <0-9,A-F> 1AH, 0ABH, 0FFH | | decimal D <0-9> 107D, 107, 15384 | | octal O or Q <0-7> 166Q, 166O | | binary B <0-1> 01101110B | | | | Note: Decimal is assumed if the radix character is omitted | |_____________________________________________________________| A constant not followed by one of the radix characters is assumed to be decimal. A constant must begin with a decimal digit. Thus "FFH" is not permitted, while "0FFH" is valid. Operands may also be constructed as complicated expressions using the mathematical and logical operators. Due to the extent of the documentation, they are described in the section on "Expressions". Comments All comments must begin with a semicolon ";". If a source statement line starts with a semicolon in the first character position of the line, the entire line is a comment. If EDAS is in the lower case converted mode, comments will be retained in whatever case they are entered. It is suggested that comments be entered in lower case with punctuation as required. It will make your source code listings much easier to read. All entry of text following a semi-colon is maintained in its entered case. ~INFO - Syntax~ 2 - 6 ~MISOSYS Editor Assembler Version 4.x~ ~Copyright 1984 MISOSYS, Inc., All rights reserved~ Expressions A value of an operand may be an expression consisting of multiple terms (labels and data constants) connected with mathematical operators. These expressions are evaluated in strictly LEFT to RIGHT order. No parentheses are allowed. EDAS does not support operator precedence. Most operators are binary, which means that they require two arguments. Both "+" and "-" have unary uses also. The following operators are supported: _____________________________________________________________ | | | Operator Function Example | | | | + Addition value1 + value2 | | - Subtraction value1 - value2 | | * Multiplication value1 * value2 | | / Division value1 / value2 | | .MOD. Modulo Division value1 .MOD. value2 | | < Shift Left or Right value1 < -value2 | | .AND. or & Logical Bitwise AND value1 .AND. value2 | | .OR. or ! Logical Bitwise OR value1 .OR. value2 | | .XOR. Logical Exclusive OR value1 .XOR. value2 | | .NOT. Logical 1's Complement FALSE EQU .NOT. TRUE | | .NE. Logical Binary Not Equal value1 .NE. value2 | | .EQ. Logical Binary Equal value1 .EQ. value2 | | .GE. greater than or equal to value1 .GE. value2 | | .GT. greater than value1 .GT. value2 | | .LE. less than or equal to value1 .LE. value2 | | .LT. less than value1 .LT. value2 | | .SHL. shift value1 left value1 .SHL. value2 | | .SHR. shift value1 right value1 .SHR. value2 | | .HIGH. obtain high order byte .HIGH.value | | .LOW. obtain low order byte .LOW.value | | % Length of MACRO %#LABEL or %% | | %& MACRO label concatenation #NAME%&L | |_____________________________________________________________| Addition (+) The addition operator will add two constants and/or symbolic values. When used as a unary operator, it simply echoes the value. 001E CON30 EQU 30 0010 CON16 EQU +10H 0003 CON3 EQU 3 002E A2 EQU CON30+CON16 ~INFO - Expressions~ 2 - 7 ~MISOSYS Editor Assembler Version 4.x~ ~Copyright 1984 MISOSYS, Inc., All rights reserved~ Subtraction (-) The minus operator will subtract two constants and/or symbolic values. Unary minus produces a 2's complement. 000E A2 EQU CON30-CON16 FFF2 A4 EQU -A2 Multiplication (*) The multiplication operator will perform an integer multiplication of a 16-bit multiplicand by an 16-bit multiplier. Overflow of the resulting 16-bit value is not flagged as an error. 01E0 A5 EQU CON30*CON16 BF20 A6 EQU 60000*3 ;this overflows Division (/) The division operator will perform an integer division of a 16-bit dividend by an 8-bit divisor. 0002 A7 EQU 5/2 1B4D A8 EQU 48928/7 Modulo (.MOD.) The modulo operator calculates the remainder of the above integer division. 0001 A9 EQU 5.MOD.2 0005 A10 EQU 48928.MOD.7 Shift (<) This operator can be used to shift a value left or right. The form is: _____________________________________________________________ | | | VALUE < {-}AMOUNT | |_____________________________________________________________| If AMOUNT is positive, VALUE is shifted left. If AMOUNT is negative, VALUE is shifted right. The magnitude of the shift is determined from the numeric value of AMOUNT. 0057 HIORD EQU 5739H<-8 C000 A1 EQU 3C00H<4 03C0 A2 EQU 3C00H<-4 BBFF A3 EQU 3CBBH<8+255 03C0 A3 EQU 15+3C00H<-4 ~INFO - Expressions~ 2 - 8 ~MISOSYS Editor Assembler Version 4.x~ ~Copyright 1984 MISOSYS, Inc., All rights reserved~ Logical AND (.AND. or &) The logical AND operator bitwise ANDS two constants and/or symbolic values. Each bit position of the 16-bit resultant value is a "1" only if both arguments have a "1" in the corresponding position, or a "0" if either argument has a "0". 3C00 A1 EQU 3C00H&0FFH 0000 A2 EQU 0&15 0000 A3 EQU 0AAAAH.AND.5555H Logical OR (.OR. or !) The logical OR operator bitwise "ORS" two constants and/or symbolic values. Each bit position of the 16-bit resultant value is a "1" if either argument has a "1" in the corresponding position, or a "0" if neither argument has a "1". 3CFF A1 EQU 3C00H!0FFH 000F A2 EQU 0.OR.15 FFFF A3 EQU 0AAAAH.OR.5555H Logical XOR (.XOR.) The logical XOR operator performs a bitwise exclusive OR on two constants and/or symbolic values. Each bit position of the 16-bit resultant value is a "1" only if both arguments have reversed bits in the corresponding position (i.e. one must have a "1" while the other must have a "0"). The XOR operation is considered a modulo two addition. 3CF8 A1 EQU 3C07H.XOR.0FFH 0007 A2 EQU 8.XOR.15 FFFF A3 EQU 0AAAAH.XOR.5555H Logical NOT (.NOT.) This is a unary operator. It performs a one's complement on the term it precedes. Observe the following examples: FFFE T1 EQU .NOT.1 FFFF T2 EQU .NOT.0 0000 T3 EQU .NOT.-1 ~INFO - Expressions~ 2 - 9 ~MISOSYS Editor Assembler Version 4.x~ ~Copyright 1984 MISOSYS, Inc., All rights reserved~ Logical NOT-EQUAL (.NE.) This operator is a binary operator that compares two adjacent terms. The resultant value is TRUE if the terms are not equal. A FALSE result is returned if the two terms are equal. Observe the following examples: 0000 T1 EQU 1000.NE.1000 FFFF T2 EQU 1000.NE.10 FFFF T3 EQU 1.NE.-1 0000 T4 EQU .NOT.0.NE.-1 Logical EQUAL (.EQ.) This operator is a binary operator that compares two adjacent terms. The resultant value is TRUE if the terms are equal. A FALSE result is returned if the two terms are not equal. Observe the following examples: FFFF T1 EQU 1000.EQ.1000 0000 T2 EQU 1000.EQ.10 0000 T3 EQU 1.EQ.-1 FFFF T4 EQU .NOT.0.EQ.-1 Logical GREATER-THAN-OR-EQUAL-TO (.GE.) This is a binary operator that compares two adjacent terms. The resultant value is TRUE if the left term is >= the right term. 0000 T1 EQU 1.GE.2 FFFF T2 EQU 2.GE.2 Logical GREATER-THAN (.GT.) This is a binary operator that compares two adjacent terms. The resultant value is TRUE if the left term is > the right term. 0000 T1 EQU 1.GT.2 0000 T2 EQU 2.GT.2 Logical LESS-THAN-OR-EQUAL-TO (.LE.) This is a binary operator that compares two adjacent terms. The resultant value is TRUE if the left term is <= the right term. FFFF T1 EQU 1.LE.2 FFFF T2 EQU 2.LE.2 ~INFO - Expressions~ 2 - 10 ~MISOSYS Editor Assembler Version 4.x~ ~Copyright 1984 MISOSYS, Inc., All rights reserved~ Logical LESS-THAN (.LT.) This is a binary operator that compares two adjacent terms. The resultant value is TRUE if the left term is < the right term. FFFF T1 EQU 1.LT.2 0000 T2 EQU 2.LT.2 Logical SHIFT LEFT (.SHL.) This is a binary operator that shifts the left term a number of bits left according to the right term. It is the same as "value1 expression2. | | | | ~IFGT$~ Logically TRUE if string1 > string2. | | | | ~IFNE~ Logically TRUE if expression1 <> expression2. | | | | ~IFNE$~ Logically TRUE if string1 <> string2. | | | | ~IFDEF~ Logically TRUE if "label" has been defined prior to | | this statement, else FALSE. | | | | ~IFNDEF~Logically TRUE if "label" has not been defined prior | | to the statement, else FALSE. | | | | ~IFREF~ Logically TRUE if "label" has been referenced but not | | defined prior to the statement, else FALSE. | | | | ~ELSE~ Alternate clause to be assembled if the prior clause | | has evaluated FALSE. | | | | ~ENDIF~ Signifies the end of a conditional clause. | | | | Note: "IFxx$" denotes alternate macro string comparison. | |________________________________________________________________| ~Pseudo-OPs - General~ 2 - 16 ~MISOSYS Editor Assembler Version 4.x~ ~Copyright 1984 MISOSYS, Inc., All rights reserved~ ________________________________________________________________ | ~Miscellaneous~ | | | | ~COM~ Generates an object code file comment record. | | | | ~ENDM~ Designates the end of a MACRO model. | | | | ~ERR~ Forces an assembly error. | | | | ~EXITM~ Can be used to prematurely exit from a MACRO expansion.| | This is normally used within a conditional. [**] | | | | ~IRP~ The statements within IRP-ENDM are repeated for as | | many items are in the argument list with "dummy" being | | replaced by each argument in turn. [**] | | | | ~IRPC~ The statements within IRPC-ENDM are repeated for each | | character in the character-list while the "identifier" | | is replaced, in turn, from the identifier list. [**] | | | | ~MACRO~ Designates the prototype of a MACRO model. | | | | ~OPTION~This permits the altering of any of the permissable | | assembler switches from within the source code. | | | | ~PAGE~ Transmits a form feed during a listing. | | | | ~REF~ Forces a reference to the symbols identified in the | | argument list. | | | | ~REPT~ The statements within REPT-ENDM are repeated according | | to the result of "expression". [**] | | | | ~SPACE~ Generates extra line feeds during a listing. | | | | ~SUBTTL~Invokes a heading sub-title for listings. | | | | ~TITLE~ Invokes a heading title for listings. | | | | [**] Details are in the section on USING MACROS | |________________________________________________________________| ~Pseudo-OPs - General~ 2 - 17 ~MISOSYS Editor Assembler Version 4.x~ ~Copyright 1984 MISOSYS, Inc., All rights reserved~ Pseudo-OP DB The "DB" pseudo-OP is used to define a data byte or series of bytes. Its syntax is: _____________________________________________________________ | | | DB n{,n}{,'c'}{,s}{,expression} | | | | ~n~ Defines the contents of a byte at the current | | reference counter to be "n". | | | | ~'c'~ Defines the content of one byte of memory to | | be the ASCII representation of character "c". | | | | ~'s'~ Defines the contents of n bytes of memory to | | be the ASCII representation of string "s", | | where "n" is the length of "s". | | | | ~expression~ Is a mathematical expression which evaluates | | to a number in the range <0-255>. | |_____________________________________________________________| The constant declaration "DB" permits the concatenation of its data arguments using the comma "," as an argument separator. Data values are denoted according to the specifications in the chapter on ASSEMBLY LANGUAGE INFORMATION. The pseudo-OPs DM, DEFB, and DEFM can be used in lieu of "DB" and are completly equivalent. "DB" string arguments permit two connected single-quotes to indicate a single-quote value PROVIDED that two or more characters precede the 2-quote appearance in the string. For example: DB 'AB''C' will produce the character string: 41 42 27 43. This may have been coded as a complex declaration such as, "'AB',27H,'C'", but the extensive declaration support in EDAS provides the easier specification. The following are valid declaration statements: DB 'This',' ','is',' ','a',' ','test' DB 1,2,'buckle your shoe',3,4,'close the door' DB 'This is a tes','t'!80H The hexadecimal expansions of the constant will appear in listings as rows of eight bytes per row. The expansions may be suppressed from your listings by using the assembler switch, -NE. ~Pseudo-OPs - Data Declarations~ 2 - 18 ~MISOSYS Editor Assembler Version 4.x~ ~Copyright 1984 MISOSYS, Inc., All rights reserved~ Pseudo-OP DC This pseudo-OP defines a repetitive constant. Its syntax is: _____________________________________________________________ | | | DC quantity,value | | | | ~quantity~ Specifies how many times that "value" is to be | | repeated as a data byte. It can be defined as | | any other data definition: n, expression, 'c'. | | | | ~value~ Is the constant to be repeated. As in a "DB" | | data declaration, the value can be specified | | as a character, 'c', a numeric value, n, or an | | expression evaluated to a number in the | | range <0-255>. | |_____________________________________________________________| The pseudo-OP, "DC", will define a repetitive constant and eliminate the necessity of defining a series of identical data values by long DB specifications. For example, the following two statements are equivalent: DB 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 DC 16,0 The latter is much shorter, easier to enter as text, more readable, and takes up less space in its source form. The "quantity" must range from 1 to 65535 (a zero value will result in 65536). The "value" must be less than 256. With this pseudo-OP, you can generate repetitions of a single constant. For example, say you want to set 100 storage locations to a zero value during the assembly. Insert the statement, DC 100,0 and it will be done. A character constant can also be used for "value" as illustrated in the following example: DC 256,'A' which will set the next 256 storage locations to the letter, "A". The expansions of the constant will appear in listings just as they do in the DB expansion. The expansions may be suppressed from your listings by using the assembler switch, -NE. ~Pseudo-OPs - Data Declarations~ 2 - 19 ~MISOSYS Editor Assembler Version 4.x~ ~Copyright 1984 MISOSYS, Inc., All rights reserved~ Pseudo-OP DS This pseudo-OP is used to reserve a quantity of storage locations for use by your program. Its syntax is: _____________________________________________________________ | | | DS nn | | | | ~nn~ Reserves "nn" bytes of memory starting at the | | current value of the reference counter. | |_____________________________________________________________| The DS pseudo-OP can also be entered as "DEFS". The quantity, "nn", can be a data value or an expression. Note that "DS" does not define data values. The "DS" pseudo-OP adds the quantity of storage locations reserved to the current program counter (PC) to calculate a new PC value. When generating an object code file, this action will cause the next assembled byte to create a new load record. The following examples depict various "DS" declarations. The statement, FCB DS 32 will define a 32-byte region for later use as a File Control Block. Its origin can then be referenced as "FCB". The statement, TABLE DS TABLE_LENGTH * TABLE_WIDTH will reserve a quantity of storage locations equal to the result of multiplying the two terms, TABLE_LENGTH and TABLE_WIDTH. If your source code is being assembled with the "-CI" switch, EDAS automatically converts all "DS" declarations into equivalent "DC" declarations using a value equal to zero. The above two examples would therefore be translated to the following: FCB DC 32,0 TABLE DC TABLE_LENGTH * TABLE_WIDTH,0 ~Pseudo-OPs - Data Declarations~ 2 - 20 ~MISOSYS Editor Assembler Version 4.x~ ~Copyright 1984 MISOSYS, Inc., All rights reserved~ Pseudo-OP DW This declaration specifies a 16-bit data value. Its syntax is: _____________________________________________________________ | | | DW nn{,'cc'}{,nn} | | | | ~nn~ Defines the contents of a 2-byte word to be | | the value, "nn". | | | | ~'cc'~ Defines the contents of a 2-byte word to be | | the characters, 'cc' | |_____________________________________________________________| The DW pseudo-OP can also be entered as "DEFW". In the expansion of the data word, its least significant byte is located at the current program reference counter while the most significant byte is located at the reference counter plus one. The data word can be a numeric constant, an expression that evaluates to a 16-bit value, or a character constant of one or two characters. The following examples illustrate various forms of "DW" data declarations. DW 10000,1000,100,10,1 DW 'ab' DW 'R','o','y' Note that if a single character is defined as a character constant word, the low-order byte of the word will contain the character value and the high-order byte of the word will be set to zero. Pseudo-OP DATE The DATE pseudo-OP is used to assemble the system date as an 8-character string, MM/DD/YY. It's syntax is: _____________________________________________________________ | | | DATE | |_____________________________________________________________| This actual date is established when you power up your computer and respond to the DOS's date entry query or by using the DOS's DATE library command. The date string can be useful to place an ASCII date stamp in your object program for the purpose of identification as to when it was assembled. See example 1 for an illustration of DATE. ~Pseudo-OPs - Data Declarations~ 2 - 21 ~MISOSYS Editor Assembler Version 4.x~ ~Copyright 1984 MISOSYS, Inc., All rights reserved~ Pseudo-OP DSYM DSYM is usually used within a macro to assemble the "symbol" argument as if it were a DB character string. It's syntax is: _____________________________________________________________ | | | label DSYM symbol | | | | ~label~ An optional statement label. | | | | ~symbol~ A defined symbol. | |_____________________________________________________________| When used in a macro environment, "symbol" will have the "#" indicator prefixed to designate the symbol as a macro dummy argument name. An alternative method is to use the ampersand escape function within a standard quoted character string such as "DB '&#symbol'" which also assembles to the same thing in a macro. See example 1 for an illustration of DSYM. Pseudo-OP DX expression DX assembles "expression" as a 4-hexadecimal digit character string. Its syntax is: _____________________________________________________________ | | | label DX expression | | | | ~label~ An optional statement label. | | | | ~expression~ An expression operand. | |_____________________________________________________________| The expression can be a simple symbol or a complicated collection of terms. The expression is evaluated to a 16-bit value and output as four hexadecimal digits. See example 1 for an illustration of DX. PSEUDO-OP TIME The TIME pseudo is used to assemble the system time as an 8-character string, HH:MM:SS. It's syntax is: _____________________________________________________________ | | | TIME | |_____________________________________________________________| This actual time is established when you power up your computer and respond to the DOS's time entry query or by using the DOS's TIME library command. The TIME string can be useful to place an ASCII TIME stamp in your object program for the purpose of identification as to when it was assembled. See example 1 for an illustration of TIME. ~Pseudo-OPs - Data Declarations~ 2 - 22 ~MISOSYS Editor Assembler Version 4.x~ ~Copyright 1984 MISOSYS, Inc., All rights reserved~ ~Example 1~ 3000 00001 ORG 3000H 3000 00002 LBLNAM MACRO #SYM 3000 00003 DSYM #SYM 3000 00004 DX #SYM 3000 00005 ENDM 3000 00006 ENTRY BEGIN 3000 210730 00007 BEGIN LD HL,MSG$ 3003 3E0A 00008 LD A,10 3005 EF 00009 RST 40 3006 C9 00010 RET 3007 00011 MSG$ LBLNAM BEGIN 3007+42 00012 DSYM BEGIN 45 47 49 4E 300C+33 00013 DX BEGIN 30 30 30 3010 0D 00014 DB 13 3011 31 00015 DATE 32 2F 33 31 2F 38 34 3019 30 00016 TIME 39 3A 31 31 3A 33 36 0000 00017 END ~Pseudo-OPs - Data Declarations~ 2 - 23 ~MISOSYS Editor Assembler Version 4.x~ ~Copyright 1984 MISOSYS, Inc., All rights reserved~ Pseudo-OP DEFL The "DEFL" pseudo-OP assigns a value to a label. The value is permitted to be changed during the assembly. The "DEFL" syntax is: _____________________________________________________________ | | | label DEFL nn | | label DEFL expression | | | | ~nn~ Sets the value of "label" to the quantity "nn" | | | | ~expression~ Sets the value of "label" to the evaluated | | result of "expression". | |_____________________________________________________________| This declaration is similar to the "EQU" declaration except that the label value is permitted to change during the course of the assembly without producing phase errors (which are generally observed as numerous MULTIPLY DEFINED SYMBOL errors). If the value of "label" is declared by a "DEFL", the declaration can be repeated in the program with different values for the same label. One useful purpose to support this method of coding would be to simulate the maintenance of two program reference counters. Observe the fol- lowing sequence of code: ... some code PROG$ DEFL $ ; Save current program counter ORG DATA$ ; Set PC to data counter MSG1 DB 'This is a test message',CR DATA$ DEFL $ ; Save current data counter ORG PROG$ ; Reset PC to program counter ... more code PROG$ DEFL $ ; Save current program counter ORG DATA$ ; Now set PC to the data counter MSG2 DB 'Another message',LF,CR DATA$ DEFL $ ; Save new current data counter ORG PROG$ ; then re-establish PC ... continuation of program code The program maintains two address counters. One is utilized as a counter to keep track of the code portion of the program (PROG$), while the other is used to keep track of the data portion of the program (DATA$). This technique can be used to keep the data fields associated with routines in close prox- imity to their associated routine in the source code, while the object code location of the data is collected into some other region. Labels defined as "DEFL" will be carried as "DEFL" in the EQUate file generation of the Cross-Reference utility. They will also be notated in the cross-reference listing by a plus sign, "+", prefix to the label name. ~Pseudo-OPs - Origins and Values~ 2 - 24 ~MISOSYS Editor Assembler Version 4.x~ ~Copyright 1984 MISOSYS, Inc., All rights reserved~ Pseudo-OP END The "END" pseudo is used to denote the exit of a *GET or *SEARCH pro- cess, or when used in the memory text buffer, it will denote the end of the source code. Its syntax is: _____________________________________________________________ | | | END {expression} | | END {label} | | | | Signifies the end of the source program (see | | text for handling during *GET and *SEARCH). | | | | ~expression~ Specifies an execution transfer address branch | | that will be used by the system loader. | | | | ~label~ Specifies an execution transfer address branch | | to be the value of "label". | |_____________________________________________________________| The "END" statement is used to indicate to the assembler, when the last source code statement is reached so that any following statements are ignor- ed. If no "END" statement is found, a warning is produced. The END statement can specify a transfer address (i.e. END LABEL or END 6000H). The transfer address is used by the DOS program execution to transfer control to the ad- dress specified in the END statement. Note that the END statement cannot have a label in the label field of the statement). If an "END" statement is detected in a file read via *GET, the "END" is treated as if the end-of-file was reached and EDAS will switch back to as- semble from what ever invoked the *GET. A similar process takes place with *SEARCH, except that EDAS continues the normal searching process. PSEUDO-OP ENTRY The ENTRY pseudo-OP is used to establish the object program's entry point when invoked as a CMD program. Its syntax is: _____________________________________________________________ | | | ENTRY expression | | | | ~expression~ Specifies an execution transfer address branch | | that will be used by the system loader. | |_____________________________________________________________| ENTRY uses the result of "expression" as the transfer address. The use of ENTRY will override any expression argument on the END statement. ~Pseudo-OPs - Origins and Values~ 2 - 25 ~MISOSYS Editor Assembler Version 4.x~ ~Copyright 1984 MISOSYS, Inc., All rights reserved~ Pseudo-OP EQU This pseudo-OP assigns a constant value to a label. Its syntax is: _____________________________________________________________ | | | label EQU nn | | label EQU expression | | | | ~nn~ Sets the value of label to nn. | | | | ~expression~ Sets the value of label to the calculated | | value of "expression" | |_____________________________________________________________| The "EQU" (equate) pseudo-OP is the generally accepted way to define constant values for use in your program. This declaration serves a different purpose than the the data declarations such as DB, DC, and DW. Data declara- tions specify storage locations that contain the values declared. The "EQU" assigns the value to the label; thus, anywhere the label is used, the as- signed value is utilized. Your programs will be more readable, and easier to maintain if the values need to be altered in a program revision. An "EQU" can occur only once for any label. A multiple "EQU" with dif- ferent values will result in the MULTIPLY DEFINED SYMBOL error. Pseudo-OP LORG The "LORG" pseudo-OP is used to establish an object code file (or part of one) that loads at an address different from where it will execute. The syntax of "LORG" is: _____________________________________________________________ | | | LORG nn | | LORG expression | | | | ~nn~ Is the address to start loading the object | | file (or part of the file). | | | | ~expression~ When evaluated, "expression" will be treated | | the same as "nn". | |_____________________________________________________________| A load-origin assembler directive, "LORG", is provided to cause the load addresses of the object file to be based on the LORG operand while the exe- cution code address references will still be based on the "ORG" operand. This is useful to construct a module (or part of a module) that will load at an address different from its execution address. For example: ORG 5200H LORG 7000H will assemble code so that absolute address references and the execution ad- ~Pseudo-OPs - Origins and Values~ 2 - 26 ~MISOSYS Editor Assembler Version 4.x~ ~Copyright 1984 MISOSYS, Inc., All rights reserved~ dresses are referenced from X'5200'; however, the object code file will start loading at X'7000'. Any subsequent "ORG" will maintain the offset difference established at the previous "ORG" until another "LORG" is detected. If you want to switch off the offsetting operation of LORG, add the statement LORG $ to follow the last statement of the offset block of code. The assembler will specifically test for the case, LORG $, so that it forces a new load block where one is required. Pseudo-OP ORG The "ORG" pseudo-OP is used to establish an address for the program counter so that the absolute address references within a program are desig- nated. The syntax of "ORG" is: _____________________________________________________________ | | | ORG nn | | ORG expression | | | | ~nn~ Sets the address reference counter to the | | value "nn". | | | | ~expression~ When evaluated, "expression" will be treated | | the same as "nn". Terms of "expression" must | | be defined prior to the "ORG" statement. | |_____________________________________________________________| The "ORG" statement is used to tell the assembler at what address to begin generating the object code for statements which follow. The assembler will generate object code starting at the address specified by "nn" or "expression", automatically advancing the program counter by the length of each instruction or data declaration assembled. The "DS" data declaration advances the program counter by the amount of storage locations reserved. A program can have more than one "ORG" statement. If multiple "ORGs" are used, and one or more inadvertantly will cause the overwrite of a previously assembled module of code, no warning message of any kind will be issued. It is left up to the programmer, to protect against such events by use of con- ditional tests (using conditional pseudo-OPs) and the "ERR" pseudo-OP. The ORG pseudo-OP causes no code generation itself but just prepares the assembly process to start a new object deck record with the generation of subsequent object code (note that if the evaluated address is one greater than the current PC, a new object file record will not be started). ~Pseudo-OPs - Origins and Values~ 2 - 27 ~MISOSYS Editor Assembler Version 4.x~ ~Copyright 1984 MISOSYS, Inc., All rights reserved~ Conditional Pseudo-OPs The "conditional" pseudo-OPs provide a powerful way to maintain a pro- gram that is slightly different when assembled to run on different machine configurations. Instead of having to maintain multiple copies of a program, with each copy having some routines and modifications to make a "custom" version of the program, by using the conditional pseudo-OPs, you can maintain one set of source code that has conditional clauses which perform the "cus- tomization". It is very easy to specify which clauses are to be assembled during a particular assembly. The structure of a conditional clause is: _____________________________________________________________ | | | IFxx argument_of_IF | | code clause | | ENDIF | | | | ~THE OPERAND OF THE CONDITIONAL MUST BE DEFINED~ | | ~PRIOR TO THE EVALUATION OF THE "IF" STATEMENT!~ | |_____________________________________________________________| The operand of the "IF" takes on different formats depending on the particular "IF" pseudo-OP. It can be an expression, a label, or two expres- sions separated by commas. If the operand evaluates to a non-zero value, it is interpreted as a logical TRUE condition. If the operand evaluates to a zero value, it is interpreted as a logical FALSE condition. When the condi- tion is TRUE, the conditional clause between the "IF" and the "ENDIF" is assembled. If "expression" evaluates to a zero value then the conditional clause is not assembled. For the sake of uniformity, use the value of "-1" for a logical TRUE and a "0" for a logical false so that, "FALSE EQU .NOT.TRUE" is a valid statment. The values can be set in programs as follows: TRUE EQU -1 FALSE EQU 0 MOD1 EQU TRUE MOD3 EQU FALSE Conditional clauses can also be nested, in case complicated logical constructs are needed or in case a conditional clause itself has a condi- tional sub-clause. For example: IF expression1 IF expression2 ENDIF ENDIF is a two-level conditional. Conditional clauses can be nested to sixteen (16) levels although you will rarely find a need for more than three. The conditional construct of IF-ELSE-ENDIF is coded as follows: IF expression clause_1 ELSE clause_2 ENDIF ~Pseudo-OPs - Conditionals~ 2 - 28 ~MISOSYS Editor Assembler Version 4.x~ ~Copyright 1984 MISOSYS, Inc., All rights reserved~ which implies that if expression is TRUE, clause_1 assembles. If expression is FALSE, then clause_2 will be assembled. The ELSE construct is not required in a conditional but may be used where you have an alternative clause that can be based on one expression. As mentioned earlier, the IF argument can take one of three forms. The conditional structures of these are as follows: _____________________________________________________________ | | | ---Type I--- -----Type II------ --Type III-- | | IF[x] exp IFxx[$] exp1,exp2 IFyy name | | . . . | | clause clause clause | | . . . | | ENDIF ENDIF ENDIF | | | | ~[x]~ Optional entry of 1, 2, or 3 to evaluate based | | on the assembler phase during the assembly. | | | | ~xx~ Can be "LT", "EQ", or "GT" representing less | | than, equal to, or greater than conditions | | respectively when comparing "exp1" to "exp2". | | | | ~[$]~ The "$" is specified in macro comparisons with | | the expressions treated as strings (see the | | section on MACRO PROCCESSING). | | | | ~yy~ Can be "DEF", "NDEF", or "REF" representing | | whether "label" has been defined, undefined, | | or referenced but undefined. | |_____________________________________________________________| Pseudo-OPs IFx - Type I The IF1, IF2, and IF3 conditional pseudo-OPs evaluate TRUE when the as- sembler is on pass 1, 2, and 3 respectively. Pass 1 is the first pass used to evaluate the value of all symbols. Pass 2 generates the listing and cross reference data file. Pass 2 will be omitted if -NL is TRUE and -XR is FALSE. Pass 3 generates the object code. Macros must be read in on each pass. EQUates must be read in on each pass if they are the object of an IFDEF pseudo-OP, otherwise, they can be read in on the first pass only. In the latter case, surround the *GET which gets the equate file with an IF1-ENDIF. Pseudo-OPs IFxx - Type II Among the Type II constructs, using "IFLT", if the value of expression_1 is less than the value of expression_2, then the conditional clause will be assembled. Using "IFEQ", the conditional clause will be assembled only if expression_1 and expression_2 have equal values. The "IFGT" pseudo-OP will assemble the conditional clause (i.e. result in a TRUE condition) only if expression_1 has a value exceeding that of expression_2. The last possibility is "IFNE", which will cause the assembly of the conditional segment if the expressions are not of equal value. ~Pseudo-OPs - Conditionals~ 2 - 29 ~MISOSYS Editor Assembler Version 4.x~ ~Copyright 1984 MISOSYS, Inc., All rights reserved~ If, for instance, you want to ensure that a program does not assemble code past a particular address, then the ERR pseudo-op could be used in con- junction with IFGT to force an assembly error as follows: IFGT $,MAXADDRESS ERR Program is too long! ENDIF which compares the current value of the program counter (PC) to some prev- iously specified maximum address. Once the PC exceeds this maximum value, the condition evaluates TRUE resulting in an assembly of the segment. The "ERR" pseudo-OP is used to force an assembly error. Pseudo-OPs IFyy - Type III Among the Type III constructs, "IFDEF name" will evaluate TRUE if "name" has been defined prior to the evaluation of the IFDEF on each assembler pass. "IFNDEF name" will evaluate TRUE if "name" has NOT been defined prior to the evaluation of the IFNDEF on each assembler pass. "IFREF name" will evaluate TRUE if "name" has been referenced but NOT defined prior to the evaluation of the IFREF on each assembler pass. The Type III constructs will find greater use when working with source libraries of code. For instance, if a clause is a routine that is surrounded with an IFREF-ENDIF conditional, the routine will only be assembled if prior to the segment, the "name" has been referenced but not yet defined. If "name" is the entry point symbol to the routine, then the routine will be assembled if it is needed. Similarly, you may have a library routine that is always to be placed in your program unless its "name" has already been defined in some alternate routine. Surrounding it with the IFDEF-ENDIF conditional will in- hibit its assembly if your program has defined that name. Suppressing FALSE Conditionals If during the listing pass, you want to suppress the listing of certain conditional clauses that are not assembled (i.e. they are evaluated as FALSE), use the following sequence of operators: *LIST OFF IF expression *LIST ON code clause *LIST OFF ENDIF *LIST ON With this sequence, the "IF" and "ENDIF" lines will always be suppressed. The conditional clause will only be listed if the condition being evaluated is logically TRUE. If no FALSE conditional clause is to be listed, then you may use the assembler "-NC" switch which inhibits the listing of all FALSE con- ditionals - including the IF-ENDIF statements. ~Pseudo-OPs - Conditionals~ 2 - 30 ~MISOSYS Editor Assembler Version 4.x~ ~Copyright 1984 MISOSYS, Inc., All rights reserved~ Pseudo-OP ENDIF Each "IF" statement must be matched up with a corresponding "ENDIF". The "ENDIF" is needed to define the scope of the conditional clause. Pseudo-OP COM This pseudo-OP is used to generate a comment record in the object code file. Its syntax is: _____________________________________________________________ | | | COM | | | | ~~ Is the information to be placed as a comment. | |_____________________________________________________________| An object file comment record can be generated within the executable ob- ject code file directly by using the "COM" pseudo-OP. The comment string must have a length less than 128 characters. As can be noted, the comment string must be enclosed in angle brackets. The closing bracket may be omitted. If lower case characters are desired, then single quotes must surround the angle brackets. Neither the quotes nor the angle brackets will be part of the com- ment record. The "COM" pseudo-OP will generate a comment record in the object file of the format X'1F' followed by the string length, followed by the string it- self. A typical use would be to place a non-loading copyright statement in an executable object code file. For example: COM '' will produce the comment record which would be viewed if the file were listed. The generation of the "COM" object code record will be inhibited if the assembly is performed using the "-CI" switch. A binary core-image file can not have a non-loadable record. Pseudo-OP ERR The "ERR" pseudo-OP is used to force an assembly error. Its syntax is: _____________________________________________________________ | | | ERR {message} | | | | ~message~ is an optional message to inform what is wrong. | |_____________________________________________________________| This pseudo-OP forces an immediate warning error and displays the optional message. It is commonly used in a conditional clause for error trap- ping. ~Pseudo-OPs - Miscellaneous~ 2 - 31 ~MISOSYS Editor Assembler Version 4.x~ ~Copyright 1984 MISOSYS, Inc., All rights reserved~ Pseudo-OP OPTION This pseudo-OP is used to alter the state of any of the assembler switches entered on the command line invoking the assembly (either via MAS or the "A" command of EDAS). Its syntax is: _____________________________________________________________ | | | OPTION {-/+}switch{,-/+switch},... | | | | ~-/+~ An optional prefix to turn the switch OFF or ON. | | | | ~switch~ Any of the permissable assembler switches. | |_____________________________________________________________| Prefix each switch with "-" to turn OFF, or "+" to turn ON (i.e. +NL suppresses the listing - sets the NO LISTING switch to TRUE). If "+" is omitted, it is assumed. The COMMA separator is mandatory if you omit the "+". OPTION switches over-ride command line switches. The OPTION pseudo-OP is only processed during the first pass; therefore, you cannot use it to dynamically switch options ON and OFF during an assem- bly. It is used to conveniently set options specific to a source stream to eliminate the need for their entry on the assembler command line. Pseudo-OP REF REF may be used to force a reference to the symbols identified in the argument list. Its syntax is: _____________________________________________________________ | | | REF symbol1{,symbol2},... | | | | ~symboln~ A "name" to be force-referenced. | |_____________________________________________________________| This function may be useful to force references to macros so that they may be loaded via a '*SEARCH' operation. ~Pseudo-OPs - Miscellaneous~ 2 - 32 ~MISOSYS Editor Assembler Version 4.x~ ~Copyright 1984 MISOSYS, Inc., All rights reserved~ Listing Pseudo-OPS Four pseudo-OPs are available to control the assembler listings. These are: PAGE, SPACE, SUBTTL, and TITLE. Their syntax is: _____________________________________________________________ | | | PAGE | | | | SPACE n | | | | SUBTTL {} | | | | TITLE | | | | ~n~ Specifies how many line feeds to generate. | | | | ~~ Is the title or sub-title string to appear in | | the listing headings. | |_____________________________________________________________| A new page can be forced to provide separation of routines, modules, etc. by using the "PAGE" pseudo-op. This pseudo-OP will be ignored if it ap- pears between *LIST OFF and *LIST ON. PAGE statements are automatically sup- pressed from the listing. PAGE will output the form feed character only during the listing pass. "SPACE n" performs line spacing whenever the "SPACE" pseudo-OP is used. When assembled, "n" is the number of lines to space and is interpreted as modulo 256. The line containing the SPACE pseudo-op is not displayed. This pseudo-op also will be ignored if it appears between *LIST OFF and *LIST ON. A heading sub-title is requested with the "SUBTTL" pseudo-OP. The sub- title string can be up to 80 characters long. A NULL length indicates that sub-titling is disengaged. The SUBTTL string does not need to be enclosed in angle brackets; they are optional. SUBTTL automatically invokes a PAGE. Lower case strings can be maintained by surrounding the brackets with single quotes. You may change the subtitle by using "SUBTTL" pseudo-OPs throughout the text. If the "SUBTTL" text string is null, then subtitling will cease on the subsequent page. A line will also be skipped between the subtitle and first printed text line on the page. The "TITLE" pseudo-OP automatically invokes a page heading and adds the title to the headings of assembler listings. The first "TITLE" pseudo-OP found in the text will be used for titling. Any other "TITLE" pseudo-OPs will be ignored. The title string is limited to 28 characters. The left and right carets (angle brackets) must be entered but are not output in the listing - they serve only to delimit your title string. The title line will include the EDAS version, the date and time retrieved from the system, your title string, and a page number [page number is limited to the range <1-255> and will wrap around to zero if more than 255 pages are printed]. A line will be skipped between the title and start of printed text (or subtitle if used). Lower case titles will be maintained by surrounding carets with single quotes as in: TITLE '' ~Pseudo-OPs - Miscellaneous~ 2 - 33 ~MISOSYS Editor Assembler Version 4.x~ ~Copyright 1984 MISOSYS, Inc., All rights reserved~ Assembler Directives The MISOSYS Editor Assembler Version 4.x, supports five assembler com- mands. In contrast to source statements which are translated to machine language, these directives are "conversation" to the assembler. Each directs the assembler to behave in a particular manner or perform a specific func- tion. The directives, by themselves, do not generate any machine language code - they merely act as "commands" to the assembler. Each "command" must start in column one of a source statement line, and must start with an asterisk (*). Only the first character of each directive is significant. The entire directive "word" may be entered, or the directive may be abbreviated to its first character. The assembler directives are: _____________________________________________________________ | | | *GET file Causes the assembler to begin reading source | | code from the "file". | | | | *INCLUDE Same as "*GET" for EDAS; works in concert with | | "+I=filespec" for MAS. | | | | *LIST OFF Causes the assembler listing to be suspended, | | starting with the next line. | | | | *LIST ON Causes assembler listing to resume, starting | | with this line. | | | | *MOD exp Advances the "module" character substitution | | string and optionally sets/resets the prefix. | | | | *SEARCH lib Invokes an automatic search of the Partitioned | | Data Set (PaDS) "lib" to resolve any undefined | | references capable of being resolved by PaDS | | assembler source member modules. | |_____________________________________________________________| *GET filespec This directive invokes assembly from a source disk file. Its syntax is: _____________________________________________________________ | | | *GET filespec | | | | ~filespec~ Causes the assembler to begin reading source | | code from the file, "filespec". | |_____________________________________________________________| This directive tells the assembler to temporarily switch its source as- sembly to the file identified as "filespec", and use it to continue the as- sembly. A default file extension of "/ASM" will be used if none is provided in the directive statement. The file itself can be headered and/or numbered, as the assembler will automatically detect its type and adjust accordingly; however, all nested *GETs must be similarly configured. When the end-of-file ~Assembler Directives~ 2 - 34 ~MISOSYS Editor Assembler Version 4.x~ ~Copyright 1984 MISOSYS, Inc., All rights reserved~ is reached, or an assembly language "END" statement is read, assembly auto- matically resumes from the next statement following the statement which invoked the "*GET". Any "END" statement read during the *GET process wi