creator_ 发表于 2021-7-15 22:56:46

王爽-实验7问题求助

assume cs:code
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
;First we have to move the data from data segment to table just as the format below
;year(4byte)(20H)income(4byte)(20H)Number of employees(2byte)(20H)per capita income(2byte)(20H)
;Example
;197516 3 23

code segment
start:


mov ax,data
mov ds,ax       ;Later we will move data from it

mov ax,table
mov es,ax       ;Later we will move data into it

xor si,si       ;empty the register si
xor bx,bx       ;empty bx
mov cx,21       ;the data is from 1975-1995 so we have to loop for 21 times

s:            ;the purpose of the loop is to move the data(year) from data segment into table segment
mov ax,ds:
mov es:,ax
add bx,2
mov ax,ds:
mov es:,ax
add bx,2
add si,10H
loop s

mov cx,21
xor si,si
xor bp,bp
mov bp,5
s1:             ;the purpose of the loop is to move the data(income) from data segment into table segment
mov ax,ds:
mov es:,ax
add bx,2
mov ax,ds:
mov es:,ax

add bx,2
add si,10H

loop s1




xor si,si
xor bp,bp
mov bp,0AH
mov cx,21
s2:            ;the purpose of the loop is to move the data(Number of employees) from data segment into table segment
mov ax,ds:
mov es:,ax
add bx,2
add si,10H
loop s2

mov si,000EH
mov bx,168
xor di,di
mov di,84
mov cx,21
s3:         ;the purpose of the loop is to div the data(income/Number of employees) from data segment into table segment

mov ax,ds:
add di,2
mov dx,ds:
div word ptr ds:
add bx,2
mov es:,ax
loop s3

mov ax,4C00H    ;end the programme
int 21H
code ends
end start
页: [1]
查看完整版本: 王爽-实验7问题求助