• Keine Ergebnisse gefunden

I I for Patrick Zlink, partof in this or withoutpriorwritten publisher. Altos, requeststo Street, Inc., First

N/A
N/A
Protected

Academic year: 2022

Aktie "I I for Patrick Zlink, partof in this or withoutpriorwritten publisher. Altos, requeststo Street, Inc., First"

Copied!
63
0
0

Wird geladen.... (Jetzt Volltext ansehen)

Volltext

(1)R E. L. O C A T. N G. I. M. A S S E. A. C. R O. L. I. N K E R. A N D. M. B. L. E R. for Z 8. O. H D 6. A N D. 4 1. 8. O. by. Patrick O'Connell. No Zlink, Z1ib, Zcon, Zref are Copyright 1984/85 by Mitek. reproduced document by be may of any part in any way or this means without prior written permission of the publisher. Mdress requests to Echelon, Inc., 101 First Street, Los Altos, CA. Zas,. 94022.. Rev. 6/25/85.

(2) 1984/85 Mitek Copyright Reserved Rights All. WARNING LAW BY U.S. COPYRIGHT AND/OR REPRODUCTION MAY RESULT IN IMPRISONMENTOF UPTOONEYEARAND FINES OF BE INFRINGERS MAY ALSO COPYRIGHT USC 506). (17 $10,000. THIS SOFTWARE AND (TITLE 17 UNITED SALES UP TO SUBJECT. TO. MANUAL ARE BOTH PROTECTED CODE). UNAUTHORIZED STATES. CIVIL LIABILITY.. LIMITED. WARRANTY. IS,". WITHOUT ARE SOLD "AS MANUAL PROGRAM AND INSTRUCTION OR FITNESS FOR MERCHANTABILITY, PERFORMANCE, WARRANTY AS TO THEIR AND PURPOSE. THE ENTIRE RISK AS TO THE RESULTS ANY PARTICULAR PERFORMANCE OF THIS PROGRAM IS ASSUMED BY YOU.. THIS. WARRANTS THE HOWEVER, ONLY, ECHELON TO THE ORIGINAL PURCHASER MAGNETC DISKETTE ON WHICH THE PROGRAM IS RECORDED TO BE FREE FROM DEFECTS UNDER NORMAL USE FOR AND FAULTY WORKMANSHIP IN MATERIALS OF THIRTY DAYS FROM THE DATE OF SHIPMENT. A PERIOD IF DURING THIS THIRTY-DAY SHOULD BECOME DEFECTIVE, PERIOD THE DISKETTE IT CHARGE. MAY BE RETURNED TO ECHELON FOR A REPLACEMENT WITHOUT YOUR SOLE AND EXCLUSIVE REMEDY IS IN THE EVENT OF A DEFECT EXPRESSLY OF THE DISKETTE AS PROVIDED LIMITED TO REPLACEMENT ABOVE. OR FROM ACCIDENT IF FAILURE OF A DISKETTE HAS RESULTED ABUSE THE ECHELON SHALL HAVE NO RESPONSIBILITY TO REPLACE DISKETTE U7'DER THE TERMS OF THIS LIMITED WARRANTY. ANY. RELATING TO IMPLIED WARRANTIES IMPLIED WARRANTIES OF MERCHANTABILITY LAR PURPOSE, ARE LIMITED TO A PERIOD. THE DISKETTE, INCLUDINGANY AND FITNESS FOR A PARTICUOF THIRTY DAYS FROM DATE OF OR SHIPMENT. ECHELOP' SHALL NOT BE LIABLE FOR INDIRECT, SPECIAL, CONSEQUENTIAL DAMAGES RESULTING FROM THE USE OF THIS PRODUCT. DO SOME STATES NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENSO DAMAGES, THE ABOVE LIMITATIONS MIGHT NOT TIAL OR CONSEQUENTIAL APPLY TO YOU. THIS WARRANTY GIVES YOU SPECIFIC LEGAL RIGHTS, AND YOU MAY ALSO HAVE OTHER RIGHTS WHICH VARY FROM STATE TO STATE.. Trademarks:. Zas, Zlink, Zlib, Zcon, Zref, Mitek; ZDM, RD Software; DSD, soft Solutions; Z-System, Echelon, Inc.; Z80, Zilog, Inc.; HD64180, Hitachi; CP/M, DDT, SID, ZSID, Digital. Research,. Inc..

(3) TABLE. Chapter. Chapter. Chapter. Chapter. 1. Overview. 2. ZAS ZAS ZAS. Distribution Installation Software. Files. Updates. INVCCATION.................... I 1. 1 1 2. 3 3. 2.1 2.2 2.3. Operation Options Assembly Statistics. 3. PROGRAM. 3.1 3.2 3.3 3.4. Label Field Operation Field Operand Field. 5. EXPRESSIONS....................... 7 7 7. 4. 4.5 4.6 4.7 4.8 4.9 4.10 5. Comment. FORMAT................... Field. Numeric Constants String Constants Character Constants Labels 4.4.1 Label Characteristics 4.4.2 Relocation Bases Relocation Counter Reference Registers Operators Precedence of Operators Parentheses Versus Brackets Expression Restrictions. 3 4. 5 5 5 6. 7. 8 8 8. 9 9 10 11 12 12. PSEUIX)-OPS........................ 5.4 5.5 5.6 5.7. Pseudo-ops Listing Control Pseudo-ops Conditional Assembly Pseudo-ops 5.3.1 IF Pseudo-ops Evaluatiorí 5.3.2 Conditional Assembly Forms Linkage Pseudo-ops Base Relocation Pseudo-ops Macro Pseudo-ops Special Function Pseudo-ops. 13 13 16 16 16 17 19 20 d? ~4 22. 6. MACRO. 6.1 6.2 6.3 6.4 6.5 6.6. Repeat Macros Stored Macros Exiting Macros Local Symbols Macro Invocation Parameter Evaluation. 23 23 25 25 25 26 26. 5.1 5.2 5.3. Chapter. CONTENTS. INTRODUCFION....................... 1.1 1.2 1.3 1.4. 4.1 4.2 4.3 4.4. Chapter. OF. General. FACILITY....................

(4) TABLE. Chapter. CHAPTER. CHAPTER. CHAPTER. (continued). MESSAGES................ 29 29 30 30 30. GENERATION........ 31 31. 7. ZAS. 7.1 7.2. Non-Fatal Errors Fatal Errors General Fatal Error Messages 7.2.1 7.2.2 Macro Fata! Error Messages. 8. CROSS-REFERENCE. 8.1 8.2 8.3. Overview ZREF Operation Reserved Symbols. 9. CODE Code. 9.1 9.2 9.3 CHAPTER. OF CONTENTS. 10. ERROR. 3i 31. 33 33 33 34. CONVERTER.................... Converter Operation TDL Pseudo-ops Convertible Error Messages. 35 35 35 35 36 37. LINKER............................ 10.1 10.2 10.3 10.4 10.5. Overview ZLINK Operation ZLINK Options Define Next Free Memory ZLINK Error Messages. 11. LIBRARY. 11.1 11.2 11.3 11.4 11.5. Overview ZLIB Operation ZLIB Options ZLIB Messages ZLIB Error Messages. Location. 39 39 39 39 39 40. MANAGER................... Appendix. A:. Z80. Appendix. B:. Software. Appendix. C:. Pseudo-op. Appendix. D:. Hitachi. Mnemonic. Machine. Update. Form. Summary. HD64180. Mode. Instruction. Codes.

(5) 1 CHAPTER INTRODUCTION. 1—I ZAS. OVERVIEW (Z80. and HD64180 Relocating from a disk statements. Macro Assembler) and produces. assembly. reads. Intel These compatible file. CP/f'1 file or can then be loaded using Echelon supplied files or A LOAD, command or any Microsoft object compatible linker. (SYM) symbol table produced used that can be is optionally file with Echelon DSD or Digital Research SID and ZSID debuggers. language. compatible. The. minimum. HEX. Z. 48k-bytes of. a. or. RAM. file Microsoft. either. system configuration in which to use zas is with one disk drive.. CP/M. soon as you receive ZAS, make backup copies! the installation process using a copy.. Then. As. 1.2. DISTRIBUTION. You. will find. 1.3. an. REL MLOAD,. go. through. FILES the. following. files. distribution. on your. File. Function. ZAS.COM. Assembler. ZLINK.COM. Linker. ZLIB.COM. Library Manager. ZCON.COf1. 8080. ZREF.COM. Cross-reference. TEST.Z80. Test Assembly. INSTZAS.COM. Installation. to. Z80. Code. disk:. Converter Generator. File Program. INSTALLATION. The. installation program was designed to set assembler output opThe tions. Type in INSTZAS to invoke the installation program. options. described. on. the next page. will. appear. on. the screen.. Page. 1.

(6) CHAPTER. I:. INTRODUCTION. INSTMS<cr>. ZAS. installation. l.. Listing to terminal. 2.. Listing to disk. 3.. Listing to printer. 4.. Generate. object. 5.. Generate. symbol. 6.. object. 7.. IF trueness. 99. Enter. Changes. file. options:. file file file. -. off. - off -. off. - on -. off. - rel based on - least significant type. bit. complete. option number to change:. for different options is indicated to right of (toggle) an option value (i.e., onto off, rel option. to hex, or least significant bit to all sixteen bits), simply enter option number (l to 7) followed by carriage return <CR>. When desired option changes have been made, type in 99 to end installation program and have ZAS.COM automatically updated.. The. preset. To. 1.4. values change. UPDATES. assist in refining ZAS by recommending enhancements and reporting any software problems on a copy of the Software Update Software updates will Form, a sample of which is in Appendix B. be provided intervals for a nominal fee. You will be at regular notified by Echelon when software updates are available. You. Page. can. 2.

(7) ZAS. 2.1. ZAS. ZAS. is invoked by typing:. 2 INVOCATION. cmvrm. OPERATION. ZAS. filename.filetype. filename is the name of the source fije to be assembled. no filetype is specified, then Z80 is assumed. Typing ^C will If ZAS cancel operation. where. 2.2 A. ZAS. OFTIONS. variety. execution command. of options are available to provide control over They are used once at the end pararneters of ZAS. line and spaces are not allowed between options: ZAS. filename. the of a. {$}options. of options: non-disk reference options arid disk reference options. Using the non-disk reference options reverses the settings supplied by the Install Program and includes the C, H, and L options.. There. are. two types. Option. Setting the option will page the output of Pressing any key allows you to at 23 lines per page. continue to scroll through the output page by page. However, it should be noted that a ^C will abort the assembly. C: CRT ZAS,. C. Hex Option. When this option is set Intel will generate hex REL compatible instead of Microsoft compatible files. files Note: When using HEX files, you must have an ORG statement of 1OOH or higher to prevent an inverted address error from MLOAD or. it. H:. LOAD.COM.. L option sends Listing tcj Printer Option. SettingLST: thedevice. formatted assembly listing to or. L:. Z. The disk character. a. CP,"61. reference options require two characters. The first The second characis the P, O, or option characters. indicates the disk drive for specified output the option. ter The second character must be A-P or Z, where (for zero or null) suppresses the output altogether. S. Z. The object File Generation (filename.REL or filename.HEX). option specifies the disk for object file output. Depending on the option, the object file will be a Microsoft compatible REL file or an Intel compatible HEX file.. o:. O. H. The to a PRN File (filenarne.PRN). option will send Listing a formatted assembly listing to the specified disk. The S: Symbol File Generation (filename.SYMÁ option specifies output disk for Echelon or DRI compatible SYM file. P:. P. S. Page. 3.

(8) CHAPTER. 2.3. 2:. ZAS. ASSEMBLY. INVOCATION. STATISTICS. At the completion of an assembly, ZAS provides several The output the assembled. is as follows: program on Assembly. statistics:. nnnn lines nnnn labels nnnn macros read nnnn macro expansions nnnn errors nnnn free bytes where nnnn. Page. 4. is. a. decimal. number.. statistics.

(9) 3 cFlAprER PRCX;RAMFORMAT. Acceptable the form:. input consists of. program. label. a. sequence. operand. operation. in. of statements. comment. by one or more spaces and/or tabs. field is separated and begin in any column except for may optional are All fields the label field which must begin in column one. The statement is but feed by and where each. terminated. a. not necessary.. a line is allowed carriage return rnay also insert blank lines into the program.. You. may be either upper or lower-case statement except the actual and formal parameters. For macro parameters, must be in the saíne case for substitution to take place. The. for macro. parameters. 3.1 IABEL FIELD Labels. take. the form:. label. or. label:. and are. optional except for the SET, EQU, and MACRO assembler The a ?, directives. label consist-s of alphanumeric characters, $ and the be numeric. an character the a must not first or If 15 exceeds label characters then the label is truncated to the can be either upper-case right. Labels or lower-case. The ": " a Examples following label is optional. of labels include the following: @,. a123 aLL:. Áll? 3.2. OPERATION. ?a123. @a123. ?ALL:. update_file. INDEX. UPDATE$EILE. FIELD. The. one of the following three: a mnefield contains code, a pseudo operation code which instruction The Z80 mnemonic directs the assembly process, or a macro. machine instruction codes are listed in Appendix A and Hitachi HD64180 instruction codes are listed in Appendix D. The assembler pseudo-op codes are discussed in Chapter 5, with a C. Appendix And the macro summary of the pseudo-ops listed discussed Chapter 6. operation monic machine. instructions. in. are. 3.3. OPERAND. FIELD. The. operand. field. may. contain. numeric. constants,. character. con-. stants, ASCII strings, relocation counter references, labels, register references, operators, or expressions containing any combination of the previously mentioned items. Expresstons are further described in Chapter 4. Page. 5. '.

(10) CHAPTER. 3.4. 3:. COFHENT. PR(JGRPM. FORMAT. FIEID. comment field is always preceded by a semicolon (;). Comments are ignored by the assembler but are useful for programmer docuand later, debugging. mentation, A. Page. 6.

(11) 4 CHAETER EXPRESSIONS. is Before the pseudo operations and macros can be described, necessary to discuss expressions because of their complexity. Expressions consist of simple operands combined into properly. it. Blanks and tabs are ignored by operators. formed sub-expressions Each and operands of the expression. between operators expresonly 8 bits sion produces a 16-bit value during the assembly. are needed, the least significant half of the 16-bit value is used.. If. 4.1. NUMERIC. CONSTANTS. constant is a 16-bit value in one of several number base, called the radix of the constant, is denoted by Any which does not numeric constant a trailing radix indicator. which has terminate with a radix indicator uses the default radix The been initially set to decimal. radix indicators are:. numeric The bases.. A. B O Q D H. binary constant octal constant octal constant. decimal constant hexadecimal constant. base base base base base. 2. 8 8 10 16. constant is a sequence of digits, followed by an optional radix indicator, where the digits are appropriate for the radix, i.e., and I digits etc. For binary constants must be composed of. A. O. hexadecimal. constants,. the. leading. digit must hexadecimal. be. a. decimal. digit. in order to avoid confusing the constant with an A numeric (a leading work). constant must identifier will produce a binary number which can be contained within a 16-bit O. value.. 4.2 ASCII. STRINGS. String constants. and are represent sequences of ASCII characters, by enclosing the characters symbols apostrophe within ('). current All stringsThe must be fully contained within the be apostrophe character included physical line. can itself within a string by representing as a double apostrophe ("), which becomes a single apostrophe when read by the assembler. represented. it. 4.3. CHARACTER. CONSTANTS. Like strings,. character constants are composed of O, 1, or 2 characters, ASCII delimited by an apostrophe (') or quotation (") One difference between symbol. strings and character constants is strings are used only with db, dc, DEFB, and all macro pseudoPage. 7.

(12) CHAPTER. 4:. EXPRESSIONS. all other cases, a character constant is assumed. difference is that the value of a character constant is calculated and the result is stored with the low byte in the address and the high byte in the second address. For first example, in the character constant:. ops. In Another. DW. the value of stored in the. 'AB'. is stored in the second memory location and first memory location. In the string:. A. DB. is. B. is. 'AB'. the value of A is stored in the first memory location stored in the second memory location. 4.4. B. and. T?F'[FT"é. valuedeterminedby the type of statement precedes a macro definition, the label is label If given a text value, which is the body of the macro definition. the label precedes an EQU or SET pseudo operation, then the If label is given the value of the operand field. If a label precedes any other type of statement, is given the value of the current relocation counter. A. label is given. precedes.. it. a. the. it. The value of a label is precedes a SET pseudo-op. the number of times the. 4.4.1. LABEL. not allowed to change unless the label In which case, there is no limit to label's value may change.. CHARACTERISTICS. Labels fall into one of three categories: public, external, or local. Public labels are labels defined in the current program module and can be referenced in other program modules External labels are labels which have been defined as public in some other in the module declaring program module and are being referenced them external. a label has not been declared external or If public then is local and cannot be referenced by any other program. 4.4.2. it. module.. REUJCATION. BASES. The symbolic names for independently located memory areas are These relocationbases may represent called relocationbases. ROM, shared COMMON areas, special memory areas such as video refresh, memory mapped I/O, etc. Within each sub-program, each of these memory areas is referenced by a unique name. The actual allocation and mapping of the name to physical addresses is deferred All label references to the link edit and load process. within the assembled program are relative to one of these relocation bases. The four relocation bases and their typical uses are summarized as follows:. Page. 8.

(13) CHAPTER. 4:. EXPRESSIONS. Absolute: Absolute assembles non-relocatable code. A programmer selects Absolute mode when a block of program code is to be loaded each time into specific addresses, regardless of what else located the same is time. at code for a section of a Data Relative: Data Relative assembles and change therefore must be loaded into RAM. program that may Symbols in Data This applies especially to program data areas. Relative are relocatable. Code Relative: Code (program) Relative assembles code for sections of programs that will not be changed and therefore can be loaded into ROM/PROM. Symbols in Code Relative are. relocatable.. COMMON code that assembles data common This allows program area. of memory and common values. COMMON:. To. change. ops. 4.5. in. a. the relocation line:. base,. use one. statement. RELOCATION. is loaded modules. of the following. ASEG DSEG CSEG. Absolute Data Relative. CO.YLYON. CO!)MON. COUNTER. Code. into a defined to share a block pseudo-. Relative--default. REFERENCE. The. current relocation counter may be referenced as a 16-bit value by use of the symbol $. The value represented by is always the relocation counter value at the start of the current $. statement.. For example,. JP. will 4.6 When. endlessly. junp. to. $. itself.. RE)GISTERS ZAS. a one or two character encounters symbol, will look symbol up the in the corresponding 8 or 16-bit register table (see the next page). the symbol is found, then the operand is assumed to be a register reference. Because these single and double character symbols are reserved words, do not use them as. it. If. labels.. Page. 9.

(14) 4:. CHAPTER. EXPRESSIONS. 8-Bit Registers (Reserved Words). 16-Bit Registers (Reserved. A B. Words). BC DE HL. C. D E H L. IX IY SP AF. M. I. R. 4.7. OPERAIKJRS. The operands. previously described can be combined in normal algebraic expression using any combination of properly formed operands, operators, and parenthesized expressions. All arithmeSHR) and produce a 16-bit un(",-,*,/,MOD,SHL, operators tic The signed arithmetic result. relational operators (EQ, LT, LE, (OOOOH) GT, GE, and NE) produce a true (OFFFFH) 16-bit or false And the (NOT, XOR) operate AND, OR, and operators result. logical a 16-bit result of 16 bit-by-bit on their operand(s) Theproducing LOW HIGH and individual bit operations. operators always produce a 16-bit result with a high order byte which is zero. The NUL operator produces a true or false result. for the operand field are given below. In general, operands which the letters andy represent are treated as 160-65535. unsigned the quantities in range bit. The. operators. x. Arithmetic. Result. Operators x"y x-y *. x x x x x. /. MOD. SHL SHR. y y y y y. arithmetic sum of x and y arithmetic difference between x and y unsigned multiplication of x by y unsigned division of x by y remainder after division of x by y shift left byby y, with zero right shift right y, with zero left. fill fill. Relational. Result. Operators x x x x x x. EQ LT LE GT GE NE. Page. y,. x=y y, x<y y, x<=y y, x>y y, x)=y y, x<>y. 10. true true true true true true. if if ifif if if. x x x x x x. y, false otherwise less than y, false otherwise less or equal to y, else false greater than y, false otherwise greater or equal to y, else false not equal to y, false otherwise. equals. is is is is is.

(15) 4:. CHAPTER. Logical Operators. Result. NOT y x AND y x OR y, x XOR y. bit-by-bit logical inverse of y bitwise logical AND of x and y of x and y bitwise logical of x and y logical exclusive. x!y. OR. OR. Special Operators HIGH LOW. NUL. EXPRESSIONS. Result. identical to y SHR 8 (high order byte of y) identical to y AND OFFH (low order byte of y) the remainder of the current line is null true. y y. line. if. only space and/or tab characters. Beor contains NUL operator uses the rest of the cause the must be the current source line as an operand, last operator on a line.. it. 4.8. PRECEDENCE. OF OPERATORS. Without parentheses have an order of applior brackets operators As described cation as if they were parenthesized or bracketed. below, the operators listed and first have highest precedence, the operators listed last have lowest precedence. Operators listed on the same line have equal priority and are applied from left to right in the expression highest. precedence. *. /. SHL. MOD +. EQ. lowest The. precedence. expressions. shown. below are ". X. x. LT. OR. y. *. a. y * Z SHR b. SHR. —. LE GT NOT AND OR XOR LOW HIGH NUL. GE. NE. equivalent: X. = =. x. " [y {y. OR. * *. Z] la. SHR. bll. Balanced parenthesized or bracketed sub-expressions can always be used to override the order of precedence described above. The last expression could be rewritten to force application of operators in a different order: lx or. y]. *. [a shr. bl. Page. 11.

(16) 4:. CHAPTER. EXPRESSIONS. 4.9 parentheses. xmtsus brackets. Parentheses. and brackets are not interchangeable. They serve Parentheses used in expressions that are different purposes. have indirect addressing modes. For example, LD. load the register pair will location six (5"1) and seven. are used for not indirect.. Brackets mode. is. load the. 4.10. EXPRESSION. HL. other all Using the LD. will. (5+1). HL,. register pair. HL, HL. from. the contents of memory. expressions where the addressing above example with brackets, 15+1). with the immediate value six.. RESTRICTIONS. operand field of a statement may consist of metic expression the following restrictions: with. The. external. An. (2). A. (3). two relocatable values be absolute.. (4). In. may. from. arith-. added. or. relocatable value may have an absolute or another relocatable value (in the same relocation base) added to or subtracted from it. The result will relocatable.. If. arithmetic allbe other The absolute.. must. are subtracted and. 12. then the. logical operations, result will be absolute.. expression error will be generated above the restrictions. follow. An. Page. ccmplex. only have an absolute quantity it. The result will be external.. (I). subtracted. a. if. result. will. both operands. an expression. does not.

(17) 5 CHAPTER PSEUDO-OPS. 5.1. GENERAL. PSEUDO-OPS. D.efine Byte pseudo-op is used to enter one or more oneThe statement form is: data values into the program. The. DB:. byte. {,n...}. DB n. where n is any expression with a valid B-bit value. More than one from the preceding byte can be defined at a time by separating a defined in a single DB bytes with of the comma. value All memory statement locations. The Zilog are assigned consecutive be used instead of DB. mnemonic DEFB can. it. The D.efine C.haracter pseudo-op stores the characters in a successive memory string in locations beginning with the current The most counter. of the last characrelocation significant bit DC be set The pseudo-op form the is: for ter will to one. DC:. DC. The D.efine. DS:. form. Space pseudo-op. is:. DS. where the value to be reserved.. 'string'. of the. DS.. The. expression. reserves an area of memory. The {,expression} the number of bytes can be used instead of. expression gives first mnemonic DEFS. Zilog. the initialize the value. reserved space, set the optional second expresdesired. the second expression to is omitted, the reserved space is left as is (uninitialized). The reserved To block of memory is not automatically initialized to zeros. O. give the second expression the value initialize to zeros To. sion. All. If. used in the first expression must be previously defined U Otherwise, (undefined symbol) is generated a pass error during pass 1, and a P error (phase error) will probably be generated during pass 2 because the DS pseudo-op generated no code on pass 1. on. names. 1.. The Define Word directive is used to enter into the program. This directive takes the form:. DW:. DW. nn. a. 16-bit value. {,nn...}. Where nn is any expression with a valid 16-bit value. Multiple 16-bit values may be defined with one DW statement by separating the values with a comma. All 16-bit values defined by the DW pseudo-op are stored in standard Z80 word format with the least The Zilog mnemonic DEFW can be used byte significant instead of DW.. first.. Page. 13.

(18) 5:. CHAPTER. END: END. The. are. PSETJ1X)-OPS. All statements. END statement is optional. The form is: ignored.. following the. lexpressiorú. END. optional expression is the program starting address. If an Intel compatible hex file is being generated, then this starting address will be included in the last record of the hex file. If a REL is being then ZLINK will place a JUMP generated, file 1OOH instruction at to the specified starting address. The. The. EQU:. EQUate. lar numeric values.. statement is used The form is:. to. label. expression. EQU. name. synonyms. for particu-. label mustbe present andcannot label any other statement. the expression evaluates and assigns this value to the label. The label is usually a name which describes the value of the expression. Also, this name can be used throughout the program as a parameter or operand. The The. assembler. The.l.N.sert (or MACLIB) pseudo-op allows the programmer to the same section of assembler source code in a number of The assemblies. format different is:. .IN: use. .IN. {d: }filenaIne. or. K: lfilename. MACLIB. where d is the optional Z or CP/M disk specifier the logged disk) and filename is the on assumed filetype LIB.. file. (defaulting to disk with the. to be copied into the directive causes theandspecified file be in its entirety, treated exactly as to it were are part of the original source file. All inserted source iflines flagged with a "+" on the listing. Only one level of insert is allowed, they cannot be nested.. This. assembly. .LIST: This pseudo-op resumes a listing which has been suppressed See the next page. by the .XLIST directive. The. PAGE:. which device.. page pseudo-op. sent to the is The form. gives. PRN. for the. file PAGE. PAGE. control over the output formatting and/or directly to or CP/M LST: statement is: Z. {expression}. the PAGE statement is used without the optional expression then a form feed is sent to the output and/or Z or CP/M LST: The form feed the device. before sent statement is with PAGE has PAGE been printed. Consequently, command the is often issued directly ahead of major sections of an assembly language program, such as a group of subroutines, to cause the next statement to appear at the top of the following printer page.. If. The. Page. file. second form. 14. of the. PAGE. command. is used to specify the output.

(19) CHAPTER. 5:. PSEUIXJ-OPS. the PAGE page size. In this case, the expression which follows the number of output lines to be printed on pseudo-op determines each page. the expression equates to a value between 40 and 90, then the page size is set to the value of the expression. When for each page, a form feed is 56issued thisa value is reached The assembler line page eject. to cause initially assumes a produces and a page eject at the beginning of the page size. If. Usually, no more than one PAGE statement with the option is included in a particular program.. listing.. expression. The. .RADIX:. form. statement. is: .RADIX. n. the radix to n or 16. This pseudo-op set-s .RADIX unless another statement is follow, for all by a suffix radix modiencountered, or the radix is overridden fier. Initially, the default radix is set to 10 (decima]). where. is 2, 8, 10, numbers which. n. The. SET:. numeric. SET. values.. statement is used The form is:. label. to. name. synonyms. for particular. expression. SET. label must be present and cannot label any other statement, The assembler evaluates the expression except for another SET. The label is usually a name and assigns this value to the label. which describes the value of the expression. Also, this name can be used throughout the program as a parameter or operand. The Zilog mnemonic DEFL can be used instead of SET.. The. .TITLE form:. and .SBTTL: The. title .TITLE .SBTTL. and. subtitle. pseudo-ops. 'string-constant 'string-constant. take the. I'. 2'. where the string-constants enclosed in are an ASCII string, a .TITLE apostrophes, which do not exceed 64 characters. and/or .SBTTL is encountered during the assembly, thenIf each page of the listing is prefixed with the title and,'or subtitle stringconstant. The title line will be preceded by a standard ZAS header as follows: MITEK. Relocating. string-constant string-constant. Macro Assembler. l2. vers. n.n. page. nnn. where n.n number and. is the ZAS version number, nnn is the current page string-constant 1 and/or 2 is the string given in the ZAS corresponding pseudo-op. assumes that these initially When pseudo-ops are not in effect. specified, the title line, along with the subtitle line are not included in the line count for the page. Usually, no more than one .TITLE statement is included in a particular program. Page. 15.

(20) 5:. CHAPTER. PSEUDO-OPS. 5.2 LISTING. CONTROL. PSEUDO-OPS. .LALL: generate. ,L,ist ALL macro code.. .LIST:. This pseudo-op resumes by the .XLIST directive.. suppressed. The. .LFCOND:. ing. L,ist. .F,alse. lines,. The. that. This pseudo-op specified pass.. - print text during - print text during. which has been the. list-. the console during the. three. values:. both passes pass one. - print text during pass two ALL of the macro listing, including. 2 ,S.uppress. code produced. by macros.. The,S.uppress.F.alse portion of the listing evaluate false.. .SFCOND:. that. not. pass,text. output text to willpass can be one of. 1. the. listing. do. that. pseudo-op assures evaluate false.. The O. object. lines. print on console pseudo-op takes the form: .PRINT. .SALÍ):. a. CONDitionals. of conditional expressions. .PRINT:. including. CONDitionals that contains. pseudo-op. all text. and. suppresses. conditional expressions. The EXclude ALL non-code .XALL: macro lines pseudo-op will and code produced by a macro, but source object lines source do code which not generate are not listed.. list. .XLIST: This pseudo-op suppresses pseudo-op is encountered. 5.3 The. CONDITIONAL. ASSEMBLY. all list output until. facility.. PSEUDO-OP. .LIST. PSEUDO-OPS. next two sections describe the. 5.3.1 IF. a. ZAS. conditional. assembly. EVALUATION. methods for evaluating the trueness of an method bases the trueness on the least significant bit of the IF expression, which is compatible with Digital ASM, MAC, Research's and RMAC assemblers. The second method bases the trueness of the expression on the 16-bit expression value. This method is compatible with the Microsoft M80 assembler. has two IF expression. ZAS. different One. full. Page. 16.

(21) CHAPTER. 5:. PSEUIXJ-OPS. program default evaluation is set by the installation be The also method may 1.3). evaluation explicitly set (section by the following two pseudo-ops:. The. .IF1. -. cause IF expressions to evaluate will the least significant bit of the IF 1. evaluates. to. .IF16. 5.3.2. if. to true expression. OR. to evaluate to true cause IF expressions - will evaluates the IF expression to non-zero.. CONDITIONAL. ASSEMBLY. when. FYJRMS. The IF, ELSE, and ENDIF pseudo-ops define a range of assembly be included which language statements or excluded during are to assembly and ENDIF statements alone can be the process. The IF used to bound a group of statements to be conditionally assembled thus: expression IF statement #1 stat.ernent- #2 e 0. statement. #n. ENDIF. the the IF statement, encountering the assembler evaluates expression following the IF (all operands in the expression must be defiríed ahead of the IF statement). Depending on the condievaluates the expression tional assembly option in effect, to 1, a non-zero value a the least evaluates to significant bit or then statement #1 through statement #n are assembled. the expression evaluates to a zero, then the statements are listed but not assembled. Upon. if. If. The. statement can be used as an alternative to an IF statement, and must occur between the IF and ENDIF statements. The form is: ELSE. expression IF statement #1 statement #2 0 0 0. statement. #n. ELSE. statement statement. #n"l #n"2. 0 9 0. statement. #m. ENDIF. Page. 17.

(22) CHAPTER. 5:. PSEUIX)-OPS. the expression produces a non-zero (true) If statements through nareassembled. However,. I. in the assembly process. When the expresvalue (false), statements 1 through n are As an skipped, while statements n"l through are assembled. example, the conditional assembly shown in Listing A could be rewritten as shown in Listing B. through m are sion prcxiuces. skipped a zero. value, then statements rj+j. m. Listing TTY CRT DEVICE TTYOUT CRTOUT. EQU EQU EQU EQU EQU. IF CALL ENDIF. IF CALL ENDIF. 1 2 TTY OFO03H OF1OOH DEVICE TTYOUT DEVICE CRTOUT. Listinq TTY CRT DEVICE TTYOUT CRTOUT. EQU EQU EQU EQU EQU. IF CALL ELSE CALL ENDIF. A. EQ. TTY. EQ. CRT. EQ. TTY. B. l2 TTY OFO03H OF1OOH DEVICE TTYOUT CRTOUT. Properly balanced IF'S, ELSE'S, and ENDIF's can be completely contained within the boundaries of outer encQmpassing conditional The structure outlined below shows properly assembly groups. nested. IF,. ELSE,. and. ENDIF. statements:. exp#1 IF #1 group exp#2 IF group#2 ELSE. group#3 ENDIF. group#4 ELSE. group#5 exp#3 IF group#6 ENDIF. group#7 ENDIF. Page. 18.

(23) CHAPTER. 5:. PSEUIXJ-OPS. through 7 are sequences of statements to be and exp#1 through exp#3 are expressions assembled, conditionally exp#1 is true, then which control the conditional assembly. 7 assembled, and group#4 always and group#1 group 5,6, and are be skipped. Further, exp#l and exp#2 are both true, then will group#2 will also be included in the assembly, otherwise group#3 produced 1, 2, be exp#1 a false value, groups included. will always be 3, and 4 will be skipped, and group 5 and 7 assembled. under these circumstances, exp#3 is true then group#6 will also be included with 5 and 7, otherwise will be skipped in the assembly. where. 1. group. If. if. If. will. If. it. Conditional assembly of this sort can be nested up to eight levels (i.e., there can be up to eight pending IFS or ELSEs with unresolved ENDIFS at any point in the assembly), but usually becomes unreadable after two or three levels of nesting. The ELSEs nesting level restriction also holds for pending IFS and during macro evaluation. Nesting level overflow will produce an error during assembly. 5.4. LINKAGE. The. EXTRN:. fined in The. PSEUDO-OPS. pseudo-op identifies symbols whichare deother program but are used in the current- program.. EXTeR.N.al. some. form. is:. EXTRN. where symbol symbols may. symbol. {,syñbol...}. is the symbol being declared as external. Multiple declared in the same statement by separating them Also, a symbol in an expression with commas. is suffixed with if one or two signs, then the symbol is treated as an external. EXT is a synonym for EXTRN. be. #. The. NAME:. NAME. pseudo-op. takes NAME. the form: symbol. where symbol by the linking. This name is used is the relocatable module name. loader and library manager to identify the module Only the six for selective loading or manipulation. first characters absence of the are significant in the module name. In the NAME pseudo-op, up to the characters the six of program first name. are used.. PUBLIC:. The. pseudo-op identifies those symbols within the current program which are to be made accessible to other programs symbols. as external This directive has no effect on the assembly process for the current program, but merely records the name and value of the identified symbols on the object file for later use by the linking loader. A public symbol must be defined within the current program as a label. PUBLIC. Page. 19.

(24) CHAPTER. 5:. .REQUEST:. PSEUDO-OPS. Request. a. library search. filename. .REQUEST. The. form. is:. {,fi1ename...}. sends a request to ZLINK or any Microsoft This pseudo-op compatible loader to search the filenames in the list for The undefined external symbols. filename in the list should not ZLINK assumes the include filetypes or device designation. .REL extension and the logged default currently disk drive. 5.5. REIÁJCATICN. Absolute. The. ASEG:. BASE. PSEUDO-OPS. pseudo-op code.. SEGment. non-relocatable. generates. never. has operands.. ASEG. sets the location counter to an absolute segment (actual address) of memory. The ASEG default to O, which could module the cause to write over part of the oFerating system. is recommended that each ASEG be followed with an ORG statement set at 1OOH or higher.. ASEG. will. It. allocating data to a This allows various program storage. storage called modules to share the same storagearea. The lengthof aCOMMON area is the number of bytes required to contain the variables, arrays, anddata declared in the COMMON block, which ends when another relocation base pseudo-op is encountered.. COMMON:. COMMON statements COMMON COMMON area. The assembled. CSEG:. are non-executable,. assigns variables,. statements.. C.ode SEGment Code. never has an operand. can be loaded into ROM/PROM.. directive mode. Relative. in. storage arrays, and. Code. resets the location counter to the code relative segment of The location will be that of the last CSEG(defaultto memory. O), unless an ORG is done after the CSEG to change the location.. CSEG. However the ORG statement does not set a hardabsoluteaddress An ORG statement under CSEG causes the assemunder CSEG mode. bler to add the number of bytes specified by the expression argument in the ORG statement to the last CSEG address loaded. ORG 25 is given, 25 bytes be added to the For example, CSEG Then csEgwill be loaded. The clearing location. current effect of the ORG statement following CSEG (and DSEG) can be used to give the module an offset. Rationale for not allowing ORG to address for CSEG is to keep the CSEG relocatable. set an absolute. if. will. ZWsembly begins with is the default mode of the assembler. automatically executed, and the location counter in the Code Relative mode, pointing to location inthe CodeRelative segment of memory. All subsequent instructions will be assembled into the Code Relative segment of memory until ASEG, DSEG, or CSEG is then entered COMMON is executed. to return the assembler mode, which Code point Relative the location counter at to Code the the next free Relative segment. location in returns to. CSEG a CSEG. O. Page. 20.

(25) CHAPTER. 5:. PSEUDO-OPS. The D.ata SEGment pseudo-op never has operands. specifies segments of assembled relocatable code that will be loaded into RAM only.. DSEG:. DSEG. later. of sets the location counter to the Data Relative segment be The data the counter relative that location of memory. will of the last DSEG (default is O), unless an ORG is done after the DSEG to change the location. does not However, the ORG statement ORG DSEG An under mode. hard address a absolute statement set under DSEG causes the assembler to add the number of bytes specified by the expression in the ORG statement to the last DSEG ORG 25 is given, 25 bytes address loaded. For example, will be added Then DSEG the address loaded. the DSEG will be last to The loaded. clearing effect of the ORG statement following DSEG (and CSEG) can be used to give the module an offset. Rational for not allowing ORG to set an absolute address for DSEG is to keep the DSEG relocatable. DSEG. if. ORG:. counter. The Set. to. be. ORGin pseudo-op allows changed at any time. The ORG. the value of is:. form. a. location. expression. the ASEG program counter mode, the relocation counter is set to the value of the expression, and the assembler assigns generated code starting with that value. Under CSEG, DSEG, and COP1PÍON relocation bases, the location counter for that base is by incremented the value of the expression. All names used in the expression must be known on pass 1, and the value must either be absolute or in the same relocation base as the current location counter. Under. .PHASE/.DPHASE:. The. form. is: .PHASE. expression. e 0 0. .DPHASE. where. .PHASE allows code expression is an absolute value. to executed a located in one area, but area with at different .DPHASE specified by expression. is used start address the end the block code. indicate of relocated of. be a. to. The relocation base withina .PHASE block is absolute, the same The code, as the mode of the expression in the .PHASE statement. however, .PHASE loaded is in the area in effect when the stateThe ccMe ment is encountered. within the block is later moved to the address specified by expression for execution. l. Page. 21.

(26) CHAPTER. This. 5:. PSEUIXJ-OPS. example,. DUMMY: ENTRY:. assembles 0300 0300 0303 0306 0007 0007. 5.6. DUNQY ENTRY. O. to: CD0630 C30700 C9. DUMMY:. C30000. ENTRY:. 30OH DUMMY ENTRY. .PHASE CALL JP RET .DPHASE JP. O. MACRO PSEUDO-OPS. Provided here is only For. ops.. 5.7. 30OH. .PHASE CALL JP RET .DPHASE JP. a. SPECIAL. a. more complete. of the brief description the description,. see. Pseudo-op. Description. ENDM EXITM IRP IRPC LOCAL REPT MACRO. End. FUNCTION. macro pseudonext chapter.. Macro. Exit Macro Indefinite Repeat Indefinite Repeat Character. Local Symbol Generation Repeat Macro Definition PSEUDO-OPS. This pseudo-openables ZAS toassemble the ten extended upward Z80 instructions of the Hitachi HD64180 microprocessor, The compatible. ten instructions and their forms are listed in .HD64:. Appendix. t. Page. 22. D..

(27) CHAPTER. 6. FACILITY. MACRO. of assembly language programs is that common characteristic coding sequences are repeated over and over with only one or two of the operands changing. Macros provide a mechanism for The generating the repeated sequences with a single statement. repeated sequences are written with dummy values for the changing A single statement, operands. referring to the macro by name and dummy operands, providing values for the can then generate the repeated sequence.. A. many. The coding sequence begins with either the macro definition pseudo-op or one of the repeat pseudo-ops and ends with the ENDM pseudo-op. All ofThethe macro pseudo-ops may be used inside a macro sequence. one exception is a stored macro which, cannot be defined inside a repeat type macro. Macro nesting is allowed up to 15 levels deep. The. macro. facility. includes. macro. pseudo-ops. definition:. (macro. MACRO. for:. definition). repetitions. (repeat). REPT IRE' IRPC. (indefinite repeat) (indefinite repeat charac: ter). terminations:. (end macro) (exit macro). ENDM EXITM. unique. symbols. LOCAL. within macro sequences:. operators: &. P P I V. ^ 9¿; ':. 6.1. REPEAT. (OR. >. INLINE). MACROS. The simplest macro groups.. macro facilities involve the REPT, IRPC, and IRP All these forms cause the assembler to repetitively re-read portions of the source program under control of a These groups are counter or of textual substitutions. listed in increasing order of complexity.. list. Page. 23.

(28) rept-endm group: assembly. language terminated by an. The. group is written as a sequence of statements starting with the REPT pseudo-op and The form ENDM pseudo-op. is: REPT-ENDM. label:. REPT. expression. 0 0 0. label:. ENDM. where the labels are optional, and the expression indicates the REPT the and ENDM number of times between sequence of statements be repeated. The expression is evaluated as a 16-bit unsigned number. the expression contains an external symbol or undefined operands, an error is generated.. will. If. a label appears Ingeneral, onthe REPT statement, its value is the first machine code address which follows. This REPT label is not re-read on each repetition of the loop. The optional label on the ENDM is re-read on each iteration and thus constant labels (not generated through concatenation or with LOCAL pseudoops) will generate phase errors the repetition count is greater than l.. if. if. IRPC-ENDM GROUP: Similar to the REPT group, the IRPC-ENDM causes the assembler to re-read a bounded set of statements. form is:. label:. IRPC. group The. identifier,string. 0 0 0. label:. ENDM. optional labels follow the same conventions as in the The symbol and string identifier is any valid denotes a string of characters, terminated by a delimiter (space, tab, end-of-line, or comment). where. the. REPT-ENDM. group.. The sequence of statements between IRPC and ENDM are repeated Each repetition in the string. once for each character substitutes the next character in the string for every occurrence of identifier in the sequence. The IRP is except that the controlling The form string value. is: IRP-ENDM. GROUP:. label:. IRP. similar in function toa the IRPC, identifier can take on multiple. identifier, string {,string...}. 0 0 0. label:. ENIM. where the optional labels The sequence IRPC groups. repeated for each string.. Page. 24. follow the conventions of the REPT and of statements between IRP and ENDM is On the first iteration, the string is.

(29) 6:. CHAPTER. MACRO. FACILITY. substituted for the identifier wherever the identifier occurs in On the second iteration, the second sequence of statements. value the becomes the controlling identifier and so on of string and processed. encountered the last string is until. the. 6.2. S1DRED. MACRO. MACROS. DEFINITION: inacname. florin. The. MACRO. for the macrodefinition. is:. dummyl,dummy...}. 6 e *. ENDM P. of statements from the MACRO statement line to the statement line comprises the body of the macro, or the The macname macro's definition. is any non-conflicting assembly Dummy language label. parameter is a place holder that is replaced by an actual parameter in a one for one text substitution when the MACRO sequence is used. The. sequence. ENDM. statements are read and stored in the under internal tables the name given by "macname", processed until the macro is expanded.. The. prototype. assembler's but are not-. comment preceded by two semicolons is not saved as part of the But a comment preceded by only one semicolon macro definition. is preserved and will appear in the expansion.. A. 6.3 EXITING. MACROS. The EXITM pseudo-op is used inside a MACRO or Repeat block to terminate an expansion when some condition makes the remaining EXITM expansion unnecessary or undesirable. Usually, is used in pseudo-op. conjunction with a conditional The Any. expansion remaining. 6.4. LOCAL. The. LOCAL. The. form. when an EXITM is exited immediately is assembled. expansion or repetition is not generated. the If nested EXITM block containing the is within another block, the outer level continues to be expanded. SYMBOLS. pseudo-op is for the LOCAL LOCAL. When. allowed only inside directive is:. a. MACROdefinition.. identifier l,identifier...í. ZAS creates a unique symbol for each is executed, substitutes that symbol for each occurrence of the identifier These unique symbols are usually identifier in the expansion. used to define a label within a macro. This eliminates multipleLOCAL. and. Page. 25.

(30) CHAPTER. 6:. MACRO. defined labels symbols created avoid the form must precede. definition. 6.5. MACRO. The. form. FACILITY The of the macro. on successive expansions by ZAS range from ??0001 to ??9999. Users should A LOCAL ??nnnn for their own symbols. statement other types of statements in the macro. all. INVOCATION. for the macro invocation is: macname. parameteH,parameter...}. of the macname, ZAS "pairs-off" each dummy definition with the actual parameter text, dummy i.e., the first parameter is associated with the first actual parameter, the second dummy is associated with the second actual, and so on until the list is completed. If more actuals than dummy parameters then the extras are ignored. are provided fewer actuals are provided, then the extra dummy parameter are If associated with the empty string, i.e., a text string of zero length. is imWrtant to realize at this EK)int that the value It dummy of parameter is not a numeric value, but is instead a textual value consisting of a sequence of zero or more ASCII characters. Upon recognition parameter in the. 6.6. PARAMETER. MACRO. EVALUATION. There are several options available in the construction of actual parameters, as well as in the specification of character lists Although an actual parameter is simply a group. for the IRP characters placed between parameter delimiters, these sequence of options allow overrides where delimiter characters themselves become a part of the text. In general, a parameter x occurs in the context:. label:. ...,x,.... macname. the label is optional and the macname is the name of a The ellipses (...) represent previously defined macro. optional surrounding parameters actual in the invocation of macname. In x the ease of an IRP group, the occurrence Qf a character would be: label: IRP id, where. list. ...,x,.... ellipses represent optional substitution within the IRP group for lists controlling identifier "id" is found. In either case, the statements could be contained within the scope of a surdummy rounding macro expansion. Therefore, parameter substitution could take place for the encompassing macro while the actual parameter is being scanned. where the surrounding where the. label is optional, character. zas follows these character list:. Page. 26. and the. steps in forming an actual. parameter or.

(31) CHAPTER. (I) Leading blanks and tabs are removed of X. (2). The. of (3). leading character of x which operation is scan. when. 6:. they. MACRO. FACILITY. occur. in front. is examined to determine to take place.. the type. the leading character is a string quote, then x becomes text up through and including the balancing string quote, using the normal string scanning rules: double apostrophes within the string are reduced to a single apostrophe, and adjacent to the ampersand symbol upper case dummy parameters Note that. by are substituted their actual parameter values. the string quotes on either end of the string are included in the actual parameter text.. If. the. the character is the left caret (<) then the removed, and the value of x becomes the sequence of characters up to , but not including, the balancing right caret (>) which does not become part of x. In this case, left and right carets may be nested to any level within x, and only the outer carets are removed in the evaluation. Quoted strings within the carets are allowed, and substitution within these strings follows the rules stated in (3) above. Note that left and right carets within quoted strings become a part of the string, and are not counted in the caret: nesting the delimiter characters comma, within x. Further, when blank, semicolon, and tab, become they x a part of occur within the caret nesting.. (4). instead If bracket is. (5). If the leading characters which. (6). If the leading character is none of the above (quote, left bracket, or percent), the sequence of characters which follow, up to the next comma, blank, tab, or semicolon, becomes the value of x.. first. character is a follows is taken evaluated immediately as a 16-bit is converted to a decimal number sequence of digits, with left zero. then the sequence of which is as an expression value. The resulting value and treated as an ASCII suppression (0-65535). %,. There is one important exception to the above rule: the single character escape, denoted by an up-arrow, causes ZAS to read the character immediately following as a part of x without treating the character as significant. which folHowever, the character lows the up-arrow, must be a blank, tab, or visible ASCII character. The up-arrow itself can be represented by two up-arrows iri succession. the up-arrow directly precedes a dummy parameter, then the up-arrow is removed and the dummy parameter is not replaced by its actual parameter value. Thus, the up-arrow can be used to prevent evaluation of dummy within the parameters Note that the up-arrow has no special significance macro body. within string quotes, and is simply included as a part of the. If. i. string.. Evaluation considered,. of dummy although. parameters. in macro expansions. this topic has been presented. must also be throughout the. Page. 27.

(32) 6:. CHAPTER. MACRO. FACILITY. previous sections. Generally parameters as follows:. the macro assembler. (I). dummy a parameter is either preceded If concatenation operator (&), then the. (2). Dummy. evaluated. dummy. followed by the preceding and/or following "&" operator is removed, the actual parameter is substituted for the dummy parameter, and the implied delimiter is removed at the p©sition(s) the ampersand occurs. or. parameters are replaced only once at each occurrence as the "infinite encompassing macro expands. This prevents adummy parameter evalsubstitution" which wouldoccur uated itself. the. if. In sumnary. parameter -. Page. evaluation follows these rules:. leading and trailing tabs and blanks are rerooved quoted strings are passed with their string quotes intact nested carets enclose arbitrary characters with delimiters °0 a leading causes immediate numeric evaluation as a literal value an up-arrow passes a special character dummy parameter an up-arrow prevents evaluation of a the "&" operator is removed next to a dummy parameter durnmy parameters are replaced only once at each occurrence. 28.

(33) ZAS. 7 CHAFTER MESSAGES ERROR. of error messages: Non-fatal errors and fatal Non-fatal errors are indicated by a single letter code errors. of the statement line with the error. Fatal errors to the left the assembly and give messages as to why the error may have kill occurred. Statement lines with errors will not generate object-. There are two types. code. 7.1. NON-FATAL. Error. ERRORS. Explanation. Code. of the arguments. for the op-. A. Argument code is. B. An ELSE Balance error. or an ENDIF pseudo-op does not have a preceding IF statement. Or an END macro statement has no preceding macro call and/or macro definition.. C. Character. One. error. invalid.. character. is invalid.. The. it. D. Duplicate error. than once.. E. Expression error. be and found or. M. Mode mode. O. Opcode opcode.. P. Phase error. Pass 2 than. S. be. due. replaced. by. a. label has been defined The. expression. "^". 0. more. is ill-formed. specified insert file cannot insert is already in progress.. an The. error. error.. Syntax formed. be. invalid control character. an. The. Insert error.. be. A. a. computed.. cannot. I. has found. ZAS. and is probably character invalid will. statement The. error.. contains. statement. an. contains. label has a different did on Pass 1.. A. it. addressing an. illegal. value. on. The assembly statement is error. and cannot be processed. This error may characters invalid to or delimiters which. in-. are out of place. U. A label argument Undefined symbol. defined in the program.. V. Value. its. error. The operand allowable range.. (argument). has not been. is out of. Page. 29.

(34) CHAPTER. 7.2. 7:. FATAL. ZAS. ERROR MESSAGES. ERRORS. Fatal error messages have been classified into two categories: errors caused by macros and general errors (or errors not caused by macros).. 7.2.1 (I) (2). Gw.ñmN-iL. FATAL. ERROR MESSAGES. "Eilename.filetr. The. not source. specified. found.". file. cannot. be found on the. "Invalid option specification." or more of the assembler options line is invalid.. One. (3). disk.. specified in the. command. "More than. eight IF levels are pending at line nnnn" line nnnn is the line with the ninth IF. A maximum of eight IF levels can be nested. Where. (4). "Unterminated end of. The. (5). IF!". file. has been reached. full at line. "FSemory The assembler's. 7.2.2. MACRO. FATAL. (3). Page. starting at line nnnn" This error is the line with the error. END has terminating that no definition. l~l oflimit. "Macro nested. of. 16 levels at line nnnn" levels of nested macros are allowed.. past 16. al table exceeds 127 bytes at line nnnn" total length of all local symbols cannot exceed for a particular macro definition. "Ux:. The. (5). nnnn". exceeded!" 9,999 local symbols has been exceeded.. "1Áx: The rnaximum. A maximum. (4). terminating ENDIF.. ERROR MESSAGES. macro Where line nnnn is caused by a macro macro statement.. al. no. internal tables have run out of memory.. (I) "Unterminated. (2). with. 127. bytes. definition inside an ínline macro at line nnnn" This message indicates that a macro definition has been placed inside a repeat type macro and that is not allowed. "Macro. 30.

(35) 8 GENERATION. cElAprER CROSS-REFERENCE. 8.1. OVERVIEW. is used to provide a summary of symbol usage throughout a program. ZREF reads the file specified line by line, attaches a line number prefix to each line, and writes each prefixed line to the filename.XRF. After file ZREF completing filename.XRF, appends the this operation, to file a cross-reference report that lists all the line numbers where each symbol in the also flags with an 'u each appears. file It number where the referenced symbol line is defined. The. cross-reference generator. 8.2. ZREF. (ZREF). OPERATION. is invoked by typing. ZREF. ZREF. filename.filetype. {$}option. where. filename.filetype is the name of the fije to be crossassumed .Z80, and option is the referenced with the filetypedevice the the instead of a file. L, output is to letter list if 8.3. RESERVED. The. following symbols. SYMBOLS. will. be. not. A AF AND B BC. HI. C. L LE IÁ)W LT. D. DE E. FIL. I. IX IY. EQ. M. GE GT. MOD. H. NC NE. part of the cross reference: NUL NOT NZ OR. P PE PO R. SHL SHR SP XOR Z. Page. 31.

(36) 9 CHAPIER CODE CONVERTER. 9.1. CONVERTER. CODE. OPERATION. 8080 (ZCON) converts code converter source statements, all of machine instruction the statements, and most of the common TDL pseudo-ops to Z80 source statements (see the next section for a listing of the convertible TDL pseudo-ops). In addition, and comments, ASCII strings, except for character-constants, Also, parity bit (bit 7) parentheses to brackets. are converted is zeroed. The. TDL. To. invoke. the code. converter, type: ZCQN. filenarne.filetype. k$ju. filename is the name of the source file to be converted. then is assumed. When the"u" filetype is specified, If option is specified, only upper-case conversion is done. This is When useful you already have a Z80 source fije in lower case. be the conversion in a file called is completed, the output will filename.Z80 and one of two messages will be displayed. where no. ASP1. if. Message. "nnnn Where. I:. lines converted, with no errors detected." nnnn is the number of lines converted. OR. Message2: "nrmn lines converted, with eee errors logged in filenatne.ERR" Where nnnn is the number of lines converted and eee is the number of errors detected. 9.2 The. CONVERTIBLE. TDL. code converter They include the. PSEUDO-OPS. will. convert. the. most. common. TDL. pseudo-ops.. following: .ASCII .BLKB .BLKW .BYTE .EXTERN. .IDENT .INTERN. .LIST .WORD -. .XLIST. Page. 33.

(37) 9:. CHAPTER. 9.3. CODE CONVERTER. MESSAGES. the If leaves. code converter detects an error in a the line unchanged. There are two types. statement line, of error messages.. it. (I) ":'** Syntax error at line nnn, line follcMs ***w error line Where nnn. is the statement line number, and error line is the statement line with the syntax error. Normally, this error should not occur because indicates that the operand for op-code is syntactically incorrect. this particular. it. (2). "**" IF/ENDIF unbalanced. ***". the IFS and ENDIFs are not This error message appears should be an ENDIF, and vice paired. For every IF, there. if. versa.. Page. 34.

(38) 10. CHAPTER LINKER. 10.1. OVERVIEW. Linker (ZLINK) is used to combine Microsoft relocatable object modules into an absolute file ready for execution under the sorted symbol table, lists or CP/M. When completed, ZLINK and shows a load map which or duplicate symbols, any unresolved the number of free bytes left and the size and locations of the different segments: Z80. The. Z. LOAD. MAP. SEGMENT ABSOLUTE CODE DATA. FOR. FILENAME.COM START. SIZE. STOP. COMMON. FREE. writes the sorted symbol table to a .SYM file suitable for (DSD) and Digital Dynamic Screen Debugger use with Echelon and Symbolic Debuggers ZSID) as Research (SID Instruction page). (see ZLINK described in the option also creates a next COM under CP/M. direct execution or file for If errors are detected, the option (see next page) will be set automatically. ZLINK. S. Z. P. 10.2. ZLINK. ZLINK. OPERATION. is invoked by typing ZLINK. filename1{,fi]ename2,...,filer]ameN}. where filename. is the name of the object rnodu!e(s) to filetype is specified, then REL is assumed. If If filename is desired for the cori and SYM files, specified as follows: no. ZLINK. If. newfilename=filename1. be some. it. linked. other. may. be. {,filename2,...filenameNl. encounters a starting address which is caused by supoptional program starting address to the assembler END pseudo-op then ZLINK will place a JUMP instruction at 1OOH to the program starting address. ZLINK. plying. an. 10.3 ZLINK A. variety. execution. OPTIONS. of options are available. parameters. Qf ZLINK.. to provi.de control over the for the / option (library. Except. Page. 35.

(39) search option) are used once. the alltheof end. at. options. of. link control options. line:. are. a command. They. filename1l,filename2,...filenarneN} $Cnnnn,Dnnnn,P,Rnnnn Where. nnnn. ZLINK. options. is. hexadecimal. a. number.. include:. Code Segment Origin Option. The C option is used to specify the load address of the code segment. is not used, then (IOOHÁ Unless ZLINK will put the code segment at the address C:. If it. the. R. option indicates. code segment C. option is. otherwise,. the relocation. The set to its load address. will bewhere the desired code Cnnnn, nnnn. if. value of the for the origin in hex. syntax. D Data Origin Option. option indicates the load address of the data and common segments. the D option is used, the address specified must be higher than the load address for the code segment. is not used, ZLINK put the data and common segments immediately after the program segment. The syntax for the D option is Dnnnn, where nnnn is the desired data origin in hex.. The. D:. If. If it. Paging. will. option will page the output of ZLINK, lines per page to the terminal. Pressing any key allows at continue output a time. you to one page at to P:. 23. Option.. The. P. The Relocate Orígin Option. option specifies the recode segment. location value for the not used, then ZLINK If code segment to its load will set the relocation value of the R. R:. address.. willwithwrite the. .SYM S: File Option. this option is set, ZLINK the sorted symbol table to a .SYM suitable for use Echelon DSD or Digital Research SID and ZSID debuggers.. If. file. Search Option. l: ceding file should the and include file are referenced but. This option is used to indicate that the prebe treated as a library. search ZLINK only those modules containing symbols which not defined in the modules already linked. Unlike the link control options which can be used once at the end of a command line, the / option must be used after each filename to be searched:. will. filenamel/,filename2/,...filenameN/ 10.4. DEFINE. NEXT. FREE. MEMORY IACATION. the public symbol $MEMRY is encountered during the link proIf cess, then the two bytes addressed by the value $MEMRY and $MEMRY 1 are filled in with the address of the next free memory location. The statement labeled $MEMRY must be a DS statement. +. Page. 36.

(40) CHAPTER. 10:. LINKER. For example:. $MEMRY:. 10.5. ERROR. ZLINK. FREBEG,$ME?'1RY HLJ$MEMRY). PUBLIC LD RET DS. FREBEG:. 2. MESSAGES. (l) "Can't find filerLame.filetyµ2" Specified file cannot be found (2). file. (3). "MenKjry. is insufficient. "Undefined symbol not defined. memory. ". name(s) in any. following this heading are referenced of the modules being linked.. "Duplicate symbols:. "Read. error!". file. cannot. "Syntax The. ". be. read. are defined thistheheading modules being. as. a. linked.. of. command. line is. a D. segment. is error options.. into. ill. formed.. or more modules contain. (li) A"Library maximum .REQUEST. used. incor-. line!". "Multiple main mAules!". Two. already caused by. memory. probably. properly.. error in ccxmand. r. (IQ). but. "***OverlaWing segmmits**"". A. (9). REL. symbols:. ZLINK attempted to write by another segment. This rect use of the C and/or. (8). Microsoft compatible. to complete the linking process.. The symbol name(s) following PUBLIC symbol in more than one (7). a. full!". The. (6). not. file!". specified is invalid.. of the options. There (5). files specified is. REL. disk.. "Invalid option sFecification!" One. (4). of the. the. on. "FilenaIne.filetyE¥ is an invalid One. routine returns ;the first free byte ;of memory ;This. a. program. search limit exceeded!" of ten libraries can be statements.. starting address.. specified from assembler. Page. 37.

(41) II. CHAPTER MANAGER LIBRARY. ll.l. OVERVIEW. Library Manager (ZLIB) is used to combine Microsoft relocatLibraries are files consisobject modules into a library. ZLIB can ting of any number of relocatable object modules. delete modules from a library, concatenate REL files into a library, re-place modules in a library, and print module names and public symbols from a library. The. able. 11.2 ZLIB. OPERATION. is invoked by typing:. ZLIB. ZLIB. libname=filenamM,filename,...l. $option. where libname is the name of the library with filename is the name of the object module(s). specified, then REL is assumed.. alternate form of invoking (as described bdÍow) is:. An. ZLIB. ZLIB libname where. listoption. 11.3 ZLIB. is the. M. or. P. when. using. If. !4. or. and. filetype P. is. option. option.. specified, then the specified The options include: library.. Delete. M:. Print the module. names. in the library.. P:. Print the module. names. and. R:. Replace. the. ZLIB. the. modules. will. be. specified modules. public symbols in the library.. specified modules.. MESSAGES. Under the When. the. REL. $listoption. D:. (l). If. no. OPTIONS. no option is appended to the. 11.4. filetype. following circumstances a. module. ZLIB. will. produce. messages.. is being appended to the library: "AEEKmding. fjnerLame.filetyFE!". Page. 39.

(42) 11:. CHAPTER. (2). If. the. ified. LIBRARY. MANAGER. specified library does not exist on disk and the specoption is append: "Creating. (3). If. module. a. library". is being deleted: "Deleting KKjdulename". (4). If. module. a. is being replaced: "Deleting nKjdulename filename.filetyFe". AEKX!nding. 11.5 ZLIB. ERROR MESSAGES. (I) "Can't find filenarDe.filetyEe" Specified (2). of the. file.. ,. found on the. files specified is. not. option specified is invalid.. "Syntax The. Page. be. "Invalid option sÉjecifieation!" The. (4). cannot. "Eilenarne.filetyFe is an invalid One. (3). file. 40. error in ccxmand line!" formed. line is. command. ill. REL a. disk.. fíle!" Microsoft compatible. REL.

(43) Z80. object. Source Statement. Code. BE DD8E05 FD8E05 8F 88 89 BA 8B 8C BD CE,20. ptNEMDNIc. APPENDIX A INSTRUCTION MACHINE. ADC ADC ADC ADC ADC ADC ADC ADC ADC ADC ADC. A,(HL). A,(lX"d). A,(IY+d) A,A A,B A,C A,D A,E A,H A,L A,n. CODES. Operation Add and. with Carry Operto Acc.. Notes Leading A Operand is Optional. If isd O. is Omitted. Assumed. *************************************k************************X******** Add HL,BC adc with Carry Reg. ADC HL,DE Pair to HL. ED4A ED5A ED6A ED7A. ADC ADC. HL,HL HL,SP. *********************************************k************************* 86 Add Operand ADD Leading A OperA,(HL) to Acc. IJD8605 ADD and is Optional A,(1x+d) FD8605 87 80 81 82 83 84 85 C620. ADD ADD ADD ADD ADD ADD ADD ADD ADD. A,(IY+CI) A,A A,B A,C A,D A,E A,H A,L A,n. If isd O. is Omitted. Assumed. *********************************************************************** Add Reg. HL,BC add Pair to HL. 09 19 29 39. ADD ADD ADD. HL,DE. HL,HL HL,SP. *********************************************************************** DD09 ADD Add Reg. IX,BC Pair to IX DD19 DD29 DD39. ADD ADD ADD. IX,DE. IX,IX IX,SP. *****************************************************************h***** FD09 ADD Add Reg. IY,BC Pair to IV FD19 FD29 FD39. ADD ADD ADD. IY,DE. IY,IY IY,SP. *********************************************************************** A6 AND 'AND' A,(HL) Logical Leading A Operof DDA605 AND A,(1X+d) Operand and Acc. and is Optional FDA605 AND A,(IY+d). Al.

(44) APPENDIX. A:. Z80. object. Al A2 A3 A4 A5 E620. MACHINE. Source Statement. Code. A7 AD. MNEMONIC. AND AND AND AND AND AND AND AND. A,A A,B A,C A,D A,E A,H A,L A,n. INSTRUCTION. CODES. Operation. Logial 'AND' of Operand and Acc.. Notes Leading A Operand is Optional. If isd O. is Omitted. Assumed. *********************************************************************** d 0,(HL) BIT Test Bit of Location is Omitted If Assumed 0,(IX+d) BIT is or Reg.. CB46 DDCB0546 FDCB0546 CB47 CB40 CB41 CB42 CB43 CB44 CB45 CB4E DDCB054E FDCB054E CB4F CB48 CB49 CB4A CB4B CB4C CB4D CB56 DDCB0556 FDCB0556 CB57 CB50 CB51 CB52 CB53 CB54 CB55 CB5E DDCB055E DFCB055E CB5F CB58 CB59 CB5A CB5B CB5C CB5D CB66 DDCB0566 FDCBO566. O. BIT BIT BIT BIT BIT BIT BIT BIT BIT BIT BIT BIT BIT BIT BIT BIT BIT BIT BIT BIT BIT BIT BIT BIT BIT BIT BIT BIT BIT BIT BIT BIT BIT BIT BIT BIT BIT BIT BIT BIT BIT. 0,(IY+d). O,A O,B O,C O,D O,E O,H. O,L 1,(HL) 1,(IX+d) 1,(IY+d) 1,A 1,B. l,C. 1,D 1,E 1,H 1,L 2,(HL) 2,(IX+d). 2,(Ix+d) 2,A 2,B 2,C 2,D 2,E 2,H 2,L 3,(HL). 3,(Ix+d) 3,(1Y+d) 3,A 3,B 3,C 3,D 3,E 3,El. 3,L 4,(HL) 4,(IX+d) 4,(IY+d). A2.

(45) APPENDIX. object. Source Statement. Code. CB67 CB60. CB6l CB62 CB63 CB64 CB65 CB6E DDCB056E FDCB056E CB6F CB68 CB69 CB6A CB6B CB6C CB6D CB76 DDCB0576 FDCB0576 CB77 CB70 CB71 CB72 CB73 CB74 CB75 CB7E DDCB057E FDCBÚ57E CB7F CB78 CB79 CB7A CB7B CB7C CB7D. BIT BIT BIT BIT BIT BIT BIT BIT BIT BIT BIT BIT BIT BIT BIT BIT BIT BIT BIT BIT BIT BIT BIT BIT BIT BIT BIT BIT BIT BIT BIT BIT BIT BIT BIT BIT BIT. 4,A 4,B 4,C 4,D 4,E 4,H 4,L 5,(HL) 5,(IX+d) 5,(IY+d) 5,A 5,B 5,C 5,D 5,E 5,H 5,L 6,(HL) 6,(IX+d) 6,(IY+d) 6,A 6,B 6,C 6,D 6,E 6,H 6,L 7,(HL). A:. Z80. MNEMONIC. MACHINE. INSTRUCTION. Notes. Operation Test Bit or Reg.. of Location. If isd O. 7,(Ix+d) 7,(IY+d) 7,A 7,B 7,C 7,D 7,E 7,H 7,L. *********************************************************************** CALL C,nn Call Subroutine at. DC8405 FC8405 D48405 C48405 F48405 EC8405 E48405 CC8405. CALL CALL CALL CALL CALL CALL CALL. M,nn NC,nn NZ,nn P,nn PE,nn. Location tion True. nn. if. Condi-. PO,nn. Z,nn. *********************************************************************** CALL Unconditional nn Call to Subroutine at nn ********************************************************************k**. CD8405. 3F. CCF. Complement Carry. A3. CODES. Flag. is Omitted. Assumed.

(46) APPENDIX. A:. Z80. object. BA BB BC BD FE20. MACHINE. INSTRUCTION. Source Statement. Code. BE DDBE05 FDBE05 BF B8 B9. MNEMONIC. CP. cp CP CP CP CP CP CP CP CP CP. Operation. (HI,). Compar. (Ix"d). with. (1Y+d). CODES. Notes. Operand Acc.. Leading A Operand is Optional. If isd. A B. O. C. is Omitted. Assumed. D E H. L n. ***********************************************************************. EDA9. Location (HL) and Acc. Decrement HL and. CPD. Compare. BC. ***********************************************************************. EDB9. Location (HL) and Acc., Decrement HL and BC, Repeat until BC=O. CPDR. Compare. ***********************k***********************************************. EDAI. Location (HL) and Acc., Increment HL and Decrement. CPI. Compare. BC. ***********************************************************************. EDBI. Location (HL) and Acc., Increment HL, Decrement BC, Repeat until BC=O. CPIR. Compare. ***********************************************************************. 2F. Complement Ace. Complement). CPL. (l's. ***********************************************************************. 27. Decimal. DAA. Adjust. Acc.. ***********************************************************************. 35 DD3505 FD3505 3D 05 OB OD. 15. IB ID 25 2B DD2B FD2B 2D 3B. DEC DEC DEC DEC DEC DEC DEC DEC DEC DEC DEC DEC DEC DEC DEC DEC. (HL) (IX+d) (1Y+d). Decrement Operand. If isd O. A B BC C D. DE E H. HL. IX IY L SP. A4. is Omitted. Assumed.

(47) APPENDIX. object. A:. Z80. Source Statement. Code. F3. DI. 102E. DJNZ. MNEMONIC. MACHINE. INSTRUCTION. Operation. CODES. Notes. Disable. Interrupts *********************************************************************** e. Decrement. B. and. Relative if B=O *********************************************************************k* EB Enable Interrupts EI *********************************************************************** Jump. E3 DDE3 FDE3. EX EX EX. (SP),HL (SP),IX (SP),IY. Exchange Location and (SE'). *******************k**************************************************k 08. ****-. EB. EX. ·. AF,AF'. Exchange the Contents of AF and AF'. -**************************************************************** "'. DE,HL. Exchange the Con"ents of DE and HL. *****************************************************************Z+·. D9. *kE. Exchange the Content-s of BC,DE,HL with Contents of BC',DE',HL' Respec-. EXX. t1vely **********************k*************k********" -******************* 76 HALT HALT (wait for Inter·*7G. rupt. or Reset). *********************************************************************** ED46 IM Set Interrupt Mode ED56 O. Ib1. ED5E. IPl. l2. *********************************************************************** A,(C) Load Reg. with Input IK. ED78 ED40 EDJ8 ED50 ED58 ED60 ED68. IN IN IN IN IN IN. E3,(C). from Device. (C). C,(C) D,(C) E,(C) H,(C) L,(C). ***********************************************************************. 34 DD340% FD3405 3C 04 03 QC. 14 13. lC 24 23 DD23 FD23. INC INC INC INC IN"C INC INC INC INC INC INC INC INC INC. (HL) (Ix+d) (1Y"d). Increment. Operand. If isd O. A B BC C D. DE E H. HL. IX IY. A5. is Omitted. Assumed.

(48) APPENDIX. A:. Z80. object. 33. MACHINE. INSTRUCTION. Source Statement. Code. 2c. MNEMONIC. INC INC. L SP. CODES. operation Increment. Notes. Operand. *********************************************************************** Load Acc. with IN A,(n) Input from Device n ***********************************************************************. DB20. EDAA. Load Location (HL) from Port with Input (C), Decrement HL and B. IND. *k*********************************************************************. EDBA. Load Location (HL) from Port with Input (C), Decrement HI, and Decrement B, Repeat until B=O. INDR. ***********************************************************************. EDA2. Load Location (HL) from Port with Input (C); Increment HL and Decrement B. INI. *************************************************************k******k**. EDB2. Load Location (HL) from Port with Input (C), Increment HL and Decrement B, Repeat until B=O. INIR. *******************************************k***************************. C38405 E9 DDE9 FDE9. JP JP JP JP. nn. (HL) (IX) (IY). Unconditional to Location. jump. *********************************************************************** JP jump to Location C,nn. DA8405 FA8405 D28405 C28405 F28405 EA8405 E28405 CA8405. JP JP JP JP JP JP JP. M,nn NC,nn NZ,nn P,nn PE,nn PO,nn Z,nn. Condtion. if. True. *************************************************************k********* JR C,e jump Relative to. 382E 302E 202E 282E. JR JR JR. NC,e NZ,e Z,e. PC+e. True. if. Condition. ***********************************************************************. 182E. JR. e. Uncondtional. jump. Relative to *********************************************************************** 02 LD Load Source to (BC),A 12 LD (DE),A Destination PC+e. A6.

Referenzen

ÄHNLICHE DOKUMENTE

The a BUILD during execution of only time that REVAS mode the during the sets automatically lock is creation of symbol branch-type the arguments for of instructions such table

Display system ARTICLES/FEATURES menu Enter private message Sysop to Display system bulletins Exit system without leaving private comments Chat with Sysop after calling Enter a

In order to further emphasise the significance of the work in the explosives security area, the Council has approved several conclusions: In April 2010 the Council endorsed

The red-green government of Chancellor Gerhard Schröder enforced promotion of electricity produced from renewable energy sources and the gradual restriction of

Historically, a leader in multi-user system technology, Altos has designed the Series 600 to provide higher performance in the the low-end UNIX market.. As a

This element of interaction between the components of hardware and orgware is crucial to the system and, for a conventional type of an organized

– All the considered classification algorithms, both supervised and non, agree that by using the RMS of tremor as the only feature, only events belonging to class P can be

Total population (in millions) of the European Union (EU-25) in 2050, according to alternative projections assuming a wide range of fertility and annual net migration levels..