ECE291 Computer Engineering II Lecture 12 Josh Potts University of Illinois at Urbana- Champaign.

Slides:



Advertisements
Similar presentations
DOS and BIOS Interrupts DOS and BIOS interrupts are used to perform some very useful functions, such as displaying data to the monitor, reading data from.
Advertisements

A Design Example An Exact Calculator. Exact Calculator Manipulating Large Integer Values Operations: – +, -, *, /, %, And, Or, Xor, Not, Power Functions.
CEN 226: Computer Organization & Assembly Language :CSC 225 (Lec#3) By Dr. Syed Noman.
EENG 4005 Microprocessors.
More about procedures and Video Processing. Lesson plan Review existing concepts More about procedures and boolean expression Video processing.
Video systems (continue). Practice Modify the program to get a string from a keyboard to display the input string on the middle of the screen with reverse.
Assembly Language for Intel-Based Computers Chapter 15: BIOS-Level Programming (c) Pearson Education, All rights reserved. You may modify and.
Chapter 7 Programming with DOS and BIOS Function Calls Objectives: The use of DOS and BIOS function call How to read the PC’s keyboard How to send text.
Kip Irvine: Assembly Language for Intel-Based Computers
Screen Display Module M15.2 Sections 9.5, 13.1, 13.2.
Practical Session No. 10 Input &Output (I/O). I/O Devices Input/output (I/O) devices provide the means to interact with the “outside world”. An I/O device.
CEN 226: Computer Organization & Assembly Language :CSC 225 (Lec#8) By Dr. Syed Noman.
Video Monitor Uses raster scanning to display images
Assembly Language for Intel-Based Computers, 5 th Edition Chapter 15: BIOS-Level Programming (c) Pearson Education, All rights reserved. You.
ICS312 Set 4 Program Structure. Outline for a SMALL Model Program Note the quiz at the next lecture will be to reproduce this slide.MODEL SMALL.586 ;
Lab 5 Part C Write to the screen a character string that uses a ‘$’ to indicate the end of the string. Do not write the ‘$’ to the screen. Use DOS Interrupt.
BIOS1 Basic Input Output System BIOS BIOS refers to a set of procedures or functions that enable the programmer have access to the hardware of the computer.
ORG ; FOUR INT 21H and INT 10H Programming and Macros Dec Hex Bin
Lecture 11 Last notes on interrupts and exam review Dr. Dimitrios S. Nikolopoulos CSL/UIUC.
BIOS1 Basic Input Output System BIOS BIOS refers to a set of procedures or functions that enable the programmer have access to the hardware of the computer.
ECE291 Computer Engineering II Lecture 13 Dr. Zbigniew Kalbarczyk University of Illinois at Urbana- Champaign.
ECE291 Computer Engineering II Lecture 9 Josh Potts University of Illinois at Urbana- Champaign.
Video Monitor Uses raster scanning to display images –Beam of electrons illuminates phosphorus dots on the screen called pixels. Starting at the top of.
Text-mode Video Dr. Dimitrios S. Nikolopoulos CSL/UIUC
1/2002JNM1 Positional Notation (Hex Digits). 1/2002JNM2 Problem The 8086 has a 20-bit address bus. Therefore, it can access 1,048,576 bytes of memory.
Assembly Language for x86 Processors 6th Edition
Riyadh Philanthropic Society For Science Prince Sultan College For Woman Dept. of Computer & Information Sciences CS 251 Introduction to Computer Organization.
BIOS and DOS Programming in DOS INT 10 and 21H. Interrupts There are some extremely useful subroutines within BIOS or DOS that are available to the user.
1 Screen and Keyboard Operations Suthida Chaichomchuen
1 Chapter 5: Procedures and Interrupts Assembly Language for Intel-Based Computers, Kip R. Irvine 3rd edition 3/17/2000.
Lab 8 Bit-Mapped Graphics Moving from text-based graphics to bit- mapped graphics. Easy to draw graphic points and lines using INT 10h, Function 0Ch (write.
Text-Mode Programming Question #1 What are the three levels of access to the video display when writing characters on the screen in text mode?
Lecture 10: BIOS and DOS Programming
ECE291 Lecture 12 Mode 13h Graphics. ECE 291 Lecture 12Page 2 of 27 Lecture outline Color theory Video Hardware Mode 13h Graphics File Formats.
ECE291 Computer Engineering II Lecture 15 Josh Potts University of Illinois at Urbana- Champaign.
Lecture 7 A closer look at procedures Dr. Dimitrios S. Nikolopoulos CSL/UIUC.
File I/O MS-DOS Interrupt 21h has many functions dealing with file and directory I/O services. Both MS-DOS and MS_Windows use 16- bit integers called HANDLES.
Binary Number Output To display a number in binary format, a program looks at each bit in the number and sends the ASCII equivalent of a ‘1’ (31h) or a.
Video systems. Lesson plan Review the code for the previous exercise Video systems Review for midterm exam.
8086 Microprocessor Interrupts By: Vijay Kumar. K Reference From Slide Share.
21/11/2005CAP2411 Input & Output Instructions CPU communicates with the peripherals through I/O registers called I/O ports. There are 2 instructions, IN.
ECE291 Lecture 6 Procedures and macros. ECE 291 Lecture 6Page 2 of 36 Lecture outline Procedures Procedure call mechanism Passing parameters Local variable.
ECE 103 Engineering Programming Chapter 53 Generic Algorithms Herbert G. Mayer, PSU CS Status 6/4/2014 Initial content copied verbatim from ECE 103 material.
10H Interrupt. Option 0H – Sets video mode. Registers used: – AH = 0H – AL = Video Mode. 3H - CGA Color text of 80X25 7H - Monochrome text of 80X25 Ex:
String Instructions String instructions were designed to operate on large data structures. The SI and DI registers are used as pointers to the data structures.
4. Kernel and VGA ENGI 3655 Lab Sessions. Richard Khoury2 Textbook Readings  None.
Lecture 9 (The Stack and Procedures). 1 Lecture Outline Introduction The Stack The PUSH Instruction The POP Instruction Terminology of Procedures INDEC.
Microprocessors Monday, Apr. 16 Dr. Asmaa Farouk Faculty of Engineering, Electrical Department, Assiut University.
ECE291 Lecture 10 Interrupts II. ECE 291 Lecture 9Slide 2 of 22 Lecture outline Installing/Removing ISRsInstalling/Removing ISRs Interrupt SchedulingInterrupt.
Week 9 Monitors and output to the screen. Monitors, also known as Visual display units (V.D.Us) Desktop computers contain a Cathode Ray Tube (C.R.T.)
Calling Procedures C calling conventions. Outline Procedures Procedure call mechanism Passing parameters Local variable storage C-Style procedures Recursion.
ECE291 Computer Engineering II Lecture 8 Josh Potts University of Illinois at Urbana- Champaign.
Assembly Language Lecture 2. Lecture Outline Program Structure Memory models Data Segment Stack Segment Code Segment Input and Output Instructions INT.
Lecture 11 Text mode video
Direct-Access Color Graphics Chapter 11. Graphics modes C++ provides a different combination of graphics characteristics. These characteristics include.
File Operations. FILE PROCESSING For the purposes of the following discussion, reading means copying all or part of an existing file into memory Writing.
ECE291 Computer Engineering II Lecture 14 Josh Potts University of Illinois at Urbana- Champaign.
Computer Graphics Lecture 04 Point Taqdees A. Siddiqi
1st prog! Q: Read a char – from a keyboard & display it at the beginning of the next line! ====== A.
COURSE OUTCOMES OF Microprocessor and programming
Additional Assembly Programming Concepts
9/17/2018 Kiến Trúc Máy Tính.
Microprocessor and Assembly Language
Symbolic Instruction and Addressing
8086 Registers Module M14.2 Sections 9.2, 10.1.
Symbolic Instruction and Addressing
Symbolic Instruction and Addressing
Unit:08 Software Interrupts
Chapter 6 –Symbolic Instruction and Addressing
Process.
Presentation transcript:

ECE291 Computer Engineering II Lecture 12 Josh Potts University of Illinois at Urbana- Champaign

Josh PottsECE291 Outline Video Display Text video mode Controlling and accessing video display using –DOS functions –BIOS functions

Josh PottsECE291 Basic Forms of Input and Output I/O-mapped I/O –uses special instructions to transfer data between the computer system and the outside world Memory-mapped I/O –uses special memory locations in the normal address space of the CPU to communicate with real-world devices Direct memory access (DMA) –special form of memory-mapped I/O where the peripheral device reads and writes the memory without going through the CPU –Note that the CPU and DMA device cannot both use the address and data buses at the same time –concurrent processing only occurs if the CPU has a cache and is executing code and accessing data found in the cache (so the bus is free)

Josh PottsECE291 Video I/O Video is the primary form of I/O between a human and a computer The monochrome (one color) monitor uses one wire for video, one for horizontal sync, and one for vertical synch A color video monitor uses three video signals: red, green, & blue –these monitors are called RGB monitors and convert the analog RGB signal to an optical image. The RGB monitor is available as either analog or TTL monitor

Josh PottsECE291 TTL RGB monitor Uses TTL level signals (0 or 5V) as video inputs (RGB) and an extra signal called intensity to allow change in intensity Used in the CGA (Color Graphics adaptor) system found in older computers Can display a total of 16 different colors (eight are generated at high intensity and eight at low intensity) Example: Red GreenBlueIntensityColor Black Gray Light green Light red White

Josh PottsECE291 The Analog RGB Monitor Uses analog signals - any voltage between 0.0 V and 0.7 V This allow infinite number of colors to be displayed In practice a finite number of levels is generated (256K, 16M, or 24M colors depending on the standard) Analog displays use a digital-to-analog converter (DAC) to generate each color video voltage A common standard uses a 6-bit DAC to generate 64 different video levels between 0 V and 0.7 V –this allows 64x64x64 different colors to be displayed or 262,144 (256 K) colors 8-bit DACs allow 256x256x256 or 16M colors

Josh PottsECE291 The Analog RGB Monitor The Video Adapter converts digital information from the CPU to analog signals for a monitor. VRAM/DRAM Video/Dynamic Random Access Memory –Stores screen content Video BIOS –Stores character mappings Palette registers –Defines R/G/B color values Graphic accelerator –Hardware implemented graphic routines DAC –Generates analog Red/Green/Blue signals

Josh PottsECE291 The Analog RGB Monitor Example of Video Generation Example video generation used in video standards such as EGA (enhance graphic adapter) and VGA (variable graphics array) A high-speed palette SRAM (access time less than 40ns) stores 256 different codes that represent 256 different hues (18-bit codes) This 18-bit code is applied to the DACs The SRAM is addressed by 8-bit code that is stored in the computer VRAM to specify color of the pixel Once the color code is selected, the three DACs convert it to three video voltages for the monitor to display a picture element (pixel)

Josh PottsECE291 The Analog RGB Monitor Example of Video Generation (cont.) Any change in the color codes is accomplish during retrace (moving the electron beam to the upper left-hand corner for vertical retrace and to the left margin of the screen for horizontal retrace) The resolution of the display (e.g., 640x400) determines the amount of memory required for the video interface card 640x400 resolution with 256 colors (8 bit per pixel) 256K bytes of memory are required to store all the pixels for the display

Josh PottsECE291 Text-Video Mode There is not a single common device for supporting video display There are numerous display adapter cards available for the PC Each supports several different display modes We discuss the 80x25 text display mode which is supported by most of display adapters The 80x25 text display is a two dimensional array of words with each word in the array corresponding a character on the screen Storing the data into this array affects the characters appearing on the display

Josh PottsECE291 Text-Video Mode Each text page occupies under 4K bytes of memory 80(columns) x 25 (rows) x 2 (bytes) = 4000bytes The LO byte contains the ASCII code of the character to display The HO byte contains the attribute byte The color display adapters provide 32 K for text displays and let you select one of eight different pages Each display begins on a 4K boundary, at address: –B800:0, B800:1000, B800:2000, …. B800:7000 You can address the memory on the video display like ordinary RAM, but it is never a good idea to do this –access to the display adapter is much slower than to the main memory

Josh PottsECE291 Text-Video Mode The attribute byte controls underlying background and foreground colors, intensity and blinking video Choose your colors with care (some combinations of foreground and background colors are not readable) Do not overdo blinking text on the screen

Josh PottsECE291 Using DOS and BIOS Functions to Control Display DOS (disk operating system) and BIOS (basic I/O system) provide functions to control and to access the I/O environment of the computer including display. DOS provides INT 21h, which is called the DOS function dispatcher and supports functions such as: read from the keyboard, write to the screen, write to the printer, read and write to disk files ….. INT 21 must be told which function is being requested this information is passed by placing the function number in the AH register depending on the function being used, other information may be needed

Josh PottsECE291 Displaying A Single Character Using DOS INT 21h Example: suppose that the letter ‘A’ is to be printed to the screen at the current cursor position can use function 02h, or 06h (this function can also be used to read a key) INT 21h must also be told which letter to print – the ASCII code must be placed into DL register MOVDL, ‘A’ MOVAH, 06h INT21h

Josh PottsECE291 Displaying A Character String Using DOS INT 21h DOS function 09h displays a character string that ends with $ MSGDB‘This is a test line’,’$’ …... MOVDX, OFFSET MSG MOVAH, 09h INT21h The string will be printed at the current cursor position

Josh PottsECE291 Using BIOS to Control Display The DOS function calls allow a key to be read and a character to be displayed but the cursor is difficult to be position at the desired screen location The BIOS function calls allow more control over the video display and require less time to execute than the DOS function calls BIOS provides interrupt INT 10h, known as video interrupt, which gives access to various functions to control video screen Before we place information on the screen we should get the position of the cursor: function 03h reads cursor position (DH = Row, DL = Column, BH =Page # function 02h sets cursor position (DH = Row, DL = Column, BH =Page #

Josh PottsECE291 Using BIOS to Control Display Function 0Fh finds the number of the active page –the page number is returned in BH register The cursor position assumes that –the left hand page column is column 0 progressing across a line to column 79 –the row number corresponds to the character line number on the screen

Josh PottsECE291 Using BIOS to Control Display Example TITLE vidDispl.asm CR EQU 0dh LF EQU 0ah.MODEL small.STACK.DATA HeadBYTE '==============', 0 PromptBYTE 'Middle (12, 40)’,0 ClearBYTE'Do you want to clear screen', 0 yesBYTE3 dup (?) middleBYTE'Move cursor to the middle', 0 HelloBYTE'ECE291', 0.CODE.STARTUP movds, ax GetPage MACRO ;gets current page movah, 0fh int10h ENDM HomeMACRO ;moves cursor to (0,0) GetPage movah, 02h movdx, 0 ;coordinates of the cursor int10h ENDM

Josh PottsECE291 Using BIOS to Control Display Example (cont.) ClearScr MACRO ;clear the screen GetPage mov ah, 8;read attributes int 10h mov bl, bh mov bh, ah;bh=attributes for cleared area sub cx, cx ;ch and cl = (x,y) coordinates of upper left ;corner of the window (0, 0) mov dx, 184fh;dh and dl = (x,y) coordinates of lower ;right corner of the window (24, 79) mov ax, 0600h;al=#lines to scroll if zero window cleared int 10h ENDM

Josh PottsECE291 Using BIOS to Control Display Example (cont.) ClearScr Home mov ax, OFFSET Head push ax call putStr call newLine mov ax, OFFSET Clear push ax call putStr call newLine mov ax, OFFSET yes ;checks whether to clear the screen push ax call getStr movbx, OFFSET yes cmpBYTE PTR [bx], 'y' jne noClear ClearScr Home noClear: call newLine mov ax, OFFSET middle push ax call putStr call newLine mov ax, OFFSET yes push ax call getStr mov bx, OFFSET yes cmp BYTE PTR [bx], 'y' jne goToEnd

Josh PottsECE291 Using BIOS to Control Display Example (cont.) ;Cursor to the middle of the screen ClearScr GetPage movdh, 12 movdl, 40 movah, 02h int10h movbl, 1eh ;initial attributes ;background = blue (001) ;foreground = yellow(110) movcx,1 ;#times a character ;will be printed mov al, 'M' ;mark middle with M movah, 09h int10h ;write in the middle movdh, 12 movdl, 42 ;move the cursor two ;position right movah, 02h int10h mov ax, OFFSET Prompt push ax call putStr call newLine

Josh PottsECE291 Using BIOS to Control Display Example (cont.) ;Print text with different attributes GetPage mov si,OFFSET Hello mov bl, 1ah ;initial attributes ;background = blue (001) ;foreground = green (010) movcx,80 ;#times a character will be printed movah,09h ;ready to write a character next: call newLine cmp BYTE PTR [si], 0 ;check for the end of the string je goToEnd mov al, [si] int 10h inc si ;next character inc bl ;change in foreground color jmp next goToEnd: mov ah, 4ch int 21h

Josh PottsECE291 Using BIOS to Control Display Example (cont.) ;OFFSET of string to be printed must ;be on the stack and the string must ;be null terminated putStrPROC NEAR pushbp movbp, sp pushax pushbx pushdx movbx, [bp + 4] ;expect bx to point to string movah, 2h nextChar: cmp BYTE PTR [bx], 0h ;check for null terminator jefoundEnd ;when found exit movdl, [bx] int21h ; print with 21h incbx ;point to next char jmpnextChar foundEnd: popdx popbx popax popbp ret 2 putStrENDP

Josh PottsECE291 Using BIOS to Control Display Example (cont.) ;OFFSET of large enough buffer must ;have been pushed onto stack ;string will be null terminated getStrPROC NEAR pushbp movbp, sp pushax pushbx movbx, [bp + 4] ;base address of storing buffer movah, 01h getLoop: int21h cmpal, CR ;look for CR in al je getEnd mov[bx], al ;bx points to storage location inc bx jmpgetLoop getEnd: movBYTE PTR [bx], 0 ;CR is converted in null term popbx popax popbp ret2 getStr ENDP

Josh PottsECE291 Using BIOS to Control Display Example (cont.) newLine PROC NEAR push ax push dx movah, 02h movdl, CR int21h movdl, LF int21h popdx popax ret newLineENDP