编程语言
首页 > 编程语言> > 汇编学习 2022/4/5

汇编学习 2022/4/5

作者:互联网

win10+dosbox+masm5.0

题目:王爽《汇编语言第四版》第八章 实验七(p172)

遇到了问题,代码如下:

assume cs:codesg

data segment
   db '1975','1976','1977','1978','1979','1980','1981','1982'
   db '1983','1984','1985','1986','1987','1988','1989','1990'
   db '1991','1992','1993','1994','1995'
   dd 16,22,382,1356,2390,8000,16000,24486,50065,97479,140417
   dd 197514,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
   dw 8826,11542,14430,15257,17800
data ends

table segment
   db 21 dup('year summ ne ?? ')
table ends

codesg segment
start:mov ax,data
    mov ds,ax
    mov ax,table
    mov es,ax
    mov si,0
    mov di,0
    mov bx,0
    mov cx,21
    tablevar:               ;复制开始
    mov ah,ds:[0+si]
    mov es:[0+di],ah
    mov ah,ds:[1+si]
    mov es:[1+di],ah
    mov ah,ds:[2+si]
    mov es:[2+di],ah
    mov ah,ds:[3+si]
    mov es:[3+di],ah
    mov ax,ds:[84+si]
    mov dx,ds:[86+si]
    mov es:[5+di],ax
    mov es:[7+di],dx
    mov ax,ds:[168+bx]
    mov es:[10+di],ax
    add di,16
    add si,4
    add bx,2
    loop tablevar   ;复制结束
    mov ax,table
    mov es,ax
    mov si,0
    mov di,0
    mov cx,21
salavc:mov ax,es:[5+di] ;一开始有错,不加48,49两句,编译器就会将es编译成了ds;调试成功之后,再去掉48,49两句编译调试却没有出错;
    mov dx,es:[7+di]
    div word ptr ds:[168+si]
    mov es:[0dH+di],ax
    add di,16
    add si,2
    loop salavc
    mov ax,4c00H
    int 21H
codesg ends
end start

标签:汇编,di,mov,学习,si,2022,ax,ds,es
来源: https://www.cnblogs.com/zmxue/p/16102764.html