assume cs:codesg,ds:data,ss:stack,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'
;年份
;21*4-1=84-1=83
;截止到83
;84开始就是总收入的双字数据 55H 16 10H
dd 16,22,382,1356,2390,8000,16000,24486,50065,97479,140417,197514
dd 345980,590827,803530,1183000,1843000,2759000,3753000,4649000,5937000
;总收入
;
;截止到167
;168开始就是雇员人数
dw 3,7,9,13,28,38,130,220,476,778,1001,1442,2258,2793,4037,5635,8226
dw 11542,14430,15257,17800
;雇员人数
;从168-209
;17800为地址208
data ends
table segment
db 21 dup ('year summ ne ?? ')
table ends
stack segment
db 32 dup (0)
stack ends
codesg segment
start:
mov ax, data
mov ds, ax
mov ax, table
mov es, ax
mov ax, stack
mov ss, ax
mov si, 0 ;寄存器初始化
mov di, 0
mov bx, 0
mov dx, 0
mov ax, 0
mov cx, 0
mov sp, 32
; tb0 --- #0-3 YEAR
mov cx, 21
tb0:
push cx
push si
push di
mov ax, [si]
mov es:[bx+di], ax
add di, 2
add si, 2
mov ax, [si]
mov es:[bx+di], ax
pop di
pop si
add si, 4
pop cx
add bx, 10H
loop tb0
;
;tb1 --- #5-8 EARN
mov cx, 21
mov si, 84
mov di, 5
mov bx, 0
tb1:
push cx
push si
push di
mov ax, [si]
mov es:[bx+di], ax
mov ax, [si+2]
mov es:[bx+di+2], ax
pop di
pop si
add si, 4
pop cx
add bx, 10H
loop tb1
;
;tb2 --- #A-B #PEOPLE
mov cx, 21
mov si, 168
mov di, 10
mov bx, 0
tb2:
push cx
push si
push di
mov ax, [si]
mov es:[bx+di], ax
pop di
pop si
add si, 2
pop cx
add bx, 10H
loop tb2
;
;tb3 --- #D-E EARNPERPEOPLE
mov cx, 21
mov si, 84
mov di, 13
mov bx, 0
tb3:
push cx
push si
push di
mov ax, [si]
mov dx, [si+2]
mov di, 10
div word ptr es:[bx+di]
pop di
push di
mov es:[bx+di], ax
pop di
pop si
add si, 4
pop cx
add bx, 10H
loop tb3
;
mov ax, 4c00h
int 21h
codesg ends
end start
在看视频之前摸索出的代码- -使用栈功能避免使用了常量段——只是提出一种思路{:1_1:}