CS401 Assignment#1
CS401 Assignment#1
Question_1: What is the effective address generated by each of the following instruction? Initially AX= 0x0FED, BX=0x0400, label=0x04201, and SI=0x00E1 (Offsets in part a, b and f are in decimal) a. mov ax, [bx+65] b. mov bx, [ax+35] c. mov ax, [bx+label] d. mov bx, [label+ax] e. mov bx, [ax+si]
Answer: a. mov ax, [bx+65]= 0441 b. mov bx, [ax+35]= 1010 c. mov ax, [bx+label]= 4601 d. mov bx, [label+ax]= 51EE e. mov bx, [ax+si]= 10AE Question_2: Calculate the physical memory address generated by the following segment: offset pairs (both are hexadecimal values). a. 0000:FFFF b. 0100:0100 c. DEF8:2222 d. 543F:3254 e. FFFF:AAAA Answer: a. 000:0:FFFF= 0FFFF
b. 0100:0100= 01100
d. 543F:3254= 57644
Question_3: Write the given program, assemble it and then analyze it in Debugger [org 0x0100] mov al, [num1] mov bl, [num1+1] mov bl, [num1+2] add al, bl mov ax, 0x4c00 int 0x21 num1: db 5, 10, 15, 0 After analysis you have to provide all information that is asked under: al,bl and IP Register You have to fill the table given below and write the values of al,bl and IP registers before and after execution of an instruction as you analyze in debugger. You also have to give reason that why the value of al,bl and IP registers change after a particular instruction. Give reason in corresponding column. Before Execution Value of al Value of bl mov al, [num1] mov bl, [num1+1] add al,bl mov bl, [num1+2] add al,bl mov [num1+3],al Value of IP After Execution( with Reasons) Value of al Value of bl
Instruction
Value of IP
You also have to provide the following information Address of num1=? Address of num1+1=? Address of num1+2=? Address of num1+3=? Value of num1+3(at end of program) =? Answer: Before Execution Value of al Value of bl 0000 0000 0005 0005 000F 000F 001E 0000 000A 000A 000F 000F Value of IP 0100 0103 0107 0109 010D 010F After Execution( with Reasons) Value of al Value of bl 0005 0000 0005 000F 000F 001E 001E 000A 000A 000F 000F 000F
Instruction
mov al, [num1] mov bl, [num1+1] add al,bl mov bl, [num1+2] add al,bl mov [num1+3],al
Address of num1= 1700 Address of num1+1= 1800 Address of num1+2= 1900 Address of num1+3= 1A00 Value of num1+3(at end of program) = 1E