ICS312 Lecture1

Download Report

Transcript ICS312 Lecture1

ICS312 Set 18
Graphics Mode Programming
And Mouse Functions
3 ways to send output to the
screen



Direct Video access: This method moves
characters directly to the video buffer in
memory. Provides best performance.
BIOS-level access: This method displays
characters using the BIOS video routines of INT
10h.
DOS-level access: Very poor performance and
infrequently used.
Recall:
INT 10h Video Functions
00h: Set Video Mode.
Selects the video mode and clears the screen automatically.
Input:
AH = 0
AL = 3
AL = 13h
; mode 3 = 80 cols x 25 rows color text
; to avoid clearing the screen use mode 83h to set high bit
; sets resolution to 320 x 200 graphics mode
When BIOS sets the display mode, it also clears the screen.
Graphics Demo Program
This demo program illustrates writing directly to the video buffer which
is much faster than using the specialized graphics display functions that are
provided by INT 10h or INT 21h.
Title Graphics Demo
; to write a yellow horizontal line 150 pixels long, starting at col 10, row 30
.model small
.386
.stack 100h
.code
main proc
; set graphics mode
mov ah, 0
mov al, 13h
int 10h
; 320 X 200 graphics mode
Graphics Demo Program
(Cont.1)
; prepare for string instructions
mov ax, 0A000h
; set ES
mov es, ax
cld
; set DF for left to right
mov al, 0eh
; set color as yellow
mov cx, 150
; number of pixels to display
mov di, 30*320+10
; di = rows * 320 + cols
REP STOSB
; writes the byte in Al repetitively CX times starting at ES:DI
Graphics Demo Program
(Cont.2)
; wait for keystroke
mov ah, 1
int 21h
mov ax, 4C00h
int 21h
main endp
end main