X86 硬件底层之debug&borland c++显示1-100递增及打印“99”

https://blog.csdn.net/sdl0358/article/details/99209362

一、dos下debug常见使用方法
在这里插入图片描述
*具体的使用方法可以参考别的教程,本文主要是通过具体实例来介绍debug command
二、borland c++软件
在Windows下使用borland编写硬件程序是很方便的,使用方法文件名.cpp,虽然是C++后缀,但实际上是语法完全是c语言的
小编发现网上搜不到在Windows下使用borland C软件和纯dos下的debug.exe,因此给出了链接如下:
debug32.exe
链接:https://pan.baidu.com/s/17aWirQr8IRLbwwNsDsXldg
提取码:fr33

borland C++
链接:https://pan.baidu.com/s/1e3itf7XxIUxLPEjFOtQePA
提取码:z31k
三、使得debug card显示“99”的三种方式
1.使用debug command命令
进入debug编译框:
debug32
o 80 99
i 80
说明:
o [out]向硬件I/O显示端口输出
i [in]从硬件I/O显示端口输入或者输出某端口的值
80 :表示port80
2.使用汇编语言
进入debug编译环境后使用-a进行汇编
debug
-a
mov ax,99
out 80,ax
-t
)
在这里插入图片描述
3.使用borlandC++

#include <stdio.h>
#include <dos.h>
void main()
{
	outportb(0x80,99)
}

四、使用borland C++编写1-100输入到debug card

# include <stdio.h>
# include <string.h>
# include <dos.h>
# include  <stdlib.h>
void main()
{
	int i;
	int port=0x80;//端口号
	for(i=1;i<=100;i++)
{
	outport(port,i);
	printf(“d% d%”,i,port);
	sleep(1);
}
}
//***debug card只能显示2位,并且是16进制,因此10进制的99在debug card显示的64

下一篇介绍通过端口操作和编程方式来进行硬件重启

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章