\documentclass[10pt,a4paper]{article} % Packages \usepackage{fancyhdr} % For header and footer \usepackage{multicol} % Allows multicols in tables \usepackage{tabularx} % Intelligent column widths \usepackage{tabulary} % Used in header and footer \usepackage{hhline} % Border under tables \usepackage{graphicx} % For images \usepackage{xcolor} % For hex colours %\usepackage[utf8x]{inputenc} % For unicode character support \usepackage[T1]{fontenc} % Without this we get weird character replacements \usepackage{colortbl} % For coloured tables \usepackage{setspace} % For line height \usepackage{lastpage} % Needed for total page number \usepackage{seqsplit} % Splits long words. %\usepackage{opensans} % Can't make this work so far. Shame. Would be lovely. \usepackage[normalem]{ulem} % For underlining links % Most of the following are not required for the majority % of cheat sheets but are needed for some symbol support. \usepackage{amsmath} % Symbols \usepackage{MnSymbol} % Symbols \usepackage{wasysym} % Symbols %\usepackage[english,german,french,spanish,italian]{babel} % Languages % Document Info \author{pisceswolf96 (pisceswolf96)} \pdfinfo{ /Title (computer-architecture-summary-1.pdf) /Creator (Cheatography) /Author (pisceswolf96 (pisceswolf96)) /Subject (Computer Architecture summary 1 Cheat Sheet) } % Lengths and widths \addtolength{\textwidth}{6cm} \addtolength{\textheight}{-1cm} \addtolength{\hoffset}{-3cm} \addtolength{\voffset}{-2cm} \setlength{\tabcolsep}{0.2cm} % Space between columns \setlength{\headsep}{-12pt} % Reduce space between header and content \setlength{\headheight}{85pt} % If less, LaTeX automatically increases it \renewcommand{\footrulewidth}{0pt} % Remove footer line \renewcommand{\headrulewidth}{0pt} % Remove header line \renewcommand{\seqinsert}{\ifmmode\allowbreak\else\-\fi} % Hyphens in seqsplit % This two commands together give roughly % the right line height in the tables \renewcommand{\arraystretch}{1.3} \onehalfspacing % Commands \newcommand{\SetRowColor}[1]{\noalign{\gdef\RowColorName{#1}}\rowcolor{\RowColorName}} % Shortcut for row colour \newcommand{\mymulticolumn}[3]{\multicolumn{#1}{>{\columncolor{\RowColorName}}#2}{#3}} % For coloured multi-cols \newcolumntype{x}[1]{>{\raggedright}p{#1}} % New column types for ragged-right paragraph columns \newcommand{\tn}{\tabularnewline} % Required as custom column type in use % Font and Colours \definecolor{HeadBackground}{HTML}{333333} \definecolor{FootBackground}{HTML}{666666} \definecolor{TextColor}{HTML}{333333} \definecolor{DarkBackground}{HTML}{143FA3} \definecolor{LightBackground}{HTML}{F0F3F9} \renewcommand{\familydefault}{\sfdefault} \color{TextColor} % Header and Footer \pagestyle{fancy} \fancyhead{} % Set header to blank \fancyfoot{} % Set footer to blank \fancyhead[L]{ \noindent \begin{multicols}{3} \begin{tabulary}{5.8cm}{C} \SetRowColor{DarkBackground} \vspace{-7pt} {\parbox{\dimexpr\textwidth-2\fboxsep\relax}{\noindent \hspace*{-6pt}\includegraphics[width=5.8cm]{/web/www.cheatography.com/public/images/cheatography_logo.pdf}} } \end{tabulary} \columnbreak \begin{tabulary}{11cm}{L} \vspace{-2pt}\large{\bf{\textcolor{DarkBackground}{\textrm{Computer Architecture summary 1 Cheat Sheet}}}} \\ \normalsize{by \textcolor{DarkBackground}{pisceswolf96 (pisceswolf96)} via \textcolor{DarkBackground}{\uline{cheatography.com/33980/cs/11961/}}} \end{tabulary} \end{multicols}} \fancyfoot[L]{ \footnotesize \noindent \begin{multicols}{3} \begin{tabulary}{5.8cm}{LL} \SetRowColor{FootBackground} \mymulticolumn{2}{p{5.377cm}}{\bf\textcolor{white}{Cheatographer}} \\ \vspace{-2pt}pisceswolf96 (pisceswolf96) \\ \uline{cheatography.com/pisceswolf96} \\ \end{tabulary} \vfill \columnbreak \begin{tabulary}{5.8cm}{L} \SetRowColor{FootBackground} \mymulticolumn{1}{p{5.377cm}}{\bf\textcolor{white}{Cheat Sheet}} \\ \vspace{-2pt}Published 31st May, 2017.\\ Updated 31st May, 2017.\\ Page {\thepage} of \pageref{LastPage}. \end{tabulary} \vfill \columnbreak \begin{tabulary}{5.8cm}{L} \SetRowColor{FootBackground} \mymulticolumn{1}{p{5.377cm}}{\bf\textcolor{white}{Sponsor}} \\ \SetRowColor{white} \vspace{-5pt} %\includegraphics[width=48px,height=48px]{dave.jpeg} Measure your website readability!\\ www.readability-score.com \end{tabulary} \end{multicols}} \begin{document} \raggedright \raggedcolumns % Set font size to small. Switch to any value % from this page to resize cheat sheet text: % www.emerson.emory.edu/services/latex/latex_169.html \footnotesize % Small font. \begin{tabularx}{17.67cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{17.67cm}}{\bf\textcolor{white}{Programming I/O Devices}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{17.67cm}}{What is I/O?} \tn \mymulticolumn{1}{x{17.67cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}I/O is the communication between an information processing system, such as a computer, with the outside world, possibly a human or another system. Inputs are signals or data received by the system, and outputs are signals or data sent by it.} \tn % Row Count 7 (+ 7) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{17.67cm}}{What are the components of I/O device?} \tn \mymulticolumn{1}{x{17.67cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}There are 2 main components of I/O Device: {\bf{Hardware Interface}} and {\bf{Internal Structure}}.} \tn % Row Count 10 (+ 3) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{1}{x{17.67cm}}{What is hardware structure?} \tn \mymulticolumn{1}{x{17.67cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Hardware Structure is the device interface. it represents the interface used by the system to control the device, and every device has an {\bf{interface}} and a {\bf{protocol}} for typical interaction.} \tn % Row Count 16 (+ 6) % Row 3 \SetRowColor{white} \mymulticolumn{1}{x{17.67cm}}{How many registers are used in the hardware of an I/O device?} \tn \mymulticolumn{1}{x{17.67cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}There are 3 registers in use: {\bf{Status Register}}, used to get the status of the device, {\bf{Command Register}}, used to tell the device to perform a certain task, and {\bf{Data Register}}, used to pass data to the device, or get data from the device.} \tn % Row Count 24 (+ 8) % Row 4 \SetRowColor{LightBackground} \mymulticolumn{1}{x{17.67cm}}{What is internal structure of an I/O device?} \tn \mymulticolumn{1}{x{17.67cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Internal Structure is the device abstract implementation, it is device specific(meaning it depends on the device itself). Simple devices need one or few hardware chips to implement their functionality, while more complex devices need a simple CPU(also called a micro-controller), a general purpose memory(either DRAM, SRAM or both), and device specific chips to get their jobs done.} \tn % Row Count 34 (+ 10) \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{17.67cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{17.67cm}}{\bf\textcolor{white}{Programming I/O Devices (cont)}} \tn % Row 5 \SetRowColor{white} \mymulticolumn{1}{x{17.67cm}}{Why are I/O slow} \tn \mymulticolumn{1}{x{17.67cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}They are slow for 3 reasons:\{\{nl\}\}{\bf{1-}} They are the main way of interaction between the user and the computer, so they can be as fast as the user.\{\{nl\}\}{\bf{2-}} Their signal is analog and need to be converted to digital. \{\{nl\}\}{\bf{3-}} They depend on mechanical movements which is slow compared to digital signals.} \tn % Row Count 8 (+ 8) % Row 6 \SetRowColor{LightBackground} \mymulticolumn{1}{x{17.67cm}}{What 2 components each I/O device need?} \tn \mymulticolumn{1}{x{17.67cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Each I/O device must have: a {\bf{buffer}} and a {\bf{status register}}.} \tn % Row Count 11 (+ 3) % Row 7 \SetRowColor{white} \mymulticolumn{1}{x{17.67cm}}{Define a buffer?} \tn \mymulticolumn{1}{x{17.67cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}A buffer is a sequence of memory locations, its size depends on the I/O device, it is used to hold data temporarily until it is processed by the CPU.} \tn % Row Count 16 (+ 5) % Row 8 \SetRowColor{LightBackground} \mymulticolumn{1}{x{17.67cm}}{Define the status register?} \tn \mymulticolumn{1}{x{17.67cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}It is a sequence of bits, its size depends on the I/O device, it is used to report the status of the I/O to the CPU?} \tn % Row Count 20 (+ 4) % Row 9 \SetRowColor{white} \mymulticolumn{1}{x{17.67cm}}{What is the most important bit in the status register?} \tn \mymulticolumn{1}{x{17.67cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}The most important bit is the {\bf{ready bit}}.} \tn % Row Count 23 (+ 3) \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{17.67cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{17.67cm}}{\bf\textcolor{white}{Programmed I/O Technique}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{17.67cm}}{What is the protocol of programmed I/O technique?} \tn \mymulticolumn{1}{x{17.67cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}The protocol has 4 steps:\{\{nl\}\} {\bf{1-}} poll the device to see if it's ready to receive a command(this is done by repeatedly reading the status register).\{\{nl\}\}{\bf{2-}} The OS sends data to the data register.\{\{n\}\}{\bf{3-}} The OS writes a command to the command register, this also implicitly tells the device that the data is present in the data register and that it should begin working on the command.\{\{nl\}\}{\bf{4-}} The OS waits for the device to finish by again polling it in a loop to see if it has finished(it may then get an error indicating a success or a failure).} \tn % Row Count 14 (+ 14) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{17.67cm}}{When do we call something PIO(programmed I/O)?} \tn \mymulticolumn{1}{x{17.67cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}We call it PIO when the CPU is involved in the movement of the data.} \tn % Row Count 17 (+ 3) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{1}{x{17.67cm}}{What are the advantages of PIO?} \tn \mymulticolumn{1}{x{17.67cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}This technique is simple and working.} \tn % Row Count 19 (+ 2) % Row 3 \SetRowColor{white} \mymulticolumn{1}{x{17.67cm}}{What are the disadvantages of PIO?} \tn \mymulticolumn{1}{x{17.67cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}This technique wastes a great deal of CPU time just waiting for the potentially slow I/O device to complete its activity.} \tn % Row Count 23 (+ 4) % Row 4 \SetRowColor{LightBackground} \mymulticolumn{1}{x{17.67cm}}{Write the corresponding Assembly code for (cin \textgreater{}\textgreater{} x) using Programmed I/O method.} \tn \mymulticolumn{1}{x{17.67cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}`NotReady: \{\{nl\}\}~~~~IN AL , StatusD1 → The status register of Device \#1 \{\{nl\}\}~~~~AND AL , MaskD1 \{\{nl\}\}~~~~JZ NotReady \{\{nl\}\}~~~~IN AL , BufferD1 → The Buffer of Device \#1 \{\{nl\}\}~~~~MOV X , AL`} \tn % Row Count 32 (+ 9) \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{17.67cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{17.67cm}}{\bf\textcolor{white}{Programmed I/O Technique (cont)}} \tn % Row 5 \SetRowColor{white} \mymulticolumn{1}{x{17.67cm}}{Write the corresponding Assembly code for (cout\textless{}\textless{}x) using Programmed I/O method.} \tn \mymulticolumn{1}{x{17.67cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}`NotReady: \{\{nl\}\}~~~~IN AL , StatusD2 \{\{nl\}\}~~~~AND AL , MaskD2 \{\{nl\}\}~~~~JZ NotReady \{\{nl\}\}~~~~MOV AL , X \{\{nl\}\}~~~~OUT BufferD2 , AL`} \tn % Row Count 7 (+ 7) \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{17.67cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{17.67cm}}{\bf\textcolor{white}{Interrupt Driven Technique}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{17.67cm}}{What is an interrupt?} \tn \mymulticolumn{1}{x{17.67cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}An interrupt is a signal emitted to the processor by software or hardware, to indicate that there is an event(which is temporary) that requires immediate attention.} \tn % Row Count 5 (+ 5) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{17.67cm}}{How does the processor responds to an interrupt?} \tn \mymulticolumn{1}{x{17.67cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}It responds by {\bf{suspending its current activities}}, {\bf{saving its state}}, and {\bf{executing a special function called interrupt handler or Interrupt service routine}}.} \tn % Row Count 10 (+ 5) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{1}{x{17.67cm}}{What do we mean by interrupt service routine?} \tn \mymulticolumn{1}{x{17.67cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Interrupt Service Routine(ISR): is a special function that is called when there is an interrupt, this function is called by the processor and not the programmer.} \tn % Row Count 15 (+ 5) % Row 3 \SetRowColor{white} \mymulticolumn{1}{x{17.67cm}}{What values do we need to save when an interrupt happens?} \tn \mymulticolumn{1}{x{17.67cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}The typical values include: {\bf{condition code flags((flag registers)}} and contents of any {\bf{register}} used by both the interrupted program and ISR} \tn % Row Count 21 (+ 6) % Row 4 \SetRowColor{LightBackground} \mymulticolumn{1}{x{17.67cm}}{What values does the processor save?} \tn \mymulticolumn{1}{x{17.67cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}The processor only saves the {\bf{Program Counter(PC) which is also called Instruction Pointer(IP)}} and the values of {\bf{Processor status register}}. Other values must be saved by the programmer.} \tn % Row Count 27 (+ 6) % Row 5 \SetRowColor{white} \mymulticolumn{1}{x{17.67cm}}{How does the programmer save values of registers used in an ISR?} \tn \mymulticolumn{1}{x{17.67cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}He does so by pushing them into the {\bf{stack segment}} in the start of the ISR and then popping them from the stack at the end of the ISR.} \tn % Row Count 32 (+ 5) \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{17.67cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{17.67cm}}{\bf\textcolor{white}{Interrupt Driven Technique (cont)}} \tn % Row 6 \SetRowColor{LightBackground} \mymulticolumn{1}{x{17.67cm}}{What is the difference between an ISR and a standard subroutine(or a function)} \tn \mymulticolumn{1}{x{17.67cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}The main differences are: \{\{nl\}\}{\bf{-}} An ISR can be called anywhere and anytime.\{\{nl\}\}{\bf{-}} An ISR is called by the CPU and not the programmer\{\{nl\}\}{\bf{-}} The CPU saves the values of registers and the flags, and restore them after the execution of the ISR} \tn % Row Count 8 (+ 8) % Row 7 \SetRowColor{white} \mymulticolumn{1}{x{17.67cm}}{Why do we use PUSH and POP commands instead of MOV command when dealing with the stack?} \tn \mymulticolumn{1}{x{17.67cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Because both PUSH and POP need only 1 byte, while MOV requires 2 bytes or more.} \tn % Row Count 12 (+ 4) % Row 8 \SetRowColor{LightBackground} \mymulticolumn{1}{x{17.67cm}}{What is the difference between RET and IRET commands} \tn \mymulticolumn{1}{x{17.67cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}The RET command returns the value of PC(or IP) {\bf{only}}, while IRET returns {\bf{both}} PC(or IP) and the values of the flags.} \tn % Row Count 17 (+ 5) % Row 9 \SetRowColor{white} \mymulticolumn{1}{x{17.67cm}}{What do we mean by interrupt nesting?} \tn \mymulticolumn{1}{x{17.67cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Pre-emption of low priority interrupt by another high priority interrupt.} \tn % Row Count 20 (+ 3) % Row 10 \SetRowColor{LightBackground} \mymulticolumn{1}{x{17.67cm}}{How many types of interrupts are there?} \tn \mymulticolumn{1}{x{17.67cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}There are 2 types: {\bf{Hardware}} and {\bf{Software}} interrupts} \tn % Row Count 23 (+ 3) % Row 11 \SetRowColor{white} \mymulticolumn{1}{x{17.67cm}}{What are the types of hardware interrupts?} \tn \mymulticolumn{1}{x{17.67cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}There are 2 types: {\bf{Non-Maskable}} and {\bf{Maskable}}.} \tn % Row Count 26 (+ 3) % Row 12 \SetRowColor{LightBackground} \mymulticolumn{1}{x{17.67cm}}{What do we mean by Non-maskable Interrupts?} \tn \mymulticolumn{1}{x{17.67cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}It is a high priority interrupt, usually it has its own pin on the processor. In 8086 processor it is called NMI (Non Maskable Interrupt) pin. It is used for power failure routine(the power off button on a desktop or a laptop).} \tn % Row Count 32 (+ 6) \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{17.67cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{17.67cm}}{\bf\textcolor{white}{Interrupt Driven Technique (cont)}} \tn % Row 13 \SetRowColor{white} \mymulticolumn{1}{x{17.67cm}}{What do we mean by maskable interrupts?} \tn \mymulticolumn{1}{x{17.67cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Interrupts that are in levels, and they depend on the INTR(Interrupt Request) pin. When an interrupt is called the {\bf{enable bit}} is set to 0, which means we can't send any further interrupts until this interrupt is finished.} \tn % Row Count 6 (+ 6) % Row 14 \SetRowColor{LightBackground} \mymulticolumn{1}{x{17.67cm}}{Give examples on the interrupts preserved for the processor.} \tn \mymulticolumn{1}{x{17.67cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}{\bf{-}} Interrupt 0: preserved for {\bf{divide error(division by zero)}}\{\{nl\}\}{\bf{-}} Interrupt 1: for single step\{\{nl\}\}{\bf{-}} Interrupt 2: preserved for {\bf{NMI(Non-Maskable Interrupt)}}\{\{nl\}\}{\bf{-}} Interrupt 3: preserved for{\bf{ setting a breakpoint}}\{\{nl\}\}{\bf{-}} Interrupt 4: preserved for {\bf{overflow}}.} \tn % Row Count 15 (+ 9) % Row 15 \SetRowColor{white} \mymulticolumn{1}{x{17.67cm}}{Define Interrupt Vector Table?} \tn \mymulticolumn{1}{x{17.67cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Interrupt Vector Table(IVT): is a data structure that contains the address of interrupt service routine, the IVT is located in the first 1024 bytes(1 KB) of memory, it contains 256, 4-byte interrupt vectors.} \tn % Row Count 21 (+ 6) % Row 16 \SetRowColor{LightBackground} \mymulticolumn{1}{x{17.67cm}}{What does each ISR takes 4 bytes in the IVT?} \tn \mymulticolumn{1}{x{17.67cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}it takes 4 bytes because each ISR address is made of:\{\{nl\}\}{\bf{-}} code segment register(16 bit or 2 bytes)\{\{nl\}\}{\bf{-}} Instruction Pointer(16 bit or 2 bytes).} \tn % Row Count 26 (+ 5) % Row 17 \SetRowColor{white} \mymulticolumn{1}{x{17.67cm}}{What is the use of CLI and STI commands?} \tn \mymulticolumn{1}{x{17.67cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}{\bf{-}} CLI clears the {\bf{IF(interrupt flag)}}, by setting it to zero and thus interrupts are disabled\{\{nl\}\}{\bf{-}} STI sets the {\bf{IF(interrupt flag)}}, by setting it to 1 and thus interrupts are enabled.} \tn % Row Count 32 (+ 6) \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{17.67cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{17.67cm}}{\bf\textcolor{white}{Interrupt Driven Technique (cont)}} \tn % Row 18 \SetRowColor{LightBackground} \mymulticolumn{1}{x{17.67cm}}{What is the 8259A?} \tn \mymulticolumn{1}{x{17.67cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}It is a PIC (Programmable Interrupt Device), which allows us to have more than 2 levels of interrupts (It allows to have up to 255 levels), it works by combining multiple interrupt inputs into one output which connects to microprocessor.} \tn % Row Count 7 (+ 7) % Row 19 \SetRowColor{white} \mymulticolumn{1}{x{17.67cm}}{What are the main pins in 8259A?} \tn \mymulticolumn{1}{x{17.67cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}{\bf{-}} D0-D7: Bidirectional Data connections.\{\{nl\}\}{\bf{-}} IR0-IR7: Interrupt request inputs.\{\{nl\}\}{\bf{-}} INT(Output): Connects to the microprocessor INTR pin.\{\{nl\}\}{\bf{-}} INTA`(Input): connects to the microprocessor INTA\textbackslash{}` pin.} \tn % Row Count 13 (+ 6) % Row 20 \SetRowColor{LightBackground} \mymulticolumn{1}{x{17.67cm}}{Q / Write a program in {\bf{interrupt driven}} to convert cin \textgreater{}\textgreater{} x to Assembly code, presume that the device we are dealing with is a keyboard, and is device0 ( D0 )} \tn \mymulticolumn{1}{x{17.67cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}`ISRD0: ; Interrupt Service Routine for device 0 \{\{nl\}\}CLI ; Clear Interrupt Flag (Set it to zero and don't allow interrupts) \{\{nl\}\}PUSH AX ; Put the value of AX into the stack \{\{nl\}\}IN AL, BUFFD0 ; Put the value of the buffer of device 0 into AL \{\{nl\}\} MOV X, AL ; Put the value of AL into X \{\{nl\}\}POP AX ; Take out the value of AX from the stack \{\{nl\}\}STI ; Set Interrupt Flag (Set it to one and allow interrupts) \{\{nl\}\}IRET ; Interrupt Return (This pops the value of IP, CS and Flags from the stack)`} \tn % Row Count 28 (+ 15) \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \end{document}