home *** CD-ROM | disk | FTP | other *** search
- ;--------------------------------------------------------------------
- ; Author : Kevin Dahl :
- ; Last Revised : June 7, 1986 :
- ; :
- ; FILENAME - V19.ENH :
- ; :
- ; SCROLLRIGHT :
- ; Moves a block of characters right 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. :
- ;--------------------------------------------------------------------
- scrollright 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 v67
- cmp al,4 ; check if text modes
- jb v65 ; graphics mode - no write
- jmp v75
- v65:
- mov cx,7 ; set for 40 col text modes
- cmp dl,80 ; check for num of cols
- jb v66 ; 40 cols if jmp
- inc cx ; if get here then 80 cols
- v66:
- 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 v68
- v67:
- mov ax,0B000h ; monochrome monitor address
- v68:
- 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+8] ; (row - 1) * # cols + col offset
- dec ax ; (row - 1) * # cols + col offset - 1
- shl ax,1 ; ((row-1)* #cols + col offset - 1)*2
- inc ax ; start at attribute byte
- mov di,ax ; left col starting point
- pop dx ; get # cols/screen
- push ax ; save left col start pt
- dec ax
-
- mov bx,[bp+16] ; # cols to scroll
- shl bx,1 ; mult by 2
- sub ax,bx ; sub # cols to scroll
- inc ax ; start at attribute byte
- mov si,ax ; move into source index
- push ax ; save start pt
- dec ax
-
- 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 v75 ; no characters to display
-
- 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
- std ; set direction flag
- cli ; clear interrupts
-
- v69: 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
- v70:
- in al,dx ; get status
- test al,1 ; is it low?
- jnz v70 ; wait until it is
- v71:
- in al,dx ; get status
- test al,1 ; is it high?
- jz v71 ; wait until it is
- movsb ; put char & attribute byte
- loop v70 ; repeat until done
-
- dec di
- mov bh,[bp+14] ; attribute color
- mov bl,32 ; blank space
- mov cx,[bp+16] ; # cols to scroll
- v72:
- in al,dx ; get status
- test al,1 ; is it low?
- jnz v72 ; wait until it is
- v73:
- in al,dx ; get status
- test al,1 ; is it high?
- jz v73 ; wait until it is
- mov ax,bx ; char & attribute to display
- stosw ; put char & attribute byte
- loop v72 ; 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 v69
- sti
- jmp v75
- v74:
- 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
- dec dl
- dec ch
- dec cl
- mov bh,[bp+14] ; color for blank rows
- mov al,[bp+16] ; number of lines to scroll
- mov ah,7 ; scroll down service
- push bp ; save base pointer
- int 10h ; let BIOS do scroll
- pop bp
- v75:
- 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
- scrollright endp