|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
在做第一个循环的时候遇到了编译问题,没有看出来问题在哪儿,解决了一个又出现一个,不知道怎么办了,麻烦各位帮忙看看!
问题提示是:<40> :error A2070:invalid instruction operands!
assume cs:codesg,ss:stack,es:table,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 ('year summ ne ?? ')
table ends
stack segment
dw 0,0,0,0,0,0,0,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 sp,16
mov si,0
mov di,0
mov bx,0
mov cx,3
s:push cx
mov cx,8
s0:mov es:[di],ds:[bx+si]
inc si
add di,16
loop s0
pop cx
add bx,36
loop s
mov ax,4c00h
int 21h
codesg ends
end start
本帖最后由 jackz007 于 2021-12-14 15:26 编辑
这条指令是无效的 s0:mov es:[di],ds:[bx+si]
mov 指令不允许两个操作数都是内存地址
这是我修改的代码,你可以关注一下堆栈段的定义和初始化相关的代码。 assume cs:code , es:table , ds:data
data segment para public 'DATA'
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 para public 'TABLE'
db 21 dup ('year summ ne ?? ')
table ends
stack segment para stack 'STACK'
dw 200h dup(0)
stack ends
code segment para public 'CODE'
main proc far
mov ax,data
mov ds,ax
mov ax,table
mov es,ax
xor bx,bx
xor dx,dx
xor si,si
mov cx,21
cld
s:push si
movsw
movsw
add si,80
inc di
movsw
movsw
add si,80
add si,dx
sub si,bx
inc di
movsw
pop si
add si,4
add di,4
add bx,4
add dx,2
loop s
mov ax,4c00h
int 21h
main endp
code ends
end main
运行实况: -d es:0 l150
14B3:0000 31 39 37 35 20 10 00 00-00 20 03 00 20 3F 3F 20 1975 .... .. ??
14B3:0010 31 39 37 36 20 16 00 00-00 20 07 00 20 3F 3F 20 1976 .... .. ??
14B3:0020 31 39 37 37 20 7E 01 00-00 20 09 00 20 3F 3F 20 1977 ~... .. ??
14B3:0030 31 39 37 38 20 4C 05 00-00 20 0D 00 20 3F 3F 20 1978 L... .. ??
14B3:0040 31 39 37 39 20 56 09 00-00 20 1C 00 20 3F 3F 20 1979 V... .. ??
14B3:0050 31 39 38 30 20 40 1F 00-00 20 26 00 20 3F 3F 20 1980 @... &. ??
14B3:0060 31 39 38 31 20 80 3E 00-00 20 82 00 20 3F 3F 20 1981 .>.. .. ??
14B3:0070 31 39 38 32 20 A6 5F 00-00 20 DC 00 20 3F 3F 20 1982 ._.. .. ??
14B3:0080 31 39 38 33 20 91 C3 00-00 20 DC 01 20 3F 3F 20 1983 .... .. ??
14B3:0090 31 39 38 34 20 C7 7C 01-00 20 0A 03 20 3F 3F 20 1984 .|.. .. ??
14B3:00A0 31 39 38 35 20 81 24 02-00 20 E9 03 20 3F 3F 20 1985 .$.. .. ??
14B3:00B0 31 39 38 36 20 8A 03 03-00 20 A2 05 20 3F 3F 20 1986 .... .. ??
14B3:00C0 31 39 38 37 20 7C 47 05-00 20 D2 08 20 3F 3F 20 1987 |G.. .. ??
14B3:00D0 31 39 38 38 20 EB 03 09-00 20 E9 0A 20 3F 3F 20 1988 .... .. ??
14B3:00E0 31 39 38 39 20 CA 42 0C-00 20 C5 0F 20 3F 3F 20 1989 .B.. .. ??
14B3:00F0 31 39 39 30 20 18 0D 12-00 20 03 16 20 3F 3F 20 1990 .... .. ??
14B3:0100 31 39 39 31 20 38 1F 1C-00 20 22 20 20 3F 3F 20 1991 8... " ??
14B3:0110 31 39 39 32 20 58 19 2A-00 20 16 2D 20 3F 3F 20 1992 X.*. .- ??
14B3:0120 31 39 39 33 20 28 44 39-00 20 5E 38 20 3F 3F 20 1993 (D9. ^8 ??
14B3:0130 31 39 39 34 20 28 F0 46-00 20 99 3B 20 3F 3F 20 1994 (.F. .; ??
14B3:0140 31 39 39 35 20 68 97 5A-00 20 88 45 20 3F 3F 20 1995 h.Z. .E ??
|
|