home *** CD-ROM | disk | FTP | other *** search
- ;--------------------------------------------------------------------
- ; Author : Kevin Dahl :
- ; Last Revised : June 7, 1986 :
- ; :
- ; FILENAME - V17.ENH :
- ; :
- ; SCROLLLEFT :
- ; Moves a block of characters left on the screen :
- ; :
- ; ENTRY :
- ; [bp+6] = Bottom row of screen area to be scrolled. :
- ; [bp+8] = Right column of screen area to be scrolled. :
- ; [bp+10] = Top row of screen are to be scrolled. :
- ; [bp+12] = Left column of screen area to be scrolled. :
- ; [bp+14] = Attribute color to be used on blank line. :
- ; [bp+16] = Number of columns to scroll :
- ; :
- ; EXIT :
- ; Nothing -- the screen is modified. :
- ;--------------------------------------------------------------------
- scrollleft proc near
- push ds
- push bp ; save stack
- mov bp,sp
- mov ah,0fh ; get current video mode
- int 10h ; using BIOS services
- xor dx,dx ; zero out dx register
- mov dl,ah ; save number columns per line
- cmp al,7 ; check for monochrome monitor
- je v56
- cmp al,4 ; check if text modes
- jb v54 ; graphics mode - no write
- jmp v64
- v54:
- mov cx,7 ; set for 40 col text modes
- cmp dl,80 ; check for num of cols
- jb v55 ; 40 cols if jmp
- inc cx ; if get here then 80 cols
- v55:
- xor ax,ax ; zero out ax
- mov al,bh ; active display page for CGA
- shl ax,cl ; calc address for display page
- mov cx,0B800h ; address for CGA
- add ax,cx ; calc starting address
- jmp v57
- v56:
- mov ax,0B000h ; monochrome monitor address
- v57:
- mov es,ax ; video address into es
- mov ds,ax ; video address into ds
- xor ax,ax ; zero out ax
- mov bx,ax ; zero out bx
- push dx ; save # cols on screen
-
- mov al,[bp+10] ; top row parameter
- dec ax ; (row - 1)
- mul dx ; (row - 1) * number of columns
- add ax,[bp+12] ; (row - 1) * # cols + col offset
- dec ax ; (row - 1) * # cols + col offset - 1
- shl ax,1 ; ((row-1)* #cols + col offset - 1)*2
- mov di,ax ; left col starting point
- pop dx ; get # cols/screen
- push ax ; save left col start pt
-
- mov bx,[bp+16] ; # cols to scroll
- shl bx,1 ; mult by 2
- add ax,bx ; add # cols to scroll
- mov si,ax ; move into source index
- push ax ; save start pt
-
- shl dx,1 ; for offset information
- push dx ; save for later use
-
- mov cx,[bp+8] ; right column
- sub cx,[bp+12] ; left column
- sub cx,[bp+16] ; rc - lc - #cols to scroll
- inc cx ; add one
- shl cx,1 ; mult by 2
- cmp cx,1 ; if < 1 then clear window
- jb v63 ; jmp to scroll routine
-
- push cx ; save # cols to adjust
- mov cx,[bp+6] ; bottom row
- sub cx,[bp+10] ; bottom row - top row
- inc cx ; add one
- pop ax ; # cols to scroll
-
- cld ; clear direction flag
- cli ; clear interrupts
-
- v58: push ax ; # cols to scroll on 1 line
- push cx ; # rows to be scrolled
- mov cx,ax ; set for inner loop
-
- mov dx,03DAh ; status port
- v59:
- in al,dx ; get status
- test al,1 ; is it low?
- jnz v59 ; wait until it is
- v60:
- in al,dx ; get status
- test al,1 ; is it high?
- jz v60 ; wait until it is
- movsb ; put char & attribute byte
- loop v59 ; repeat until done
-
- mov bh,[bp+14] ; attribute color
- mov bl,32 ; blank space
- mov cx,[bp+16] ; # cols to scroll
- v61:
- in al,dx ; get status
- test al,1 ; is it low?
- jnz v61 ; wait until it is
- v62:
- in al,dx ; get status
- test al,1 ; is it high?
- jz v62 ; wait until it is
- mov ax,bx ; char & attribute to display
- stosw ; put char & attribute byte
- loop v61 ; repeat until done
-
- pop cx ; # rows to be scrolled
- pop ax ; # cols to scroll on 1 line
- pop dx ; # cols per screen
- pop si ; start pt of col to move left
- pop di ; start pt of col for si
- add di,dx ; add for next row
- add si,dx ; add for next row
- push di ; save start pt
- push si ; save start pt of col to move left
- push dx ; save # cols per screen
-
- loop v58
- sti
- jmp v64
- v63:
- mov dh,[bp+6] ; bottom row
- mov dl,[bp+8] ; right column
- mov ch,[bp+10] ; top row
- mov cl,[bp+12] ; left column
- dec dh ; adjust to absolute bottom row
- dec dl ; adjust to absolute right col
- dec ch ; adjust to absolute top row
- dec cl ; adjust to absolute left col
- mov bh,[bp+14] ; color for blank rows
- mov al,0 ; number of lines to scroll
- mov ah,7 ; scroll down service
- push bp ; save base pointer
- int 10h ; let BIOS do scroll
- pop bp
- v64:
- pop ax ; clean up stack
- pop ax
- pop ax
-
- mov sp,bp ; restore stack
- pop bp ; restore base pointer
- pop ds ; restore data segment
- ret 12 ; remove parameters and return
- scrollleft endp