我使用Open V1.9,目标环境是DOS-16位,图像类型是exe。目标cpu是80386。
这是我的源代码:
#include <stdio.h>
void getITV(int n);
unsigned int ITV[16];
void main()
{
int i=0;
for(i=0;i<16;i++){
getITV(i);
printf("%x ",ITV[i]);
}
printf("\n");
}
void getITV(int n)
{
int* address ;
n = n * 2;
address = (int*) ( (int)ITV + n );
__asm{
push es
push ax
push bx
mov ax,0
mov es,ax
mov ax,n
mov bx,es:[ax] --<this line is the one create error>--
mov word ptr [address],bx
pop bx
pop ax
pop es
}
}当我成功的时候,我得到了这个:
cd D:\watcom-project\dumpIVT
wmake -f D:\watcom-project\dumpIVT\dumpIVT.mk -h -e -a D:\watcom-project\dumpIVT\getCS.obj
wcc getCS.c -i="C:\WATCOM/h" -w4 -e25 -zq -od -d2 -3 -bt=dos -fo=.obj -mm
getCS.c(28): Error! E1156: Assembler error: 'Illegal use of register'
Error(E42): Last command making (D:\watcom-project\dumpIVT\getCS.obj) returned a bad status
Error(E02): Make execution terminated
Execution complete好吧,但是我看不出Line28是怎么错的,我检查了打开的watcom用户指南,但是在“在线汇编语言”一节中,没有关于我为什么会出现这个错误的信息。有什么建议吗?
发布于 2013-11-11 16:29:40
您不能在16位模式下使用80x86处理器的ax寄存器来访问内存位置,或者至少不能以这种方式访问。尝试使用索引寄存器之一,例如si或di。
https://stackoverflow.com/questions/19898081
复制相似问题