home *** CD-ROM | disk | FTP | other *** search
/ Shareware Overload / ShartewareOverload.cdr / progm / tpfast.zip / FASTSCR.ASM < prev    next >
Assembly Source File  |  1990-09-26  |  73KB  |  1,570 lines

  1. ;   _______________________________________________________________
  2. ;  |                                                               |
  3. ;  |            Copyright (C) 1989,1990  Steven Lutrov             |
  4. ;  |_______________________________________________________________|____
  5. ;  |                                                               |    |
  6. ;  |  Program Title : FastScr.Asm                                  |    | ___
  7. ;  |  Author        : Steven Lutrov                                |    |    |
  8. ;  |  Revision      : 2.01                                         |    |    |
  9. ;  |  Date          : 1990-03-16                                   |    |    |
  10. ;  |  Language      : Turbo Assembler                              |    |    |
  11. ;  |                                                               |    |    |
  12. ;  |  Description   : Assembly Functions For Primitive Screen      |    |    |
  13. ;  |                : manipulation .                               |    |    |
  14. ;  |                : Tested with Turbo Pascal 5.0 & 5.5           |    |    |
  15. ;  |                                                               |    |    |
  16. ;  |_______________________________________________________________|    |    |
  17. ;      |                                                                |    |
  18. ;      |________________________________________________________________|    |
  19. ;          |                                                                 |
  20. ;          |_________________________________________________________________|
  21. ;
  22.  
  23.  
  24. Code    Segment Word  Public
  25.  
  26. Assume  Cs:Code,Ds:Data
  27.  
  28.  
  29. Public Background,Blinkoff,Blinkon,Screencolour,Colourx
  30. Public Cursordown,Cursorleft,Cursorright,Cursoroff,Cursoron,Cursorup
  31. Public Dspat,Foreground,Formatleft,Formatright,Getcolour,Getpage
  32. Public Intenseoff,Intenseon,Normal,Reverse,Rowcolour,Setcolour,Setpage
  33. Public Dspcolour,Dsplncolour,Dsp,Dspln,Dspend,Dsppart
  34. Public Dspjust,Dspvert
  35.  
  36.  
  37. ;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  38. ;                       Local Subroutine Called By Dspend
  39. ;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  40. Writeit Proc
  41.                 Push Dx                 ;Save Dx
  42.                 Mov  Dx,Es              ;Get Video Buffer Address
  43.                 Cmp  Byte Ptr[Bp+10],0  ;Protect Against Snow?
  44.                 Je   Writeitc9          ;Jump Ahead If Not
  45.                 Mov  Dx,3Dah            ;Status Byte Address
  46.                 Mov  Bx,Ax              ;Save Char-Attri In Bx
  47. Writeitc8:      In   Al,Dx              ;Get Status Byte
  48.                 Test Al,1               ;Test Bit
  49.                 Jnz  Writeitc8          ;Loop Untill 0
  50.                 Cli                     ;Disable Interrupts
  51. Writeitc9:      In   Al,Dx              ;Get Status Byte
  52.                 Test Al,1               ;Test Bit
  53.                 Jz   Writeitc9          ;Loop Untill 1
  54.                 Mov  Ax,Bx              ;Return Char-Attri To Ax
  55. Writeitc0:      Stosw                   ;Write The Char And Attri
  56.                 Pop  Dx                 ;Restore Dx And Return
  57.                 Ret
  58. Writeit Endp
  59.  
  60.  
  61.  
  62. ;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  63. ;      Main Procedures And Functions Commence Here All Using Far Calls
  64. ;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  65.  
  66.  
  67.  
  68. ;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  69. ;Procedure Background(Code: Char);
  70. ;
  71. ;
  72. Data    Segment
  73.         Extrn  Textattr:Byte
  74. Data    Ends
  75. ;
  76. ;
  77. Background Proc Far
  78.                 Push Bp                 ;Save Bp
  79.                 Mov  Bp,Sp              ;Set Stack Frame
  80.                 Mov  Al,Textattr        ;Get Textattr
  81.                 And  Al,1111B           ;Turn Off Four High Bits
  82.                 Mov  Bl,[Bp+6]          ;Get The Code
  83.                 Cmp  Bl,97              ;Lower Case?
  84.                 Jae  Background1        ;Jump Ahead If So
  85.                 Or   Al,10000000B       ;Set Intensity Bit
  86.                 Add  Bl,32              ;Make It Lower Case
  87. Background1:    Sub  Bh,Bh              ;Use Bh As Mask
  88.                 Cmp  Bl,107             ;Black?
  89.                 Je   Background2        ;Jump If So
  90.                 Inc  Bh                 ;Increase Mask Value
  91.                 Cmp  Bl,98              ;Blue?
  92.                 Je   Background2        ;Jump If So
  93.                 Inc  Bh                 ;Increase Mask Value
  94.                 Cmp  Bl,103             ;Green?
  95.                 Je   Background2        ;Jump If So
  96.                 Inc  Bh                 ;Increase Mask Value
  97.                 Cmp  Bl,99              ;Cyan?
  98.                 Je   Background2        ;Jump If So
  99.                 Inc  Bh                 ;Increase Mask Value
  100.                 Cmp  Bl,114             ;Red?
  101.                 Je   Background2        ;Jump If So
  102.                 Inc  Bh                 ;Increase Mask Value
  103.                 Cmp  Bl,109             ;Magenta?
  104.                 Je   Background2        ;Jump If So
  105.                 Inc  Bh                 ;Increase Mask Value
  106.                 Cmp  Bl,121             ;Yellow?
  107.                 Je   Background2        ;Jump If So
  108.                 Inc  Bh                 ;Increase Mask Value
  109.                 Cmp  Bl,119             ;White?
  110.                 Je   Background2        ;Jump If So
  111.                 Jmp  Short Background3  ;Else Don'T Change Colour
  112. Background2:    Mov  Cl,4               ;Shift Left By Four Bits
  113.                 Shl  Bh,Cl              ;Make The Shift
  114.                 Or   Al,Bh              ;Set The Bits
  115.                 Mov  Textattr,Al        ;Change Textattr
  116.                 Pop  Bp                 ;Restore Bp
  117. Background3:    Ret  2
  118. Background Endp
  119.  
  120.  
  121. ;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  122. ;Procedure Blinkoff;
  123. ;
  124. ;
  125. Data    Segment
  126.         Extrn  Textattr:Byte
  127. Data    Ends
  128. ;
  129. ;
  130. Blinkoff Proc Far
  131.                 Mov  Al,Textattr        ;Get The Current Colour
  132.                 And  Al,01111111B       ;Clear The Relevant Bit
  133.                 Mov  Textattr,Al        ;Set The Value
  134.                 Ret
  135. Blinkoff Endp
  136.  
  137.  
  138. ;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  139. ;Procedure Blinkon;
  140. ;
  141. ;
  142. Data    Segment
  143.         Extrn  Textattr:Byte
  144. Data    Ends
  145. ;
  146. ;
  147. Blinkon Proc Far
  148.                 Mov  Al,Textattr        ;Get The Current Colour
  149.                 Or   Al,10000000B       ;Set The Relevant Bit
  150.                 Mov  Textattr,Al        ;Set The Value
  151.                 Ret
  152. Blinkon Endp
  153.  
  154.  
  155. ;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  156. ;Procedure Screencolour(X_Pos,Y_Pos,X_Num,Y_Num,Colour: Byte);
  157. ;
  158. ;
  159. Data    Segment
  160.         Extrn  Video_Buff:Word
  161.         Extrn  Snow_Check:Byte
  162. Data    Ends
  163. ;
  164. ;
  165. Screencolour Proc Far
  166.                 Cld                     ;Direction Flag Forward
  167.                 Push Bp                 ;Save Bp
  168.                 Mov  Bp,Sp              ;Set Stack Frame
  169.                 Mov  Ax,Video_Buff      ;Fetch Video_Buff
  170.                 Mov  Es,Ax              ;Place In Es
  171.                 Sub  Ax,Ax              ;
  172.                 Mov  Al,[Bp+12]         ;Get Y_Pos
  173.                 Dec  Ax                 ;Count From 0
  174.                 Mov  Dl,160             ;Bytes Per Y_Pos
  175.                 Mul  Dl                 ;Times Y_Pos
  176.                 Sub  Dx,Dx              ;
  177.                 Mov  Dl,[Bp+14]         ;Get Column
  178.                 Dec  Dx                 ;Count From 0
  179.                 Shl  Dx,1               ;Double For Attributes
  180.                 Add  Ax,Dx              ;Add To Y_Pos Offset
  181.                 Mov  Si,Ax              ;Es:Di Pts To First Char
  182.                 Inc  Si                 ;Shift To First Attribute
  183.                 Sub  Bx,Bx              ;
  184.                 Mov  Bl,[Bp+10]         ;X_Num In Bx
  185.                 Or   Bx,Bx              ;Test For Zero
  186.                 Jz   Screencol6         ;Quit If Zero
  187.                 Sub  Dx,Dx              ;
  188.                 Mov  Dl,[Bp+8]          ;Y_Pos In Dx
  189.                 Or   Dx,Dx              ;Test For Zero
  190.                 Jz   Screencol6         ;Quit If Zero
  191.                 Mov  Al,[Bp+6]          ;Attribute In Al
  192. Screencol1:     Mov  Cx,Bx              ;X_Num To Cx As Counter
  193.                 Mov  Di,Si              ;Move Ptr To Di
  194.                 Push Dx                 ;Save Y_Pos Counter
  195. Screencol2:     Mov  Dx,Es              ;Get Video Buffer Address
  196.                 Cmp  Snow_Check,0       ;Protect Against Snow?
  197.                 Je   Screencol5         ;Jump If Not
  198.                 Mov  Dx,3Dah            ;Status Byte Address
  199.                 Mov  Bp,Ax              ;Save Ax Contents
  200. Screencol3:     In   Al,Dx              ;Get Status Byte
  201.                 Test Al,1               ;Test Bit
  202.                 Jnz  Screencol3         ;Loop Untill 0
  203.                 Cli                     ;Disable Interrupts
  204. Screencol4:     In   Al,Dx              ;Get Status Byte
  205.                 Test Al,1               ;Test Bit
  206.                 Jz   Screencol4         ;Loop Untill 1
  207.                 Mov  Ax,Bp              ;Restore Ax Contents
  208. Screencol5:     Stosb                   ;Write An Attribute Byte
  209.                 Inc  Di                 ;Pt To Next Attri Byte
  210.                 Loop Screencol2         ;Go Do Next Attri In Line
  211.                 Pop  Dx                 ;Restore Dx
  212.                 Dec  Dx                 ;Dec Y_Pos Counter
  213.                 Jz   Screencol6         ;Quit If Finished
  214.                 Add  Si,160             ;Move Ptr Forward 1 Y_Pos
  215.                 Jmp  Short Screencol1   ;Go Do Next Y_Pos
  216. Screencol6:     Pop  Bp                 ;Restore Bp And Quit
  217.                 Sti                     ;Reenable Interrupts
  218.                 Ret  10
  219. Screencolour Endp
  220.  
  221. ;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  222. ;Procedure Colourx(X_Pos,Y_Pos,Y_Num,Colour: Byte);
  223. ;
  224. ;
  225. Data    Segment
  226.         Extrn  Video_Buff:Word
  227.         Extrn  Snow_Check:Byte
  228. Data    Ends
  229. ;
  230. ;
  231. Colourx Proc Far
  232.                 Push Bp                 ;Save Bp
  233.                 Mov  Bp,Sp              ;Set Stack Frame
  234.                 Mov  Ax,Video_Buff      ;Fetch Video_Buff Segment
  235.                 Mov  Es,Ax              ;Es Pts To Buffer
  236.                 Sub  Ax,Ax              ;
  237.                 Mov  Al,[Bp+12]         ;Get X_Pos Value
  238.                 Mov  Di,Ax              ;
  239.                 Dec  Di                 ;Count From 0
  240.                 Shl  Di,1               ;Double For Attri Bytes
  241.                 Mov  Al,[Bp+10]         ;Get Y_Pos Value
  242.                 Dec  Ax                 ;Count From 0
  243.                 Mov  Dl,160             ;Bytes Per Y_Pos
  244.                 Mul  Dl                 ;Times Columns
  245.                 Add  Di,Ax              ;Add Y_Pos Offset
  246.                 Inc  Di                 ;Es:Di Pts To 1St Attri
  247.                 Sub  Cx,Cx              ;
  248.                 Mov  Cl,[Bp+8]          ;Line Length In Cx
  249.                 Jcxz Colourx5           ;Quit If Null
  250.                 Mov  Al,[Bp+6]          ;Attribute In Al
  251.                 Cld                     ;Direction Flag Forward
  252. Colourx1:       Mov  Dx,Es              ;Get Video Buffer Address
  253.                 Cmp  Snow_Check,0       ;Protect Against Snow?
  254.                 Je   Colourx4           ;Jump If Not
  255.                 Mov  Dx,3Dah            ;Status Byte Address
  256.                 Mov  Bx,Ax              ;Save Ax Contents
  257. Colourx2:       In   Al,Dx              ;Get Status Byte
  258.                 Test Al,1               ;Test Bit
  259.                 Jnz  Colourx2           ;Loop Untill 0
  260.                 Cli                     ;Disable Interrupts
  261. Colourx3:       In   Al,Dx              ;Get Status Byte
  262.                 Test Al,1               ;Test Bit
  263.                 Jz   Colourx3           ;Loop Untill 1
  264.                 Mov  Ax,Bx              ;Restore Ax Contents
  265. Colourx4:       Stosb                   ;Change Attri Of 1 Char
  266.                 Add  Di,159             ;Move Pointer To Next Y_Pos
  267.                 Loop Colourx1           ;Go Change Next Attribute
  268. Colourx5:       Sti                     ;Enable Interrupts
  269.                 Pop  Bp                 ;Restore Bp
  270.                 Ret  8
  271. Colourx Endp
  272.  
  273. ;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  274. ;Procedure Cursordown(Y_Pos: Integer);
  275. ;
  276. ;
  277. Data    Segment
  278.         Extrn  Video_Page:Byte
  279. Data    Ends
  280. ;
  281. ;
  282. Cursordown Proc Far
  283.                 Push Bp                 ;Save Bp
  284.                 Mov  Bp,Sp              ;Set Stack Frame
  285.                 Mov  Bh,Video_Page       ;Get Page Number
  286.                 Mov  Ah,3               ;Func To Get Cursor Pos
  287.                 Int  10H                ;Y_Pos In Dh, X_Pos In Dl
  288.                 Mov  Ah,2               ;Func To Set Cursor
  289.                 Add  Dh,[Bp+6]          ;Add Offset
  290.                 Cmp  Dh,24              ;In Range?
  291.                 Jna  Cursordown1        ;Jump Ahead If So
  292.                 Mov  Dh,24              ;Else Bottom Y_Pos
  293. Cursordown1:    Int  10H                ;Reset Cursor
  294.                 Pop  Bp                 ;Restore Bp
  295.                 Ret  2
  296. Cursordown Endp
  297.  
  298.  
  299. ;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  300. ;Procedure Cursorleft(Columns: Integer);
  301. ;
  302. ;
  303. Data    Segment
  304.         Extrn  Video_Page:Byte
  305. Data    Ends
  306. ;
  307. ;
  308. Cursorleft Proc Far
  309.                 Push Bp                 ;Save Bp
  310.                 Mov  Bp,Sp              ;Set Stack Frame
  311.                 Mov  Bh,Video_Page      ;Get Page Number
  312.                 Mov  Ah,3               ;Func To Get Cursor Pos
  313.                 Int  10H                ;Y_Pos In Dh, X_Pos In Dl
  314.                 Mov  Ah,2               ;Func To Set Cursor
  315.                 Sub  Dl,[Bp+6]          ;Subtract Offset
  316.                 Cmp  Dl,79              ;In Range?
  317.                 Jna  Cursorleft1        ;Jump Ahead If So
  318.                 Mov  Dl,0               ;Else Left Column
  319. Cursorleft1:    Int  10H                ;Reset Cursor
  320.                 Pop  Bp                 ;Restore Bp
  321.                 Ret  2
  322. Cursorleft Endp
  323.  
  324.  
  325. ;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  326. ;Procedure Cursoroff;
  327. ;
  328. Data    Segment
  329.         Extrn  Startline:Byte
  330.         Extrn  Stopline:Byte
  331. Data    Ends
  332. ;
  333. ;
  334. Cursoroff Proc Far
  335.                 Mov  Ah,3               ;Func To Get Cursor Lines
  336.                 Mov  Bh,0               ;Page 0
  337.                 Int  10H                ;Ch=Start, Cl=Stop
  338.                 Mov  Startline,Ch       ;Save Startline
  339.                 Mov  Stopline,Cl        ;Save Stopline
  340.                 Mov  Cl,0               ;Make Stopline 0
  341.                 Mov  Ch,20              ;Use Too-High Number For Startline
  342.                 Mov  Ah,1               ;Func To Set Cursor Lines
  343.                 Int  10H                ;Make Cursor Invisible
  344.                 Ret
  345. Cursoroff Endp
  346.  
  347.  
  348. ;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  349. ;Procedure Cursoron;
  350. ;
  351. Data    Segment
  352.         Extrn  Startline:Byte
  353.         Extrn  Stopline:Byte
  354. Data    Ends
  355. ;
  356. ;
  357. Cursoron Proc Far
  358.                 Mov  Ch,Startline       ;Fetch Former Startline
  359.                 Mov  Cl,Stopline        ;...And Stopline
  360.                 Mov  Ah,1               ;Func To Set Cursor Lines
  361.                 Int  10H                ;Make Cursor Invisible
  362.                 Ret
  363. Cursoron Endp
  364.  
  365.  
  366. ;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  367. ;Procedure Cursorright(Columns: Integer);
  368. ;
  369. ;
  370. Data    Segment
  371.         Extrn  Video_Page:Byte
  372. Data    Ends
  373. ;
  374. ;
  375. Cursorright Proc  Far
  376.                 Push Bp                 ;Save Bp
  377.                 Mov  Bp,Sp              ;Set Stack Frame
  378.                 Mov  Bh,Video_Page      ;Get Page Number
  379.                 Mov  Ah,3               ;Func To Get Cursor Pos
  380.                 Int  10H                ;Y_Pos In Dh, X_Pos In Dl
  381.                 Mov  Ah,2               ;Func To Set Cursor
  382.                 Add  Dl,[Bp+6]          ;Add Offset
  383.                 Cmp  Dl,79              ;In Range?
  384.                 Jna  Cursoron1          ;Jump Ahead If So
  385.                 Mov  Dl,79              ;Else Right Column
  386. Cursoron1:      Int  10H                ;Reset Cursor
  387.                 Pop  Bp                 ;Restore Bp
  388.                 Ret  2
  389. Cursorright Endp
  390.  
  391.  
  392. ;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  393. ;Procedure Cursorup(Y_Pos: Integer);
  394. ;
  395. ;
  396. Data    Segment
  397.         Extrn  Video_Page:Byte
  398. Data    Ends
  399. ;
  400. ;
  401. Cursorup Proc Far
  402.                 Push Bp                 ;Save Bp
  403.                 Mov  Bp,Sp              ;Set Stack Frame
  404.                 Mov  Bh,Video_Page      ;Get Page Number
  405.                 Mov  Ah,3               ;Func To Get Cursor Pos
  406.                 Int  10H                ;Y_Pos In Dh, X_Pos In Dl
  407.                 Mov  Ah,2               ;Func To Set Cursor
  408.                 Sub  Dh,[Bp+6]          ;Subtract Offset
  409.                 Cmp  Dh,24              ;In Range?
  410.                 Jna  Cursorup1          ;Jump Ahead If So
  411.                 Mov  Dh,0               ;Else Top Y_Pos
  412. Cursorup1:      Int  10H                ;Reset Cursor
  413.                 Pop  Bp                 ;Restore Bp
  414.                 Ret  2
  415. Cursorup Endp
  416.  
  417.  
  418. ;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  419. ;Procedure Dspat(Strx: Stype; X_Pos,Y_Pos,Colour: Byte);
  420. ;
  421. ;
  422. Data    Segment
  423.         Extrn  Video_Buff:Word
  424.         Extrn  Video_Page:Byte
  425.         Extrn  Snow_Check:Byte
  426. Data    Ends
  427. ;
  428. ;
  429. Dspat Proc Far
  430.                 Cld                     ;Direction Flag Forward
  431.                 Push Bp                 ;Save Bp
  432.                 Mov  Bp,Sp              ;Set Stack Frame
  433.                 Push Ds                 ;Save Turbo'S Ds
  434.                 Mov  Ax,Video_Buff      ;Fetch Video_Buff
  435.                 Mov  Es,Ax              ;Place In Es
  436.                 Mov  Bl,Snow_Check      ;Fetch Snow_Check
  437.                 Mov  Bh,Video_Page      ;Fetch Video_Page
  438.                 Lds  Si,Dword Ptr[Bp+12] ;Ds:Si Pts To Strx
  439.                 Mov  [Bp+14],Bx         ;Save Video_Page And Snow_Check
  440.                 Sub  Cx,Cx              ;Clear Cx
  441.                 Mov  Cl,[Si]            ;String Len Counted In Cx
  442.                 Inc  Si                 ;Pt Ds:Si To First Char
  443.                 Sub  Ax,Ax              ;
  444.                 Mov  Al,[Bp+10]         ;Get X_Pos Value
  445.                 Mov  Di,Ax              ;
  446.                 Mov  Al,[Bp+8]          ;Get Y_Pos Value
  447.                 Dec  Ax                 ;Count From 0
  448.                 Mov  Dl,160             ;Bytes Per Y_Pos
  449.                 Mul  Dl                 ;Times Y_Pos
  450.                 Dec  Di                 ;Count Cols From 0
  451.                 Shl  Di,1               ;Double For Attributes
  452.                 Add  Di,Ax              ;Es:Di Pts To Lst Pos
  453.                 Jcxz Display5           ;If Null, Set Cursor,Quit
  454.                 Mov  Ah,[Bp+6]          ;Get Attribute
  455. Display1:       Lodsb                   ;Get A Character
  456.                 Cmp  Byte Ptr[Bp+14],0  ;Protect Against Snow?
  457.                 Je   Display4           ;Jump Ahead If Not
  458.                 Mov  Dx,3Dah            ;Status Byte Address
  459.                 Mov  Bx,Ax              ;Save Ah Contents
  460. Display2:       In   Al,Dx              ;Get Status Byte
  461.                 Test Al,1               ;Test Bit
  462.                 Jnz  Display2           ;Loop Untill 0
  463.                 Cli                     ;Disable Interrupts
  464. Display3:       In   Al,Dx              ;Get Status Byte
  465.                 Test Al,1               ;Test Bit
  466.                 Jz   Display3           ;Loop Untill 1
  467.                 Mov  Ax,Bx              ;Restore Ah Contents
  468. Display4:       Stosw                   ;Write It With Attribute
  469.                 Loop Display1           ;Go Do Next
  470.                 Sti                     ;Reenable Interrupts
  471. Display5:       Mov  Bh,[Bp+15]         ;Video Page To Bh
  472.                 Mov  Ax,Di              ;Screen Pointer
  473.                 Shr  Ax,1               ;Div By 2 For Attributes
  474.                 Mov  Cl,80              ;Div By Number Cols
  475.                 Div  Cl                 ;Make The Division
  476.                 Mov  Dh,Al              ;Y_Pos Number
  477.                 Mov  Dl,Ah              ;X_Pos Number
  478.                 Mov  Ah,2               ;Function To Set Cursor
  479.                 Int  10H                ;Set Curs To Final Pos
  480. Display6:       Pop  Ds                 ;Restore Ds And Quit                    
  481.                 Pop  Bp                 ;Restore Bp
  482.                 Ret  10
  483. Dspat Endp
  484.  
  485.  
  486. ;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  487. ;Procedure Foreground(Code: Char);
  488. ;
  489. ;
  490. Data    Segment
  491.         Extrn  Textattr:Byte
  492. Data    Ends
  493. ;
  494. ;
  495. Foreground Proc Far
  496.                 Push Bp                 ;Save Bp
  497.                 Mov  Bp,Sp              ;Set Stack Frame
  498.                 Mov  Al,Textattr        ;Get Textattr
  499.                 And  Al,11110000B       ;Turn Off Four Low Bits
  500.                 Mov  Bl,[Bp+6]          ;Get The Code
  501.                 Cmp  Bl,97              ;Lower Case?
  502.                 Jae  Foreground1        ;Jump Ahead If So
  503.                 Or   Al,1000B           ;Set Intensity Bit
  504.                 Add  Bl,32              ;Make It Lower Case
  505. Foreground1:    Sub  Bh,Bh              ;Use Bh As Mask
  506.                 Cmp  Bl,107             ;Black?
  507.                 Je   Foreground2        ;Jump If So
  508.                 Inc  Bh                 ;Increase Mask Value
  509.                 Cmp  Bl,98              ;Blue?
  510.                 Je   Foreground2        ;Jump If So
  511.                 Inc  Bh                 ;Increase Mask Value
  512.                 Cmp  Bl,103             ;Green?
  513.                 Je   Foreground2        ;Jump If So
  514.                 Inc  Bh                 ;Increase Mask Value
  515.                 Cmp  Bl,99              ;Cyan?
  516.                 Je   Foreground2        ;Jump If So
  517.                 Inc  Bh                 ;Increase Mask Value
  518.                 Cmp  Bl,114             ;Red?
  519.                 Je   Foreground2        ;Jump If So
  520.                 Inc  Bh                 ;Increase Mask Value
  521.                 Cmp  Bl,109             ;Magenta?
  522.                 Je   Foreground2        ;Jump If So
  523.                 Inc  Bh                 ;Increase Mask Value
  524.                 Cmp  Bl,121             ;Yellow?
  525.                 Je   Foreground2        ;Jump If So
  526.                 Inc  Bh                 ;Increase Mask Value
  527.                 Cmp  Bl,119             ;White?
  528.                 Je   Foreground2        ;Jump If So
  529.                 Jmp  Short Foreground3  ;Else Don'T Change Colour
  530. Foreground2:    Or   Al,Bh              ;Set The Bits
  531.                 Mov  Textattr,Al        ;Change Textattr
  532.                 Pop  Bp                 ;Restore Bp
  533. Foreground3:    Ret  2
  534. Foreground Endp
  535.  
  536.  
  537. ;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  538. ;Procedure Formatleft(Strx: Stype; How_Many: Integer; Colour: Byte);
  539. ;
  540. ;
  541. Data    Segment
  542.         Extrn  Video_Buff:Word
  543.         Extrn  Video_Page:Byte
  544.         Extrn  Snow_Check:Byte
  545. Data    Ends
  546. ;
  547. ;
  548. Formatleft Proc Far
  549.                 Cld                     ;Set Direction Flag
  550.                 Push Bp                 ;Save Bp
  551.                 Mov  Bp,Sp              ;Set Stack Frame
  552.                 Mov  Bh,Video_Page      ;Get Bios Page
  553.                 Mov  Ax,Video_Buff      ;Fetch Video_Buff
  554.                 Mov  Es,Ax              ;Move To Es
  555.                 Push Ds                 ;Save Ds
  556.                 Mov  Ah,3               ;Bios Call For Curs Pos
  557.                 Int  10H                ;Dh-Dl Cursor Y_Pos-X_Pos
  558.                 Mov  Ax,160             ;Bytes Per Y_Pos
  559.                 Mul  Dh                 ;Times Y_Pos
  560.                 Sub  Cx,Cx              ;Clear Cx
  561.                 Mov  Cl,Dl              ;Cols To Cx
  562.                 Shl  Cl,1               ;Double For Attributes
  563.                 Add  Ax,Cx              ;Add To Y_Pos Offset
  564.                 Mov  Di,Ax              ;Place Offset In Di
  565.                 Mov  Bl,Snow_Check     ;Fetch Snow_Check
  566.                 Lds  Si,Dword Ptr[Bp+10] ;Ds:Si Pts To Strx
  567.                 Mov  Byte Ptr[Bp+10],Bl ;Keep Snow_Check
  568.                 Mov  Cl,[Si]            ;Get Strx Length
  569.                 Jcxz Formatleft5        ;Jump If Null
  570.                 Push Dx                 ;Save Cursor Values
  571.                 Push Bx                 ;Save Video Page
  572.                 Mov  Bh,[Bp+6]          ;Attribute To Bh
  573.                 Inc  Si                 ;Forword Ptr To First Byte
  574. Formatleft1:    Mov  Bl,[Si]            ;Get A Char
  575.                 Cmp  Byte Ptr[Bp+10],0  ;Protect Against Snow?
  576.                 Je   Formatleft4        ;Jump If Not
  577.                 Mov  Dx,3Dah            ;Status Byte Address
  578. Formatleft2:    In   Al,Dx              ;Get Status Byte
  579.                 Test Al,1               ;Test Bit
  580.                 Jnz  Formatleft2        ;Loop Untill 0
  581.                 Cli                     ;Disable Interrupts
  582. Formatleft3:    In   Al,Dx              ;Get Status Byte
  583.                 Test Al,1               ;Test Bit
  584.                 Jz   Formatleft3        ;Loop Untill 1
  585. Formatleft4:    Mov  Ax,Bx              ;Get Char-Attribute
  586.                 Stosw                   ;Write It
  587.                 Inc  Si                 ;Inc Strx Ptr
  588.                 Loop Formatleft1        ;Go Do Next Char
  589.                 Sti                     ;Reenable Interrupts
  590.                 Pop  Bx                 ;Video Page Back To Bh
  591.                 Pop  Dx                 ;Restore Cursor Values
  592. Formatleft5:    Mov  Cx,[Bp+8]          ;Get New Cursor Offset
  593.                 Test Cx,8000H           ;Negative?
  594.                 Jz   Formatleft6        ;Jump If Not
  595.                 Neg  Cx                 ;Make Positive
  596.                 Add  Dh,Cl              ;Add To Y_Pos Offset
  597.                 Cmp  Dh,24              ;Bottom Of Screen?
  598.                 Jb   Formatleft7        ;Jump If Not
  599.                 Mov  Dh,24              ;Else Edge Of Screen
  600.                 Jmp  Short Formatleft7  ;To Set Cursor
  601. Formatleft6:    Add  Dl,Cl              ;Add To X_Pos Offset
  602.                 Cmp  Dl,79              ;Off Screen?
  603.                 Jb   Formatleft7        ;Jump If Not
  604.                 Mov  Dl,79              ;Else Edge Of Screen
  605. Formatleft7:    Mov  Ah,2               ;Bios Func To Set Curs
  606.                 Int  10H                ;Set New Cursor Pos
  607.                 Pop  Ds                 ;Restore Ds
  608.                 Pop  Bp                 ;Restore Bp And Quit
  609.                 Ret  8
  610. Formatleft Endp
  611.  
  612.  
  613. ;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  614. ;Procedure Formatright(Strx: Stype; How_Many: Integer; Colour: Byte);
  615. ;
  616. ;
  617. Data    Segment
  618.         Extrn  Video_Buff:Word
  619.         Extrn  Video_Page:Byte
  620.         Extrn  Snow_Check:Byte
  621. Data    Ends
  622. ;
  623. ;
  624. Formatright Proc Far
  625.                 Cld                     ;Set Direction Flag
  626.                 Push Bp                 ;Save Bp
  627.                 Mov  Bp,Sp              ;Set Stack Frame
  628.                 Mov  Bh,Video_Page      ;Get Bios Page
  629.                 Mov  Ax,Video_Buff      ;Fetch Video_Buff
  630.                 Mov  Es,Ax              ;Move To Es
  631.                 Push Ds                 ;Save Ds
  632.                 Mov  Ah,3               ;Bios Call For Curs Pos
  633.                 Int  10H                ;Dh-Dl Cursor Y_Pos-X_Pos
  634.                 Mov  Ax,160             ;Bytes Per Y_Pos
  635.                 Mul  Dh                 ;Times Y_Pos
  636.                 Sub  Cx,Cx              ;Clear Cx
  637.                 Mov  Cl,Dl              ;Cols To Cx
  638.                 Shl  Cl,1               ;Double For Attributes
  639.                 Add  Ax,Cx              ;Add To Y_Pos Offset
  640.                 Mov  Di,Ax              ;Place Offset In Di
  641.                 Mov  Bl,Snow_Check      ;Fetch Snow_Check
  642.                 Lds  Si,Dword Ptr[Bp+10] ;Ds:Si Pts To Strx
  643.                 Mov  Byte Ptr[Bp+10],Bl ;Keep Snow_Check
  644.                 Mov  Cl,[Si]            ;Get Strx Length
  645.                 Jcxz Formatright5       ;Jump If Null
  646.                 Push Dx                 ;Save Cursor Values
  647.                 Push Bx                 ;Save Video Page
  648.                 Mov  Bh,[Bp+6]          ;Attribute To Bh
  649.                 Add  Si,Cx              ;Pt To End Of Strx
  650. Formatright1:   Mov  Bl,[Si]            ;Get A Char
  651.                 Cmp  Byte Ptr[Bp+10],0  ;Protect Against Snow?
  652.                 Je   Formatright4       ;Jump If Not
  653.                 Mov  Dx,3Dah            ;Status Byte Address
  654. Formatright2:   In   Al,Dx              ;Get Status Byte
  655.                 Test Al,1               ;Test Bit
  656.                 Jnz  Formatright2       ;Loop Untill 0
  657.                 Cli                     ;Disable Interrupts
  658. Formatright3:   In   Al,Dx              ;Get Status Byte
  659.                 Test Al,1               ;Test Bit
  660.                 Jz   Formatright3       ;Loop Untill 1
  661. Formatright4:   Mov  Ax,Bx              ;Get Char-Attribute
  662.                 Stosw                   ;Write It
  663.                 Sub  Di,4               ;Pull Back Scrn Ptr
  664.                 Dec  Si                 ;Dec Strx Ptr
  665.                 Loop Formatright1       ;Go Do Next Char
  666.                 Sti                     ;Reenable Interrupts
  667.                 Pop  Bx                 ;Video Page Back To Bh
  668.                 Pop  Dx                 ;Restore Cursor Values
  669. Formatright5:   Mov  Cx,[Bp+8]          ;Get New Cursor Offset
  670.                 Test Cx,8000H           ;Negative?
  671.                 Jz   Formatright6       ;Jump If Not
  672.                 Neg  Cx                 ;Make Positive
  673.                 Add  Dh,Cl              ;Add To Y_Pos Offset
  674.                 Cmp  Dh,24              ;Bottom Of Screen?
  675.                 Jb   Formatright7       ;Jump If Not
  676.                 Mov  Dh,24              ;Else Edge Of Screen
  677.                 Jmp  Short Formatright7 ;To Set Cursor
  678. Formatright6:   Add  Dl,Cl              ;Add To X_Pos Offset
  679.                 Cmp  Dl,79              ;Off Screen?
  680.                 Jb   Formatright7       ;Jump If Not
  681.                 Mov  Dl,79              ;Else Edge Of Screen
  682. Formatright7:   Mov  Ah,2               ;Bios Func To Set Curs
  683.                 Int  10H                ;Set New Cursor Pos
  684.                 Pop  Ds                 ;Restore Ds
  685.                 Pop  Bp                 ;Restore Bp And Quit
  686.                 Ret  8
  687. Formatright Endp
  688.  
  689.  
  690. ;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  691. ;Function Getcolour(X_Pos,Y_Pos: Byte): Byte;
  692. ;
  693. ;
  694. Data    Segment
  695.         Extrn  Video_Page:Byte
  696. Data    Ends
  697. ;
  698. Getcolour Proc Far
  699.                 Push Bp                 ;Save Bp
  700.                 Mov  Bp,Sp              ;Set Stack Frame
  701.                 Mov  Bh,Video_Page      ;Set The Page
  702.                 Mov  Dh,[Bp+6]          ;Y_Pos To Dh
  703.                 Dec  Dh                 ;Count From 0
  704.                 Mov  Dl,[Bp+8]          ;X_Pos To Dl
  705.                 Dec  Dl                 ;Count From 0
  706.                 Mov  Ah,2               ;Function To Set Cursor
  707.                 Int  10H                ;Set The Cursor
  708.                 Mov  Ah,8               ;Func To Read Attribute
  709.                 Int  10H                ;Colour Now In Ah
  710.                 Mov  Al,Ah              ;Colour To Al
  711.                 Sub  Ah,Ah              ;Clear High Byte
  712.                 Pop  Bp                 ;Restore Bp And Quit
  713.                 Ret  4
  714. Getcolour Endp
  715.  
  716.  
  717. ;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  718. ;Procedure Intenseoff;
  719. ;
  720. ;
  721. Data    Segment
  722.         Extrn  Textattr:Byte
  723. Data    Ends
  724. ;
  725. ;
  726. Intenseoff Proc Far
  727.                 Mov  Al,Textattr        ;Get The Current Colour
  728.                 And  Al,11110111B       ;Clear The Relevant Bit
  729.                 Mov  Textattr,Al        ;Set The Value
  730.                 Ret
  731. Intenseoff Endp
  732.  
  733.  
  734. ;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  735. ;Procedure Intenseon;
  736. ;
  737. ;
  738. Data    Segment
  739.         Extrn  Textattr:Byte
  740. Data    Ends
  741. ;
  742. ;
  743. Intenseon Proc Far
  744.                 Mov  Al,Textattr        ;Get The Current Colour
  745.                 Or   Al,1000B           ;Set The Relevant Bit
  746.                 Mov  Textattr,Al        ;Set The Value
  747.                 Ret
  748. Intenseon Endp
  749.  
  750.  
  751. ;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  752. ;Procedure Normal;
  753. ;
  754. ;
  755. Data    Segment
  756.         Extrn  Textattr:Byte
  757. Data    Ends
  758. ;
  759. ;
  760. Normal Proc Far
  761.                 Mov  Al,Textattr        ;Get Current Setting
  762.                 And  Al,10001000B       ;Relevant Bits Off
  763.                 Or   Al,111B            ;Relevant Bits On
  764.                 Mov  Textattr,Al        ;Set New Value
  765.                 Ret
  766. Normal Endp
  767.  
  768.  
  769. ;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  770. ;Procedure Reverse;
  771. ;
  772. ;
  773. Data    Segment
  774.         Extrn  Textattr:Byte
  775. Data    Ends
  776. ;
  777. ;
  778. Reverse Proc Far
  779.                 Mov  Al,Textattr        ;Get The Current Colour
  780.                 And  Al,10001000B       ;Relevant Bits Off
  781.                 Or   Al,1110000B        ;Relevant Bits On
  782.                 Mov  Textattr,Al        ;Set New Value
  783.                 Ret
  784. Reverse Endp
  785.  
  786.  
  787. ;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  788. ;Procedure Rowcolour(X_Pos,Y_Pos,X_Num,Colour: Byte);
  789. ;
  790. ;
  791. Data    Segment
  792.         Extrn  Video_Buff:Word
  793.         Extrn  Snow_Check:Byte
  794. Data    Ends
  795. ;
  796. ;
  797. Rowcolour Proc Far
  798.                 Push Bp                 ;Save Bp
  799.                 Mov  Bp,Sp              ;Set Stack Frame
  800.                 Mov  Ax,Video_Buff      ;Segment Of Video_Buff
  801.                 Mov  Es,Ax              ;Move To Es
  802.                 Sub  Ax,Ax              ;
  803.                 Mov  Al,[Bp+12]         ;Get X_Pos Value
  804.                 Mov  Di,Ax              ;
  805.                 Dec  Di                 ;Count From 0
  806.                 Mov  Al,[Bp+10]         ;Get Y_Pos Value
  807.                 Dec  Ax                 ;Count From 0
  808.                 Mov  Dl,160             ;Bytes Per Y_Pos
  809.                 Mul  Dl                 ;Times Number Y_Pos
  810.                 Shl  Di,1               ;Double For Attri Bytes
  811.                 Add  Di,Ax              ;Add Y_Pos Offset
  812.                 Inc  Di                 ;Es:Di Pts To 1St Attri
  813.                 Sub  Cx,Cx              ;
  814.                 Mov  Cl,[Bp+8]          ;Line Length In Cx
  815.                 Jcxz Rowcolour5         ;Quit If Null
  816.                 Mov  Al,[Bp+6]          ;Attribute In Al
  817.                 Cld                     ;Direction Flag Forward
  818. Rowcolour1:     Cmp  Snow_Check,0       ;Protect Against Snow?
  819.                 Je   Rowcolour4         ;Jump If Not
  820.                 Mov  Dx,3Dah            ;Status Byte Address
  821.                 Mov  Bx,Ax              ;Save Ax Contents
  822. Rowcolour2:     In   Al,Dx              ;Get Status Byte
  823.                 Test Al,1               ;Test Bit
  824.                 Jnz  Rowcolour2         ;Loop Untill 0
  825.                 Cli                     ;Disable Interrupts
  826. Rowcolour3:     In   Al,Dx              ;Get Status Byte
  827.                 Test Al,1               ;Test Bit
  828.                 Jz   Rowcolour3         ;Loop Untill 1
  829.                 Mov  Ax,Bx              ;Restore Ax Contents
  830. Rowcolour4:     Stosb                   ;Change Attri Of 1 Char
  831.                 Inc  Di                 ;Skip Pointer Over Next
  832.                 Loop Rowcolour1         ;Go Change Next Attribute
  833. Rowcolour5:     Sti                     ;Reenable Interrupts
  834.                 Pop  Bp                 ;Restore Bp
  835.                 Ret  8
  836. Rowcolour Endp
  837.  
  838.  
  839.  
  840. ;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  841. ;Procedure Setcolour(X_Pos,Y_Pos,Colour: Byte);
  842. ;
  843. ;
  844. Data    Segment
  845.         Extrn  Video_Page:Byte
  846. Data    Ends
  847. ;
  848. ;
  849. Setcolour Proc Far
  850.                 Push Bp                 ;Save Bp
  851.                 Mov  Bp,Sp              ;Set Stack Frame
  852.                 Mov  Bh,Video_Page      ;Set The Page
  853.                 Mov  Dh,[Bp+8]          ;Y_Pos To Dh
  854.                 Dec  Dh                 ;Count From 0
  855.                 Mov  Dl,[Bp+10]         ;X_Pos To Dl
  856.                 Dec  Dl                 ;Count From 0
  857.                 Mov  Ah,2               ;Function To Set Cursor
  858.                 Int  10H                ;Set The Cursor
  859.                 Mov  Ah,8               ;Func To Read Attribute
  860.                 Int  10H                ;Char Now In Al
  861.                 Mov  Ah,9               ;Function To Write Char
  862.                 Mov  Cx,1               ;Write At 1 Pos Only
  863.                 Mov  Bl,[Bp+6]          ;New Attribute
  864.                 Int  10H                ;Set The New Attribute
  865.                 Pop  Bp                 ;Restore Bp
  866.                 Ret  6
  867. Setcolour Endp
  868.  
  869.  
  870. ;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  871. ;Procedure Setpage(Pagenumber: Integer);
  872. ;
  873. Setpage Proc Far
  874.                 Mov  Bx,Sp              ;Bx Pts To Stack
  875.                 Mov  Ah,5               ;Function Number
  876.                 Mov  Al,Ss:[Bx+4]       ;Page Number
  877.                 Int  10H                ;Set The Current Page
  878.                 Ret  2
  879. Setpage Endp
  880.  
  881.  
  882. ;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  883. ;Procedure Dspcolour(Strx: Stype; Colour: Byte);
  884. ;
  885. ;
  886. Data    Segment
  887.         Extrn  Video_Buff:Word
  888.         Extrn  Video_Page:Byte
  889.         Extrn  Snow_Check:Byte
  890. Data    Ends
  891. ;
  892. ;
  893. Dspcolour Proc Far
  894.                 Push Bp                 ;Save Bp
  895.                 Mov  Bp,Sp              ;Set Stack Frame
  896.                 Push Ds                 ;Ds Changed
  897.                 Cld                     ;Direction Flag Forward
  898.                 Mov  Ax,Video_Buff      ;Fetch Video_Buff
  899.                 Mov  Es,Ax              ;Place In Es
  900.                 Mov  Bh,Video_Page      ;Set The Cursor Page
  901.                 Mov  Bl,Snow_Check      ;Get Snow_Check
  902.                 Mov  Ah,3               ;Bios Func For Cursor Pos
  903.                 Int  10H                ;Now Dh-Dl Holds Y_Pos-X_Pos
  904.                 Lds  Si,Dword Ptr[Bp+8] ;Ds:Si Pts To Strx
  905.                 Mov  [Bp+8],Bx          ;Save Page Number And Snow_Check
  906.                 Sub  Cx,Cx              ;Clear Cx
  907.                 Mov  Cl,[Si]            ;String Len Counted In Cx
  908.                 Jcxz Dspc8              ;Quit If Null
  909.                 Inc  Si                 ;Pt Ds:Si To First Char
  910.                 Mov  Ax,160             ;Byte Per Row
  911.                 Mul  Dh                 ;Multiply By Num Rows
  912.                 Sub  Dh,Dh              ;Now Dx Holds Num Cols
  913.                 Shl  Dx,1               ;Double For Attri Bytes
  914.                 Add  Ax,Dx              ;Cursor Offset In Buffer
  915.                 Mov  Di,Ax              ;Now Es:Di Pts To Pos
  916.                 Mov  Bx,3998            ;Scroll If Won'T Fit...
  917.                 Sub  Bx,Di              ;Space Left
  918.                 Mov  Ax,Cx              ;Chars To Be Printed
  919.                 Shl  Ax,1               ;Double For Attributes
  920.                 Cmp  Bx,Ax              ;Enough Room?
  921.                 Jge  Dspc3              ;Jump Ahead If So
  922.                 Sub  Ax,Bx              ;Amount Space Required
  923.                 Mov  Bl,160             ;Byte Per Y_Pos
  924.                 Div  Bl                 ;Divide
  925.                 Cmp  Ah,0               ;Any Remainder?
  926.                 Je   Dspc1              ;If Not, Jump Ahead
  927.                 Inc  Al                 ;Else, Scroll 1 More Line
  928. Dspc1:          Push Cx                 ;Save String Length
  929.                 Push Bp                 ;Scrolling Changes Bp
  930.                 Push Ax                 ;Save Num Lines Scrolled
  931.                 Mov  Bh,[Bp+6]          ;Attribute Of New Lines
  932.                 Mov  Cx,0000H           ;Top Left Y_Pos-X_Pos
  933.                 Mov  Dx,184Fh           ;Bottom Right Y_Pos-X_Pos
  934.                 Mov  Ah,6               ;Upwards Scroll Function
  935.                 Int  10H                ;Make The Scroll
  936.                 Pop  Cx                 ;Num Lines Scrolled In Cl
  937.                 Sub  Ch,Ch              ;Clear Ch, Use Cx Counter
  938. Dspc2:          Sub  Di,160             ;Screen Ptr Back 1 Line
  939.                 Loop Dspc2              ;Repeat For Ea Ln Of Scrl
  940.                 Pop  Bp                 ;Restore Bp
  941.                 Pop  Cx                 ;Restore String Length
  942. Dspc3:          Mov  Ah,[Bp+6]          ;Get Attribute
  943. Dspc4:          Lodsb                   ;Get A Character
  944.                 Mov  Dx,Es              ;Get Video Buffer Address
  945.                 Cmp  Byte Ptr[Bp+8],0   ;Protect Against Show?
  946.                 Je   Dspc7              ;Jump Ahead If Not
  947.                 Mov  Dx,3Dah            ;Status Byte Address
  948.                 Mov  Bx,Ax              ;Save Ax Contents
  949. Dspc5:          In   Al,Dx              ;Get Status Byte
  950.                 Test Al,1               ;Test Bit
  951.                 Jnz  Dspc5              ;Loop Untill 0
  952.                 Cli                     ;Disable Interrupts
  953. Dspc6:          In   Al,Dx              ;Get Status Byte
  954.                 Test Al,1               ;Test Bit
  955.                 Jz   Dspc6              ;Loop Untill 1
  956.                 Mov  Ax,Bx              ;Restore Ax Contents
  957. Dspc7:          Stosw                   ;Write Char And Attri
  958.                 Loop Dspc4              ;Go Do Next
  959.                 Sti                     ;Reenable Interrupts
  960.                 Mov  Ax,Di              ;Now Set New Cursor Pos
  961.                 Mov  Dl,160             ;Chars In A Y_Pos
  962.                 Div  Dl                 ;Divide Scrn Ptr
  963.                 Shr  Ah,1               ;Div Remainder By 2
  964.                 Mov  Dl,Ah              ;Bios: X_Pos In Dl
  965.                 Mov  Dh,Al              ;Y_Pos In Dh
  966.                 Mov  Bh,[Bp+9]          ;Page Number
  967.                 Mov  Ah,2               ;Function Number
  968.                 Int  10H                ;Set The Cursor
  969. Dspc8:          Pop  Ds                 ;Restore Ds And Quit
  970.                 Pop  Bp                 ;Restore Bp
  971.                 Ret  6
  972. Dspcolour Endp
  973.  
  974.  
  975. ;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  976. ;Procedure Dsp(Strx: Stype);
  977. ;
  978. ;
  979. Data    Segment
  980.         Extrn  Video_Buff:Word
  981.         Extrn  Video_Page:Byte
  982.         Extrn  Snow_Check:Byte
  983.         Extrn  Textattr:Byte
  984. Data    Ends
  985. ;
  986. ;
  987. Dsp    Proc Far
  988.                 Push Bp                 ;Save Bp
  989.                 Mov  Bp,Sp              ;Set Stack Frame
  990.                 Push Ds                 ;Ds Changed
  991.                 Cld                     ;Direction Flag Forward
  992.                 Mov  Ax,Video_Buff      ;Get Video Buffer Address
  993.                 Mov  Es,Ax              ;Place It In Es
  994.                 Mov  Al,Textattr        ;Get Colour
  995.                 Mov  Ah,Snow_Check      ;Get Snow_Check
  996.                 Mov  Bh,Video_Page      ;Set The Cursor Page
  997.                 Lds  Si,Dword Ptr[Bp+6] ;Ds:Si Pts To Strx
  998.                 Mov  [Bp+6],Ax          ;Save Colour And Snow_Check
  999.                 Mov  [Bp+8],Bh          ;Save Video_Page
  1000.                 Mov  Ah,3               ;Bios Func For Cursor Pos
  1001.                 Int  10H                ;Now Dh-Dl Holds Y_Pos-X_Pos
  1002.                 Sub  Cx,Cx              ;Clear Cx
  1003.                 Mov  Cl,[Si]            ;String Len Counted In Cx
  1004.                 Cmp  Cl,0               ;Null String?
  1005.                 Je   Dspll8             ;Quit If So
  1006.                 Inc  Si                 ;Now Ds:Si Pts To Strx
  1007.                 Mov  Ax,160             ;Cursor Pos: Bytes In Y_Pos
  1008.                 Mul  Dh                 ;Multiply By Num Y_Pos
  1009.                 Sub  Dh,Dh              ;Now Dx Holds Num Cols
  1010.                 Shl  Dx,1               ;Double For Attri Bytes
  1011.                 Add  Ax,Dx              ;Cursor Offset In Buffer
  1012.                 Mov  Di,Ax              ;Now Es:Di Pts To Pos
  1013.                 Mov  Bx,3998            ;Scroll If Won'T Fit...
  1014.                 Sub  Bx,Di              ;Space Left
  1015.                 Mov  Ax,Cx              ;Chars To Be Printed
  1016.                 Shl  Ax,1               ;Double For Attributes
  1017.                 Cmp  Bx,Ax              ;Enough Room?
  1018.                 Jge  Dspll3             ;Jump Ahead If So
  1019.                 Sub  Ax,Bx              ;Amount Space Required
  1020.                 Mov  Bl,160             ;Bytes In A Y_Pos
  1021.                 Div  Bl                 ;Divide
  1022.                 Cmp  Ah,0               ;Any Remainder?
  1023.                 Je   Dspll1             ;If Not, Jump Ahead
  1024.                 Inc  Al                 ;Else, Scroll 1 More Line
  1025. Dspll1:         Push Cx                 ;Save String Length
  1026.                 Push Bp                 ;Scrolling Changes Bp
  1027.                 Push Ax                 ;Save Num Lines Scrolled
  1028.                 Mov  Bh,7               ;Attribute Of New Lines
  1029.                 Mov  Cx,0000H           ;Top Left Y_Pos-X_Pos
  1030.                 Mov  Dx,184Fh           ;Bottom Right Y_Pos-X_Pos
  1031.                 Mov  Ah,6               ;Upwards Scroll Function
  1032.                 Int  10H                ;Make The Scroll
  1033.                 Pop  Cx                 ;Num Lines Scrolled In Cl
  1034.                 Sub  Ch,Ch              ;Clear Ch, Use Cx Counter
  1035. Dspll2:         Sub  Di,160             ;Screen Ptr Back 1 Line
  1036.                 Loop Dspll2             ;Repeat For Ea Ln Of Scrl
  1037.                 Pop  Bp                 ;Restore Bp
  1038.                 Pop  Cx                 ;Restore String Length
  1039. Dspll3:         Mov  Ah,[Bp+6]          ;Get Attribute
  1040. Dspll4:         Lodsb                   ;Get A Character
  1041.                 Cmp  Byte Ptr[Bp+7],0   ;Protect Against Snow?
  1042.                 Je   Dspll7             ;Jump Ahead If Not
  1043.                 Mov  Dx,3Dah            ;Status Byte Address
  1044.                 Mov  Bx,Ax              ;Save Char/Attri In Bx
  1045. Dspll5:         In   Al,Dx              ;Get Status Byte
  1046.                 Test Al,1               ;Test Bit
  1047.                 Jnz  Dspll5             ;Loop Untill 0
  1048.                 Cli                     ;Disable Interrupts
  1049. Dspll6:         In   Al,Dx              ;Get Status Byte
  1050.                 Test Al,1               ;Test Bit
  1051.                 Jz   Dspll6             ;Loop Untill 1
  1052.                 Mov  Ax,Bx              ;Restore Char To Ax
  1053. Dspll7:         Stosw                   ;Write It With Attribute
  1054.                 Loop Dspll4             ;Go Do Next
  1055.                 Sti                     ;Reenable Interrupts
  1056.                 Mov  Ax,Di              ;Now Set New Cursor Pos
  1057.                 Mov  Dl,160             ;Chars In A Y_Pos
  1058.                 Div  Dl                 ;Divide Scrn Ptr
  1059.                 Shr  Ah,1               ;Div Remainder By 2
  1060.                 Mov  Dl,Ah              ;Bios: X_Pos In Dl
  1061.                 Mov  Dh,Al              ;Y_Pos In Dh
  1062.                 Mov  Bh,[Bp+8]          ;Page Number
  1063.                 Mov  Ah,2               ;Function Number
  1064.                 Int  10H                ;Set The Cursor
  1065. Dspll8:         Pop  Ds                 ;Restore Ds And Quit
  1066.                 Pop  Bp                 ;Restore Bp
  1067.                 Ret  4
  1068. Dsp    Endp
  1069.  
  1070.  
  1071. ;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  1072. ;Procedure Dspln(Strx: Stype);
  1073. ;
  1074. ;
  1075. Data    Segment
  1076.         Extrn  Video_Buff:Word
  1077.         Extrn  Video_Page:Byte
  1078.         Extrn  Snow_Check:Byte
  1079.         Extrn  Textattr:Byte
  1080. Data    Ends
  1081. ;
  1082. ;
  1083. Dspln  Proc Far
  1084.                 Push Bp                 ;Save Bp
  1085.                 Mov  Bp,Sp              ;Set Stack Frame
  1086.                 Push Ds                 ;Ds Changed
  1087.                 Cld                     ;Direction Flag Forward
  1088.                 Mov  Ax,Video_Buff      ;Get Video Buffer Address
  1089.                 Mov  Es,Ax              ;Place In Es
  1090.                 Mov  Al,Textattr        ;Get Colour Value
  1091.                 Mov  Ah,Snow_Check      ;Get Snow_Check
  1092.                 Mov  Bh,Video_Page      ;Set The Cursor Page
  1093.                 Lds  Si,Dword Ptr[Bp+6] ;Ds:Si Pts To Strx
  1094.                 Mov  [Bp+8],Bh          ;Save Page Numberzz
  1095.                 Mov  [Bp+6],Ax          ;Save Colour And Snow_Check
  1096.                 Mov  Ah,3               ;Bios Func For Cursor Pos
  1097.                 Int  10H                ;Now Dh-Dl Holds Y_Pos-X_Pos
  1098.                 Sub  Cx,Cx              ;Clear Cx
  1099.                 Mov  Cl,[Si]            ;String Len Counted In Cx
  1100.                 Inc  Si                 ;Now Ds:Si Pts To Strx
  1101.                 Mov  Ax,160             ;Cursor Pos: Bytes In Y_Pos
  1102.                 Mul  Dh                 ;Multiply By Num Y_Pos
  1103.                 Sub  Dh,Dh              ;Now Dx Holds Num Cols
  1104.                 Shl  Dx,1               ;Double For Attri Bytes
  1105.                 Add  Ax,Dx              ;Cursor Offset In Buffer
  1106.                 Mov  Di,Ax              ;Now Es:Di Pts To Pos
  1107.                 Mov  Bx,3840            ;Scrl If Won'T Fit Y_Pos 24
  1108.                 Sub  Bx,Di              ;Space Left
  1109.                 Mov  Ax,Cx              ;Chars To Be Printed
  1110.                 Shl  Ax,1               ;Double For Attributes
  1111.                 Or   Cx,Cx              ;Test For Null String
  1112.                 Jnz  Dspline1           ;Jump If Not Null
  1113.                 Cmp  Di,3840            ;Last Y_Pos?
  1114.                 Jnge Dspline1           ;Jump If Not
  1115.                 Mov  Al,1               ;Scroll If Null On Y_Pos 25
  1116.                 Jmp  Short Dspline2     ;Jump Ahead
  1117. Dspline1:       Cmp  Bx,Ax              ;Enough Room?
  1118.                 Jge  Dspline4           ;Jump Ahead If So
  1119.                 Sub  Ax,Bx              ;Amount Space Required
  1120.                 Mov  Bl,160             ;Bytes In A Y_Pos
  1121.                 Div  Bl                 ;Divide
  1122.                 Cmp  Ah,0               ;Any Remainder?
  1123.                 Je   Dspline2           ;If Not, Jump Ahead
  1124.                 Inc  Al                 ;Else, Scroll 1 More Line
  1125. Dspline2:       Push Cx                 ;Save String Length
  1126.                 Push Bp                 ;Scrolling Changes Bp
  1127.                 Push Ax                 ;Save Num Lines Scrolled
  1128.                 Mov  Bh,7               ;Attribute Of New Lines
  1129.                 Mov  Cx,0000H           ;Top Left Y_Pos-X_Pos
  1130.                 Mov  Dx,184Fh           ;Bottom Right Y_Pos-X_Pos
  1131.                 Mov  Ah,6               ;Upwards Scroll Function
  1132.                 Int  10H                ;Make The Scroll
  1133.                 Pop  Cx                 ;Num Lines Scrolled In Cl
  1134.                 Sub  Ch,Ch              ;Clear Ch, Use Cx Counter
  1135. Dspline3:       Sub  Di,160             ;Screen Ptr Back 1 Line
  1136.                 Loop Dspline3           ;Repeat For Ea Ln Of Scrl
  1137.                 Pop  Bp                 ;Restore Bp
  1138.                 Pop  Cx                 ;Restore String Length
  1139. Dspline4:       Or   Cx,Cx              ;Test For Null String
  1140.                 Jnz  Dspline5           ;Jump If Not Null
  1141.                 Add  Di,160             ;Increase Screen Ptr
  1142.                 Jmp  Dspline9           ;Jump And Set Cursor
  1143. Dspline5:       Mov  Ah,[Bp+6]          ;Get Attribute
  1144.                 Lodsb                   ;Get A Character
  1145.                 Cmp  Byte Ptr[Bp+7],0   ;Protect Against Snow?
  1146.                 Je   Dspline8           ;Jump Ahead If Not
  1147.                 Mov  Dx,3Dah            ;Status Byte Address
  1148.                 Mov  Bx,Ax              ;Save Char-Attri In Bx
  1149. Dspline6:       In   Al,Dx              ;Get Status Byte
  1150.                 Test Al,1               ;Test Bit
  1151.                 Jnz  Dspline6           ;Loop Untill 0
  1152.                 Cli                     ;Disable Interrupts
  1153. Dspline7:       In   Al,Dx              ;Get Status Byte
  1154.                 Test Al,1               ;Test Bit
  1155.                 Jz   Dspline7           ;Loop Untill 1
  1156.                 Mov  Ax,Bx              ;Char-Attri Back To Ax
  1157. Dspline8:       Stosw                   ;Write It With Attribute
  1158.                 Loop Dspline5           ;Go Do Next
  1159.                 Sti                     ;Reenable Interrupts
  1160. Dspline9:       Mov  Ax,Di              ;Now Set New Cursor Pos
  1161.                 Mov  Dl,160             ;Chars In A Y_Pos
  1162.                 Div  Dl                 ;Divide Scrn Ptr
  1163.                 Shr  Ah,1               ;Div Remainder By 2
  1164.                 Mov  Dh,Al              ;Bios: Y_Pos In Dh
  1165.                 Mov  Dl,Ah              ;X_Pos In Dl
  1166.                 Cmp  Dl,0               ;Already At New Line?
  1167.                 Je   Dspline10          ;If So, Jump Ahead
  1168.                 Inc  Dh                 ;Else Add 1 More Line
  1169.                 Mov  Dl,0               ;Set Cursor To X_Pos 0
  1170. Dspline10:      Mov  Bh,[Bp+8]          ;Page Number
  1171.                 Mov  Ah,2               ;Function Number
  1172.                 Int  10H                ;Set The Cursor
  1173.                 Pop  Ds                 ;Restore Ds
  1174.                 Pop  Bp                 ;Restore Bp
  1175.                 Ret  4
  1176. Dspln  Endp
  1177.  
  1178.  
  1179. ;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  1180. ;Procedure Dspend(Strx: Stype; X_Pos,Y_Pos,Length,Colour: Byte);
  1181. ;
  1182. ;
  1183. Data    Segment
  1184.         Extrn  Video_Buff:Word
  1185.         Extrn  Snow_Check:Byte
  1186.         Extrn  Errreturn:Byte
  1187. Data    Ends
  1188. ;
  1189. ;
  1190. Dspend Proc Far
  1191.                 Push Bp                 ;Save Bp
  1192.                 Mov  Bp,Sp              ;Set Stack Frame
  1193.                 Push Ds                 ;Ds Changed
  1194.                 Cld                     ;Set Direction Flag
  1195.                 Mov  Ax,Video_Buff      ;Fetch Video_Buff
  1196.                 Mov  Es,Ax              ;Es Pts To Buffer
  1197.                 Mov  Bl,Snow_Check      ;Get Snow_Check Before Change Ds
  1198.                 Lds  Si,Dword Ptr[Bp+14] ;Ds:Si Pts To Strx
  1199.                 Sub  Cx,Cx              ;Clear Cx
  1200.                 Mov  Cl,[Si]            ;String Len Counted In Cx
  1201.                 Inc  Si                 ;Pt Si To 1St Chr Of Strx
  1202.                 Sub  Ax,Ax              ;
  1203.                 Mov  Al,[Bp+10]         ;Get Y_Pos Value
  1204.                 Mov  Byte Ptr[Bp+10],Bl ;Save Snow_Check
  1205.                 Mov  Byte Ptr[Bp+11],1  ;Errreturn 1 = Len(Strx) > Length
  1206.                 Dec  Ax                 ;Count From Zero
  1207.                 Mov  Dl,160             ;160 Bytes Per Line
  1208.                 Mul  Dl                 ;Times Number Y_Pos
  1209.                 Sub  Dx,Dx              ;
  1210.                 Mov  Dl,[Bp+8]          ;Move Line Length To Dx
  1211.                 Or   Dx,Dx              ;Null?
  1212.                 Jz   Dspendll1          ;Quit If So
  1213.                 Mov  Byte Ptr[Bp+11],0  ;Else 0 = No Error
  1214. Dspendll1:      Cmp  Dx,Cx              ;Strx Shorter?
  1215.                 Jnae Dspendll2          ;Jump Ahead If So
  1216.                 Sub  Dx,Cx              ;Num Chars At End Of Line
  1217.                 Jmp  Short Dspendll3    ;Jump Ahead
  1218. Dspendll2:      Mov  Dx,0               ;Else Draw No Extra Chars
  1219. Dspendll3:      Sub  Bx,Bx              ;
  1220.                 Mov  Bl,[Bp+12]         ;Get X_Pos Value
  1221.                 Mov  Di,Bx              ;
  1222.                 Dec  Di                 ;Count From Zero
  1223.                 Shl  Di,1               ;Double For Attri Bytes
  1224.                 Add  Di,Ax              ;Now Es:Di Pts To Lst Pos
  1225.                 Mov  Ah,[Bp+6]          ;Get Attribute
  1226.                 Jcxz Dspendll5          ;Jump Ahead If Strx Null
  1227. Dspendll4:      Lodsb                   ;Get A Character
  1228.                 Call Writeit            ;Write Char And Attri
  1229.                 Loop Dspendll4          ;Go Do Next
  1230. Dspendll5:      Mov  Cx,Dx              ;Num Chars At End Of Line
  1231.                 Mov  Al,32              ;Space Character
  1232.                 Jcxz Dspendll7          ;Jump If None To Write
  1233. Dspendll6:      Call Writeit            ;Write Char And Attribute
  1234.                 Loop Dspendll6          ;Go Do Next
  1235. Dspendll7:      Pop  Ds                 ;Restore Ds
  1236.                 Mov  Al,[Bp+11]         ;Fetch Errreturn
  1237.                 Mov  Errreturn,Al       ;Set It
  1238.                 Pop  Bp                 ;Restore Bp
  1239.                 Sti                     ;Reenable Interrupts
  1240.                 Ret  12                 ;Return To Caller
  1241. Dspend Endp
  1242.  
  1243.  
  1244.  
  1245. ;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  1246. ;Procedure Dsplncolour(Strx: Stype; Colour: Byte);
  1247. ;
  1248. ;
  1249. Data    Segment
  1250.         Extrn  Video_Buff:Word
  1251.         Extrn  Video_Page:Byte
  1252.         Extrn  Snow_Check:Byte
  1253. Data    Ends
  1254. ;
  1255. ;
  1256. Dsplncolour   Proc Far
  1257.                 Push Bp                 ;Save Bp
  1258.                 Mov  Bp,Sp              ;Set Stack Frame
  1259.                 Push Ds                 ;Ds Changed
  1260.                 Cld                     ;Direction Flag Forward
  1261.                 Mov  Ax,Video_Buff      ;Get Video Buffer Address
  1262.                 Mov  Es,Ax              ;Place In Es
  1263.                 Mov  Bh,Video_Page      ;Set The Cursor Page
  1264.                 Mov  Bl,Snow_Check      ;Fetch Snow_Check
  1265.                 Mov  Ah,3               ;Bios Func For Cursor Pos
  1266.                 Int  10H                ;Now Dh-Dl Holds Y_Pos-X_Pos
  1267.                 Lds  Si,Dword Ptr[Bp+8] ;Ds:Si Pts To Strx
  1268.                 Mov  [Bp+8],Bx          ;Save Video_Page And Snow_Check
  1269.                 Sub  Cx,Cx              ;Clear Cx
  1270.                 Mov  Cl,[Si]            ;String Len Counted In Cx
  1271.                 Inc  Si                 ;Now Ds:Si Pts To Strx
  1272.                 Mov  Ax,160             ;Cursor Pos: Bytes In Y_Pos
  1273.                 Mul  Dh                 ;Multiply By Num Y_Pos
  1274.                 Sub  Dh,Dh              ;Now Dx Holds Num Cols
  1275.                 Shl  Dx,1               ;Double For Attri Bytes
  1276.                 Add  Ax,Dx              ;Cursor Offset In Buffer
  1277.                 Mov  Di,Ax              ;Now Es:Di Pts To Pos
  1278.                 Mov  Bx,3840            ;Scrl If Won'T Fit Y_Pos 24
  1279.                 Sub  Bx,Di              ;Space Left
  1280.                 Mov  Ax,Cx              ;Chars To Be Printed
  1281.                 Shl  Ax,1               ;Double For Attributes
  1282.                 Or   Cx,Cx              ;Test For Null String
  1283.                 Jnz  Dsplnc1            ;Jump If Not Null
  1284.                 Cmp  Di,3840            ;Last Y_Pos?
  1285.                 Jnge Dsplnc1            ;Jump If Not
  1286.                 Mov  Al,1               ;Scroll If Null On Y_Pos 25
  1287.                 Jmp  Short Dsplnc2      ;Jump Ahead
  1288. Dsplnc1:        Cmp  Bx,Ax              ;Enough Room?
  1289.                 Jge  Dsplnc4            ;Jump Ahead If So
  1290.                 Sub  Ax,Bx              ;Amount Space Required
  1291.                 Mov  Bl,160             ;Bytes In A Y_Pos
  1292.                 Div  Bl                 ;Divide
  1293.                 Cmp  Ah,0               ;Any Remainder?
  1294.                 Je   Dsplnc2            ;If Not, Jump Ahead
  1295.                 Inc  Al                 ;Else, Scroll 1 More Line
  1296. Dsplnc2:        Push Cx                 ;Save String Length
  1297.                 Push Bp                 ;Scrolling Changes Bp
  1298.                 Push Ax                 ;Save Num Lines Scrolled
  1299.                 Mov  Bh,[Bp+6]          ;Attribute Of New Lines
  1300.                 Mov  Cx,0000H           ;Top Left Y_Pos-X_Pos
  1301.                 Mov  Dx,184Fh           ;Bottom Right Y_Pos-X_Pos
  1302.                 Mov  Ah,6               ;Upwards Scroll Function
  1303.                 Int  10H                ;Make The Scroll
  1304.                 Pop  Cx                 ;Num Lines Scrolled In Cl
  1305.                 Sub  Ch,Ch              ;Clear Ch, Use Cx Counter
  1306. Dsplnc3:        Sub  Di,160             ;Screen Ptr Back 1 Line
  1307.                 Loop Dsplnc3            ;Repeat For Ea Ln Of Scrl
  1308.                 Pop  Bp                 ;Restore Bp
  1309.                 Pop  Cx                 ;Restore String Length
  1310. Dsplnc4:        Or   Cx,Cx              ;Test For Null String
  1311.                 Jnz  Dsplnc5            ;Jump If Not Null
  1312.                 Add  Di,160             ;Increase Screen Ptr
  1313.                 Jmp  Dsplnc10           ;Jump And Set Cursor
  1314. Dsplnc5:        Mov  Ah,[Bp+6]          ;Get Attribute
  1315. Dsplnc6:        Lodsb                   ;Get A Character
  1316.                 Mov  Dx,Es              ;Get Video Buffer Address
  1317.                 Cmp  Byte Ptr[Bp+8],0   ;Protect Against Snow?
  1318.                 Je   Dsplnc9            ;Jump Ahead If Not
  1319.                 Mov  Dx,3Dah            ;Status Byte Address
  1320.                 Mov  Bx,Ax              ;Save Ax Contents
  1321. Dsplnc7:        In   Al,Dx              ;Get Status Byte
  1322.                 Test Al,1               ;Test Bit
  1323.                 Jnz  Dsplnc7            ;Loop Untill 0
  1324.                 Cli                     ;Disable Interrupts
  1325. Dsplnc8:        In   Al,Dx              ;Get Status Byte
  1326.                 Test Al,1               ;Test Bit
  1327.                 Jz   Dsplnc8            ;Loop Untill 1
  1328.                 Mov  Ax,Bx              ;Char/Attri Back To Ax
  1329. Dsplnc9:        Stosw                   ;Write It With Attribute
  1330.                 Loop Dsplnc6            ;Go Do Next
  1331.                 Sti                     ;Reenable Interrupts
  1332. Dsplnc10:       Mov  Ax,Di              ;Now Set New Cursor Pos
  1333.                 Mov  Dl,160             ;Chars In A Y_Pos
  1334.                 Div  Dl                 ;Divide Scrn Ptr
  1335.                 Shr  Ah,1               ;Div Remainder By 2
  1336.                 Mov  Dh,Al              ;Bios: Y_Pos In Dh
  1337.                 Mov  Dl,Ah              ;X_Pos In Dl
  1338.                 Cmp  Dl,0               ;Already At New Line?
  1339.                 Je   Dsplnc11           ;If So, Jump Ahead
  1340.                 Inc  Dh                 ;Else Add 1 More Line
  1341.                 Mov  Dl,0               ;Set Cursor To X_Pos 0
  1342. Dsplnc11:       Mov  Bh,[Bp+9]          ;Page Number
  1343.                 Mov  Ah,2               ;Function Number
  1344.                 Int  10H                ;Set The Cursor
  1345.                 Pop  Ds                 ;Restore Ds
  1346.                 Pop  Bp                 ;Restore Bp
  1347.                 Ret  6
  1348. Dsplncolour   Endp
  1349.  
  1350.  
  1351. ;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  1352. ;Procedure Dsppart(Strx: Stype; Start,Numch,X_Pos,Y_Pos,Colour: Byte);
  1353. ;
  1354. ;
  1355. Data    Segment
  1356.         Extrn  Video_Buff:Word
  1357.         Extrn  Snow_Check:Byte
  1358.         Extrn  Errreturn:Byte
  1359. Data    Ends
  1360. ;
  1361. ;
  1362. ;
  1363. Dsppart Proc Far
  1364.                 Push Bp                 ;Save Bp
  1365.                 Mov  Bp,Sp              ;Set Stack Frame
  1366.                 Mov  Cl,Snow_Check      ;Get Snow_Check
  1367.                 Push Ds                 ;Save Turbo'S Ds
  1368.                 Mov  Ax,Video_Buff      ;Fetch Video_Buff
  1369.                 Mov  Es,Ax              ;Es Pts To Buffer
  1370.                 Sub  Bx,Bx              ;
  1371.                 Mov  Bl,[Bp+8]          ;Y_Pos
  1372.                 Dec  Bx                 ;Count From Zero
  1373.                 Mov  [Bp+8],Cl          ;Save Snow_Check
  1374.                 Sub  Cx,Cx              ;
  1375.                 Mov  Cl,[Bp+10]         ;X_Pos
  1376.                 Dec  Cx                 ;Count From Zero
  1377.                 Mov  Ax,160             ;Bytes Per Y_Pos
  1378.                 Mul  Bl                 ;Y_Pos Offset
  1379.                 Shl  Cx,1               ;Dble Cols For Attributes
  1380.                 Add  Ax,Cx              ;Offset To Start Position
  1381.                 Mov  Di,Ax              ;Es:Di Pts To Start
  1382.                 Lds  Si,Dword Ptr[Bp+16] ;Ds:Si Pts To Strx
  1383.                 Sub  Cx,Cx              ;Clear Cx
  1384.                 Mov  Cl,[Si]            ;Get String Descriptor
  1385.                 Mov  Bh,1               ;Error Code 1 = Null Strx
  1386.                 Jcxz Displaypartl7      ;Quit If Null
  1387.                 Mov  Al,[Bp+14]         ;Startpoint
  1388.                 Inc  Bh                 ;2 = Start Outside Of String
  1389.                 Cmp  Al,Cl              ;Start Point In Range?
  1390.                 Jnbe Displaypartl7      ;Quit If Not
  1391.                 Or   Al,Al              ;Test For Zero
  1392.                 Jz   Displaypartl7      ;
  1393.                 Inc  Bh                 ;3 = Not Enough Room For Numch
  1394.                 Cmp  Byte Ptr[Bp+12],0  ;Check For Numch Nonzero
  1395.                 Jz   Displaypartl7      ;Quit If Zero
  1396.                 Mov  Ah,Al              ;Copy Startpoint
  1397.                 Add  Ah,[Bp+12]         ;Add Number Chars
  1398.                 Dec  Ah                 ;Adjust
  1399.                 Cmp  Ah,Cl              ;In Range?
  1400.                 Jna  Displaypartl1      ;Jump Ahead If Ok
  1401.                 Sub  Cl,[Bp+14]         ;Number Chars To Write
  1402.                 Inc  Cl                 ;Adjust
  1403.                 Jmp  Short Displaypartl2 ;
  1404. Displaypartl1:  Mov  Cl,[Bp+12]         ;Num Chars To Write
  1405.                 Sub  Bh,Bh              ;0 = No Error
  1406. Displaypartl2:  Sub  Ah,Ah              ;Extend Byte Value
  1407.                 Add  Si,Ax              ;Offset String Ptr
  1408.                 Cld                     ;Forward Direction
  1409.                 Mov  Ah,[Bp+6]          ;Get Screen Attribute
  1410. Displaypartl3:  Lodsb                   ;Get A Char From Strx
  1411.                 Cmp  Byte Ptr[Bp+8],0   ;Protect Against Snow?
  1412.                 Je   Displaypartl6      ;Jump If Not
  1413.                 Push Ax                 ;Save Char-Attri
  1414.                 Mov  Dx,3Dah            ;Status Byte Address
  1415. Displaypartl4:  In   Al,Dx              ;Get Status Byte
  1416.                 Test Al,1               ;Test Bit
  1417.                 Jnz  Displaypartl4      ;Loop Untill 0
  1418.                 Cli                     ;Disable Interrupts
  1419. Displaypartl5:  In   Al,Dx              ;Get Status Byte
  1420.                 Test Al,1               ;Test Bit
  1421.                 Jz   Displaypartl5      ;Loop Untill 1, Then Write
  1422.                 Pop  Ax                 ;Restore Char-Attri
  1423. Displaypartl6:  Stosw                   ;Write The Char And Colour
  1424.                 Loop Displaypartl3      ;Loop Untill Finished
  1425. Displaypartl7:  Sti                     ;Reenable Interrupts
  1426.                 Pop  Ds                 ;Restore Ds And Quit
  1427.                 Mov  Errreturn,Bh       ;Set Errreturn
  1428.                 Pop  Bp                 ;Restore Bp
  1429.                 Ret  14
  1430. Dsppart Endp
  1431.  
  1432.  
  1433. ;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  1434. ;Procedure Dspjust(Strx: Stype; X_Pos,Y_Pos,Colour: Byte);
  1435. ;
  1436. ;
  1437. Data    Segment
  1438.         Extrn  Video_Buff:Word
  1439.         Extrn  Snow_Check:Byte
  1440. Data    Ends
  1441. ;
  1442. ;
  1443. Dspjust Proc Far
  1444.                 Push Bp                 ;Save Bp
  1445.                 Mov  Bp,Sp              ;Set Stack Frame
  1446.                 Mov  Cl,Snow_Check      ;Get Snow_Check
  1447.                 Push Ds                 ;Save Turbo'S Ds
  1448.                 Mov  Ax,Video_Buff      ;Fetch Video_Buff
  1449.                 Mov  Es,Ax              ;Es Pts To Buffer
  1450.                 Sub  Bx,Bx              ;
  1451.                 Mov  Bl,[Bp+8]          ;Y_Pos
  1452.                 Dec  Bx                 ;Count From Zero
  1453.                 Mov  Byte Ptr[Bp+8],Cl  ;Save Snow_Check
  1454.                 Sub  Cx,Cx              ;
  1455.                 Mov  Cl,[Bp+10]         ;X_Pos
  1456.                 Dec  Cx                 ;Count From Zero
  1457.                 Mov  Ax,160             ;Bytes Per Y_Pos
  1458.                 Mul  Bl                 ;Y_Pos Offset
  1459.                 Shl  Cx,1               ;Dble Cols For Attributes
  1460.                 Add  Ax,Cx              ;Offset To Start Position
  1461.                 Mov  Di,Ax              ;Es:Di Pts To Start
  1462.                 Lds  Si,Dword Ptr[Bp+12] ;Ds:Si Pts To Strx
  1463.                 Sub  Cx,Cx              ;Clear Cx
  1464.                 Mov  Cl,[Si]            ;Get String Descriptor
  1465.                 Jcxz Dspjust5           ;Quit If Null
  1466.                 Add  Si,Cx              ;Pt To End Of Strx
  1467.                 Std                     ;Reverse Direction
  1468.                 Mov  Ah,[Bp+6]          ;Get Screen Attribute
  1469. Dspjust1:       Lodsb                   ;Get A Char From Strx
  1470.                 Cmp  Byte Ptr[Bp+8],0   ;Protect Against Snow?
  1471.                 Je   Dspjust4           ;Jump If Not
  1472.                 Mov  Bx,Ax              ;Save Char-Attri In Bx
  1473.                 Mov  Dx,3Dah            ;Status Byte Address
  1474. Dspjust2:       In   Al,Dx              ;Get Status Byte
  1475.                 Test Al,1               ;Test Bit
  1476.                 Jnz  Dspjust2           ;Loop Untill 0
  1477.                 Cli                     ;Disable Interrupts
  1478. Dspjust3:       In   Al,Dx              ;Get Status Byte
  1479.                 Test Al,1               ;Test Bit
  1480.                 Jz   Dspjust3           ;Loop Untill 1, Then Write
  1481.                 Mov  Ax,Bx              ;Return Char/Attri To Ax
  1482. Dspjust4:       Stosw                   ;Write The Char And Colour
  1483.                 Loop Dspjust1           ;Loop Untill Finished
  1484. Dspjust5:       Sti                     ;Reenable Interrupts
  1485.                 Pop  Ds                 ;Restore Ds And Quit
  1486.                 Pop  Bp                 ;Restore Bp
  1487.                 Ret  10
  1488. Dspjust Endp
  1489.  
  1490.  
  1491. ;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  1492. ;Procedure Dspvert(Strx: Stype; X_Pos,Y_Pos,Colour: Byte);
  1493. ;
  1494. ;
  1495. Data    Segment
  1496.         Extrn  Video_Buff:Word
  1497.         Extrn  Snow_Check:Byte
  1498. Data    Ends
  1499. ;
  1500. ;
  1501. Dspvert Proc Far
  1502.                 Cld                     ;Direction Flag Forward
  1503.                 Push Bp                 ;Bp Altered
  1504.                 Mov  Bp,Sp              ;Set Stack Frame
  1505.                 Push Ds                 ;Save Ds
  1506.                 Mov  Ax,Video_Buff      ;Fetch Video_Buff
  1507.                 Mov  Es,Ax              ;Es Points To Buffer
  1508.                 Mov  Bl,Snow_Check      ;Fetch Snow_Check Before Ds Change
  1509.                 Lds  Si,Dword Ptr[Bp+12] ;Ds:Si Pts To Strx
  1510.                 Mov  [Bp+12],Bl         ;Save Snow_Check
  1511.                 Sub  Ax,Ax              ;
  1512.                 Mov  Al,[Bp+8]          ;Y_Pos To Ax
  1513.                 Dec  Ax                 ;Count From 0
  1514.                 Mov  Dl,160             ;Bytes Per Y_Pos
  1515.                 Mul  Dl                 ;Times Y_Pos
  1516.                 Sub  Dx,Dx              ;
  1517.                 Mov  Dl,[Bp+10]         ;Column To Dx
  1518.                 Dec  Dx                 ;Count From 0
  1519.                 Shl  Dx,1               ;Double For Attributes
  1520.                 Add  Ax,Dx              ;Add To Y_Pos Offset
  1521.                 Mov  Di,Ax              ;Es:Di Pts To Screen
  1522.                 Mov  Ah,[Bp+6]          ;Attribute To Ah
  1523.                 Sub  Cx,Cx              ;Clear Cx
  1524.                 Mov  Cl,[Si]            ;String Length To Cx
  1525.                 Jcxz Dspvertical5       ;Quit If Null
  1526. Dspvertical1:   Inc  Si                 ;Inc String Pointer
  1527.                 Mov  Al,[Si]            ;Char To Al
  1528.                 Cmp  Byte Ptr[Bp+12],0  ;Protect Against Snow?
  1529.                 Je   Dspvertical4       ;Jump Ahead If Not
  1530.                 Mov  Dx,3Dah            ;Status Byte Address
  1531.                 Mov  Bx,Ax              ;Save Char-Attri In Bx
  1532. Dspvertical2:   In   Al,Dx              ;Get Status Byte
  1533.                 Test Al,1               ;Test Bit
  1534.                 Jnz  Dspvertical2       ;Loop Untill 0
  1535.                 Cli                     ;Disable Interrupts
  1536. Dspvertical3:   In   Al,Dx              ;Get Status Byte
  1537.                 Test Al,1               ;Test Bit
  1538.                 Jz   Dspvertical3       ;Loop Untill 1
  1539.                 Mov  Ax,Bx              ;Return Char-Attri To Ax
  1540. Dspvertical4:   Stosw                   ;Write The Char & Attri
  1541.                 Add  Di,158             ;Ptr To Next Y_Pos
  1542.                 Loop Dspvertical1       ;Go Write Next Char
  1543. Dspvertical5:   Sti                     ;Reenable Interrupts
  1544.                 Pop  Ds                 ;Restore Ds
  1545.                 Pop  Bp                 ;Restore Bp And Quit
  1546.                 Ret  10
  1547. Dspvert Endp
  1548.  
  1549.  
  1550.  
  1551. ;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  1552. ;Function Getpage: Integer;
  1553. ;
  1554. ;
  1555. Getpage Proc Far
  1556.                 Mov  Ah,0Fh             ;Function Number
  1557.                 Int  10H                ;Get The Current Page
  1558.                 Mov  Al,Bh              ;Shift Page Num To Al
  1559.                 Sub  Ah,Ah              ;Clear Ah
  1560.                 Ret
  1561. Getpage Endp
  1562.  
  1563.  
  1564.  
  1565. Code    Ends
  1566.  
  1567.         End
  1568.  
  1569. ;
  1570.