home *** CD-ROM | disk | FTP | other *** search
-
- page 58,132
- ;
- ; cursor.asm
- ; contains: curtype(),curset(),getcur(),cls(),upscroll(),dnscroll()
- ; contains: _gcurvpc(),_cursetc()
- ;
- include model.h
- include prologue.h
- name cursor
- pseg curtype
-
- ;==>-- void curtype(type,startline,stopline)
- ;
- ;; ARGUMENTS:
- ; (int) type - Cursor type, (blink,blank etc)
- ; (int) startline - Top scan line 0..9 of cursor
- ; (int) stopline - Bottom scan line 0..9 of cursor
- ;
- ;; DESCRIPTION:
- ; Set cursor type. Defines cursor shape on screen.
- ;
- ; The first (type) arg controls start_line bits 5 and 6 which control
- ; blink and display of the cursor. Controls to the function from C
- ; are:
- ; BLANK = 20h NOBLINK = 4 FAST = 2 SLOW = 3
- ; 0010xxxx 0000xxxx 0100xxxx 0110xxxx
- ; (NORM = 1)
- ; Note: There are 3 different blink types. The power-up default is
- ; close to NOBLINK.. i.e. it is a slow, 50% duty-cycle type of
- ; blink, and for whatever reason, at least with the IBM Color
- ; Graphics card,the NOBLINK parameter value produces the same
- ; effect as pwr-up. Therefore, an additional value, NORM,
- ; will also produce NOBLINK.
- ;
- ;; AUTHOR:
- ; Copyright (C)1987-1990 Greenleaf Software Inc. All Rights Reserved.
- ;;;
- cproc curtype
- mov ax,parm2_ ;get start line
- mov cx,parm3_ ;and stop line to CL
- mov ch,al ;put start line in CH
- and cx,0F0Fh ;don't use values over 15 for either
- mov dx,parm1_ ;get type.
- cmp dx,1 ;is it "norm" ?
- jz ctnob ;this is normal "no blink"
- cmp dx,4 ;is it noblink ?
- jz ctnob
- cmp dx,20h ;is it non display ?
- jz ctnod
- cmp dx,2 ;is it fast blink ?
- jz ctfast
- cmp dx,3 ;is it slow ?
- jz ctslow
- jmp short ctnob ;default to normal.
- ctnod: or ch,00100000b ;set bits to non-display
- jmp short ctnob
- ctfast: or ch,01000000b ;..to fast blink
- jmp short ctnob
- ctslow: or ch,01100000b ;.. to slow
- ctnob: ;no bits to put in for no-blink
- mov ah,1 ;function to set cursor type
- int 10h
- xor ax,ax ;cleanup
- cproce
-
- ;==>-- void curset(row,column,page)
- ;
- ;; ARGUMENTS:
- ; (int) row - row to position on
- ; (int) column - column to position on
- ; (int) page - video page
- ;
- ;; DESCRIPTION:
- ; Set cursor position on indicated video page.
- ;
- ;; AUTHOR:
- ; Copyright (C)1987-1990 Greenleaf Software Inc. All Rights Reserved.
- ;;;
- cproc curset
- mov dl,parm2_ ;get column no. to DL
- mov dh,parm1_ ;get row no. to dh
- mov bh,parm3_ ;get page to BH
- mov ah,02 ;function to AH
- int 10h
- cproce
-
- ;==>-- unsigned getcur(page)
- ;
- ;; ARGUMENTS:
- ; (int) page - video page to read
- ;
- ;; DESCRIPTION:
- ; Determine cursor position on the indicated video page
- ;
- ;; RETURNS:
- ; Row in high order 8 bits, column in low order 8 bits.
- ;
- ;; AUTHOR:
- ; Copyright (C)1987-1990 Greenleaf Software Inc. All Rights Reserved.
- ;;;
- cproc getcur
- mov bh,parm1_ ;get page
- mov ah,3 ;function 3
- int 10h
- mov ax,dx ;get return value
- cproce
-
- ;==>-- void cls(void)
- ;
- ;; ARGUMENTS:
- ; (none)
- ;
- ;; DESCRIPTION:
- ; Clear screen. Works only in text mode and on current video page
- ; paint a NORMAL attribute on the screen.
- ;
- ;; SIDE EFFECTS:
- ; screen will clear
- ;
- ;; AUTHOR:
- ; Copyright (C)1987-1990 Greenleaf Software Inc. All Rights Reserved.
- ;;;
- cproc cls
- mov ah,15
- int 10h ;get number of columns in AH
- push ax
- mov cx,0ffffh ;check for EGA BIOS
- mov ah,12h
- mov bl,10h
- int 10h
- inc cx
- mov dh,24 ;assume 24 rows
- jz noega
- mov ax,1130h ;get extended information
- push bp
- push es
- push si
- int 10h
- pop si
- pop es
- pop bp ;dl has max row
- mov dh,dl ;get to dh
- noega: pop ax ;get number of columns back
- dec ah
- mov dl,ah ;dl=columns
- mov ax,0600h ;upscroll entire screen fn=6
- mov cx,0 ;ul corner = 0,0
- mov bh,07h ;normal attribute on blanked lines
- int 10h
- cproce
-
- ;==>-- void upscroll(lines,urow,lrow,lcol,rcol,attr)
- ;
- ;; ARGUMENTS:
- ; (int) lines -- no. lines to scroll
- ; (int) urow -- upper row of area to scroll
- ; (int) lrow -- lower row af area
- ; (int) lcol -- left hand column of area
- ; (int) rcol -- right hand column of area
- ; (int) attr -- video attribute for blank line
- ;
- ;; DESCRIPTION:
- ; Scroll Active Page Up. A rectangular area bounded by urow,lcol
- ; at the upper left, and by lrow,rcol at the lower right, is scrolled
- ; up. Lines are blanked on the bottom of the page as they are rolled
- ; upwards, and the attr parameter determines the attribute to be used
- ; for all characters there.
- ;
- ;; SIDE EFFECTS:
- ; This function only loads registers per IBM-PC Technical Reference
- ; manual and calls the Rom-Bios.
- ;
- ;; AUTHOR:
- ; Copyright (C)1987-1990 Greenleaf Software Inc. All Rights Reserved.
- ;;;
- cproc upscroll
- mov al,parm1_
- mov ch,parm2_ ;ch=upper row
- mov dh,parm3_ ;dh=lower row
- mov cl,parm4_ ;cl=upper left column
- mov dl,parm5_ ;dl=right column
- mov bh,parm6_ ;bh=attribute
- mov ah,6 ;function 6
- int 10h
- cproce
-
- ;==>-- void dnscroll(lines,urow,lrow,lcol,rcol,attr)
- ;
- ;; ARGUMENTS:
- ; (int) lines -- no. lines to scroll
- ; (int) urow -- upper row of area to scroll
- ; (int) lrow -- lower row af area
- ; (int) lcol -- left hand column of area
- ; (int) rcol -- right hand column of area
- ; (int) attr -- video attribute for blank line
- ;
- ;; DESCRIPTION:
- ; Scroll Active Page down. A rectangular area bounded by urow,lcol
- ; at the upper left, and by lrow,rcol at the lower right, is scrolled
- ; down. Lines are blanked on the bottom of the page as they are
- ; rolled upwards, and the attr parameter determines the attribute
- ; to be used for all characters there.
- ;
- ;; SIDE EFFECTS:
- ; This function only loads registers per IBM-PC Technical Reference
- ; manual and calls the Rom-Bios.
- ;
- ;; AUTHOR:
- ; Copyright (C)1987-1990 Greenleaf Software Inc. All Rights Reserved.
- ;;;
- cproc dnscroll
- mov al,parm1_
- mov ch,parm2_ ;ch=upper row
- mov dh,parm3_ ;dh=lower row
- mov cl,parm4_ ;cl=upper left column
- mov dl,parm5_ ;dl=right column
- mov bh,parm6_ ;bh=attribute
- mov ah,7 ; function 7
- int 10h
- cproce
-
- ;==>-- unsigned _gcurvpc(void)
- ;
- ;; ARGUMENTS:
- ; (none)
- ;
- ;; DESCRIPTION:
- ; Determine cursor position on the current video page. This is a
- ; helper function for the curlf(), currt(), curup(), curdn()
- ; functions.
- ;
- ;; RETURNS:
- ; Row in high order 8 bits, column in low order 8 bits.
- ;
- ;; AUTHOR:
- ; "" 10-APR-1987 09:06:02.83
- ; Copyright (C)1987-1990 Greenleaf Software Inc. All Rights Reserved.
- ;;;
- cproc _gcurvpc
- mov ah,15
- int 10h ;get current page to bh
- mov ah,3 ;read cursor position to dx
- int 10h
- mov ax,dx ;return value in ax
- cproce
-
- ;==>-- void _cursetc(row,column)
- ;
- ;; ARGUMENTS:
- ; (int) row - row to position on
- ; (int) column - column to position on
- ;
- ;; DESCRIPTION:
- ; Set cursor position on current video page. This is a
- ; helper function for the curlf(), currt(), curup(), curdn()
- ; functions.
- ;
- ;; AUTHOR:
- ; "" 10-APR-1987 09:11:14.70
- ; Copyright (C)1987-1990 Greenleaf Software Inc. All Rights Reserved.
- ;;;
- cproc _cursetc
- mov ah,15 ;get current page to BH
- int 10h
- mov dl,parm2_ ;get column no. to DL
- mov dh,parm1_ ;get row no. to dh
- mov ah,2 ;function to AH
- int 10h
- cproce
- endps
- end
-