home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1994 #1 / monster.zip / monster / BBS_UTIL / BM0406_A.ZIP / BMASM.ZIP / ANSI18.ASM < prev    next >
Assembly Source File  |  1993-01-02  |  11KB  |  232 lines

  1. ; ANSI1-8aASM Revised 01/01/93 Richie Molinelli
  2. ;  This version of ANSI18 is based upon modifications done by Scott McNay
  3. ;  whereby he modified the code to work with the ability of PDS BASIC v7.1
  4. ;  to compile using the far string option.  Scott's code heavily modified
  5. ;  and "optimized" the original ANSI18 code.  I chose, rather, to just
  6. ;  implement the retrieval of the far strings and utilize the existing
  7. ;  code.  We all owe tremendous gratitude to Scott for his breakthrough
  8. ;  giving RBBS much needed string space.
  9. ;
  10. ; ANSI1-8ASM  Revised 10/18/90 Nathan T. Barber
  11. ;   V1.7 of Ansi.obj works well except in one situation:  The attribute
  12. ;   byte of character 1 on line 24 is used when scrolling the screen
  13. ;   This causes color bleeding on the local screen.  The fix can be done
  14. ;   in two ways: always set the attrib byte to the correct one, or just
  15. ;   use attrib 7, which appears to be for "bland" text.
  16. ;   I use attrib 7 since RBBS seems to set the color for the next line
  17. ;   all by itself.
  18. ;
  19. ;   Also in this version, a new function called ANSISET.  It replaces the
  20. ;   initialization code that fetchs the current video page for every call
  21. ;   to ANSI().  This makes an appreciable speed difference when scrolling the
  22. ;   screen at 9600+ BPS.  It requires changing one line in RBBS-PC.BAS, which
  23. ;   is noted here:  (from line 108)
  24. ;    IF ZUseBASICWrites THEN _
  25. ;       ZLocalBksp$ = ZBackArrow$ _
  26. ;    ELSE ZLocalBksp$ = ZBackSpace$ : call ANSISET ' NB101890
  27. ;   I don't THINK what I do is illegal from a programming point of view,
  28. ;   as I don't think RBBS ever changes video pages when it executes this
  29. ;   routine!
  30. ;
  31. ;   Finally, the routine Where_are_we has been moved from a proc call to
  32. ;   mainline.  Every cycle counts!
  33. ;
  34. ;
  35. ; ANSI1-7ASM  Revised 11/28/88 Garry G. Kraemer
  36. ;
  37. ;   A problem existed with version 1-6 when the sysop exited to DOS from
  38. ;   CHAT and returned, Linefeeds would not be displayed on the CRT.
  39. ;   The text would overwrite on the same line.  After several hours of
  40. ;   intense debugging, I have placed a few lines of code into the .ASM
  41. ;   file that will add a LineFeed (LF or CHR$(10)) to STRNG$ if it
  42. ;   does not end with one.  I assume that if I find a CR and am NOT at
  43. ;   the end of the string, a LF follows!!
  44. ;
  45. ;   Changed lines reflect GGK in the right column
  46. ;
  47. ;   Garry G. Kraemer    520 El Portal   Merced, CA
  48. ;   WINTONS LOCAL RBBS 9758 N SHAFFER RD WINTON, CA 95388
  49. ;   2400/1200/300 24hrs 400 days a year (209) 358-6154
  50. ;
  51. ; ANSI1-6ASM  Revised 10/28/87 Jon Martin fix boundary bug
  52. ; ANSI1-5ASM  Revised 8/24/85 Dave Terry for QuickBasic Compiler
  53. ; ANSI1-4ASM  Revised 8/23/85 Dave Staehlin
  54.  
  55.           EXTRN   StringAddress:FAR     ;FS010192 Create External Routine -
  56.                                         ;When called will return:
  57.                                         ; Start address of data seg in DX
  58.                                         ; Start address of string in AX
  59.                                         ; Offset in CX
  60.                                         ; Determine length with ADD AX,CX
  61.  
  62.  
  63. ANSI_PRNT SEGMENT PUBLIC 'CODE'         ;By  David W. Terry
  64.           ASSUME CS:ANSI_PRNT           ;    3036 So. Putnam Ct.
  65.           PUBLIC ANSI                   ;    West Valley City, UT 84120
  66.           PUBLIC ANSISET                ;    NB101890
  67.  
  68. ;                      Screen scroll mods by David C. Staehlin
  69. ;                                            5430 Candle Glow NE
  70. ;                                            Albuquerque, NM 87111
  71. ;
  72. ;                                       Data (505) 821-7379 24 Hrs, 2400 Baud
  73. STRG_LEN          DW 0                  ;CHANGED TO LENGTH OF STRING PASSED
  74. VID_PAGE          DB 0                  ;Active video page
  75. ;
  76. ;
  77. ANSISET   PROC    FAR
  78.           PUSH    AX
  79.           PUSH    BX
  80.           MOV     AH,15
  81.           INT     10H
  82.           MOV     VID_PAGE,BH
  83.           POP     BX
  84.           POP     AX
  85.           RET
  86. ANSISET   ENDP
  87. ;
  88. ANSI      PROC    FAR
  89.           PUSH    BP
  90.           MOV     BP,SP
  91.           PUSH    ES                ;FS010192 SAVE OLD ES
  92.           PUSH    10[BP]            ;FS010192 STORE OLD DESCRIPTOR
  93. ;
  94.           CALL    StringAddress     ;FS010192 GET FAR STRING INFO
  95. ;         MOV     SI,10[BP]         ;GET STRING DESCRIPTOR
  96. ;         MOV     BL,[SI+ 2]        ;REARRANGE LOW/HIGH BYTES
  97. ;         MOV     BH,[SI+ 3]        ;NOW BX HOLDS THE ADDRESS OF THE STRING
  98. ;         MOV     AX,[SI]           ;GET STRING LENGTH
  99. ;         ADD     AX,BX             ;ADD INITIAL OFFSET (BX) TO LENGTH
  100.           MOV     BX,AX             ;BX HOLDS ADDRESS OF STRING
  101.           ADD     AX,CX             ;ADD INITIAL OFFSET (CX) TO LENGTH
  102.           MOV     STRG_LEN,AX       ;STORE OFFSET PLUS LENGTH
  103.           MOV     ES,DX             ;SET NEW ES SEGMENT
  104. ;
  105. ;          PUSH    BX                ;SAVE BX
  106. ;          MOV     AH,15             ;Get current video state
  107. ;          INT     10H               ;DO INTERRUPT
  108. ;          MOV     VID_PAGE,BH       ;Save it
  109. ;          POP     BX                ;RESTORE BX
  110. ;
  111.           MOV     AH,02             ;SET UP FOR FUNCTION CALL 02H
  112. LOOP1:
  113.           MOV     DL,ES:[BX]        ;SET DL TO CHARACTER TO PRINT  FS010192
  114.           PUSH    DX                ;Save the character in AX 'till we check..
  115. ;          CALL   WHERE_ARE_WE      ; where the cursor is.......  ' nb101890
  116.           PUSH    AX                ;Save the registers           ' nb101890
  117.           PUSH    BX                                           ;  ' nb101890
  118.           PUSH    CX                                           ;  ' nb101890
  119.           MOV     AH,03             ;SET UP FOR ROM-BIOS CALL (03H) ' nb101890
  120.           MOV     BH,VID_PAGE       ;TO READ THE CURRENT CURSOR POSITION ' nb101890
  121.           INT     10H               ;  DH = ROW   DL = COLUMN      ' nb101890
  122.           POP     CX                ;Restore the registers         ' nb101890
  123.           POP     BX                                          ;    ' nb101890
  124.           POP     AX                                          ;    ' nb101890
  125.           CMP     DH,17H            ;Row 24?
  126.           JL      NOPE              ; Jump if less......
  127.           CMP     DX,174FH          ;Row 24 column 79 ?
  128.           JZ      NEXT1             ;YES, JUMP TO NEXT 1
  129.           CMP     DH,18H            ;Row 25?
  130.           JZ      NOPE              ;Don't scroll line 25
  131. ;         DEC     BX                ; Else backup one character
  132. ;         JMP     SCROLL2           ; And go scroll the screen
  133. ;
  134. ; program never executes thru NEXT2!!  Trust ME!                            GGK
  135. ;
  136. NEXT2:    POP     DX                ;And restore the stack to where it was
  137.           CMP     DL,0AH            ;Do we have a line feed?
  138.           JZ      SCROLL            ; Yup - scroll this sucker!
  139.           CMP     DL,0DH            ;  How about a carriage return?
  140.           JNZ     NOPE1             ;  Nope - just go display it.......
  141.           INC     BX                ;  Yup - see if next char is a line feed
  142.           MOV     DX,ES:[BX]        ;FS010192
  143.           CMP     DL,0AH            ;  Well, is it?
  144.           JZ      SCROLL            ;  It sure is - let's go scroll
  145.           DEC     BX                ;  Oops - just a carriage return
  146.           JMP     SCROLL            ;  But let's go scroll it anyway
  147. ;
  148. NEXT1:    POP     DX                ; save DX
  149.           INT     21H               ; print char using interrupt
  150.           CALL    SCROLLIT
  151.           JMP     EXIT1
  152. ;
  153. NOPE:     POP     DX
  154. NOPE1:    INT     21H               ; Else just display it
  155. SKIPIT:   INC     BX                ; point to next char
  156.           CMP     DL,0DH            ; WAS LAST CHAR A CR?                   GGK
  157.           JNZ     NOTCR             ; NO, jump to not CR                    GGK
  158.           CMP     BX, STRG_LEN      ; AT END OF STRING?                     GGK
  159.           JB      LOOP1             ; NO, CONTINUE - NEXT MUST BE A LF!!    GGK
  160.           MOV     DL,0AH            ; ELSE AT END OF STRING SO WE ADD A LF! GGK
  161.           INT     21H               ; DO INTERRUPT AND DISPLAY IT!          GGK
  162.           JMP     EXIT1             ; AND EXIT                              GGK
  163. ;                                                                           GGK
  164. ;                                                                           GGK
  165. NOTCR:    CMP     BX,STRG_LEN       ; Test 'AT END OF STRING' ?             GGK
  166.           JB      LOOP1             ; NO, LOOP UNTIL ALL CHARS PROCESSED
  167. ;
  168. EXIT1:    MOV     AH,03             ;SET UP FOR ROM-BIOS CALL (03H)
  169.           MOV     BH,VID_PAGE       ;TO READ THE CURRENT CURSOR POSITION
  170.           INT     10H               ;  DH = ROW   DL = COLUMN
  171.           INC     DH                ;ADD 1 TO ROW (BECAUSE TOP OF SCREEN = 0)
  172.           INC     DL                ;ADD 1 TO COL (BECAUSE POS 1 = 0)
  173.           MOV     SI,[BP]+ 8
  174.           MOV     [SI],DH           ;PASS BACK ROW COORDINATE
  175.           MOV     SI,[BP]+ 6
  176.           MOV     [SI],DL           ;PASS BACK COLUMN COORDINATE
  177.           POP     ES                ;FS010192 RESTORE ES
  178.           POP     BP
  179.           RET     6
  180. ANSI      ENDP
  181.  
  182. ;Where_Are_We:                       ;Get the current cursor position
  183. ;          PUSH    AX                ;Save the registers
  184. ;          PUSH    BX
  185. ;          PUSH    CX
  186. ;         MOV     AH,03             ;SET UP FOR ROM-BIOS CALL (03H)
  187. ;          MOV     BH,VID_PAGE       ;TO READ THE CURRENT CURSOR POSITION
  188. ;          INT     10H               ;  DH = ROW   DL = COLUMN
  189. ;          POP     CX                ;Restore the registers
  190. ;          POP     BX
  191. ;          POP     AX
  192. ;          RET                        ;And go back from wence we came
  193. ;
  194. SCROLL2:  POP     DX                ;Put the stack like it was
  195. SCROLL:   CALL    SCROLLIT          ;Scroll the screen
  196.           JMP     SKIPIT
  197. ;
  198. SCROLLIT: PUSH    AX                ;Save the registers that will be affected
  199.           PUSH    BX
  200.           PUSH    CX
  201.           PUSH    DX
  202.           PUSH    BP
  203.           MOV     AH,2              ;Now set cursor position to 24,0
  204. ;          MOV     DX,174fH          ;so we can get the proper character  ' nb101890
  205. ;          MOV     DX,1700H          ;so we can get the proper character ' ANSIV17
  206. ;          MOV     BH,VID_PAGE       ;attribute
  207. ;          INT     10H
  208. ;          MOV     AH,8              ;Get the current character attribute
  209. ;          MOV     BH,VID_PAGE
  210. ;          INT     10H
  211. ;          MOV     BH,AH             ;Transfer the attribute to BH for next call
  212.           mov     bh,7
  213.           MOV     AH,6              ;Otherwise scroll 24 lines
  214.           MOV     AL,1              ; Only blank line 24
  215.           MOV     CX,0000H          ; Begin scroll at position 0,0
  216.           MOV     DX,174FH          ; End scroll at Line 24, Col 79
  217.           INT     10H               ; And do it.......
  218.           MOV     AH,2              ;Now set cursor position to 24,0
  219.           MOV     DX,1700H
  220.           MOV     BH,VID_PAGE
  221.           INT     10H
  222.           POP     BP
  223.           POP     DX                ;Restore the stack like it was
  224.           POP     CX
  225.           POP     BX
  226.           POP     AX
  227.           RET
  228. ;
  229. ANSI_PRNT ENDS
  230.           END
  231. 
  232.