本实验有一个注意点,之前没懂,结果傻逼地想了几个小时,终于醒悟。(末尾说明)
期间,对该程序有了更深的理解,每一块内存的存放数据都做到心中有数。
题目:
代码:
assume cs:code,ds:data,es:table
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'
dd 16,22,382,1356,2390,8000,16000,24486,50065,97479,140417,197514
dd 345980,590827,803530,1183000,1843000,2759000,3753000,4649000,5937000
dw 3,7,9,13,28,38,130,220,476,778,1001,1442,2258,2793,4037,5635,8226
dw 11542,14430,15257,17800
data ends
table segment
db 21 dup ('year summ ne ?? ')
table ends
code segment
start:
mov ax,table
mov ds,ax
mov ax,data
mov es,ax
mov di,0
mov si,0
mov bx,0
mov cx,21
s:
mov ax,es:[di]
mov ds:[bx+0],ax
mov ax,es:[di+2]
mov ds:[bx+2],ax
mov ax,es:[54h+di]
mov ds:[bx+5h],ax
mov ax,es:[56h+di]
mov ds:[bx+7h],ax
mov ax,es:[0A8h+si]
mov ds:[bx+0Ah],ax
mov ax,ds:[bx+5h]
mov dx,ds:[bx+7h]
div word ptr ds:[bx+0Ah]
mov ds:[bx+0Dh],ax
add bx,10h
add si,2
add di,4
loop s
mov ax,4c00h
int 21h
code ends
end start
<strong>
</strong>
初始状态:
结果:
结果只需要做成这样即可。保存数字对应的十六进制。
如果是要显示出来,每一个字符需要一个字节来保存。
一开始还以为,要在右边显示出对应的数字!!= = 其实不需要!!