home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / pascal / library / dos / jr_tools / jrscr201.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1988-07-12  |  5.0 KB  |  162 lines

  1. Unit JRSCR201 ;
  2.  
  3. (*╔═════════════════════════════════════════════════════════════════════════╗*)
  4. (*║                                                                         ║*)
  5. (*║             JR Unit Library  -  Version 2.01  -  June xxrd 1988         ║*)
  6. (*║                                                                         ║*)
  7. (*║                 Screen control functions and procedures                 ║*)
  8. (*║                                                                         ║*)
  9. (*╚═════════════════════════════════════════════════════════════════════════╝*)
  10.  
  11. Interface
  12.  
  13. (*───────────────────────────────────────────────────────────────────────────*)
  14.  
  15. Uses Dos ;
  16.  
  17. (*───────────────────────────────────────────────────────────────────────────*)
  18.  
  19. Const _BIOSVideoService    = $10 ;
  20.  
  21. (*───────────────────────────────────────────────────────────────────────────*)
  22.  
  23. Type  _ScreenType    = Array(.0..3999.) Of Byte ;
  24.  
  25. (*───────────────────────────────────────────────────────────────────────────*)
  26.  
  27. Var
  28.       _regs8086    : Registers ;
  29.       _Screenbuf   : _ScreenType  Absolute $B800:$0000 ;
  30.       _VideoMode   : Byte         Absolute $0000:$0449 ;
  31.  
  32. (*───────────────────────────────────────────────────────────────────────────*)
  33.  
  34. Procedure _Cursor(_startline,_endline : Integer) ;
  35. Procedure _ScrollDown(_lowerX,_lowerY,_upperX,_upperY,
  36.                        _lines,_attribute : Integer) ;
  37. Procedure _ScrollUp(_lowerX,_lowerY,_upperX,_upperY,
  38.                     _lines,_attribute : Integer) ;
  39. Procedure _SetPage(_pagenr : Integer) ;
  40. Procedure _DispChar(_x,_y : Integer  ; _char : Char ;_attribute : Integer) ;
  41. Procedure _DispStr(_x,_y : Integer ; _string : String ;_attribute : Integer) ;
  42. Procedure _ShowScreen(_screen : _ScreenType) ;
  43. Procedure _ReadScreen(_screenfile : String ; Var _screen : _ScreenType) ;
  44. Procedure _SaveScreen(Var _screen : _ScreenType) ;
  45.  
  46. (*───────────────────────────────────────────────────────────────────────────*)
  47.  
  48. Implementation
  49.  
  50. (*───────────────────────────────────────────────────────────────────────────*)
  51.  
  52. Procedure _Cursor ;
  53. (*  Version 1.01  *)
  54. Begin ;
  55.    With _regs8086 Do Begin ;
  56.         If (_startline=0) And (_endline=0) Then ch:=32
  57.         Else Begin ;
  58.            ch:=_startline ; cl:=_endline ;
  59.         End ;
  60.         ah:=1 ;
  61.    End ;
  62.    Intr(_BIOSVideoService,_regs8086) ;      
  63. End  (* Procedure _Cursor *) ;
  64.  
  65. (*───────────────────────────────────────────────────────────────────────────*)
  66.  
  67. Procedure _ScrollDown ;
  68. (*  Version  1.01  *)
  69. (*  Modified 2.00  *)
  70. Begin ;
  71.    With _regs8086 Do Begin ;
  72.       ah:=6 ; al:=_lines ;
  73.       cl:=_lowerX-1 ; dh:=_lowerY-1 ;
  74.       dl:=_upperX-1 ; ch:=_upperY-1 ;
  75.       bh:=_attribute ;
  76.    End ;
  77.    Intr(_BIOSVideoService,_regs8086) ;      
  78. End  (* Procedure _ScrollDown *) ;
  79.  
  80. (*───────────────────────────────────────────────────────────────────────────*)
  81.  
  82. Procedure _ScrollUp ;
  83. (*  Version 1.01   *)
  84. (*  Modified 2.00  *)
  85. Begin ;
  86.    With _regs8086 Do Begin ;
  87.       ah:=7 ; al:=_lines ;
  88.       cl:=_lowerX-1 ; dh:=_lowerY-1 ;
  89.       dl:=_upperX-1 ; ch:=_upperY-1 ;
  90.       bh:=_attribute ;
  91.    End ;
  92.    Intr(_BIOSVideoService,_regs8086) ;      
  93. End  (* Procedure _ScrollUp *) ;
  94.  
  95. (*───────────────────────────────────────────────────────────────────────────*)
  96.  
  97. Procedure _SetPage ;
  98. (*  Version 1.01  *)
  99. Begin ;
  100.    With _regs8086 Do Begin ;
  101.         al:=_pagenr ; ah:=5 ;
  102.    End ;
  103.    Intr(_BIOSVideoService,_regs8086) ;      
  104. End  (* Procedure _SetPage *) ;
  105.  
  106. (*───────────────────────────────────────────────────────────────────────────*)
  107.  
  108. Procedure _DispChar ;
  109. (*  Version 1.01  *)
  110. Var _ix : Integer ;
  111. Begin ;
  112.    _ix:=2*((_x-1)+(_y-1)*80) ;
  113.    _Screenbuf(._ix.):=Ord(_char) ;
  114.    _Screenbuf(._ix+1.):=_attribute ;
  115. End  (* Procedure _DispChar *) ;
  116.  
  117. (*───────────────────────────────────────────────────────────────────────────*)
  118.  
  119. Procedure _DispStr ;
  120. (*  Version 1.01  *)
  121. Var _i,_ix : Integer ;
  122.     _ch : Char ;
  123. Begin ;
  124.    _ix:=2*((_x-1)+(_y-1)*80) ;
  125.    For _i:=1 To Length(_string) Do Begin ;
  126.        _ch:=_string(._i.) ;
  127.        _Screenbuf(._ix+2*_i-2.):=Ord(_ch) ;
  128.        _Screenbuf(._ix+2*_i-1.):=_attribute ;
  129.    End ;
  130. End  (* Procedure _DispStr *) ;
  131.  
  132. (*───────────────────────────────────────────────────────────────────────────*)
  133.  
  134. Procedure _ShowScreen ;
  135. (*  Version 1.01  *)
  136. Begin ;
  137.    _Screenbuf:=_screen ;
  138. End  (* Procedure _ShowScreen *) ;
  139.  
  140. (*───────────────────────────────────────────────────────────────────────────*)
  141.  
  142. Procedure _ReadScreen ;
  143. (*  Version 1.02  *)
  144. Var _file : File ;
  145.        _i : Integer ;
  146. Begin ;
  147.    Assign(_file,_screenfile) ; Reset(_file,4000) ;
  148.    BlockRead(_file,_screen,1,_i) ; Close(_file) ;
  149. End  (* Procedure _ReadScreen *) ;
  150.  
  151. (*───────────────────────────────────────────────────────────────────────────*)
  152.  
  153. Procedure _SaveScreen ;
  154. (*  Version 1.02  *)
  155. Begin ;
  156.    _screen:=_Screenbuf ;
  157. End  (* Procedure _SaveScreen *) ;
  158.  
  159. (*───────────────────────────────────────────────────────────────────────────*)
  160.  
  161. End  (* Of Unit JRSCR201 *).
  162.