NGASM 8086/8088 Assembler v1.4 Beta 2 - Assembler Directives



Download
NGASM 8086/8088 Assembler v1.4 Beta 2

NGASM 8086/8088 Assembler v1.4 Beta 2 is the simplest 8086/8088 Assembler you can find. It has only 5 directives which you can easily master. Don't underestimate their usefulness. Using just these we created every newer version of our own Assembler.

NGASM 8086/8088 Assembler v1.4 Beta 2 supports three basic data declaration directives, a directive for declaring structure templates and a directive for declaring EQUates (5 in total). The not-counted one is the COMMENT directive. They are listed below with example declarations.

The DB directive
The DW directive
The DD directive
The STRUCT (or STRUC) and ENDS directives (counted as one)
The EQU Directive
The COMMENT directive (not counted)

Data declaration directives:

  1. DB - The DB directive is used to declare a BYTE - A BYTE is made up of 8 bits

    Declaration examples:

    Byte1   DB  10h
    Byte2   DB  255     ;0FFh, the maximum possible for a BYTE

    CRLF     DB  0Dh, 0Ah, 24h     ;Carriage Return, Line Feed, DOS string terminator BYTEs


  2. DW - The DW directive is used to declare a WORD - A WORD is made up of 16 bits (2 BYTEs)

    Declaration examples:

    Word1    DW  1234h
    Word2    DW  65535     ;0FFFFh, the maximum possible for a WORD


  3. DD - The DD directive is used to declare a DWORD - A DWORD (doubleword) is made up of 32 bits (2 WORDs or 4 BYTEs)

    Declaration examples:

    Dword1    DW  12345678h
    Dword2    DW  4294967295     ;0FFFFFFFFh, the maximum possible for a DWORD

NGASM 8086/8088 Assembler v1.4 Beta 2 supports the STRUCT (or STRUC) and ENDS directives to define a structure template for grouping data items.

The STRUCT (or STRUC) directive
The ENDS directive

The STRUCT or STRUC directive tells the assembler that a user defined uninitialized data structure follows. The uninitialized data structure consists of a combination of the three supported data types viz. DB, DW, and DD. The uninitialized data structure specifies the labels (names) for the elements in the structure and the elements' data types. The labels serve as zero-based offsets into the structure. The first element's offset for any structure is 0. A structure element is referenced with the base and/or index registers by applying the "+" operator before the element's name.

A Structure ends with the ENDS directive (meaning END of Structure).

Syntax

  STRUCT
  Structure_element_name   element_data_type  ?
  .                        .                  .
  .                        .                  .
  .                        .                  .
  ENDS

  (OR)

  STRUC
  Structure_element_name   element_data_type  ?
  .                        .                  .
  .                        .                  .
  .                        .                  .
  ENDS

Declaration example:

STRUCT

Byte1   DB  ?
Byte2   DB  ?
Word1   DW  ?
Word2   DW  ?
Dword1  DW  ?
Dword2  DW  ?
ENDS

Use of STRUCT:

Apart from grouping data items, the STRUCT directive enables you to change the order of items in the structure when, say, you reform a file header (of yours) and shuffle the data items there. Shuffle the data items in the file header and reformat the sequence of data declaration in the STRUCT and off you go. No change in the code you wrote that processes the file header is necessary unless you inserted an extra data element that needs to be processed too in your code.


The EQU Directive

The EQU (EQUate) directive declares a symbolic name for a value. The value can be in the range 0 through 65535 and it can be another EQUate declared anywhere above or below.

The following operators can also be used to declare an EQUate:

THIS BYTE
THIS WORD
THIS DWORD
$.

A variable - declared with a DB, DW, or DD directive - has an address and has space reserved at that address for it in the .COM file. But an EQUate does not have an address or space reserved for it in the .COM file.

Syntax

  label EQU value

  label is a symbolic name (not a nametag for a memory location as in
  the case of variables) and is compulsory. The symbolic name represents
  the value specified.

  value is the value that is used to replace the symbolic name wherever
  it is found in the assembly source code file during assembly time (not
  when the program is run).

  When an immediate value (Imm16) or $ or another EQUate is the value
  specified, that value is used to replace the symbolic name wherever it is
  found. When the EQUate is declared using THIS BYTE, THIS WORD, and THIS
  DWORD, it behaves like a variable of type byte, word, or doubleword
  respectively and its offset address is used to replace the symbolic name
  wherever the symbolic name is found in the assembly source code file. 
Example:

  a_byte      EQU  THIS BYTE
              DB   10
  a_word      EQU  THIS WORD
              DW   1000
  a_dword     EQU  THIS DWORD
              DD   4294967295

  BufferSize  EQU  1024
  buffer      DB   1024 DUP(0)
  bufend_ptr  EQU  $         ;actually points to the next byte after the
                             ;1024th byte in buffer.

The COMMENT directive

The COMMENT directive is useful for writing multi-line comments anywhere in the source code file. Usually a multi-line comment should start with the COMMENT directive. A delimiter character is placed one or more space characters after the COMMENT directive; a second instance of the same delimiter character ends the whole comment. All texts between the identical delimiter characters are ignored together with everything else on the last line of comment.

Examples showing multi-line comments:

      COMMENT 'This comment
      runs across two lines'

      COMMENT ^ This comment occupies
      three lines
      ^

      COMMENT 'This comment ends in this line itself'







Home     |     Awards     |     RECOVER Floppy Pro v1.0     |     RECOVER Fixed/Floppy Disk FAT32/16/12 v3.0    | Recover Fixed/Floppy Disk v2.2    |     ANALYZER for RECOVER Floppy Pro v0.3 FREEWARE    |     ANALYZER for RECOVER Fixed/Floppy Disk v0.3 FREEWARE    |     Dealing with Multiple Disk Errors     |     100% Data Recovery - How-to    | Floppy Disk Recovery    |    RFD v1.4  FREEWARE    |    NGASM 8086/8088 Assembler    |    Delete Special    |    Search Zip Rar

Google
Systech Software
G.Namasivayam & G.Gurupandian 16, South Veli Street, Madurai Pin 625001, Tamil Nadu, India
E-Mail:info@www.bestdiskrecovery.com





eXTReMe Tracker
FREE hit counter and Internet traffic statistics from freestats.com