王爽《汇编语言》课程设计1

assume cs:codesg
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
string segment
 db 21 dup ('                         ',0)
string ends
codesg segment
start:mov ax,data 
      mov ds,ax
      mov ax,table
      mov es,ax
      mov cx,21
      mov bx,0
      mov di,0
      mov bp,0

    s:mov si,0
      mov ax,ds:[si+bp]
      mov es:[di],ax
      mov ax,ds:[si+2+bp]
      mov es:[di+2],ax

      mov si,84
      mov ax,ds:[si+bp]
      mov es:[5+di],ax
      mov ax,ds:[si+2+bp]
      mov es:[7+di],ax

      mov si,168
      mov ax,ds:[si+bx]
      mov es:[10+di],ax

      mov ax,es:[di+5]
      mov dx,es:[di+7]
      div word ptr es:[di+10]
      mov es:[di+13],ax

      add bp,4
      add bx,2
      add di,16
      loop s
      
      mov ax,table
      mov ds,ax
      mov bx,0
      mov si,0
      mov ax,string
      mov es,ax
      mov bp,0
      mov di,0
      
      mov cx,21
   s1:mov dx,ds:[bx+si]
      mov es:[bp+di],dx
      mov dx,ds:[bx+si+2]
      mov es:[bp+di+2],dx
      add bx,16
      add bp,26
      loop s1 
     
      mov bx,0
      mov si,5
      mov bp,0
      mov di,6
      mov cx,21
   s2:mov ax,ds:[bx+si]
      mov dx,ds:[bx+si+2]
      call dtoc
      add bx,16
      add bp,26
      loop s2

      mov bx,0
      mov si,10
      mov bp,0
      mov di,15
      mov cx,21
   s3:mov ax,ds:[bx+si]
      mov dx,0
      call dtoc
      add bx,16
      add bp,26
      loop s3

      mov bx,0
      mov si,13
      mov bp,0
      mov di,22
      mov cx,21
   s4:mov ax,ds:[bx+si]
      mov dx,0
      call dtoc
      add bx,16
      add bp,26
      loop s4

      mov ax,string
      mov ds,ax
      mov dh,0
      mov dl,0
      mov cl,2
      mov bl,cl
      mov cx,21
      mov si,0
   sx:call showstr
      add si,26
      inc dh
      loop sx

      mov ax,4c00h
      int 21h
     
showstr:push ax      
        push bx
        push cx
	push dx
        push di
        push es
	push si
	mov ax,0b800h
        mov es,ax 

	mov al,160
        mul dh
        mov di,ax
        mov al,2
        mul dl
        add di,ax
        
	mov cl,bl
        mov ah,cl         
    str:mov cl,ds:[si]   
        mov ch,0        
        jcxz ok           
        mov ch,ah        
        mov es:[di],cx 
        inc si           
        add di,2         
        jmp short str      
     ok:pop si
        pop es
        pop di
	pop dx
        pop cx
        pop bx
        pop ax
        ret

 dtoc:push ax
      push bx
      push cx
      push dx
      push di

       mov bx,0
 dtoc1:push bx
       push ax
       mov ax,dx
       mov dx,0
       mov cx,10
       div cx
       mov bx,ax
       pop ax
       div cx
       mov cx,dx
       mov dx,bx
       add cx,30h
       pop bx
       push cx
       inc bx
       add ax,dx
       mov cx,ax
       jcxz dok1
       jmp short dtoc1
        
   dok1:mov cx,bx
    ds1:pop dx
        mov es:[bp+di],dl
	inc di
	loop ds1
        pop di
        pop dx
	pop cx
	pop bx
	pop ax
        ret

codesg ends
end start


阅读更多
文章标签: 汇编
个人分类: 汇编语言
上一篇王爽《汇编语言》实验十10.3数值显示
下一篇王爽《汇编语言》实验七
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

关闭
关闭