SET 21 OPERATING SYSTEM USE OF ASSEMBLY LANGUAGE …

Download Report

Transcript SET 21 OPERATING SYSTEM USE OF ASSEMBLY LANGUAGE …

SET 21
OPERATING SYSTEM
USE OF ASSEMBLY
LANGUAGE
SYSTEM USES OF ASSEMBLY LANGUAGE
• For drivers for external devices connected to
the computer, such as printers, digital
cameras, etc.
• In operating system software to control
internal devices such as the interrupt
controller, DMA controller, timer, etc
INTERNAL DEVICE USE
• Many of the chips on the motherboard are
made for general use, including circuits that
are not connected to computers
• These chips generally need to be programmed
in order to carry out the specific functions
required in a computer’s circuitry.
EXAMPLES
• The interrupt controller chip has to be
programmed in order to give some interrupts
precedence over others.
• For instance the interrupt for the timer (to
update the time of day) cannot itself be
interrupted by the keyboard, but the keyboard
interrupt can be interrupted by the timer.
• Reading and writing from the hard disk
requires numerous commands sent to the
DMA controller chip and the hard drive
controller
• The timer chip has to be programmed in order,
among other functions, to produce interrupts
at the desired frequency for use in updating
the time of day.
• Commands to devices, to get them to perform
various functions, or to initialize them, are
made by sending one or more bytes to special
addresses associated with the devices, called
ports
• To send a byte to a port, one needs to put the
byte in AL, and assuming that the port number
is (say) 43h, employ the instruction
OUT 43h, AL
• Depending on the device, one can also send
words, or double words to a device, employing
e.g.
OUT port no., AX
or
OUT port no., EAX
• To input a byte from a device, e.g. to obtain
status information, one employs
IN port no., AL
A SIMPLE EXAMPLE OF USING ASSEMBLER
TO WRITE PROGRAMS FOR DEVICES
We will consider in the example following this
slide set how one can program the timer, and
another chip called a Programmable
Peripheral Interface (PPI), to play music on
the computer’s speakers