I'm writing an Intel 8080 Disassembler when I came across this problem.
Here's the code:
int 8080disassemble(unsigned char *cbuffer, int pc){
unsigned char* code=&cbuffer[pc];
int opbytes=1;
printf("%04x ",pc);
switch(*code){
case 0x00:printf("NOP");
break;
case 0x01:printf("LXI B,#$%02x%02x",code[2],code[1]);opbytes=3;
break;
case 0x02:printf("STAX B");
break;
case 0x03:printf("INX B");
break;
case 0x04:printf("INR B");
break;
case 0x05:printf("DCR B");
break;
case 0x06:printf("MVI B,#$%02x",code[1]);opbytes=2;
break;
}
}
It's a header file, that's why there is no includings.
Thanks!
I tried making it a pointer but didn't work
1条答案
按热度按时间fafcakar1#
C语言中的标识符(如函数和变量名)不允许以数字开头。编译器试图将
8080disassemble
解析为数字,当它到达d
时会出现混乱。请为函数选择其他名称,例如
cpu_8080_disassemble
或disassemble_8080
。