150 likes | 242 Views
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 text color BIOS-level INT (Int 10) Higher speed than DOS (when filling large areas, a slight delay detected).
E N D
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 text color • BIOS-level INT (Int 10) • Higher speed than DOS (when filling large areas, a slight delay detected). • User can control the text color • Output cannot be redirected • Direct video Access (Memory Mapped Graphics) • Characters are moved directly to video RAM, so execution is instantaneous • Output cannot be redirected • Usage restricted to full-screen mode under Windows NT, 2000, and XP
Text Modes(can only display characters from the IBM extended Character set)
BIOS • Basic Input Output Service – a set of X86 routines stored in ROM that can be used by any operating system for low level I/O to various devices. • Int 10h – Video Services • Int 16h – Keyboard Services • Int 17h – Printer Services • Int 33h - Mouse Services
Lab 7A – Positioning the Cursor • Irvine Library Function – Clrscr • Dos Int 21h, Function 7 – get char with no echo • ‘w’- move “up” - ‘a’ – move left • ‘s’ – move “down” - ‘d’ – move right • Procedure “Setcur” – uses BIOS int 10h, function 2 to set cursor position.
Value Attributes 07 Normal 87 Blinking 0F Bright(highlight) 70 Reverse(inverse) 01 Underline 09 Bright underline Monochrome Attributes
Color Attributes – foreground – chars; background – screen behind chars b7 b0
Lab 7B – Character Attributes • Procedure setcur – positions cursor • Procedure wchar – writes character with attribute at current cursor position (will have to increment column)
Random Number Generation • Irvine Library Functions • Randomize – Re-seeds the random number generator. Current time value is seed value. No input or output required. Only needs to be called once at the beginning of a program. • Random_Range – Returns a pseudo-random 32-bit integer between 0 and n. Input: EAX = n.
Lab 7C – Pseudo-Random Numbers; Delay • Randomize and Random-Range used for random number generation. EAX = 10 to produce the values 0-9. To display ASCII value, 30h added to returned value. • Procedure mywait – waits the number of milliseconds in CX.
Mywait Procedure • Uses 64-bit timer • Timer accessed through timget procedure • Uses rdtsc (read time stamp counter) • Windows 95 and some 98 versions have problems with the timget procedure • Inner loop of mywait waits number of timeticks equivalent to 1 millisecond (TICS_MS = CLKFREQ*1000) • Need to set CLKFREQ = your PC clock frequency
CLKFREQ • START->Search->Find->FILES/Folders • Find ‘msinfo32.exe’ • Programs->Accessories->System Tools->SystemInfo • System Summary • Reboot PC – watch BIOS screen information