Video systems
Transcript of Video systems
Video systems
Lesson plan
Review the code for the previous exercise
Video systems
Review for midterm exam
Midterm exam
Thursday,March 16, 2004.
Include:Multiple choice
Fill-in the blank
Problem solving
Last practice exercise
MOV AX,DATASEG ;Set address of data MOV DS, AX
MOV AH, 0AH ;Get inputsLEA DX, Para_listINT 21H
MOV BH, 00 ;Add ‘$’ to the endMOV BL, act_len ;of the input stringMOV input[BX+1],'$'
Last practice exercise
MOV AH, 02H ; set cursorMOV BH, 0 ; page# to BHMOV DH, 12 ; row# to DHMOV DL, 40 ; column# to DLINT 10H MOV AH,09H ; display the stringlea dx, inputint 21h
Video systems
Components of a video system
Monitor
Monitor SignalGenerator
CharacterGenerator
Mode Control
Video controller
Attribute Decoder
Video displayArea
Video systems
MonitorConsists of a group of closely-spaced horizontal lines (raster)Each line consists of pointsEach points consists of three luminescent phosphor dots
Video Display AreaIs the area in memory to contain data for text and graphic mode (buffer)Address depends on the type of video adapter and chosen mode
Video systems
Video display area:A0000H: font descriptors
B0000H: monochrome text for mode 07H
B8000H:Text and graphic modes
Allows store data in pages
Video controllerGenerates horizontal and vertical timing signals
Video systems
Video BIOS:Acts as an interface to the video adapter contains routines as setting the cursor and displaying characters
Video RAM bios supports two Video Data Areas:
40:[49H]: current mode, #columns, size
40:[84H]: #rows and height
Video systems
Video modes (text and graphic modes)
Mode Type Area Page
07 Monochrome B000 0
03 Color B800 0-3
Attributes
Attribute byte in text mode determines the characteristics of each displayed characters
Background Foreground
Black Blue 01HBlue Red 14HGreen Cyan 23HWhite Light magenta 7DHGreen Gray A8H
BIOS INT 10H
We have learned INT 10H to:
This week, we use this 10H
to manage screen, cursor, pages
Clear screenSet cursor
Set video mode
Step 1: Set AH=00HStep 2: Load video mode to AL (see video mode on page 156)Step 3: Call INT 10H
Example:MOV AH, 00HMOV AL, 00H ;Text mode 40x25INT 10H
Video mode supported by EMU8086
00h - text mode. 40x25. 16 colors. 8 pages.
03h - text mode. 80x25. 16 colors. 8 pages.
13h - graphical mode. 40x25. 256 colors. 320x200 pixels. 1 page
Set cursor size
Step 1: Set AH=01HStep 2: Set CH=start scanning lineStep 3: Set CL =end scanning lineStep 4: Call INT 10H
Start scanning line: [0,13]End scanning line:[0,14]when bit 5 of CH is set to 0, the cursor is
visible. when bit 5 is 1, the cursor is not visible.
Set cursor size
Example:MOV AH, 01H
MOV CH, 00H
MOV CL, 07H
INT 10H
Get cursor status
• Cursor status include: row, column and size of the cursor
Step 1: Set AH=03H
Step 2: Set BH= page number
Step 3: Call INT 10H
Step 4: Return values at DH=Row, DL=Column, CH= Starting scan line and CL= Ending scan line
Get cursor status
Example
MOV AH, 03h
MOV BH,0
INT 10H
Scroll up screen
• Step 1: Set AH=06H, Set AL= number of rows
• Step 2: Set BH= Attribute or pixel value
• Step 3: Set CX: starting row:column
• Step 4: Set DX: ending row:column
Scroll up screen
• Example:MOV AX, 602H ; AH=06H, AL=02H
MOV BH, 61H ; Brown background, ; Blue foreground
MOV CX, 0000H
MOV DX, 184FH ; Scroll full screen
INT 10H
Scroll down screen
Step 1: Set AH=07H, AL=00H
Step 2: Set BH=attribute or pixel value
Step 3: Set CX=Starting row:column
Step 4: Set DX=Ending row:column
Scroll down screen
Example:MOV AX, 702H ; AH=06H, AL=02H
MOV BH, 61H ; Brown background, ; Blue background
MOV CX, 0000H
MOV DX, 184FH ; Scroll full screen
INT 10H
Display character and attribute at cursor
Step1: Set AH=09H
Step 2: Set AL=character to display
Step 3: Set BL = attribute or pixel value
Step 4: Set BH= page number
Step 5: Call INT 10H
Display character and attribute at cursor
Example:
MOV AH, 09H
MOV AL, 41H
MOV BL, 16H
MOV BH, 0
MOV CX, 10
INT 10H
Read character and attribute at Cursor
INT 10H Function 08H
MOV AH, 08H
MOV BH, 00
INT 10H
The character will be stored at AL and its attribute is stored in AH
Review midterm exercise
Review chapter 8
Read Character Generator Data
INT 10H function 11H and subfunction 30H
Example
Step 1: Set AH=11H and AL=30H
Step 2: Set BH=0; code 0,1,2..7
Step 3: Call INT 10H
Display character string
INT 10H, function 13HStep 1: Set AH=13HStep 2: Set AL=subfunction(00,01,02,or 03)Step 3: Set BH=page numberStep 4:Set BL=attributeStep 5: Set BP=address of the string (ES:BP)Step 6: Set CX=lengthStep 7: Set DX=row:columnStep 8: Call INT 10H
Display character stringExample:
MOV AL, 1 MOV BH, 0 MOV BL, 00111011bMOV CX, 10;MOV DL, 10MOV DH, 7PUSH DSPOP ESLEA BP, offset messageMOV AH, 13h int 10h
Answers for review exercise
1. On the display screen, the row:column (a) for the upper left corner is numbered _00_H:__00__H; (b) for the upper right corner is _00__H:_4F_H; (c) for the lower left corner is _18__H:_00__H; (d) for the lower right corner is _18___H:_4F_H.
Answers for review exercise
2. INT 10H_ is the BIOS operation for screen handling, and function 02__ in AH tells the operation to set the cursor. Page number, normally 0_, is in the _BH__ register, and row and column are in the _DX__ register.
Answers for review exercise
3. For screen clearing or scrolling, use BIOS INT 10H__ and insert function _06H_ in AH, _00__ for full screen in AL, _attribute___ in BH, starting row:column______ in CX, and ending row:column_____ in DX.
Answers for review exercise
4. INT 21H function 09H for displaying requires defining a display string in the data area, immediately followed by the __$____ character.
Answers for review exercise
5. For INT 21H function 0AH, the area for keyboard input requires definition of a _parameter_ _list___. The first byte contains maximum number of character entered_. The second byte is for the operation to store the __actual number of character entered_. The third byte begins a field that is to contain _entered ______ _characters_________.
Answers for review exercise
6. INT 21H function _40H__ for file handles requests display. Load file handle 01 in the _BX__ register, the number of characters to display in the _CX__ register, and the address of the area to display in the _DX__ register.
Answers for review exercise
7. The hex character for Tab is _09H_, for Line Feed is _0AH_, and for Carriage Return is _0DH_.
Answers for review exercise
This code uses the instructions for INT 21H function 40H to display the message "Informatics Computers" followed by a Carriage Return and Line Feed, to begin displaying at row 02, column 18.
Week 5 review
A _short_____ address is limited to a distance of -128 to 127 bytes. A _near_____ address is limited to a distance of 32,768 to 32,767 bytes within the same segment. A _far___ address is one that is (usually) in another segment and is reached by a segment:offset value.
Week 5 review
The LOOP instruction requires an initial value in the _CX__ register. For each iteration, LOOP deducts 1 from this value; if it is __zero______, control drops through to the following instruction, and if it is _nonzero______, control jumps to the operand address.
Week 5 review
The _CALL___ instruction transfers control to a called procedure and the RET___ instruction returns from the called procedure to the original calling procedure.
Week 5 review
A CALL to a procedure within the same segment is _near___ (short/near/far) and decrements the _SP__ register by 2, pushes the _IP__ register (containing the offset of the instruction following the CALL) onto the stack, and inserts the offset address of the called procedure in the _IP_ register.
Week 5 review
A RET instruction that returns from a near procedure pops the original value from the stack into the _IP__ register and increments the _SP__ register by 2.
Week 5 review
AX= 0 CX=5AX=AX+BX = 0+25CX=4AX=AX+BX =0+25+25 CX=3AX=AX+BX=0+25+25+25CX=2AX=AX+BX=0+25+25+25+25CX=1AX=AX+BX= 0+25+25+25+25+25CX=0 (quit)AX= 25*5 = 125