ABSTRACT

Assembly language is simply a programming tool to facilitate the generation of a sequence of bytes representing machine instructions and data.  ese bytes can be generated directly in memory or stored in a ¢le that can be later loaded into memory in preparation for execution.  e job of the assembly language programmer is to write instructions that will cause the assembler to generate the desired bytes. Frequently, there are several ways to accomplish this task. For example, the two-byte sequence 0x03, 0x95 can be generated using any of the following assembly language statements:

Since the goal was to produce a sequence of two bytes, the ¢rst statement provides the most obvious and direct solution. It uses a single de¢ne byte directive specifying a sequence of bytes to be assembled in the order they are listed.  is is the purpose of the de¢ne byte directive.  e second statement de¢nes a word (using the de¢ne word directive) representing the value 38,147. In hexadecimal, this is 0x9503. Because word data is assembled in reverse byte order (little-endian order), the ¢rst byte is placed last in the word; the end result is indistinguishable from that of the previous directive.  e last statement uses an instruction mnemonic (INC) and a register operand.  e assembler dutifully assembles the two-byte instruction which happens to correspond to the hexadecimal value 0x9503; this

value is also byte reversed when placed in memory, resulting in the same pair of bytes.