Created
January 10, 2018 12:59
-
-
Save Ionizing/a010bddd0167c8b54ec52a8ae0794a55 to your computer and use it in GitHub Desktop.
王爽《汇编语言》实验七,p172
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
assume cs:code | |
data segment | |
db '1975','1976','1977','1978','1979','1980', '1981' | |
db '1982', '1983','1984', '1985','1986', '1987','1988' | |
db '1989','1990','1991','1992','1993','1994','1995' | |
;以上是表示21年的21个字符串 | |
dd 16,22,382,1356,2390,8000,16000,24486,50065,97479 | |
dd 140417,197514,345980,590827,803530,118300,1843000 | |
dd 2759000,3753000,4649000,5937000 | |
;以上是表示21年公司总收入的21个dword型数据 | |
dw 3,7,9,13,28,38,130,220,476,778,1001,1442,2258,2793,4037 | |
dw 5635,8226,11542,14430,15257,17800 | |
;以上是表示21年公司雇员人数的21个word数据 | |
data ends | |
table segment | |
;预留位置,用于显示数据 | |
db 21 dup ('year summ ne ?? ') | |
table ends | |
code segment | |
start: | |
mov ax, data | |
mov es, ax | |
mov ax, table | |
mov ds, ax | |
mov bx, 0 ;table 数据的偏移地址 +16 | |
mov bp, 0 ;年份、收入数据的偏移地址 +4 | |
mov si, 0 ;雇员的偏移地址 +2 | |
mov cx, 21 | |
main: | |
;复制年份 | |
mov ax, es:[bp + 0] | |
mov ds:[bx + 0], ax | |
mov ax, es:[bp + 2] | |
mov ds:[bx + 2], ax | |
;复制收入 | |
mov ax, es:[bp + 54h] | |
mov ds:[bx + 5], ax | |
mov ax, es:[bp + 56h] | |
mov ds:[bx + 7], ax | |
;复制雇员数量 | |
mov ax, es:[si + 0a8h] | |
mov ds:[bx + 10], ax | |
;求人均 | |
mov ax, ds:[bx + 5] | |
mov dx, ds:[bx + 7] | |
div word ptr ds:[bx + 0ah] | |
mov ds:[bx + 0dh], ax | |
add bx, 10h | |
add bp, 4 | |
add si, 2 | |
loop main | |
mov ah, 4ch | |
int 21h | |
code ends | |
end start |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment