00001 /*@A (C) 1992 Allen I. Holub */ 00002 #ifndef __VBIOS_H 00003 #define __VBIOS_H 00004 00005 #include "termlib.h" 00006 00007 #define VIDEO_INT 0x10 /* Video interrupt */ 00008 #define KB_INT 0x16 /* Keyboard interrupt */ 00009 #define CUR_SIZE 0x1 /* Set cursor size */ 00010 #define SET_POSN 0x2 /* Modify cursor posn */ 00011 #define READ_POSN 0x3 /* Read current cursor posn */ 00012 #define SCROLL_UP 0x6 /* scroll region of screen up */ 00013 #define SCROLL_DOWN 0x7 /* " down */ 00014 #define READ_CHAR 0x8 /* Read character from screen */ 00015 #define WRITE 0x9 /* Write character */ 00016 #define WRITE_TTY 0xe /* Write char & move cursor */ 00017 #define GET_VMODE 0xf /* Get video mode & disp pg */ 00018 /* These video-BIOS functions are implemented as macros. The ones marked with 00019 * stars have side effects. 00020 * 00021 * VB_INCHA Returns the character and attribute ORed together. Character in 00022 * the low byte and attribute in the high byte. 00023 * VB_GETPAGE Return the currently active display page number 00024 * VB_GETCUR Get current cursor position. The top byte of the return value 00025 * holds the row, the bottom by the column. Pagenum is the video 00026 * page number. Note that VB_GETPAGE() will mess up the fields in 00027 * the Regs structure so it must be called first. 00028 * VB_CURSIZE Change the cursor shape to go from the top to the bottom scan 00029 * line. 00030 * VB_OUTCHA * Write a character and attribute without moving the cursor. The 00031 * attribute is in c's high byte, the character is the low byte. 00032 * VB_REPLACE * Same as VB_OUTCHA but uses the existing attribute byte. 00033 * VB_SETCUR Modify current cursor position. The top byte of "posn" value 00034 * holds the row (y), the bottom byte, the column (x). The top-left 00035 * corner of the screen is (0,0). Pagenum is the video-display-page 00036 * number. 00037 * VB_CTOYX(y,x) Like VB_SETCUR but y and x coordinates are used. 00038 * VB_SCROLL * Scroll the indicated region on the screen. If amt is <0, 00039 * scroll down; otherwise, scroll up. 00040 * VB_CLRS Clear the entire screen 00041 * VB_CLR_REGION * Clear a region of the screen 00042 * VB_BLOCKCUR Change to a block cursor. 00043 * VB_NORMALCUR Change to an underline cursor. 00044 * VB_PUTCHAR like vb_putc, but uses white on black for the attribute. 00045 */ 00046 00047 #define VB_GETPAGE() _Vbios( GET_VMODE, 0, 0, 0, 0, "bh") 00048 #define VB_INCHA() _Vbios( READ_CHAR, 0, VB_GETPAGE(), 0, 0, "ax") 00049 #define VB_GETCUR() _Vbios( READ_POSN, 0, VB_GETPAGE(), 0, 0, "dx") 00050 #define VB_CURSIZE(t,b) _Vbios( CUR_SIZE, 0,0,((t)<<8)|(b),0, "ax") 00051 #define VB_OUTCHA(c) _Vbios( WRITE, (c)&0xff,((c)>>8)&0xff, 1, 0, "ax") 00052 #define VB_REPLACE(c) VB_OUTCHA( (c & 0xff) | (VB_INCHA() & ~0xff) ) 00053 #define VB_SETCUR(posn) _Vbios( SET_POSN, 0, VB_GETPAGE() << 8, 0,(posn), "ax") 00054 #define VB_CTOYX(y,x) VB_SETCUR( ((y) << 8) | ((x) & 0xff) ) 00055 00056 #define VB_SCROLL(xl, xr, yt, yb, amt, attr) _Vbios( \ 00057 ((amt) < 0) ? SCROLL_DOWN : SCROLL_UP, \ 00058 abs(amt), (attr) << 8, ((yt) << 8) | (xl), \ 00059 ((yb) << 8) | (xr), "ax"\ 00060 ) 00061 00062 #define VB_CLRS(at) VB_SCROLL( 0, 79, 0, 24, 25, (at)) 00063 #define VB_CLR_REGION(l,r,t,b,at) VB_SCROLL( (l),(r),(t),(b),((b)-(t))+1,(at)) 00064 00065 #define VB_BLOCKCUR() VB_CURSIZE( 0, vb_iscolor() ? 7 : 12 ) 00066 #define VB_NORMALCUR() ( vb_iscolor() ? VB_CURSIZE(6,7) : VB_CURSIZE(11,12) ) 00067 #define VB_PUTCHAR(c) vb_putc( (c), NORMAL ) 00068 00069 #endif /* __VBIOS_H */