实验7
assume cs:codesg
data segment
db '1975','1976','1977','1978','1979','1980','1981','1982','1983';
db '1984','1985','1986','1987','1988','1989','1990','1991','1992';
db '1993','1994','1995'
; 21 years' names
dd 16, 22, 382, 1356, 2390, 8000, 16000, 24486, 50065;
dd 97479,140417,197514,345980,590827,803530,1183000,1843000,2759000
dd 3753000,4649000,5937000
; 21 years' incomings
dw 3, 7, 9, 13, 28, 38, 130, 220, 476;
dw 778, 1001, 1442, 2258, 2793, 4037, 5635, 8226, 11542;
dw 14430, 15257, 17800;
; Number of employees
data ends
table segment
db 21 dup('year summ ne ?? ');
table ends
;ex7*****
codesg segment
start:
mov ax, data;
mov ds, ax;
mov ax, table;
mov es, ax;
mov bx, 0; year
mov bp, 54h; incoming 21*4 = 84 = 54h
mov si, 0a8h; # employees 84+21*4 = 84*2 = a8h
mov di, 0; table row #, row length = 16bytes
mov cx, 21;
s:mov ax, ds:[bx];
mov es:[di+0], ax;
mov ax, ds:[bx+2];
mov es:[di+2], ax;
;copied the year name
mov ax, ds:[bp];
mov es:[di+5], ax;
mov dx, ds:[bp+2];
mov es:[di+5+2], dx;
;copied the incoming
div word ptr ds:[si];
mov es:[di+0dh], ax;
;copyied the average
mov ax, ds:[si];
mov es:[di+0ah], ax;
;copied the # of employees
add bx, 4;
add bp, 4;
add si, 2;
add di, 10h;
loop s;
mov ax, 4c00h;
int 21h;
codesg ends
end start
;ex7*****
结果:
-d es:0 14f
0000 31 39 37 35 20 10 00 00-00 20 03 00 20 05 00 20 1975 .... .. ..
0010 31 39 37 36 20 16 00 00-00 20 07 00 20 03 00 20 1976 .... .. ..
0020 31 39 37 37 20 7E 01 00-00 20 09 00 20 2A 00 20 1977 ~... .. *.
0030 31 39 37 38 20 4C 05 00-00 20 0D 00 20 68 00 20 1978 L... .. h.
0040 31 39 37 39 20 56 09 00-00 20 1C 00 20 55 00 20 1979 V... .. U.
0050 31 39 38 30 20 40 1F 00-00 20 26 00 20 D2 00 20 1980 @... &. ..
0060 31 39 38 31 20 80 3E 00-00 20 82 00 20 7B 00 20 1981 .>.. .. {.
0070 31 39 38 32 20 A6 5F 00-00 20 DC 00 20 6F 00 20 1982 ._.. .. o.
0080 31 39 38 33 20 91 C3 00-00 20 DC 01 20 69 00 20 1983 .... .. i.
0090 31 39 38 34 20 C7 7C 01-00 20 0A 03 20 7D 00 20 1984 .|.. .. }.
00A0 31 39 38 35 20 81 24 02-00 20 E9 03 20 8C 00 20 1985 .$.. .. ..
00B0 31 39 38 36 20 8A 03 03-00 20 A2 05 20 88 00 20 1986 .... .. ..
00C0 31 39 38 37 20 7C 47 05-00 20 D2 08 20 99 00 20 1987 |G.. .. ..
00D0 31 39 38 38 20 EB 03 09-00 20 E9 0A 20 D3 00 20 1988 .... .. ..
00E0 31 39 38 39 20 CA 42 0C-00 20 C5 0F 20 C7 00 20 1989 .B.. .. ..
00F0 31 39 39 30 20 18 0D 12-00 20 03 16 20 D1 00 20 1990 .... .. ..
0100 31 39 39 31 20 38 1F 1C-00 20 22 20 20 E0 00 20 1991 8... " ..
0110 31 39 39 32 20 58 19 2A-00 20 16 2D 20 EF 00 20 1992 X.*. .- ..
0120 31 39 39 33 20 28 44 39-00 20 5E 38 20 04 01 20 1993 (D9. ^8 ..
0130 31 39 39 34 20 28 F0 46-00 20 99 3B 20 30 01 20 1994 (.F. .; 0.
0140 31 39 39 35 20 68 97 5A-00 20 88 45 20 4D 01 20 1995 h.Z. .E M.
- [游客] cx寄存器的值是不是为指令长度? 08/20 18:03
- [qinghao1] 确定第二空 debug加载程序mov ax,cs; 地址0000 u 一下,,mov ax, 06/08 18:50
- [游客] mov cx,64; 多加1 ------ 没有多加1. 0~3F 就是64个数据。 05/28 16:54
- [游客] 关键是知道了指令的本质过程,读、跳、运行的顺序明确了,后面的很多细节理解起来就顺利多了。 05/25 15:06
- [游客] 观察的的还挺仔细。呵呵 05/25 15:05
- [qinghao1] 恩对的!谢谢. 05/24 18:49
- [游客] (1)宽度是13,但不是13bit。bit是信息最小单位。 其他的没有问题。 05/24 17:30
- [游客] 没问题。 05/24 17:29
- [游客] 分析的没问题。 05/24 17:27
- [游客] 理解正确。 05/24 17:25