home *** CD-ROM | disk | FTP | other *** search
/ Beijing Paradise BBS Backup / PARADISE.ISO / software / BBSDOORW / CDOR0811.ZIP / SOURCE.ZIP / VGAANSI.ASM < prev    next >
Encoding:
Assembly Source File  |  1993-02-20  |  8.8 KB  |  204 lines

  1. ;
  2. ; Changes made to ANSI17 by Scott McNay (1:395/11) July 26, 1992, to allow
  3. ; routine to be used with code compiled with BC's /Fs option.  (Most) changes
  4. ; marked with ;BCFS0726.  May have optimized some code also.  This is a plug-in
  5. ; replacement for the original code with BC, but requires use of RBBSQBFS.OBJ
  6. ; when using QuickBASIC.
  7.  
  8.  
  9. ; BCFS0728: Updated to ANSI18, but removed ANSISET() and hardcoded ANSI() to
  10. ; use video page 0, since RBBS does not change the video page, and I doubt that
  11. ; anyone bothers to change to other than page 0 before running RBBS.  This
  12. ; removes some more overhead and makes the code shorter.  Also partly fixed bug
  13. ; with lines going past column 80 getting cut off instead of wrapping.
  14. ; Original copy of ANSI18 available from me on request -- see above.  Also did
  15. ; a LOT of optimizing.  EVERYTHING marked BCFS0728 (except the XOR BH,BH
  16. ; lines), as well as a few others, was modified by optimizations!  This is
  17. ; about half of the code, and a bunch of code was removed also.
  18.  
  19.  
  20. ;|(THE FOLLOWING HAS BEEN REMOVED!)
  21. ;|BCFS0729: Added another parameter to return the number of line wraps that
  22. ;|occurred, so that RBBS can keep it's line count accurate.  This was not
  23. ;|possible before, since long lines were cut off, partly fixed by BCFS0728.
  24. ;|Example:
  25.  
  26. ;|   CALL ANSI ("AVeryLongLineOfText",NewX,NewY,NumLines)
  27.  
  28.  
  29. ; BCFS0831: Another virtual rewrite, to make sure that the cursor never moves
  30. ; to line 25 when it shouldn't.  Solved the problem by having separate routines
  31. ; for line 25 and the rest of the screen.  Now, if the cursor ever moves to
  32. ; line 25 for ANY reason, including ANSI cursor codes, the screen is scrolled
  33. ; and the cursor moved back up to line 24.  Code has been reduced to a mere 60
  34. ; lines, and only a handful have not been moved, removed, or replaced.  Since
  35. ; the code is so different and is stable now, have renamed to ANSI19.
  36.  
  37. ; Standardized code format.  Made sure that DI, SI, BP, and DS are saved to
  38. ; meet requirements of BC 7.x.
  39.  
  40. ; Managed to confirm that the problem with missing line feeds is in RBBSSUB2
  41. ; line 3750.  I suspect that the problem in ANSI16 was actually a case of a bug
  42. ; in RBBS being "fixed" by a bug in ANSI16.  Specifically, BX was used as a
  43. ; pointer to the character being printed.  ANSI, at one point, would find a CR
  44. ; as the last character of the string and then look at [BX+1] without checking
  45. ; to verify that it was within the string.  I believe that normally [BX+1]
  46. ; would contain a LF (for whatever reason) except right after a shell to DOS
  47. ; from within chat, in which case the LF would get replaced by something else.
  48. ; Change RBBSSUB2 line 3750 to read as follows:
  49.  
  50. ; 3750 IF SendRemote THEN _
  51. ;      CALL PutCom(WasX$)
  52. ;      IF WasX$ = ZCarriageReturn$ THEN _
  53. ;      CALL LPrnt (ZCrLf$,0) : _
  54. ;      Col = Col - 1 : _
  55. ;      GOTO 3850 _
  56. ;      ELSE _
  57. ;      CALL LPrnt (WasX$, 0)
  58.  
  59.  
  60.  
  61. ;ANSI1-8ASM  Revised 10/18/90 Nathan T. Barber
  62. ;   V1.7 of Ansi.obj works well except in one situation:  The attribute byte of
  63. ;   character 1 on line 24 is used when scrolling the screen.  This causes
  64. ;   color bleeding on the local screen.  The fix can be done in two ways:
  65. ;   always set the attrib byte to the correct one, or just use attrib 7, which
  66. ;   appears to be for "bland" text.  I use attrib 7 since RBBS seems to set the
  67. ;   color for the next line all by itself.
  68.  
  69. ;   Also in this version, a new function called ANSISET.  It replaces the
  70. ;   initialization code that fetchs the current video page for every call to
  71. ;   ANSI().  This makes an appreciable speed difference when scrolling the
  72. ;   screen at 9600+ BPS.  It requires changing one line in RBBS-PC.BAS, which
  73. ;   is noted here:  (from line 108)
  74. ;    IF ZUseBASICWrites THEN _
  75. ;    ZLocalBksp$ = ZBackArrow$ _
  76. ;    ELSE ZLocalBksp$ = ZBackSpace$ : call ANSISET              'NB101890
  77. ;   I don't THINK what I do is illegal from a programming point of view, as I
  78. ;   don't think RBBS ever changes video pages when it executes this routine!
  79.  
  80. ;   Finally, the routine Where_are_we has been moved from a proc call to
  81. ;   mainline.  Every cycle counts!
  82.  
  83. ; ANSI1-9ASM  Revised 8/1/92   W. Scott McNay
  84. ;   Changed code to allow far strings with BC 7.1.  Change requires use of
  85. ;   RBBSQBFS.OBJ when using QB to compile.  Removed all code dealing with video
  86. ;   pages, and simply assumed page 0.  Code completely rewritten, so that there
  87. ;   are now no problems with wrapping around column 80.  Also removed code to
  88. ;   bypass chat LF bug.  Fixed chat LF bug in RBBSSUB2, and determined that
  89. ;   probable cause of bug apparently occurring only after shell to DOS was
  90. ;   because of another, unnoticed, bug in ANSI.
  91. ; ANSI1-8ASM  Revised 10/18/90 Nathan T. Barber
  92. ;   Fix background color bleeding during scroll.  Also changed code for
  93. ;   detecting video page, so only checks once.  Moved Where_are_we inline.
  94. ; ANSI1-7ASM  Revised 11/28/88 Garry G. Kraemer
  95. ;   Kludge fix for chat LF bug.
  96. ; ANSI1-6ASM  Revised 10/28/87 Jon Martin
  97. ;   Fix boundary bug.
  98. ; ANSI1-5ASM  Revised 8/24/85  Dave Terry
  99. ;   Changes for QuickBasic compiler.
  100. ; ANSI1-4ASM  Revised 8/23/85  Dave Staehlin
  101. ;
  102. ; VGA support added 02/19/93 by Dan Drinnon (1:313/6) (8:903/2)
  103. ; Renamed to VGAANSI.ASM
  104. ;
  105.     Extrn    StringAddress:far                          ;BCFS0726 
  106. CR    equ    13
  107. LF    equ    10
  108.  
  109. VGAANSI_PRNT SEGMENT PUBLIC 'CODE' ;By  David W. Terry               ;DD021903
  110.         ASSUME  CS:VGAANSI_PRNT    ;    3036 So. Putnam Ct.          ;DD021903
  111.         PUBLIC  VGAANSI         ;    West Valley City, UT 84120      ;DD021903
  112.  
  113. ;        Screen scroll mods by David C. Staehlin
  114. ;                      5430 Candle Glow NE
  115. ;                      Albuquerque, NM 87111
  116.  
  117. ;                  Data (505) 821-7379 24 Hrs, 2400 Baud
  118. STRG_LEN    DW    0     ;CHANGED TO ENDING ADDRESS OF STRING PASSED
  119.  
  120.  
  121. VGAANSI PROC    FAR                                                  ;DD021903
  122.     PUSH    BP
  123.     MOV    BP,SP
  124.     PUSH    ES                                  ;BCFS0801
  125.     PUSH    BP        ;Bypass bug in orig PC BIOS, duplicated by    ;BCFS0801
  126.                 ; some clone BIOSes
  127.  
  128.     PUSH    [BP+10]        ;GET A$ STRING DESCRIPTOR ADDRESS
  129.     CALL    StringAddress                              ;BCFS0726
  130.     MOV    BX,AX                                  ;BCFS0726
  131.     ADD    AX,CX                                  ;BCFS0728
  132.     MOV    STRG_LEN,AX
  133.     MOV    ES,DX                                  ;BCFS0726
  134.  
  135.     PUSH    BX                              ;nb101890
  136.     MOV    AH,3        ;SET UP FOR ROM-BIOS CALL (03H)          ;nb101890
  137.     XOR    BH,BH        ;TO READ THE CURRENT CURSOR POSITION          ;BCFS0728
  138.     INT    10H        ;  DH = ROW   DL = COLUMN          ;nb101890
  139.     POP    BX                              ;nb101890
  140.         CMP     DH,49           ;Handle line 50 separately, which must fit and;BCFS0801
  141.     JE    LastLine    ; have no control characters.              ;BCFS0801
  142.  
  143. LOOP1:
  144.     MOV    DL,es:[BX]    ;SET DL TO CHARACTER TO PRINT              ;BCFS0728
  145.     MOV    AH,2        ;SET UP FOR FUNCTION CALL 02H              ;BCFS0728
  146.     INT    21H        ; Display it
  147.  
  148.     PUSH    BX        ;Save pointer                  ;nb101890
  149.     MOV    AH,3        ;SET UP FOR ROM-BIOS CALL (03H)          ;nb101890
  150.     XOR    BH,BH        ;TO READ THE CURRENT CURSOR POSITION          ;BCFS0728
  151.     INT    10H        ;  DH = ROW   DL = COLUMN          ;nb101890
  152.     POP    BX                              ;nb101890
  153.         CMP     DH,49           ;Did cursor get moved to last line?
  154.     JE    SCROLL        ; Yes, scroll screen, move cursor back!
  155. SKIPIT:
  156.     INC    BX        ; point to next char
  157.     CMP    BX, STRG_LEN    ; AT END OF STRING?                GGK
  158.     JB    LOOP1        ; NO, CONTINUE - NEXT MUST BE A LF!!        GGK
  159.  
  160. EXIT1:
  161.     MOV    AH,3        ;SET UP FOR ROM-BIOS CALL (03H)
  162.     XOR    BH,BH        ;TO READ THE CURRENT CURSOR POSITION          ;BCFS0728
  163.     INT    10H        ;  DH = ROW   DL = COLUMN
  164.     INC    DH        ;ADD 1 TO ROW (BECAUSE TOP OF SCREEN = 0)
  165.     INC    DL        ;ADD 1 TO COL (BECAUSE POS 1 = 0)
  166.  
  167.     POP    BP        ;Gets around PC BIOS bug              ;BCFS0801
  168.     POP    ES                                  ;BCFS0801
  169.     MOV    BX,[BP+8]                              ;BCFS0728
  170.     MOV    [BX],DH        ;PASS BACK ROW COORDINATE              ;BCFS0728
  171.     MOV    BX,[BP+6]                              ;BCFS0728
  172.     MOV    [BX],DL        ;PASS BACK COLUMN COORDINATE              ;BCFS0728
  173.  
  174.     POP    BP
  175.     RET    6
  176.  
  177. LastLine:            ;This assumes no control characters!!
  178.     MOV    DL,es:[BX]    ;SET DL TO CHARACTER TO PRINT              ;BCFS0728
  179.     MOV    AH,2        ;SET UP FOR FUNCTION CALL 02H              ;BCFS0728
  180.     INT    21H        ; Else just display it
  181.     INC    BX        ; point to next char
  182.     CMP    BX, STRG_LEN    ; AT END OF STRING?                GGK
  183.     JB    LastLine    ; NO, CONTINUE - NEXT MUST BE A LF!!        GGK
  184.     JMP    short EXIT1
  185.  
  186. SCROLL:
  187.     PUSH    BX        ;Save the pointer
  188.     MOV    AH,2        ;Now set cursor position to line 23          ;BCFS0801
  189.     XOR    BH,BH                                  ;BCFS0801
  190.     DEC    DH                                  ;BCFS0801
  191.     INT    10H                                  ;BCFS0801
  192.     mov    bh,7                              ;nb101890
  193.     MOV    AX,601h        ; Scroll up 1 line                  ;BCFS0728
  194.     XOR    CX,CX        ; Begin scroll at position 1,1              ;BCFS0728
  195.         MOV     DX,48*256+79    ; End scroll at Line 49, Col 80
  196.     INT    10H        ; And do it...
  197.     POP    BX        ;Restore the stack like it was              ;BCFS0801
  198.     JMP    short SKIPIT                              ;BCFS0728
  199.  
  200. VGAANSI ENDP                                                         ;DD021903
  201.  
  202. VGAANSI_PRNT    ENDS                                                 ;DD021903
  203.     END
  204.