A. Simplified Segment Directives: (.Exe Program Format)
A. Simplified Segment Directives: (.Exe Program Format)
b. Assemble the Assembler Source Code file. It will generate as output an Object File.
[ example: EXERCISE1.OBJ ]
To assemble, use the following command:
TASM <source file>
Example:
TASM EXERCISE1
c. Link the Object File. It will generate as an output an Executable file.
[ example: EXERCISE1.EXE ]
To link, use the following command:
TLINK <object file>
Example:
TLINK EXERCISE1
d. Execute the program by just typing the filename.
[ example: EXERCISE1]
e. If your source code uses a COM program format, do steps A to C. Notice that when you link
the object file, a warning message is display: “Warning: No stack”. Then convert the
generated exe file into com file.
To convert exe file into com file:
EXE2BIN <exe source file> <com destination file>
Example:
EXE2BIN EXERCISE1 EXER1
Note: It does not display “$” and special control characters like
hex 07 (beep), 08 (backspace), 10 (carriage return ), 13 (first column)
.code
:: ::
mov ah, 0Ah ; Input service
lea dx, <var> ; write the variable name
int 21h
Exercises:
1. What is the hex value for the bottom rightmost location on an 80-column screen?
2. Code the instruction to set the cursor to row 12, column 8.
3. Code the instruction to clear the screen beginning at row 12, column 0, through row 22,
column 79 with text color cyan (3) on background green (2).
4. Code data items and instructions to display a message “What is the date (mm/dd/yy)?”.
Follow the message with a beep sound. Use (a) original DOS services and (b) extended
DOS services with file handles.
5. Code data items and instructions to accept data from the keyboard according to the format in
problem 4. Use (a) original DOS and (b) extended DOS
CpE 321 Lab – Assembly Language Programming Page # 7
1. Register – displays the hexadecimal contents of all the registers, plus the alphabetic flag
settings, and the next instruction to be executed.
- displays the hexadecimal contents of a single register with the option of changing those
contents.
Syntax:
-R or – R [registername]
Flag settings:
Flag name Set Clear
Overflow (Yes/No) OV NV
Direction (dec/inc) DN UP
Interrupt (enable/disable) EI DI
Sign (negative/positive) NG PL
Zero (yes/no) ZR NZ
Auxiliary carry (yes/no) AC NA
Parity (even/odd) PE PO
Carry (yes/no) CY NC
You can also change directly the content of the register (in hexadecimal) by typing:
- R <registername>
<registername> <value>
: <input value>
2. Trace – executes one or more instructions starting with the instruction at CS:IP or at =
address if it is specified. The = must be entered. One instruction is assumed, but you
can specify more than one with value. It also displays the contents of all registers and
flags after each instruction executes.
Syntax:
- T [=address] [value]
Example:
- T = 0000 2 this will trace and display 2 instructions starting after 0000
3. Unassemble – translates the contents of memory into assembler-like statement and displays
their addresses and hexadecimal values, together with assembler-like statements. If
range is not specified, it will display the first 32 bytes.
Syntax:
- U [address] or - U [range]
Example:
- U 0000 or - U 0000 000E
4. Dump – displays the contents of a portion of memory. If range is not given, it will dump 128
bytes of data.
Syntax:
- D [address] or D [range]
Syntax:
- A [address]
Example:
-a
24A9:0000 mov ax,20
CpE 321 Lab – Assembly Language Programming Page # 9
Syntax:
- E address [list]
7. Fill – fills the memory locations in the range with the values in the list. If range is not given, it
will fill up 128 bytes of data.
Syntax:
- F range list or - F address list
8. Go – executes the program you are debugging. It stops the execution when the instruction at
a specified address is reached (breakpoint), and displays the registers, flags and the
next instruction to be executed.
Syntax:
- G [=address] [address [address…] ]
9. Hexarithmetic – adds the two hexadecimal values, then subtracts the second from the first.
Syntax:
- H value1 value2
10. Proceed – Causes the execution of a subroutine call, a loop instruction, an interrupt or a
repeat string instruction to stop at the next instruction.
Syntax:
- P [address] [value]