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

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

  • 1
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值