home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / PASCAL / MADTRB16.ZIP / EXFW.PAS < prev    next >
Encoding:
Pascal/Delphi Source File  |  1986-02-15  |  2.0 KB  |  55 lines

  1. type
  2.    Str80 = string[80] ;
  3. {  Procedure to write formatted output to a given location on the screen.  }
  4. {  This one procedure can accept real and integer numbers and formate them }
  5. {  as in standard turbo calls.  It also can accept byte and string         }
  6. {  variables as input.  Nice all around formatted write procedure.  I don't}
  7. {  understand the inline code but I assume that it is used to write the    }
  8. {  information to the video buffer.                                        }
  9. {          Feb. 15, 1986     Madison, WI IBM PC UG Turbo SIG Librarian,    }
  10. {                                                     -CAR-                }
  11. procedure Fwrite(col,row : integer ; attrib : byte ; VarType : char ;
  12.                   var Arg ; NumPos,NumDec : integer) ;
  13. var
  14.    RealNum : real absolute Arg ;
  15.    IntNum  : integer absolute Arg ;
  16.    ByteNum : byte absolute Arg ;
  17.    InStr   : Str80 absolute Arg ;
  18.    OutStr  : Str80 ;
  19. begin
  20.    col := col - 1 ;
  21.    row := row - 1 ;
  22.    case UpCase(VarType) of
  23.       'R'  : Str(RealNum:NumPos:NumDec,OutStr) ;
  24.       'I'  : Str(IntNum:NumPos,OutStr) ;
  25.       'B'  : Str(ByteNum:NumPos,OutStr) ;
  26.       'S'  : OutStr := InStr ;
  27.    else
  28.       Exit ;
  29.    end ;
  30.    inline
  31.       ($1E/$1E/$8A/$86/row/$B3/$50/$F6/$E3/$2B/$DB/$8A/$9E/col/
  32.        $03/$C3/$03/$C0/$8B/$F8/$be/$00/$00/$8A/$BE/attrib/
  33.        $8a/$8e/OutStr/$22/$c9/$74/$3e/$2b/$c0/$8E/$D8/$A0/$49/$04/
  34.        $1F/$2C/$07/$74/$22/$BA/$00/$B8/$8E/$DA/$BA/$DA/$03/$46/
  35.        $8a/$9A/OutStr/$EC/$A8/$01/$75/$FB/$FA/$EC/$A8/$01/$74/$FB/
  36.        $89/$1D/$47/$47/$E2/$Ea/$2A/$C0/$74/$10/$BA/$00/$B0/
  37.        $8E/$DA/$46/$8a/$9A/OutStr/$89/$1D/$47/$47/$E2/$F5/$1F);
  38. end ;
  39.  
  40. var
  41.    Strng    : Str80 ;
  42.    ByteVal  : byte ;
  43.    IntVal   : integer ;
  44.    RealVal  : real ;
  45. begin
  46.    ClrScr ;
  47.    Strng := 'This is a test' ;
  48.    FWrite(10,10,7,'s',Strng,1,0) ;
  49.    ByteVal := 20 ;
  50.    FWrite(12,11,7,'b',ByteVal,1,0) ;
  51.    IntVal := 2000 ;
  52.    FWrite(14,12,7,'i',IntVal,1,0) ;
  53.    RealVal := 1.6667098E12 ;
  54.    FWrite(16,13,7,'r',RealVal,10,25) ;
  55. end.