home *** CD-ROM | disk | FTP | other *** search
/ Turbo Toolbox / Turbo_Toolbox.iso / spezial / 20 / dos_txl / source / macros.c < prev    next >
Encoding:
C/C++ Source or Header  |  1991-02-15  |  1.3 KB  |  34 lines

  1. /*** Hercules : 0xB0000000, CGA-VGA : 0xB8000000,
  2.      muß vom Programm evtl. gesetzt werden. ****/    
  3.  
  4. extern char far *SCRSEG;
  5. extern char far *SCRPTR;
  6.  
  7. #define SCR_OFS(x,y) ((y-1)*160+(x-1)*2)
  8.     /*** Ergebnis : Offset des Zeichens an Position x/y ***/
  9.  
  10. #define SET_POS(x,y) { SCRPTR=SCRSEG+SCR_OFS(x,y); }
  11.     /*** Setzt Bildschirmposition für alle Makros auf x/y ***/
  12.  
  13. #define WR_SCR(c,a)    { *SCRPTR=(c); *(SCRPTR+1)=(a); SCRPTR+=2; };
  14.     /*** Schreibt an aktuelle Position (siehe SET_POS) das Zeichen c 
  15.          mit dem Attribut a ***/
  16.  
  17. #define WR_ATR(a)    { *(SCRPTR+1)=(a); SCRPTR+=2; };
  18.     /*** wie WR_SCR, nur Farbe wird gesetzt. ***/
  19.         
  20. #define CLEAR_LINE(count,a) { int i; for (i=1; i<=count; i++) WR_SCR(' ',(a)) }
  21.     /*** Füllt ab der gesetzten Position count Stellen mit Leerzeichen 
  22.          in Farbe a ***/
  23.         
  24. #define WR_STR(str,a)  { char *ptr=(str); while (*ptr!=0) { WR_SCR(*ptr,(a)); ptr++; } }
  25.     /*** Schreibt String str in Farbe a an gesetzte Position ***/
  26.         
  27. #define WR_ASTR(zahl,a)  { int i; for (i=1; i<=zahl; i++) WR_ATR((a)); }
  28.     /*** wie WR_STR, ohne Zeichenausgabe ***/
  29.         
  30. #define GET_CHRS(ptr,count) { int i; char *p=(ptr); for (i=1; i<=count*2; i++) { *p++=*SCRPTR++; } }
  31.  
  32. #define MAX(x,max) { if ((x)>(max)) x=(max); }
  33.              
  34. #define MIN(x,min) { if ((x)<(min)) x=(min); }