X-Authentication-Warning: kendall.sfbr.org: jeffw set sender to jeffw AT darwin DOT sfbr DOT org using -f Date: Fri, 2 Feb 2001 14:13:02 -0600 From: JT Williams To: djgpp-workers AT delorie DOT com Cc: Bill Currie Subject: djasm.txi patch Message-ID: <20010202141302.A7211@kendall.sfbr.org> Mail-Followup-To: djgpp-workers AT delorie DOT com, Bill Currie Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i Reply-To: djgpp-workers AT delorie DOT com Here's a partial patch for djasm.txi (the part that adds discussion of enumeration type). Could a few extra eyes read this over before I commit it? I'm not sure about some of the markup. Thanks. (And thanks, Bill, for making it so easy ;-) -- jtw --- djasm.txi Sun Jan 14 16:45:43 2001 +++ ./my-djasm-docs/djasm.txi Fri Feb 2 14:00:07 2001 @@ -743,6 +783,76 @@ system tables). @comment node-name, next, previous, up +@node Enumerations +@subsubsection Enumerations + +@pindex enumeration +@cindex type AT r{, enumeration} + +The enumeration type allows arbitrary mnemonic identifiers (the +`enumeration constants') to be mapped to a set of integer values. +A textbook example is that of defining a boolean variable. +The following construct defines @samp{boolean} as an enumeration +type that can take the values 0 (false) or 1 (true). + +@example +.enum boolean + false + true +.ends +@end example + +@noindent +In this example, @samp{pets} is defined to be an enumeration type +having integral values 0 (bird), 1 (cat), 2 (dog), or 3 (rock). + +@example +.enum pets + bird + cat + dog + rock +.ends +@end example + +@noindent +The above enumeration types could then be referenced as follows: + +@example +.start + nop + mov ax,true ; ax <- 1 + mov bx,pets.dog ; bx <- 2 + mov cx,pets.rock ; cx <- 3 + mov dx,pets.bird ; dx <- 0 + int 0x20 +@end example + +If the enumeration constants are not explicitly initialized, then they +are assigned consecutive integer values starting with zero. +Explicitly and implicitly initialized enumeration constants can be +used within the same enumeration type, in which case an enumeration +constant without an initializer will be assigned either the predecessor +or successor of the adjacent enumeration constant. + +In this example, the enumeration constants @samp{foo}, @samp{bar}, +and @samp{e} are implicitly initialized. +The enumeration @samp{snafu} therefore takes one of the following integer +values: foo (-1), bar (0), a (1), b (2), c (4), d (8), or e (9). + +@example +.enum snafu + foo + bar + a=1 + b=2 + c=4 + d=8 + e +.ends +@end example + +@comment node-name, next, previous, up @node Prefixes @subsection Segment Override Prefixes