home *** CD-ROM | disk | FTP | other *** search
/ Simtel MSDOS - Coast to Coast / simteldosarchivecoasttocoast2.iso / asmutil / a86v322.zip / A09.DOC < prev    next >
Text File  |  1989-10-03  |  26KB  |  615 lines

  1. CHAPTER 9   DIRECTIVES IN A86
  2.  
  3.  
  4. Segments in A86
  5.  
  6. The following discussion applies when A86 is assembling a .COM
  7. See the next chapter for the discussion of segmentation for .OBJ
  8. files.
  9.  
  10. A86 views the 86 computer's memory space as having two parts: The
  11. first part is the program, whose contents are the object bytes
  12. generated by A86 during its assembly of the source.   A86 calls
  13. this area the CODE SEGMENT.  The second part is the data area,
  14. whose contents are generated by the program after it starts
  15. running.  A86 calls this area the DATA SEGMENT.
  16.  
  17. Please note well that the only difference between the CODE and
  18. DATA segments is whether the contents are generated by the
  19. program or the assembler.  The names CODE and DATA suggest that
  20. program code is placed in the CODE segment, and data structures
  21. go in the DATA segment.  This is mostly true, but there are
  22. exceptions.  For example, there are many data structures whose
  23. contents are determined by the assembler: pointer tables, arrays
  24. of pre-defined constants, etc.  These tables are assembled in the
  25. CODE segment.
  26.  
  27. In general, you will want to begin your program with the
  28. directive DATA SEGMENT, followed by an ORG statement giving the
  29. address of the start of your data area.  You then list all your
  30. program variables and uninitialized data structures, using the
  31. directives DB, DW, and STRUC.  A86 will allocate space starting
  32. at the address given in the ORG statement, but it will not
  33. generate any object bytes in that space.  After your data segment
  34. declarations, you provide a CODE SEGMENT directive.  If the
  35. program starts at any location other than the standard 0100, you
  36. give an ORG giving the address of the start of your program.  You
  37. follow this with the program itself, together with any
  38. assembler-generated data structures.  A short program
  39. illustrating this suggested usage follows:
  40.  
  41. DATA SEGMENT
  42. ORG 08000
  43.   ANSWER_BYTE  DB ?
  44.   CALL_COUNT   DW ?
  45.  
  46. CODE SEGMENT
  47.   JMP MAIN
  48.  
  49. TRAN_TABLE:
  50.   DB 16,3,56,23,0,9,12,7
  51.  
  52. MAIN:
  53.   MOV BX,TRAN_TABLE
  54.   XLATB
  55.   MOV ANSWER_BYTE,AL
  56.   INC CALL_COUNT
  57.   RET
  58.                                                               9-2
  59.  
  60. A86 allows you to intersperse CODE SEGMENTs and DATA SEGMENTs
  61. throughout your program; but in general it is best to put all
  62. your DATA SEGMENT declarations at the top of your program, to
  63. avoid problems with forward referencing.
  64.  
  65.  
  66. CODE ENDS and DATA ENDS Statements
  67.  
  68. For compatibility with Intel/IBM assemblers, A86 provides the
  69. CODE ENDS and DATA ENDS statements.  The CODE ENDS statement is
  70. ignored; we assume that you have not nested a CODE segment inside
  71. a DATA segment.  The DATA ENDS statement is equivalent to a CODE
  72. SEGMENT statement.
  73.  
  74.  
  75.  
  76. The ORG Directive
  77.  
  78. Syntax:  ORG address
  79.  
  80. ORG moves the output pointer (the location counter at which
  81. assembly is currently taking place within the current segment) to
  82. the value of the operand, which should be an absolute constant,
  83. or an expression evaluating to an absolute,
  84. non-forward-referenced constant.
  85.  
  86. ORG is most often used in a DATA segment, to control the location
  87. of the data area within the segment.  For example, in programs
  88. that fit entirely into 64K, you provide an ORG directive as the
  89. first line within your DATA segment at the top of your program.
  90. The location given by the ORG is some location that you are sure
  91. will be beyond the end of your program.  If you are sure that
  92. your program will not go beyond 8K (02000 hex), your program can
  93. look like this:
  94.  
  95. DATA SEGMENT
  96. ORG 02000       ; data goes here, beyond the end of the program
  97.  
  98. (your data segment variable and buffer declarations go here)
  99.  
  100. DATA ENDS
  101.  
  102. (your program goes here)
  103.                                                               9-3
  104.  
  105. There is a special side effect to ORG when it is used in the CODE
  106. segment.  If you begin your code segment with ORG 0, then A86
  107. knows that you are not assembling a .COM program; but are instead
  108. assembling a code segment to be used in some other context
  109. (examples: programming a ROM, or assembling a procedure for older
  110. versions of Turbo Pascal).  The output file will start at 0, not
  111. 0100 as in a .COM file; and the default extension for the output
  112. file will be .BIN, not .COM.
  113.  
  114. Other than in the above example, you should not in general issue
  115. an ORG within the CODE segment that would lower the value of the
  116. output pointer.  This is because you thereby put yourself in
  117. danger of losing part of your assembled program.  If you
  118. re-assemble over space you have already assembled, you will
  119. clobber the previously-assembled code.  Also, be aware that the
  120. size of the output program file is determined by the value of the
  121. code segment output pointer when the program stops.  If you ORG
  122. to a lower value at the end of your program, the output program
  123. file will be truncated to the lower-value address.
  124.  
  125. Again, almost no program producing a .COM file will need any ORG
  126. directive in the code segment.  There is an implied ORG 0100 at
  127. the start of the program.  You just start coding instructions,
  128. and the assembler will put them in the right place.
  129.  
  130.  
  131. The EVEN Directive
  132.  
  133. Syntax:  EVEN
  134.  
  135. The EVEN directive coerces the current output pointer to an even
  136. value.  In a DATA SEGMENT or STRUC, it does so by adding 1 to the
  137. pointer if the pointer was odd; doing nothing if the pointer was
  138. already even.  In a code segment, it outputs a NOP if the pointer
  139. was odd.  EVEN is most often used in data segments, before a
  140. sequence of DW directives. The 16-bit machines of the 86 family
  141. fetch words more quickly when they are aligned onto even
  142. addresses; so the EVEN directive insures that your program will
  143. have the faster access to those DW's that follow it.  (This speed
  144. improvement will not be seen on the 8-bit machines, most notably
  145. the 8088 of the original IBM-PC.)
  146.  
  147.  
  148. Data Allocation Using DB, DW, DD, DQ, and DT
  149.  
  150. The 86 computer family supports the three fundamental data types
  151. BYTE, WORD, and DWORD.  A byte is eight bits, a word is 16 bits
  152. (2 bytes), and a doubleword is 32 bits (4 bytes).  In addition,
  153. the 87 floating point processor manipulates 8-byte quantities,
  154. which we call Q-words, and 10-byte quantities, which we call
  155. T-bytes.  The A86 data allocation statement is used to specify
  156. the bytes, words, doublewords, Q-words, and T-bytes which your
  157. program will use as data.  The syntax for the data allocation
  158. statement is as follows:
  159.                                                               9-4
  160.  
  161. (optional var-name)  DB  (list of values)
  162. (optional var-name)  DW  (list of values)
  163. (optional var-name)  DD  (list of values)
  164. (optional var-name)  DQ  (list of values)
  165. (optional var-name)  DT  (list of values)
  166.  
  167. The variable name, if present, causes that name to be entered
  168. into the symbol table as a memory variable with type BYTE (for
  169. DB), WORD (for DW), DWORD (for DD), QWORD (for DQ), or TBYTE (for
  170. DT). The variable name should NOT have a colon after it, unless
  171. you wish the name to be a label (instructions referring to it
  172. will interpret the label as the constant pointer to the memory
  173. location, not its contents).
  174.  
  175. The DB statement is used to reserve bytes of storage; DW is used
  176. to reserve words.  The list of values to the right of the DB or
  177. DW serves two purposes.  It specifies how many bytes or words are
  178. allocated by the statement, as well as what their initial values
  179. should be.  The list of values may contain a single value or more
  180. than one, separated by commas.  The list can even be missing;
  181. meaning that we wish to define a byte or word variable at the
  182. same location as the next variable.
  183.  
  184. If the data initialization is in the DATA segment, the values
  185. given are ignored, except as place markers to reserve the
  186. appropriate number of units of storage.  The use of "?", which in
  187. .COM mode is a synonym for zero, is recommended in this context
  188. to emphasize the lack of actual memory initialization. When A86
  189. is assembling .OBJ files, the ?-initialization will cause a break
  190. in the segment (unless ? is embedded in a nested DUP containing
  191. non-? terms, in which case it is a synonym for zero).
  192.  
  193. A special value which can be used in data initializations is the
  194. DUP construct, which allows the allocation and/or initialization
  195. of blocks of data.  The expression  n DUP x  is equivalent to a
  196. list with x repeated n times.  "x" can be either a single value,
  197. a list of values, or another DUP construct nested inside the
  198. first one.  The nested DUP construct needs to be surrounded by
  199. parentheses.  All other assemblers, and earlier versions of A86,
  200. require parentheses around all right operands to DUP, even simple
  201. ones; but this requirement has been removed for simple operands
  202. in the current A86.
  203.  
  204. Here are some examples of data initialization statements, with
  205. and without DUP constructs:
  206.  
  207. CODE SEGMENT
  208.   DW 5                  ; allocate one word, init. to 5
  209.   DB 0,3,0              ; allocate three bytes, init. to 0,3,0
  210.   DB 5 DUP 0            ; equivalent to DB 0,0,0,0,0
  211.   DW 2 DUP (0,4 DUP 7)  ; equivalent to DW 0,7,7,7,7,0,7,7,7,7
  212.                                                               9-5
  213.  
  214. DATA SEGMENT
  215. XX      DW ?            ; define a word variable XX
  216. YYLOW   DB              ; no init value: YYLOW is low byte of word var YY
  217. YY      DW ?
  218. X_ARRAY DB  100 DUP ?   ; X_ARRAY is a 100-byte array
  219. D_REAL  DQ ?            ; double precision floating variable
  220. EX_REAL DT ?            ; extended precision floating variable
  221.  
  222. A character string value may be used to initialize consecutive
  223. bytes in a DB statement.  Each character will be represented by
  224. its ASCII code.  The characters are stored in the order that they
  225. appear in the string, with the first character assigned to the
  226. lowest-addressed byte.  In the DB statement that follows, five
  227. bytes are initialized with the ASCII representation of the
  228. characters in the string 'HELLO':
  229.  
  230. DB 'HELLO'
  231.  
  232. Note that except for string comparisons described in the previous
  233. chapter, the DB directive is the only place in your program that
  234. strings of length greater than 2 may occur.  In all other
  235. contexts (including DW), a string is treated as the constant
  236. number representing the ASCII value of the string; for example,
  237. CMP AL,'@' is the instruction comparing the AL register with the
  238. ASCII value of the at-sign.  Note further that 2-character string
  239. constants, like all constants in the 8086, have their bytes
  240. reversed.  Thus, while DB 'AB' will produce hex 41 followed by
  241. hex 42, the similar looking DW 'AB' reverses the bytes: hex 42
  242. followed by hex 41.
  243.  
  244. For compatibility, A86 now accepts double quotes, as well as
  245. single quotes, for strings in DB directives.
  246.  
  247.  
  248. The DD directive is used to initialize 32-bit doubleword pointers
  249. to locations in arbitrary segments of the 86's memory space.
  250. Values for such pointers are given by two numbers separated by a
  251. colon.  The segment register value appears to the left of the
  252. colon; and the offset appears to the right of the colon.  In
  253. keeping with the reversed-bytes nature of memory storage in the
  254. 86 family, the offset comes first in memory.  For example, the
  255. statement
  256.  
  257.    DD   01234:05678
  258.  
  259. appearing in a CODE segment will cause the hex bytes 78 56 34 12
  260. to be generated, which is a long pointer to segment 01234, offset
  261. 05678.
  262.  
  263. DD, DQ, and DT can also be used to initialize large integers and
  264. floating point numbers.  Examples:
  265.  
  266.   DD 500000   ; half million, too big for most 86 instructions
  267.   DD 3.5      ; single precision floating point number
  268.   DQ 3.5      ; the same number in a double precision format
  269.   DT 3.5      ; the same number in an extended precision format
  270.                                                               9-6
  271.  
  272. The STRUC Directive
  273.  
  274. The STRUC directive is used to define a template of data to be
  275. addressed by one of the 8086's base and/or index registers.  The
  276. syntax of STRUC is as follows:
  277.  
  278. (optional strucname)  STRUC  (optional effective address)
  279.  
  280. The optional structure name given at the beginning of the line
  281. can appear in subsequent expressions in the program, with the
  282. operator TYPE applied to it, to yield the number of bytes in the
  283. structure template.
  284.  
  285. The STRUC directive causes the assembler to enter a mode similar
  286. to DATA SEGMENT: assembly within the structure declares symbols
  287. (the elements of the structure), using a location counter that
  288. starts out at the address following STRUC.  If no address is
  289. given, assembly starts at location 0.  An option not available to
  290. the DATA SEGMENT is that the address can include one base
  291. register [BX] or [BP] and/or one index register [SI] or [DI]. The
  292. registers are part of the implicit declaration of all structure
  293. elements, with the offset value increasing by the number of bytes
  294. allocated in each structure line. For example:
  295.  
  296. LINE STRUC [BP]        ; the template starts at [BP]
  297.        DB 80 DUP (?)   ; these 80 bytes advance us to [BP+80]
  298. LSIZE  DB ?            ; this 1 byte advances us to [BP+81]
  299. LPROT  DB ?
  300.      ENDS
  301.  
  302. The STRUC just given defines the variables LSIZE, equivalent to
  303. B[BP+80], and LPROT, equivalent to B[BP+81].  You can now issue
  304. instructions such as MOV AL,LSIZE; which automatically generates
  305. the correct indexing for you.
  306.  
  307. The mode entered by STRUC is terminated by the ENDS directive,
  308. which returns the assembler to whatever segment (CODE or DATA) it
  309. was in before the STRUC, with the location counter restored to
  310. its value within that segment before the STRUC was declared.
  311.  
  312.  
  313.  
  314. Forward References
  315.  
  316. A86 allows names for a variety of program elements to be forward
  317. referenced.  This means that you may use a symbol in one
  318. statement and define it later with another statement.  For
  319. example:
  320.  
  321.   JNZ TARGET
  322.   .
  323.   .
  324. TARGET:
  325.   ADD AX,10
  326.                                                               9-7
  327.  
  328. In this example, a conditional jump is made to TARGET, a label
  329. farther down in the code.  When JNZ TARGET is seen, TARGET is
  330. undefined, so this is a forward reference.
  331.  
  332. Earlier versions of A86 were much more restricted in the kinds of
  333. forward references allowed.  Most of the restrictions have now
  334. been eased, for convenience as well as compatibility with other
  335. assemblers.  In particular, you may now make forward references
  336. to variable names.  You just need to see to it that A86 has
  337. enough information about the type of the operand to generate the
  338. correct instruction.  For example, MOV FOO,AL will cause A86 to
  339. correctly deduce that FOO is a byte variable.  You can even code
  340. a subsequent MOV FOO,1 and A86 will remember that FOO was assumed
  341. to be a byte variable.  But if you code MOV FOO,1 first, A86
  342. won't know whether to issue a byte or a word MOV instruction; and
  343. will thus issue an error message.  You then specify the type by
  344. MOV FOO B,1.
  345.  
  346. In general, A86's compatibility with That Other assembler has
  347. improved dramatically for forward references.  Now, for most
  348. programs, you need only sprinkle a very few B's and W's into your
  349. references.  And you'll be rewarded: in many cases the word form
  350. is longer than the byte form, so that the other assembler winds
  351. up inserting a wasted NOP in your program.  You'll wind up with
  352. tighter code by using A86!
  353.  
  354.  
  355. Forward References in Expressions
  356.  
  357. A86 now allows you to add or subtract a constant number from a
  358. forward reference symbol; and to append indexing registers to a
  359. forward reference symbol.  This covers a vast majority of
  360. expressions formerly disallowed.  For the remaining, more
  361. complicated expressions, there is a trick you can use to work
  362. your way around almost any case where you might run into a
  363. forward reference restriction.  The trick is to move the
  364. expression evaluation down in your program so that it no longer
  365. contains a forward reference; and forward reference the
  366. evaluation answer.  For example, suppose you wish to advance the
  367. ES segment register to point immediately beyond your program. If
  368. PROG_SIZE is the number of bytes in your program, then you add
  369. (PROGSIZE+15)/16 to the program's segment register value. This
  370. value is known at assembly time; but it isn't known until the end
  371. of the program.  You do the following:
  372.  
  373.      MOV AX,CS        ; fetch the program's segment value
  374.      ADD AX,SEG_SIZE  ; use a simple forward reference
  375.      MOV ES,AX        ; ES is now loaded as desired
  376.  
  377. Then at the end of the program you evaluate the expression:
  378.  
  379.      PROG_SIZE EQU $
  380.      SEG_SIZE EQU (PROG_SIZE+15)/16
  381.                                                               9-8
  382.  
  383. The EQU Directive
  384.  
  385. Syntax:  symbol-name EQU expression
  386.          symbol-name EQU built-in-symbol
  387.          symbol-name EQU INT n
  388.  
  389. The expression field may specify an operand of any type that
  390. could appear as an operand to an instruction.
  391.  
  392. As a simple example, suppose you are writing a program that
  393. manipulates a table containing 100 names and that you want to
  394. refer to the maximum number of names throughout the source file.
  395. You can, of course, use the number 100 to refer to this maximum
  396. each time, as in MOV CX,100, but this approach suffers from two
  397. weaknesses.  First of all, 100 can mean a lot of things; in the
  398. absence of comments, it is not obvious that a particular use of
  399. 100 refers to the maximum number of names.  Secondly, if you
  400. extend the table to allow 200 names, you will have to locate each
  401. 100 and change it to a 200.  Suppose, instead, that you define a
  402. symbol to represent the maximum number of names with the
  403. following statement:
  404.  
  405. MAX_NAMES EQU 100
  406.  
  407. Now when you use the symbol MAX_NAMES instead of the number 100
  408. (for example, MOV CX,MAX_NAMES), it will be obvious that you are
  409. referring to the maximum number of names in the table.  Also, if
  410. you decide to extend the table, you need only change the 100 in
  411. the EQU directive to a 200 and every reference to MAX_NAMES will
  412. reflect the change.
  413.  
  414. You could also take advantage of A86's strong typing, by changing
  415. MAX_NAMES to a variable:
  416.  
  417. MAX_NAMES  DB ?
  418.  
  419. or even an indexed quantity:
  420.  
  421. MAX_NAMES EQU [BX+1]
  422.  
  423. Because the A86 language is strongly typed, the instruction for
  424. loading MAX_NAMES into the CX register remains exactly the same
  425. in all cases: simply MOV CX,MAX_NAMES.
  426.                                                               9-9
  427.  
  428. Equates to Built-In Symbols
  429.  
  430. A86 allows you to define synonyms for any of the assembler
  431. reserved symbols, by EQUating an alternate name of your choosing,
  432. to that symbol.  For example, suppose you were coding a source
  433. module that is to be incorporated into several different
  434. programs.  In some programs, a certain variable will exist in the
  435. code segment.  In others, it will exist in the stack segment. You
  436. want to address the variable in the common source module, but you
  437. don't know which segment override to use.  The solution is to
  438. declare a synonym, QS, for the segment register.  QS will be
  439. defined by each program: the code-segment program will have a QS
  440. EQU CS at the top of it; the stack-segment program will have QS
  441. EQU SS.  The source module can use QS as an override, just as if
  442. it were CS or SS.  The code would be, for example, QS MOV
  443. AL,VARNAME.
  444.  
  445.  
  446. The NIL Prefix
  447.  
  448. A86 provides a mnemonic, NIL, that generates no code.  NIL can be
  449. used as a prefix to another instruction (which will have no
  450. effect on that instruction), or it can appear by itself on a
  451. line.  NIL is provided to extend the example in the previous
  452. section, to cover the possibility of no overrides.  If your
  453. source module goes into a program that fits into 64K, so that all
  454. the segment registers have the same value, then code QS EQU NIL
  455. at the top of that program.
  456.  
  457.  
  458. Interrupt Equates
  459.  
  460. A86 allows you to equate your own name to an INT instruction with
  461. a specific interrupt number.  For example, if you place  TRAP EQU
  462. INT 3  at the top of your program, you can use the name TRAP as a
  463. synonym for INT 3  (the debugger trap on the 8086).
  464.  
  465.  
  466. Duplicate Definitions
  467.  
  468. A86 contains the unique feature of duplicate definitions.   We
  469. have already discussed local symbols, which can be redefined to
  470. different values without restriction.  Local symbols are the only
  471. symbols that can be redefined.  However, any symbol can be
  472. defined more than once, as long as the symbol is defined to be
  473. the same value and type in each definition.
  474.  
  475. This feature has two uses.  First, it eases modular program
  476. development.  For example, if two independently-developed source
  477. files both use the symbol ESC to stand for the ASCII code for
  478. ESCAPE, they can both contain the declaration ESC EQU 01B, with
  479. no problems if they are combined into the same program.
  480.                                                              9-10
  481.  
  482. The second use for this feature is assertion checking.  Your
  483. deliberate redeclaration of a symbol name is an assertion that
  484. the value of the symbol has not changed; and you want the
  485. assembler to issue you an error message if it has changed.
  486. Example: suppose you have declared a table of options in your
  487. DATA segment; and you have another table of initial values for
  488. those options in your CODE segment.  If you come back months
  489. later and add an option to your tables, you want to be reminded
  490. to update both tables in the same way.  You should declare your
  491. tables as follows:
  492.  
  493. DATA SEGMENT
  494.   OPTIONS:
  495.     .
  496.     .
  497.   OPT_COUNT EQU $-OPTIONS    ; OPT_COUNT is the size of the table
  498.  
  499. CODE SEGMENT
  500.   OPT_INITS:
  501.     .
  502.     .
  503.   OPT_COUNT EQU $-OPT_INITS  ; second OPT_COUNT had better be the same!
  504.  
  505.  
  506.  
  507. The = Directive
  508.  
  509. Syntax:  symbol-name = expression
  510.          symbol-name = built-in-symbol
  511.          symbol-name = INT n
  512.  
  513. The equals sign directive is provided for compatibility with That
  514. Other assembler.  It is identical to the EQU directive, with one
  515. exception: if the first time a symbol appears in a program is in
  516. an = directive, that symbol will be taken as a local symbol.  It
  517. can be redefined to other values, just like the generic local
  518. symbols (letter followed by digits) that A86 supports. (If you
  519. try to redefine an EQU symbol to a different value, you get an
  520. error message.) The = facility is most often used to define
  521. "assembler variables", that change value as the assembly
  522. progresses.
  523.  
  524.  
  525. The PROC Directive
  526.  
  527. Syntax:   name  PROC NEAR
  528.           name  PROC FAR
  529.           name  PROC
  530.  
  531. PROC is a directive provided for compatibility with Intel/IBM
  532. assemblers.  I don't like PROC; and I recommend that you do not
  533. use it, even if you are programming for those assemblers.
  534.                                                              9-11
  535.  
  536. The idea behind PROC is to give the assembler a mechanism whereby
  537. it can decide for you what kind of RET instruction you should be
  538. providing.  If you specify NEAR in your PROC directive, then the
  539. assembler will generate a near (same segment) return when it sees
  540. RET.  If you specify FAR in your PROC directive, the assembler
  541. will generate a far RETF return (which will cause both IP and CS
  542. to be popped from the stack).  If you simply leave well enough
  543. alone, and never code a PROC in your program, then RET will mean
  544. near return throughout your program.
  545.  
  546. The reason I don't like PROC is because it is yet another attempt
  547. by the assembler to do things "behind your back".  This goes
  548. against the reason why you are programming in assembly language
  549. in the first place, which is to have complete control over the
  550. code generated by your source program.  It leads to nothing but
  551. trouble and confusion.
  552.  
  553. Another problem with PROC is its verbosity.  It replaces a simple
  554. colon, given right after the label it defines.  This creates a
  555. visual clutter in the program, that makes the program harder to
  556. read.
  557.  
  558. A86 provides an explicit RETF mnemonic so that you don't need to
  559. use PROC to distinguish between near and far return instructions.
  560. You can use RET or a near return and RETF for a far return. Even
  561. if you are programming in that other assembler, and you need to
  562. code a far return, I recommend that you create a RETF macro (it
  563. would have the single line DB 0CBH), and stay away from PROCs
  564. entirely.
  565.  
  566.  
  567. The ENDP Directive
  568.  
  569. Syntax:  [name] ENDP
  570.  
  571. The only action A86 takes when it sees an ENDP directive is to
  572. return the assembler to its (sane) default state, in which RET is
  573. a near return.
  574.  
  575. NOTE that this means that A86 does not support nested PROCs, in
  576. which anything but the innermost PROC has the FAR attribute.  I'm
  577. sorry if I am blunt, but anybody who would subject their program
  578. to that level of syntactic clutter has rocks in their head.
  579.  
  580.  
  581. The LABEL Directive
  582.  
  583. Syntax:  name LABEL NEAR
  584.          name LABEL FAR
  585.          name LABEL BYTE
  586.          name LABEL WORD
  587.  
  588. LABEL is another directive provided for compatibility with
  589. Intel/IBM assemblers.  A86 provides less verbose ways of
  590. specifying all the above LABEL forms, except for LABEL FAR.
  591.                                                              9-12
  592.  
  593. LABEL defines "name" to have the type given, and a value equal to
  594. the current output pointer.  Thus, LABEL NEAR is synonymous with
  595. a simple colon following the name; and LABEL BYTE and LABEL WORD
  596. are synonymous with DB and DW, respectively, with no operands.
  597.  
  598. LABEL FAR does have a unique functionality, not found in other
  599. assemblers.  It identifies "name" as a procedure that can be
  600. called from outside this program's code segment.  Such procedures
  601. should have RETFs instead of RETs. Furthermore, I have provided
  602. the following feature, unique to A86: if you CALL the procedure
  603. from within your program, A86 will generate a PUSH CS instruction
  604. followed by a NEAR call to the procedure.  Other assemblers will
  605. generate a FAR call, having the same functional effect; but the
  606. FAR call consumes more program space, and takes more time to
  607. execute.
  608.  
  609. WARNING: you cannot use the above CALL feature as a forward
  610. reference; the LABEL FAR definition must precede any CALLs to it.
  611. This is unavoidable, since the assembler must assume that a CALL
  612. to an undefined symbol takes 3 program bytes.  All assemblers
  613. will issue an error in this situation.
  614.  
  615.