【发布时间】:2013-11-11 02:50:09
【问题描述】:
我使用的是Open Watcom IDE V1.9,目标环境是DOS-16bit,图像类型是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 有什么问题,我查看了 open watcom 用户指南, 但在“内联汇编语言”部分中,没有关于为什么的信息 我得到了这个错误。 有什么建议吗?
【问题讨论】:
标签: c inline-assembly watcom