|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
大家帮忙看看,我的课程设计1,我只是先让它显示 前三个属性,没有显示最后那个 平均数,我这个代码通过编译就是执行不出东西,代码如下:
assume cs:code,es:table,ss:stack,ds:data
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
(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
,0,0,0,0,0)
table ends
lable segment
db 16 dup (0)
db 16 dup (0)
lable ends
stack segment
dw 8 dup (0)
stack ends
code segment
start: mov ax,data
mov ds,ax
mov ax,stack
mov ss,ax
mov sp,16
mov ax,table
mov es,ax
mov si,0
mov di,0
mov bx,0
mov bp,0
mov cx,21
shu: mov bx,0
push cx
push si
mov ax,ds:[bx+si]
mov es:[bp+si],ax
mov bx,54h
mov ax,ds:[bx+si]
mov dx,ds:[bx+si+2]
mov bx,ax
mov ax,lable
mov ds,ax
mov ax,bx
call dwtoc
mov si,10
mov di,0
mov ch,0
xun: mov cl,ds:[di]
jcxz ren
mov es:[bp+si],cl
inc di
inc si
jmp xun
mov bx,0a8h
ren: mov ax,data
mov ds,ax
pop si
push si
mov ax,ds:[bx+si]
mov bx,ax
mov ax,lable
mov ds,ax
mov ax,bx
mov di,10
call dtoc
mov si,20
mov di,0
mov ch,0
xun1: mov cl,ds:[di]
jcxz ren1
mov es:[bp+si],cl
inc di
inc si
jmp xun1
ren1: pop si
add si,2
pop cx
add bp,28h
loop shu
mov ax,table
mov ds,ax
mov si,0
mov dh,1
mov dl,0
mov cx,21
sh_str: push cx
add si,0
mov dl,0
mov cl,2
call show
add si,10
mov dl,10
mov cl,2
call show
add si,20
mov dl,20
mov cl,2
call show
inc dh
pop cx
add si,40
loop sh_str
mov ax,4c00h
int 21h
dwtoc: push dx
push bx
push cx
push si
mov di,0
mov cx,10
s: call divdw
mov ch,0
add cx,30h
mov ds:[di+10h],cl
inc di
mov cx,ax
add cx,dx
jcxz ok
jmp s
ok: mov cx,di
mov bl,0
mov ds:[di],bl
sub di,1
mov si,0
rev: mov al,ds:[di+10h]
mov ds:[si],al
inc si
sub di,1
loop rev
pop si
pop cx
pop bx
pop dx
ret
divdw: push si
push ax
mov ax,dx
mov dx,0
div cx
mov si,ax
pop ax
div cx
mov cx,dx
mov dx,si
pop si
ret
dtoc: push dx
push bx
push cx
push si
mov bx,10
st2: mov dx,0
div bx
mov dh,0
add dx,30h
mov ds:[si+10h],dl
inc si
mov cx,ax
jcxz ok1
jmp st2
ok1: mov cx,si
mov bl,0
mov ds:[si],bl
sub si,1
mov di,0
rev1: mov al,ds:[si+10h]
mov ds:[di],al
inc di
sub si,1
loop rev1
pop si
pop cx
pop bx
pop dx
ret
show: push bx
push ax
push dx
push cx
mov ax,0b800h
mov es,ax
mov di,0
mov ax,0
mov al,0a0h
mul dh
mov dh,0
add dl,dl
add ax,dx
mov bx,ax
mov ch,0
s2: mov cl,ds:[si]
jcxz ok2
mov es:[bx+di],cl
pop cx
mov es:[bx+di+1],cl
push cx
inc si
add di,2
jmp s2
ok2: pop cx
pop dx
pop ax
pop bx
ret
code ends
end start
|
|