Solution Programming Handcoding Comanlises
Solution Programming Handcoding Comanlises
1. Supply the appropriate instruction for the given program to accomplish the given
task.
3010h - 20h + (20h * 40h) - (100h / 40h)
PROGRAM:
XOR AX, AX; to clear register AX, XOR is used for 16-bit size of info
XOR CX, CX (1);to clear register CX, XOR is used for 16-bit size
PLUS:
ADD AX, 20H (2); to add register AX content with 0020 hexa
DEC CL; to subtract 1 from CL content
JNZ PLUS (3) ;to check if CL is not yet equal to zero, and if true, it will go to PLUS
and execute ADD AX, 20H again.
3010H; to move 3010 hexa to register BX
MOV BX,
ADD AX, BX; to add content of register AX with the content of register BX
PUSH AX (4); to put the result of the instruction ADD AX,BX unto the stack
XOR AX, AX; to clear register AX, XOR is used for 16-bit size of info
XOR BX, BX; to clear register X, XOR is used for 16-bit size of info
XOR CX, CX OR MOV AX, 0100H(5) ; to clear register CX, XOR is used for 16-bit
size of info OR move data 0100 hexa into register AX
JNZ MINUS;
ADD DL, CL ;
XOR AX, AX;
POP AX (9) ;
to add content of register DL with the content of the register CL, the
result will be stored into the register DL
to clear register AX, XOR is used for 16-bit size of info
MOV DH,
SUB AX, DX (10) ;
LINE AX
NO.
1
0000
2
3
4
0020
5
0040
0060
0080
00A0
00C0
00E0
0100
0120
0140
0160
0180
01A0
01C0
01E0
0200
0220
0240
0260
0280
02A0
02C0
02E0
0300
.
.
.
.
.
.
0760
0780
07A0
07C0
07E0
0800
7
8
9
10
11
BX
CX
DX
CHCL
STACK
0000
0040
003F
003D
003E
003D
003C
003B
003A
0039
0038
0037
0036
0035
0034
0033
0032
0031
0030
002F
002E
002D
002C
002B
002A
0029
0028
.
.
.
.
.
0006
0005
0004
0003
0002
0001
0000
3010
3810
3810
0000
0000
12
13
14
15
16
17
18
19
20
0000
0040
0100
00C0
0080
0040
0000
0001
0002
0003
0004
20
24
0000
3810
0024
37EC
ANSWER:
AX=37EC
BX=0040
CX=0004
DX=0024
STACK=NONE
INSTRUCTION
BACK:
CONTENT/S
ADDRESS/ES
B8 34 12
8E D8
BE 00 04
BF 00 05
B9 0A 00
8B 04
89 05
46
47
49
75F7
F4
0000-0002
0003-0004
0005-0007
0008-000A
000B-000D
000E-000F
0010-0011
0012
0013
0014
0015-0016
0017
REG R/M
MOV AX, [SI]
R/M REG
MOV [DI], AX
INC SI
01000 REG
01000 110 == 46
INC DI
01000 REG
01000 111 == 47
DEC CX
01001 REG
01001 001 == 49
JNZ BACK
01110101 DISP
01110101 ==75 F7
PL=0015
DL=000E
BACKWARD BRANCHING
DL=PL+2-X
000E=0015+2-X
X=0017-000E
X= 0009; GET THE 2S COMPLENT
X= FFFF-0009=FFF6+1=FFF7
LOWER DISPLACEMENT =F7
HIGHER DISPLACEMENT = FF
11110100 == F4