软件工程

本类阅读TOP10

·PHP4 + MYSQL + APACHE 在 WIN 系统下的安装、配置
·Linux 入门常用命令(1)
·Linux 入门常用命令(2)
·使用 DCPROMO/FORCEREMOVAL 命令强制将 Active Directory 域控制器降级
·DirectShow学习(八): CBaseRender类及相应Pin类的源代码分析
·基于ICE方式SIP信令穿透Symmetric NAT技术研究
·Windows 2003网络负载均衡的实现
·一网打尽Win十四种系统故障解决方法
·数百种 Windows 软件的免费替代品列表
·收藏---行百里半九十

分类导航
VC语言Delphi
VB语言ASP
PerlJava
Script数据库
其他语言游戏开发
文件格式网站制作
软件工程.NET开发
Write Your Own Operating System Tutorial(5)

作者:未知 来源:月光软件站 加入时间:2005-2-28 月光软件站

Lesson 5: Let’s Make It Interactive

All of this printing stuff to the screen is fun, but no operating system would be any good at all if it did not provide any interactivity.  Let’s make it read input from the keyboard.  Again we will be using calls to a function in BIOS to read the keyboard.

We are going to be using function 0, interrupt 0x16.  This is done easily with the following two instructions.

     xor  ah, ah    ; we want function zero

     int  0x16 ; wait for a keypress

 

This function causes the computer to pause and does not return until a key is pressed.  This can be used in a “Press any key to continue” situation, or also if you want to get input from the user.  The scan code of the key pressed will be returned in register AH, and the ASCII code is returned in AL.

Your assignment for this lesson is to write a simple boot program that demonstrates a bit of interactivity.  Perhaps it could print a message each time a key is pressed.  Or maybe allow the user to type at the keyboard and echo each character to the screen as it is typed.

If you get stuck, here is an example of my own.  But it's no fair peeking until you’ve tried by yourself!

In the next lesson we will learn how to make our operating system larger than the single sector of the Boot Record.




相关文章

相关软件