Analyze the source codes in Figure 4. Remark that the numbers on the left are line numbers.
Figure 4
01 [org 0x100]
02
start:
03
mov si, 0
04 addnextcolumn:
05
mov ax, 0
06
mov bp, 0
07
mov ch, 0
08 addcolumn:
09
add ax, [num1+bp+si]
10
inc ch
11
add bp, 10
12
cmp ch, 3
13
jle addcolumn
14
mov [res+si], ax
15
add si, 2
16
cmp si, 8
17
jle addnextcolumn
18 end:
19 data:
20
num1 dw 10, 20, 30, 40, 50
21
num2 dw 11, 21, 31, 41, 51
22
num3 dw 12, 22, 32, 42, 52
23
num4 dw 13, 23, 33, 43, 53
24
res dw 0,0,0,0,0
25
(a) What do the codes do between line 08 until line 13?
(5 marks)
(b) What do the codes do between line 04 to line 07 and between line 15 and line 17?
(5 marks)
(c) Where are the results from actions of (a) stored?
(3 marks)
(d) Name the addressing mode in line 09.
(2 marks)
(e) Name the addressing mode in line 14.
(2 marks)