11th February
11th February
11th February
3. OBJECT
Exploring Assembly Language Programming
3. Assembly Language:
3.1 Definition
Assembly language programs are converted into executable machine code by a utility program
referred to as an assembler, the conversion process being referred to as assembly or assembling
the program.
IP Instruction Pointer
PC Program Counter
Points the next instruction to be executed.
Shows the address of next instruction.
Commands.
3.6.1. Memory Management Commands
C Compare the contents of two blocks of memory. D Display the contents of memory.
E Edit (Write) data into memory. F Fill the memory with a value. M Move the
contents of memory.
Command C: Compare the contents of two blocks of memory
Command syntax C<Range>,<Address>
For example, the bytes between DS:0100 and DS:0105 are compared to the bytes at DS:0200:
C 100 105 200
The following is displayed by Debug:
Command U: Disassemble a
program
Command syntax U [<Range>]
It is used to disassemble assembly language instructions into machine code. <Range> is used to
select a block of memory to disassemble. If <Range> is not specified, then the system will start
immediately after the final address of the last U command.
Exercise
For each add instruction in this exercise, assume that EAX contains the given contents before
the instruction is executed. Give the contents of EAX as well as the values of the CF, OF, SF, PF,
AF and ZF after the instruction is executed. All numbers are in hex. (Hint: add eax, 45 adds
45 to the contents of register eax and stores the result back in eax)
Q2. Write down the code to display the contents of 300 to 400 memory locations in DS.
Q3 Write down the following code @ offset address 100 of Code segment, Write down the
command to display initial values of all registers, execute by tracing Command, write down the
step by step changes in AX,BX,CX,DX and IP registers
MOV ax,1234 MOV bx,1232 add ax,bx NOP