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

下一篇介紹通過端口操作和編程方式來進行硬件重啓

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