posted in 体系结构 

          组合逻辑电路可以有若个输入变量和若干个输出变量,其每个输出变量是其输入的逻辑函数,其每个时刻的输出变量的状态仅与当时的输入变量的状态有关,与本输出的原来状态及输入的原状态无关,也就是输入状态的变化立即反映在输出状态的变化。时序逻辑电路任意时刻的输出不仅取决于该时刻的输入,而且还和电路原来的状态有关。也就是说,组合逻辑电路没有记忆功能,而时序电路具有记忆功能。
          时序逻辑电路简称时序电路,它是由最基本的逻辑门电路加上反馈逻辑回路(输出到输入)或器件组合而成的电路,与组合电路最本质的区别在于时序电路具有记忆功能。时序电路的特点是:输出不仅取决于当时的输入值,而且还与电路过去的状态有关。它类似于含储能元件的电感或电容的电路,如触发器、锁存器、计数器、移位寄存器、储存器等电路都是时序电路的典型器件。

 

转自:

等待

http://blog.sina.com.cn/s/blog_9d38f2eb01012a4v.html

本文章迁移自http://blog.csdn.net/timberwolf_2012/article/details/9170291

posted in 体系结构 

最近学习了 计算机组成原理,老师 问了一个问题“计算机如何执行第一条指令?”

又看了一本书《30天自制操作系统》,因此在这好好总结一下计算机开机以后的整个引导过程。

Part 1. 引导过程详解

① 第一步,开机直接访问BIOS ROM的0xFFFF0。

        开机以后,CS寄存器置为0xFFFF,IP寄存器置为0x0000。这样一来,CPU就会要求访问地址为0xFFFF0的这个地方。这个地址实际上不是内存的地址,它被 地址控制器(实际上是南桥北桥)映射到 BIOS ROM里,而这个地址的ROM中存放着一条跳转指令。

        参考:http://bbs.csdn.net/topics/370117602

        http://blog.csdn.net/mxdlove00/article/details/8821377

② 第二步,访问BIOS ROM中的初始化程序。

    0xFFFF0中这条跳转指令,跳转至BIOS ROM的某个地址。从这开始是一段初始化程序,把这段程序复制到内存中执行。

  作用:一方面 初始化硬件(如内存等);另一方面 从硬盘加载引导程序(具体方法是 从0柱0面0扇区开始寻找,如果扇区最后是”55 AA”,则说明找到该引导程序,否则继续寻找下一扇区,直到找到引导程序),找到引导(boot)程序之后 复制到内存的 0x07c00——0x7dff(复制到该地址的原因参看 http://blog.csdn.net/mxdlove00/article/details/8811060 )中,然后跳到该地址执行引导程序。

        参考: 《30天自制操作系统》

        http://bbs.csdn.net/topics/370117602

        到此为止,一切都是硬件自动完成的,是不可改变的。

        从下面开始,执行的程序可以由程序员自由控制了。

③ 第三步,引导程序开始执行。

        引导程序把操作系统硬盘读入到内存中,并跳到内存操作系统开始地址

        多说一点,在《30天自制操作系统》中是这么做的,把软盘中10个柱面的内容都读到内存中,推算(软盘在内存的开始地址+操作系统在软盘中的相对地址=操作系统在内存中的地址)出操作系统的开始地址,然后跳到该地址。

        参考:《30天自制操作系统》

④ 第四步,开始执行操作系统程序。

        开始执行操作系统程序。

Part 2. 引导程序示意图

 SouthEast

        ① 开机访问0xFFFF0地址

        ② 跳转到BIOS ROM的初始化程序

        ③ 把BIOS ROM中的初始化程序复制到内存中执行

        ④ 初始化程序 首先初始化硬件,然后在硬盘中找到 引导程序。

        ⑤ 将引导程序复制到 内存的 0x07c00,并执行

        ⑥ 引导程序 将硬盘的内容复制到内存中。

        ⑦ 跳到内存中操作系统的开始地址,

        ⑧ 开始执行操作系统。

本文章迁移自http://blog.csdn.net/timberwolf_2012/article/details/8883269

posted in 体系结构 

BIOS 中断呼叫

维基百科,自由的百科全书

跳转至: 导航 搜索

BIOS 中断呼叫是一组功能,提供DOS程式与一些软件(例如启动程式)去使用IBM_PC兼容机BIOS的功能。一些操作系统系统引导的时候也使用BIOS以检测并初始化硬件资源。

目录

 [隐藏

[编辑]中断调用

若要调用中断,可以使用X86汇编语言INT指令。 例如,如下的x86汇编语言指令可以使用BIOS的0x10中断向屏幕打印一个字符。

mov ah, 0x0e
mov al, '!'
int 0x10

[编辑]BIOS中断向量表

中断 描述
INT 00h CPU: 除零错,或商不合法时触发
INT 01h CPU: 单步陷阱,TF标记为打开状态时,每条指令执行后触发
INT 02h CPU: 非可屏蔽中断, 如 系统自举 时发生内存错误触发。
INT 03h CPU: 第一个未定义的中断向量, 约定俗成仅用于调试程序
INT 04h CPU: 算数溢出。通常由INTO指令在置溢出位时触发。
INT 05h 在按下Shift-PrintScreen或BOUND指令检测到范围异常时触发。
INT 06h CPU: Called when the Undefined Opcode (invalid instruction) exception occurs. Usually installed by the operating system.
INT 07h CPU: Called when an attempt was made to execute a floating-point instruction and no numeric coprocessor was available.
INT 08h IRQ0: Implemented by the system timing component; called 18.2 times per second (once every 55 ms) by thePIC
INT 09h IRQ1: Called after every key press and release (as well as during the time when a key is being held)
INT 0Ah IRQ2:
INT 0Bh IRQ3: Called by serial ports 2 and 4 (COM2/4) when in need of attention
INT 0Ch IRQ4: Called by serial ports 1 and 3 (COM1/3) when in need of attention
INT 0Dh IRQ5: Called by hard disk controller (PC/XT) or 2nd parallel port LPT2 (AT) when in need of attention
INT 0Eh IRQ6: Called by floppy disk controller when in need of attention
INT 0Fh IRQ7: Called by 1st parallel port LPT1 (printer) when in need of attention
INT 10h 显示服务 - 由BIOS或操作系统设定以供软件调用
AH=00h 设定显示模式
AH=01h 设定游标形态
AH=02h 设定游标位置
AH=03h 获取游标位置与形态
AH=04h 获取光笔位置
AH=05h 设定显示页
AH=06h 清除或卷轴画面(上)
AH=07h 清除或卷轴画面(下)
AH=08h 读取游标处字符与属性
AH=09h 更改游标处字符与属性
AH=0Ah 更改游标处字符
AH=0Bh 设定边界颜色
AH=0Eh 在TTY模式下写字符
AH=0Fh 取得目前显示模式
AH=13h 写字符串
INT 11h Installed by the BIOS; returns equipment list
INT 12h Installed by the BIOS or operating system; returns Conventional Memory Size
INT 13h 低阶磁盘服务; installed by the BIOS or operating system; called by software programs
AH=00h Reset Disk Drives
AH=01h Check Drive Status
AH=02h Read Sectors From Drive
AH=03h Write Sectors To Drive
AH=04h Verifies Sectors On Drive
AH=05h Format Track On Drive
AH=08h Get Drive Parameters
AH=09h Init Fixed Drive Parameters
AH=0Ch Seek To Specified Track
AH=0Dh Reset Fixed Disk Controller
AH=15h Get Drive Type
AH=16h Get Floppy Drive Media Change Status
INT 14h Routines for communicating via the serial port. Used by software programs.
AH=00h Serial Port Initialization
AH=01h Transmit Character
AH=02h Receive Character
AH=03h Status
INT 15h Miscellaneous (System services support routines)
AH=4FH Keyboard Intercept
AH=83H Event Wait
AH=84H Read Joystick
AH=85H Sysreq Key Callout
AH=86H Wait
AH=87H Move Block
AH=88H Get Extended Memory Size
AH=C0H Get System Parameters
AH=C1H Get Extended BIOS Data Area Segment
AH=C2H Pointing Device Functions
AH=E8h, AL=01h (AX = E801h) Get Extended Memory Size(Newer function, since 1994). Gives results for memory size above 64 Mb.
AH=E8h, AL=20h (AX = E820h) Query System Address Map. The information returned from e820 supersedes what is returned from the older AX=E801h and AH=88h interfaces.
INT 16h Implemented by the BIOS or operating system. Provides routines to be called by software programs which communicate with the keyboard.
AH=00h Read Character
AH=01h Read Input Status
AH=02h Read Keyboard Shift Status
AH=10h Read Character Extended
AH=11h Read Input Status Extended
AH=12h Read Keyboard Shift Status Extended
INT 17h Print Services - used by software programs to communicate with the printer
AH=00h Print Character to Printer
AH=01h Initialize Printer
AH=02h Check Printer Status
INT 18h Execute Cassette BASIC: True IBM computers contain BASIC in the ROM to be interpreted and executed by this routine in the event of a boot failure (called by the BIOS)
INT 19h After POST this interrupt is used by BIOS to load the operating system.
INT 1Ah 即时的时钟(RTC)服务 - called by software programs to communicate with the RTC
AH=00h 读取 RTC
AH=01h 设定 RTC
AH=02h 读取 RTC 时间
AH=03h 设定 RTC 时间
AH=04h 读取 RTC 日期
AH=05h 设定 RTC 日期
AH=06h 设定 RTC Alarm
AH=07h Reset RTC Alarm
INT 1Bh Installed by the operating system; automatically called by INT 9 when Ctrl-Break has been pressed
INT 1Ch Called automatically by INT 08; available for use by software programs when a routine needs to be executed regularly
INT 1Dh Not to be called; simply a pointer to the VPT (Video Parameter Table), which contains data on video modes
INT 1Eh Not to be called; simply a pointer to the DPT (Diskette Parameter Table), containing a variety of information concerning the diskette drives
INT 1Fh Not to be called; simply a pointer to the VGCT (Video Graphics Character Table), which contains the data for ASCII characters 80h to FFh
INT 41h Address pointer: FDPT = Fixed Disk Parameter Table (1st hard drive)
INT 46h Address pointer: FDPT = Fixed Disk Parameter Table (2nd hard drive)
INT 4Ah Called by RTC for alarm
INT 70h IRQ8: 由 RTC 呼叫
INT 74h IRQ12: 由鼠标呼叫
INT 75h IRQ13: Called by math coprocessor
INT 76h IRQ14: 由第一个 IDE 控制器所呼叫
INT 77h IRQ15: 由第二个 IDE 控制器所呼叫

[编辑]相关

[编辑]外部链接

本文章迁移自http://blog.csdn.net/timberwolf_2012/article/details/8869964

/** * RECOMMENDED CONFIGURATION VARIABLES: EDIT AND UNCOMMENT THE SECTION BELOW TO INSERT DYNAMIC VALUES FROM YOUR PLATFORM OR CMS. * LEARN WHY DEFINING THESE VARIABLES IS IMPORTANT: https://disqus.com/admin/universalcode/#configuration-variables*/ /* var disqus_config = function () { this.page.url = PAGE_URL; // Replace PAGE_URL with your page's canonical URL variable this.page.identifier = PAGE_IDENTIFIER; // Replace PAGE_IDENTIFIER with your page's unique identifier variable }; */ (function() { // DON'T EDIT BELOW THIS LINE var d = document, s = d.createElement('script'); s.src = 'https://chenzz.disqus.com/embed.js'; s.setAttribute('data-timestamp', +new Date()); (d.head || d.body).appendChild(s); })();