Microprocessor and Assembly Language

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

More about procedures and Video Processing. Lesson plan Review existing concepts More about procedures and boolean expression Video processing.
BY Kamran Yousaf Application of Computer Graphics and Animation Using C++ Language.
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.
1 King ABDUL AZIZ University Faculty Of Computing and Information Technology CS 454 Computer graphicsIntroduction Dr. Eng. Farag Elnagahy
Monitors and Sound Systems section 3A This lesson includes the following sections: · Monitors · PC Projectors · Sound Systems.
Computer Monitors Principles of Information Technology Lytle High School Click to Continue.
IE433 CAD/CAM Computer Aided Design and Computer Aided Manufacturing Part-2 CAD Systems Industrial Engineering Department King Saud University.
Peripherals The term peripherals refers to all hardware devices that are attached to your computer and are controlled by your computer system Peripherals.
Practical PC, 7th Edition Chapter 17: Looking Under the Hood
ORG ; FOUR INT 21H and INT 10H Programming and Macros Dec Hex Bin
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.
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
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.
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.
3 Types of Video Output for Text DOS-level INT (Int 21) Output can be easily redirected to other devices (printer, disk) Slow Speed Cannot control the.
GRAPHICS MODULE 14 STUDY BOOK. Graphic commands SCREEN - puts the screen into graphics mode WINDOW - allows scaling of the screen LINE - 3 formats –LINE.
Data Representation The storage of Text Numbers Graphics.
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:
Computer Fundamentals MSCH 233 Lecture 5. The Monitor A Monitor is a video screen that looks like a TV. It displays both the input data and instructions,
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.
Graphics in a computers memory How a picture (i.e. a graphic) is stored in a computers memory A computer screen is made up of little dots, called PICture.
4. Kernel and VGA ENGI 3655 Lab Sessions. Richard Khoury2 Textbook Readings  None.
Microprocessors Monday, Apr. 16 Dr. Asmaa Farouk Faculty of Engineering, Electrical Department, Assiut University.
ROM BIOS Chapter 9. The ROM BIOS PC computer come with a set od built in routines collectively called the ROM BIOS. These routines are permanent part.
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.)
Lecture 11 Text mode video
Direct-Access Color Graphics Chapter 11. Graphics modes C++ provides a different combination of graphics characteristics. These characteristics include.
ECE291 Computer Engineering II Lecture 12 Josh Potts University of Illinois at Urbana- Champaign.
CS-401 Computer Architecture & Assembly Language Programming Lecture-16 Display Memory.
Computer Graphics Lecture 04 Point Taqdees A. Siddiqi
DISPLAY DEVICES CIS 10, Group #1 April 01, 2006 C. X. A. L. K. H. A. V. ((( L. C.
Flowchart of basic interrupt mechanism
Computer Graphics Lecture 13 Graphics Systems Taqdees A
Computer Graphics Lecture 3 Computer Graphics Hardware
DIGITAL CALCULATOR USING 8051
Computer Organization & Assembly Language Chapter 3
9/17/2018 Kiến Trúc Máy Tính.
EET 2261 Unit 11 Controlling LCD and Keypad
Defining Types of data expression Dn [name] expression Dn [name]
Symbolic Instruction and Addressing
EET 2261 Unit 11 Controlling LCD and Keypad
Microprocessor and Assembly Language
Ch2: Data Representation
Morgan Kaufmann Publishers Computer Organization and Assembly Language
Symbolic Instruction and Addressing
COMP 1321 Digital Infrastructure
Clock hardware Chapter 5 CS 1550, cs.pitt.edu (originaly modified by Ethan L. Miller and Scott A. Brandt)
COMP 1321 Digital Infrastructure
Graphics Systems SUBJECT: COMPUTER GRAPHICS LECTURE NO: 02 BATCH: 16BS(INFORMATION TECHNOLOGY) 1/4/
Symbolic Instruction and Addressing
Graphics Systems Lecture-2
Unit:08 Software Interrupts
Otasuke GP-EX! Chapter 2 Run State Screen.
Digital Image Processing
Multimedia System Image
Chapter 2 Overview of Graphics Systems
Chapter 6 –Symbolic Instruction and Addressing
This lesson includes the following sections:
Microprocessor and Assembly Language
Presentation transcript:

Microprocessor and Assembly Language Lecture-12-Text Display and Keyboard Programming Muhammad Hafeez Department of Computer Science GC University Lahore

Today’s Agenda Controlling the Screen Controlling the Keyboard

The Monitor Electron gun shoot a stream on phosphorus screen Lines and dots are generated with electron gun A raster of lines is created starting from top left corner of screen

Types of Monitors Monochrome Color Single beam, single color typically amber or green Dots of different brightness is created called gray scale Color Screen is coated with RGB phosphorus, and three guns are used to create a single homogenous color

Types of Monitors Monochrome Color Single beam, single color typically amber or green Dots of different brightness is created called gray scale Color Screen is coated with RGB phosphorus, and three guns are used to create a single homogenous color

Video Adapters Video Adapter has two parts Display Memory Video Controller Display Memory address starts at segment A000h and above depending upon the type of video adapter Video Controller reads Display Memory and do appropriate task on the screen

Types of Video Adapters in IBM PC

Display Modes Computer has different techniques and memory requirement for displaying text and images Video Adapter has two modes, each for text and images Text Mode Screen is divided into Rows and Column, 25 rows (0-24) and 80 columns (0-79) Graphics Mode Screen is again divided into Rows and Columns and each screen position is called a pixel

Text Mode Character Generation Every single character on the screen is created using a dotter array called character cell The video adapter uses a character generation circuit to create a dotted pattern Number of dots in a character depends upon the resolution of adapter, monitor has its resolution, its mandatory that both monitor and adapter’s resolution must be compatible

Details of IBM Video Adapters IBM introduced MDA and CGA with its original PC MDA only supported text mode with good character resolution i.e. 9x14 dots, used for business software CGA could display both text and graphics but low resolution in character cell i.e. 8 x 8 dots Then IBM introduced EGA for both text and graphics with character cell 8 x 14 dots Finally IBM introduced VGA and MCGA with more text and graphics resolution, text resolution 8 x 19 dots for each character

Details of IBM Video Adapters IBM introduced MDA and CGA with its original PC MDA only supported text mode with good character resolution i.e. 9x14 dots, used for business software CGA could display both text and graphics but low resolution in character cell i.e. 8 x 8 dots Then IBM introduced EGA for both text and graphics with character cell 8 x 14 dots Finally IBM introduced VGA and MCGA with more text and graphics resolution, text resolution 8 x 19 dots for each character

Text Mode Number A program can select text or graphics mode Following are text mode

Screen Positions 80 x 25 screen positions

Character display and Video Memory In text mode screen consists of rows and columns (80x25), in graphics mode (40x25) is also possible A character displayed at screen is defined by content of word in display memory Low byte contains character ASCII code High byte contains character attribute

Display pages MDA adapter display memory hold screen full of data Graphics adapter can contain many screens of display text, each screen is called display page Number of display varies among adapter starts from 0 Each display page is 4KB for MDA has one page starts at B000:0000h CGA has four pages starting at B800:0000h

Number of pages from various adapter in text mode

Attribute Byte In text mode, high byte of character is called attribute byte It defines foreground color, background color, intensity and whether a character is blinking or not Number of display varies among adapter starts from 0 Each display page is 4KB for MDA has one page starts at B000:0000h CGA has four pages starting at B800:0000h

Attribute Byte Attribute byte for 16 color display has the following format Red color on blue background 0001 0100

Attribute Byte Adjacent colors can be added to produce new colors Intensity bit is used to brighten the color on color display Normal attribute for a character is 07h, white on black background

16 Color on Color Display

Monochrome attributes

Screen Rows and Columns

Manual Screen Printing

Video Interrupt 10h Text Mode functions of INT 10H Select text display mode i.e. character height and width and number of rows and columns INT 10H INPUT: AH=0 AL = Mode Number OUTPUT: None

Video Interrupt 10h Change Cursor Size INT 10H Cursor is displayed as small dotted array MDA, EGA 14 rows (0-13), 11 and 12 lit CGA 8 rows (0-7), 6 and 7 lit INT 10H INPUT: AH=1 CH = start scan line CL = end scan line OUTPUT: None

Video Interrupt 10h Move Cursor INT 10H Let the cursor move anywhere on the screen INT 10H INPUT: AH=2 DH = new cursor row (0-24) DL = new cursor column (0-79) BH= page number OUTPUT: None

Video Interrupt 10h Get cursor position and size INT 10H If we want to know current cursor position INT 10H INPUT: AH=3 BH= page number OUTPUT: DH = CURSOR ROW DL = CURSOR COLUMN CH = CURSOR START SCAN LINE CL = CURSOR END SCAN LINE

Video Interrupt 10h Select active display page INT 10H INPUT: AH=5 AL = ACTIVE DISPLAY PAGE (0-7) OUTPUT: NONE

Video Interrupt 10h INT 10H Scroll the screen Up Also used to clear the screen or clear a particular area on the screen It could be used to draw game boxes INT 10H INPUT: AH=6 AL = Number of lines to scroll up, 0 means whole screen BH = attribute for blank line (07H) CH, CL = ROW, COL FOR UPPER LEFT CORNER OF WINDOW DH, DL = ROW, COL FOR LOWER RIGHT CORNER OF WINDOW OUTPUT: NONE

Video Interrupt 10h INT 10H Scroll the screen Down Also used to clear the screen or clear a particular area on the screen It could also be used to draw game boxes INT 10H INPUT: AH=7 AL = Number of lines to scroll up, 0 means whole screen BH = attribute for blank line (07H) CH, CL = ROW, COL FOR UPPER LEFT CORNER OF WINDOW DH, DL = ROW, COL FOR LOWER RIGHT CORNER OF WINDOW OUTPUT: NONE

Video Interrupt 10h INT 10H Read a character a cursor position INPUT: AH=8 BH = Page Number OUTPUT: AH = ATTRIBUTE OF CHARACTER AL = ASCII OF CHARACTER

Video Interrupt 10h Display character at cursor with any attribute INT 10H INPUT: AH=9 BH = Page Number AL = ASCII OF CHARACTER TO DISPLAY CX = NUMBER OF TIMES TO WRITE CHARACTER BL = ATTRIBUTE OF CHARACTER OUTPUT: NONE

Video Interrupt 10h Display character at cursor with current attribute Cursor does not advance after display of character INT 10H INPUT: AH=0AH BH = Page Number AL = ASCII OF CHARACTER TO DISPLAY CX = NUMBER OF TIMES TO WRITE CHARACTER OUTPUT: NONE

Video Interrupt 10h Display character at cursor with current attribute Cursor is advanced one position This BIOS interrupt is called by INT 21h function 2 INT 10H INPUT: AH=0EH BH = Page Number AL = ASCII OF CHARACTER TO DISPLAY BL = FOREGROUND COLOR (GRAPHICS MODE) OUTPUT: NONE

Video Interrupt 10h INT 10H Get Video Mode INPUT: AH=0FH OUTPUT: AH = NUMBER OF SCREEN COLUMNS AL = DISPLAY MODE BH = ACTIVE DISPLAY PAGE

Video Interrupt 10h

Graphics Three color graphics adapters for IBM PC CGA (Color Graphics Adapter) EGA (Enhanced Graphics Adapter) VGA (Video Graphics Array)

Composition of Video on Monitor Electron beam creates scan lines on screen Number of dots per line can vary by changing the size of dot Number of scan lines may also vary

Pixel Graphics mode screen is also divided into rows and column Each intersection of row and column is called Pixel (Picture Element) Number of pixels define the resolution of screen 320x200 means 300 columns and 200 rows Columns are numbered from left to right starting with 0 Rows numbered from top to bottom start with 0 If in low resolution a pixel may contain more than two dots

Graphics Modes

CGA Graphics CGA in medium resolution 320x200 and high resolution 640x200 16 KB memory starting at address B800:0000 and end at B800:3FFF Each pixel is coded by two bits Four colors can be displayed at a time Medium resolution is 320x200 = 64000 pixels Each pixel require two bits 64000x2 = 128000 bits or 16000 bytes Display memory is 16 KB

16 color combinations

Text in Graphics Mode In graphics mode characters are formed by turning pixels on and off and are not drawn by character generating circuitry as in text mode However cursor position can still be set by using function number 2 INT 10h When we display text in graphics mode we use text coordinates

Text COLUMNS AND ROWS IN GRAPHICS MODE

Set Background Color INT 10H Set Background color after setting mode INPUT: AH=0BH BH = 0 BL = COLOR NUMBER (0-15) OUTPUT: NONE

Writing Pixel INT 10H Write Graphics Pixel INPUT: AH=0CH AL = PIXEL VALUE (COLOR) BH = PAGE NUMBER CX = COLUMN NUMBER DX = ROW NUMBER OUTPUT: NONE

Reading Pixel Read Graphics Pixel INT 10H INPUT: AH=0DH BH = PAGE NUMBER CX = COLUMN NUMBER DX = ROW NUMBER OUTPUT: AL = PIXEL VALUE (COLOR) Pixel read and write can be done any display page

Active Display Page INT 10H Select Active Display Page INT 10H INPUT: AH=5 AL = PAGE NUMBER OUTPUT: AL = PIXEL VALUE (COLOR) Quickly switching the page can be used for animation

Vga Adapter VGA has two important modes to work 640x480 resolution on mode 12H with 16 colors 320x200 resolution on mode 13H with 256 colors. 12H is good for game purpose

Random Number Here is the Program to generate Semi-Random Number

Adding Sound Communicate with Ports using IN and OUT instructions These instructions help assembly program to communicate with peripheral devices

Input/ Output Ports Ports are like registers, in which we send 8-bit or 16-bit data from AL or AX Ports contents can also be read in AL or AX Ports are connected to peripheral devices We change something in Port content, we send a message to particular peripheral devices

Out Instruction Send byte/ word to Input/ Output Port In case of Byte OUT Portno, AL In case of Word OUT Portno, AX

Internals of Port 61

In Instruction Receive byte/ word to Input/ Output Port In case of Byte OUT AL, Portno In case of Word OUT AX, Portno

Example: Sound generation using direct Port access

Timer in IBM PC Three types of timers circuits in IBM PC Timer0 used for DMA (Data Transfer) Timer1 is used as system clock Timer2 is connected to the speaker

Generating Sound using Timer2 Three step process Put a certain number in timer2 to initialize it Load a 16 bit number into timer2 to establish the frequency of tone to be generated Open a switch in output port 61H to generate the sound

Generating Sound using Timer2