home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / INFO / TURBOPAS / TUR6_101.ZIP / V17.ASM < prev    next >
Encoding:
Assembly Source File  |  1986-06-07  |  9.2 KB  |  161 lines

  1. ;--------------------------------------------------------------------
  2. ; Author       : Kevin Dahl                                         :
  3. ; Last Revised : June 7, 1986                                       :
  4. ;                                                                   :
  5. ; FILENAME - V17.ENH                                                :
  6. ;                                                                   :
  7. ; SCROLLLEFT                                                        :
  8. ;        Moves a block of characters left on the screen             :
  9. ;                                                                   :
  10. ; ENTRY                                                             :
  11. ;        [bp+6]  = Bottom row of screen area to be scrolled.        :
  12. ;        [bp+8]  = Right column of screen area to be scrolled.      :
  13. ;        [bp+10] = Top row of screen are to be scrolled.            :
  14. ;        [bp+12] = Left column of screen area to be scrolled.       :
  15. ;        [bp+14] = Attribute color to be used on blank line.        :
  16. ;        [bp+16] = Number of columns to scroll                      :
  17. ;                                                                   :
  18. ; EXIT                                                              :
  19. ;        Nothing -- the screen is modified.                         :
  20. ;--------------------------------------------------------------------
  21. scrollleft    proc      near
  22.               push      ds
  23.               push      bp                       ; save stack
  24.               mov       bp,sp
  25.               mov       ah,0fh                   ; get current video mode
  26.               int       10h                      ; using BIOS services
  27.               xor       dx,dx                    ; zero out dx register
  28.               mov       dl,ah                    ; save number columns per line
  29.               cmp       al,7                     ; check for monochrome monitor
  30.               je        v56
  31.               cmp       al,4                     ; check if text modes
  32.               jb        v54                      ; graphics mode - no write
  33.               jmp       v64
  34. v54:
  35.               mov       cx,7                     ; set for 40 col text modes
  36.               cmp       dl,80                    ; check for num of cols
  37.               jb        v55                      ; 40 cols if jmp
  38.               inc       cx                       ; if get here then 80 cols
  39. v55:
  40.               xor       ax,ax                    ; zero out ax
  41.               mov       al,bh                    ; active display page for CGA
  42.               shl       ax,cl                    ; calc address for display page
  43.               mov       cx,0B800h                ; address for CGA
  44.               add       ax,cx                    ; calc starting address
  45.               jmp       v57
  46. v56:
  47.               mov       ax,0B000h                ; monochrome monitor address
  48. v57:
  49.               mov       es,ax                    ; video address into es
  50.               mov       ds,ax                    ; video address into ds
  51.               xor       ax,ax                    ; zero out ax
  52.               mov       bx,ax                    ; zero out bx
  53.               push      dx                       ; save # cols on screen
  54.  
  55.               mov       al,[bp+10]               ; top row parameter
  56.               dec       ax                       ; (row - 1)
  57.               mul       dx                       ; (row - 1) * number of columns
  58.               add       ax,[bp+12]               ; (row - 1) * # cols + col offset
  59.               dec       ax                       ; (row - 1) * # cols + col offset - 1
  60.               shl       ax,1                     ; ((row-1)* #cols + col offset - 1)*2
  61.               mov       di,ax                    ; left col starting point
  62.               pop       dx                       ; get # cols/screen
  63.               push      ax                       ; save left col start pt
  64.  
  65.               mov       bx,[bp+16]               ; # cols to scroll
  66.               shl       bx,1                     ; mult by 2
  67.               add       ax,bx                    ; add # cols to scroll
  68.               mov       si,ax                    ; move into source index
  69.               push      ax                       ; save start pt
  70.  
  71.               shl       dx,1                     ; for offset information
  72.               push      dx                       ; save for later use
  73.  
  74.               mov       cx,[bp+8]                ; right column
  75.               sub       cx,[bp+12]               ; left column
  76.               sub       cx,[bp+16]               ; rc - lc - #cols to scroll
  77.               inc       cx                       ; add one
  78.               shl       cx,1                     ; mult by 2
  79.               cmp       cx,1                     ; if < 1 then clear window
  80.               jb        v63                      ; jmp to scroll routine
  81.  
  82.               push      cx                       ; save # cols to adjust
  83.               mov       cx,[bp+6]                ; bottom row
  84.               sub       cx,[bp+10]               ; bottom row - top row
  85.               inc       cx                       ; add one
  86.               pop       ax                       ; # cols to scroll
  87.  
  88.               cld                                ; clear direction flag
  89.               cli                                ; clear interrupts
  90.  
  91. v58:          push      ax                       ; # cols to scroll on 1 line
  92.               push      cx                       ; # rows to be scrolled
  93.               mov       cx,ax                    ; set for inner loop
  94.  
  95.               mov       dx,03DAh                 ; status port
  96. v59:
  97.               in        al,dx                    ; get status
  98.               test      al,1                     ; is it low?
  99.               jnz       v59                      ; wait until it is
  100. v60:
  101.               in        al,dx                    ; get status
  102.               test      al,1                     ; is it high?
  103.               jz        v60                      ; wait until it is
  104.               movsb                              ; put char & attribute byte
  105.               loop      v59                      ; repeat until done
  106.  
  107.               mov       bh,[bp+14]               ; attribute color
  108.               mov       bl,32                    ; blank space
  109.               mov       cx,[bp+16]               ; # cols to scroll
  110. v61:
  111.               in        al,dx                    ; get status
  112.               test      al,1                     ; is it low?
  113.               jnz       v61                      ; wait until it is
  114. v62:
  115.               in        al,dx                    ; get status
  116.               test      al,1                     ; is it high?
  117.               jz        v62                      ; wait until it is
  118.               mov       ax,bx                    ; char & attribute to display
  119.               stosw                              ; put char & attribute byte
  120.               loop      v61                      ; repeat until done
  121.  
  122.               pop       cx                       ; # rows to be scrolled
  123.               pop       ax                       ; # cols to scroll on 1 line
  124.               pop       dx                       ; # cols per screen
  125.               pop       si                       ; start pt of col to move left
  126.               pop       di                       ; start pt of col for si
  127.               add       di,dx                    ; add for next row
  128.               add       si,dx                    ; add for next row
  129.               push      di                       ; save start pt
  130.               push      si                       ; save start pt of col to move left
  131.               push      dx                       ; save # cols per screen
  132.  
  133.               loop      v58
  134.               sti
  135.               jmp       v64
  136. v63:
  137.               mov       dh,[bp+6]                ; bottom row
  138.               mov       dl,[bp+8]                ; right column
  139.               mov       ch,[bp+10]               ; top row
  140.               mov       cl,[bp+12]               ; left column
  141.               dec       dh                       ; adjust to absolute bottom row
  142.               dec       dl                       ; adjust to absolute right col
  143.               dec       ch                       ; adjust to absolute top row
  144.               dec       cl                       ; adjust to absolute left col
  145.               mov       bh,[bp+14]               ; color for blank rows
  146.               mov       al,0                     ; number of lines to scroll
  147.               mov       ah,7                     ; scroll down service
  148.               push      bp                       ; save base pointer
  149.               int       10h                      ; let BIOS do scroll
  150.               pop       bp
  151. v64:
  152.               pop       ax                       ; clean up stack
  153.               pop       ax
  154.               pop       ax
  155.  
  156.               mov       sp,bp                    ; restore stack
  157.               pop       bp                       ; restore base pointer
  158.               pop       ds                       ; restore data segment
  159.               ret       12                       ; remove parameters and return
  160. scrollleft    endp
  161.