Unformatted text preview: ons to perform generic text I/O and ﬁle-based I/O. If the OS
uses a graphical user interface, it has functions to display graphics in a device-independent way.
• Level 1: Call BIOS functions to control device-speciﬁc features such as color, graphics,
sound, keyboard input, and low-level disk I/O.
• Level 0: Send and receive data from hardware ports, having absolute control over speciﬁc
devices. This approach cannot be used with a wide variety of hardware devices, so we say
that it is not portable. Different devices often use different hardware ports, so the program
code must be customized for each speciﬁc type of device.
Figure 2–14 Assembly Language Access Levels.
Library Level 3 OS Function Level 2 BIOS Function Level 1 Hardware Level 0 ASM Program What are the tradeoffs? Control versus portability is the primary one. Level 2 (OS) works on
any computer running the same operating system. If an I/O device lacks certain capabilities, the
OS will do its best to approximate the intended result. Level 2 is not particularly fast because
each I/O call must go through several layers before it executes.
Level 1 (BIOS) works on all systems having a standard BIOS, but will not produce the same
result on all systems. For example, two computers might have video displays with different resolution capabilities. A programmer at Level 1 would have to write code to detect the user’s hardware setup and adjust the output format to match. Level 1 runs faster than Level 2 because it is
only one level above the hardware.
Level 0 (hardware) works with generic devices such as serial ports and with speciﬁc I/O
devices produced by known manufacturers. Programs using this level must extend their coding
logic to handle variations in I/O devices. Real-mode game programs are prime examples
because they usually take control of the computer. Programs at this level execute as quickly as
the hardware will permit.
Suppose, for example, you wanted to play a WAV ﬁle using an audio controller device. At
the OS level, you would not have to know what type...
View Full Document
- Winter '13
- Central processing unit, X86, protected mode, www.bsit.zxq.net Processor Architecture