哪位能给我解释一下这段代码,谢谢

kittyhuaner 2003-01-10 08:52:43
void SendPort(port,c)
int port;
char c;
{
union REGS reg;
reg.x.dx=port;
reg.h.al=c;
reg.h.ah=1;
int86(0x14,®,®);
if(reg.h.ah&128){
printf("\nSend mistakes!");
exit(1);
}
哪位能给我解释一下这段代码,谢谢
这是用到寄存器了吗?
这方面的知道可以在哪里看到?谢谢!
...全文
63 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
erigido 2003-01-11
  • 打赏
  • 举报
回复
还真使用到了寄存器的了,头痛!!!呜呼
riverboat 2003-01-10
  • 打赏
  • 举报
回复
找一本 IBM PC机中断详细说明的专著看一看吧(就是图书馆里封面很古老的那种,16开的),里面有PC中断的详细说明。
rushman 2003-01-10
  • 打赏
  • 举报
回复
int 14H 是BIOS调用,向COM口(由port参数指定)写一个字符(由参数c指定)。

INT 14H
AH = 1 : 功能,向通讯口写一个字符
AL : 所写的字符
DX : 通讯口号,COM1=0,COM2=1等
返回:
成功:AH 第7位为 0,AL不变
失败:AH 第7位为 1,AH线状态字节,AL不变
kittyhuaner 2003-01-10
  • 打赏
  • 举报
回复
那14号中断具体是什么中断?哪有这方面的知识啊?
dgxu 2003-01-10
  • 打赏
  • 举报
回复
是调用了第14h号dos(bios?记不得了)中断
rushman 2003-01-10
  • 打赏
  • 举报
回复
//-----------------------------------------------------
REGS (union) <DOS.H>
The union REGS is used to pass information to and from these functions:
int86 int86x intdos intdosx

union REGS {
struct WORDREGS x;
struct BYTEREGS h;
};

//-----------------------------------------------
BYTEREGS and WORDREGS <DOS.H>
Structures for storing byte and word registers

struct BYTEREGS {
unsigned char al, ah, bl, bh;
unsigned char cl, ch, dl, dh;
};

struct WORDREGS {
unsigned int ax, bx, cx, dx;
unsigned int si, di, cflag, flags;
};

//----------------------------------------------------
int86, int86x <DOS.H>
General 8086 software interrupt interfaces

Declaration:
■ int int86(int intno, union REGS *inregs, union REGS *outregs);
■ int int86x(int intno, union REGS *inregs, union REGS *outregs,
struct SREGS *segregs);

Remarks:
int86 and int86x execute an 8086 software interrupt specified by the argument intno.

With int86x, you can invoke an 8086 software interrupt that takes a value of DS different from the default data segment, and/or takes an argument in ES.

69,373

社区成员

发帖
与我相关
我的任务
社区描述
C语言相关问题讨论
社区管理员
  • C语言
  • 花神庙码农
  • 架构师李肯
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧