1 / 23

Day 02

Day 02. Vdu Basics. The DOS Perspective. Writing to Video Mode in Text Mode. Biosequip() and _bios_equiplist() RS-232 communications. VDU BASICS. Components of VDU Monitor and video graphics adapter. Monitor: Refresh rate-

johnwilbur
Download Presentation

Day 02

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Day 02 Vdu Basics. The DOS Perspective. Writing to Video Mode in Text Mode. Biosequip() and _bios_equiplist() RS-232 communications. ACCEL SOFTWARE AND TECHNOLOGIES LTD.

  2. VDU BASICS • Components of VDU Monitor and video graphics adapter. • Monitor: • Refresh rate- The microprocessor does not have the ability to send signals directly to the monitor. Either the microprocessor or the graphics processor writes the data on the video memory. The data on the video memory is converted to analog signals and send to CRT to get displayed. When the electron beam strikes the phosphor coating the CRT glows. The phosphor particle have a property that unless the electron beam again strike them they would vanish. To over come this the graphics circuitry reads the information repeatedly and display on the screen ACCEL SOFTWARE AND TECHNOLOGIES LTD.

  3. VDU BASICS The process is called refreshing the screen and the rate at which it is refreshed is called refresh rate. • Resolution: The display resolution is defined by the number of rows from top to bottom and number of pixels from left to right on each scan. • Graphics circuitry: The graphics adapter converts the digital information from the video memory to analog signals which gets displayed on the screen. • Category of adapters: 1. MDA (Monochrome display adapter). 2. HGC (Hercules graphics card). 3. VGA (Video graphics array). ACCEL SOFTWARE AND TECHNOLOGIES LTD.

  4. VDU BASICS 4. CGA (Color graphics adapter). 5. EGA (Enhanced graphics adapter). 6. SVGA (Super video graphics adapter). • Modern graphics adapter: The graphics cards are connected either to PCI or AGP. The communication between the processor and adapter in PCI takes place through PCI bus which is shared by many devices. AGP is not shared and is dedicated to graphics operation alone. COMPONENTS: • Graphics processor- The graphics processor relives the main processor from sending data to the graphics card. The main processor sends a set of instructions to the graphics processor. ACCEL SOFTWARE AND TECHNOLOGIES LTD.

  5. VDU BASICS • Video Memory- The memory that holds the video image to be displayed on the screen is called video memory. The video memory holds the information about the pixels and color of the pixels. • DAC- The data received form the main processor is in the form of digital information which has to be converted to analog information that can be displayed on the monitor. • Graphics BIOS- The BIOS on the rom chip coordinates the activity of the other chips available on the video card. Color in Text Mode: The text displayed on the screen occupies 2 byte of video memory to display each character. The byte 1 represents the ASCII value of the text getting displayed. The byte 2 represents the color characteristics. ACCEL SOFTWARE AND TECHNOLOGIES LTD.

  6. VDU BASICS The color byte contains three characteristics 1. The foreground text color. 2. The background color. 3. The blinking component. 7 6 5 4 3 2 1 0 purpose - - - - - - - 1 - - - - - - 1 - - - - - - 1 - - - - - - 1 - - - - - - 1 - - - - - - 1 - - - - - - 1 - - - - - - 1 - - - - - - - Blue f/g color Green f/g color Red f/g color Intensity of f/g Blue b/g color Green b/g color Red b/g color blinking ACCEL SOFTWARE AND TECHNOLOGIES LTD.

  7. The DOS Perspective • The first four bit produces 16 different foreground color. • The next 3 bit component produces 8 different background color. The DOS Perspective: • The DOS works under the real mode of operation. • In these mode of operation the size of the register is 16 bits so the maximum size of the segment could be 64k. • In DOS 2 blocks of memory A block and B block each of 64kb are reserved to access the video memory. • Any thing that has to be displayed on the screen has to be written in these memory location. WRITING TO VIDEO MEMORY IN TEXT MODE There are three different methods for displaying character on the screen. ACCEL SOFTWARE AND TECHNOLOGIES LTD.

  8. WRITING TO VIDEO MEMORY IN TEXT MODE a. using standard library routine. b. using ROM-BIOS or DOS routine. c. writing character directly into video memory. • The block B is used is used for displaying character in text mode. • Each character to be displayed occupies 2 bytes in memory. E.g If ‘A’ is displayed in the 0th row and 0th column on the screen if the address is 0xB8000 the next address contains the color attribute of the character. • About (80*25*2) which is 4000 bytes of memory is occupied for the total display on the screen. ACCEL SOFTWARE AND TECHNOLOGIES LTD.

  9. WRITING TO VIDEO MEMORY IN TEXT MODE • E.g Screen full of ‘A’: main() { int I; char far *scr = 0xB8000000L; for(I=0;I<=3999;I=I+2); *(scr+I)=‘A’; } • E.g changing the color of a character: main() { int I; char far *scr = 0xB8000000L; for(I=1;I<=3999;I=I+2); *(scr+I)=112; } ACCEL SOFTWARE AND TECHNOLOGIES LTD.

  10. Biosequip() and _bios_equiplist() • Biosequip() and _bios_equiplist() use BIOS interrupt 0x11 to return an integer describing the equipment connected to the system. • The return value is interpreted as a collection of bit-sized fields. E.g Declaration: int biosequip(void); unsigned _bios_equiplist(void); • Let us see how the bit fields are manipulated ACCEL SOFTWARE AND TECHNOLOGIES LTD.

  11. EQUIPMENT BIOS CALLS • Interrupt INT 11H is used to determine the hardware attached to the computer system. It returns a value in register AX, which is comprised as follows, Bits Description 15,14 Number of printers 00=0, 01=1 &so on 13 Serial printer attached 12 Game I/O attached 11,10,9 Number of RS232 cards attached ACCEL SOFTWARE AND TECHNOLOGIES LTD.

  12. EQUIPMENT BIOS CALLS 8 DMA 0=m/c has DMA,1= m/c has no DMA 7,6 Number of disk drives 00=1, 01=2, 10=3, 11=4 5,4 Initial video mode 00=40, 01=80, 11=Mono 3,2 Ram Size 00=16k, 01=32k,10=48k, 11=64k 1 Co-Processor 0 IPL from disk 1=disk, 0=None ACCEL SOFTWARE AND TECHNOLOGIES LTD.

  13. Bit field format Number of parallel printers 00 = 0; 01 = 1; 10 = 2; 11 = 3 Serial printer attached Game I/O attached Number of COM ports: 000 = 0, 001 = 1,..., 111 = 7 Direct memory access (DMA) 0 = Machine has DMA; 1 = Machine doesn't have DMA Number of disk drives: 00 = 0; 01 = 1; 10 = 2; 11 = 3 Initial video mode 00 = Unused 01 = 40x25 BW with color card 10 = 80x25 BW with color card 11 = 80x25 BW with mono card Motherboard RAM size Floating-point coprocessor 00 = 16K; 01 = 32K; 10 = 48K; 11 = 64K Boot from disk ACCEL SOFTWARE AND TECHNOLOGIES LTD.

  14. EQUIPMENT BIOS CALLS Eg:Calls to the ROM BIOS Int 11h to check whether math coprocessor is installed. #include <dos.h> #include <stdio.h> union REGS regs; main() { int86(0x11,&regs,&regs); int equip_check =regs.x.ax; if(equip_check & 0x002) printf(“\n there is a math coprocessor installed “); else printf(“\n no math coprocessor installed “); } ACCEL SOFTWARE AND TECHNOLOGIES LTD.

  15. Memory size • Both biosmemory() and _bios_memsize() use BIOS interrupt 0x12 to return the size of RAM. • Declaration: int biosmemory(void); unsigned _bios_memsize(void); E.g 1 #include <bios.h> int main(void) { int memory_size; memory_size = biosmemory(); printf("RAM size = %d K",memory_size); return 0; } ACCEL SOFTWARE AND TECHNOLOGIES LTD.

  16. Memory size • E.g 2 #include <bios.h> int main(void) { unsigned memory_size; memory_size = _bios_memsize(); printf("RAM size = %d K\n", memory_size); return 0; } ACCEL SOFTWARE AND TECHNOLOGIES LTD.

  17. RS-232 communications • Both bioscom and _bios_serialcom use BIOS interrupt 0x14 to perform various RS-232 communications over the I/O port given in port. Arg What It Is/Does abyte OR combination of bits that specifies COM port settings (ignored if cmd = 2 or 3) cmd Specifies the I/O operation to perform port Identifies the I/O port; 0 = COM1, 1 = COM2, etc. Declaration: int bioscom(int cmd, char abyte, int port); unsigned _bios_serialcom(int cmd, int port, char abyte); ACCEL SOFTWARE AND TECHNOLOGIES LTD.

  18. Cmd argument settings cmd can be one of the following Bioscom _bios_serialcom What Function Does 0 _COM_INIT Sets the communications parameters to the value in abyte. 1 _COM_SEND Sends the character in abyte out over the communications line 2 _COM_RECEIVE Receives a character from the communications line. 3 _COM_STATUS Returns current status of the communications port • For all values of cmd, both functions return a 16-bit integer. ACCEL SOFTWARE AND TECHNOLOGIES LTD.

  19. More on cmd • When cmd = 2 or 3 (_COM_RECEIVE or _COM_STATUS), the abyte argument is ignored. • When cmd = 0 (_COM_INIT), abyte is an OR combination of the following bits (one from each group). ACCEL SOFTWARE AND TECHNOLOGIES LTD.

  20. More on cmd example, if abyte = 0xEB = (0xE0 | 0x08 | 0x00 | 0x03) = (_COM_9600 | _COM_ODDPARITY | _COM_STOP1 | _COM_CHR8) The communications port is set to 9600 baud (0xE0 = _COM_9600) Odd parity (0x08 = _COM_ODDPARITY) 1 stop bit (0x00 = _COM_STOP1) 8 data bits (0x03 = _COM_CHR8) ACCEL SOFTWARE AND TECHNOLOGIES LTD.

  21. 16 Bit status register 15. Time out (set to 1 if abyte value could not be sent) 14. Transmit shift register empty. 13. Transmit holding register empty. 12. Break detect. 11. Framing error. 10. Parity error. 09. Overrun error 08. Data ready. (status bits) 07. Change in clear to send. 06. Change in data set ready. (lower bits) 05. Trailing edge ring detector. 04. Change in receive line signal detector 03. Clear to send. 02. Data set ready. 01. Ring indicator. 00. Received line signal detect ACCEL SOFTWARE AND TECHNOLOGIES LTD.

  22. _BIOS_SERIALCOM() #include <bios.h> #include <conio.h> #define COM1 0 #define DATA_READY 0x100 #define TRUE 1 #define FALSE 0 #define SETTINGS (_COM_1200 | _COM_CHR7 | _COM_STOP1 | _COM_NOPARITY) int main(void) { unsigned in, out, status; _bios_serialcom(_COM_INIT, COM1, SETTINGS); printf("... _BIOS_SERIALCOM [ESC] to exit ...\r\n"); ACCEL SOFTWARE AND TECHNOLOGIES LTD.

  23. _BIOS_SERIALCOM() for (;;) { status = _bios_serialcom(_COM_STATUS, COM1, 0); if (status & DATA_READY) if ((out = _bios_serialcom(_COM_RECEIVE, COM1, 0) & 0x7F) != 0) putch(out); if (kbhit()) { if ((in = getch()) == '\x1B') break; _bios_serialcom(_COM_SEND, COM1, in); } } return 0; } ACCEL SOFTWARE AND TECHNOLOGIES LTD.

More Related