00001
00002 #include "video.h"
00003 #include "termlib.h"
00004
00005
00006
00007 static int Row = 0;
00008 static int Col = 0;
00009
00010
00011
00012
00013
00014
00015
00016 #define fix_cur()
00017
00018
00019
00020 void dv_putc( int c, int attrib )
00021 {
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034 switch( c )
00035 {
00036 case 0: break;
00037
00038 case '\f':
00039 dv_clrs( attrib );
00040 Row = Col = 0;
00041 break;
00042
00043 case '\n':
00044 if( ++Row >= NUMROWS )
00045 {
00046 dv_scroll_line(0,79,0,24, 'u', NORMAL );
00047 Row = NUMROWS-1 ;
00048 }
00049
00050 case '\r':
00051 Col = 0;
00052 break;
00053
00054 case '\b': if( --Col < 0 )
00055 Col = 0;
00056 break;
00057
00058 default :
00059
00060
00061
00062 SCREEN[ Row ][ Col ].letter = c ;
00063 SCREEN[ Row ][ Col ].attribute = attrib ;
00064 if( ++Col >= NUMCOLS )
00065 {
00066 Col = 0;
00067 if( ++Row >= NUMROWS )
00068 {
00069 dv_scroll_line(0,79,0,24, 'u', NORMAL );
00070 Row = NUMROWS-1 ;
00071 }
00072 }
00073 break;
00074 }
00075 fix_cur();
00076 }
00077
00078
00079
00080 void dv_ctoyx(int y,int x )
00081 {
00082 Row = y;
00083 Col = x;
00084
00085 fix_cur();
00086 }
00087
00088
00089
00090 void dv_getyx(int *rowp,int *colp )
00091 {
00092 *rowp = Row;
00093 *colp = Col;
00094 }
00095
00096
00097
00098 int dv_incha(void)
00099 {
00100 return (int)( VSCREEN[ Row ][ Col ] );
00101 }
00102
00103 void dv_outcha(int c)
00104 {
00105 *VSCREEN[ Row ][ Col ] = c ;
00106 }
00107
00108 void dv_replace(int c)
00109 {
00110 SCREEN[ Row ][ Col ].letter = c ;
00111 }
00112
00113 void dv_putcyx(int y,int x,int c,int a)
00114 {
00115 SCREEN[ y ][ x ].letter = (char)c ;
00116 SCREEN[ y ][ x ].attribute = (char)a ;
00117 }
00118
00119