home *** CD-ROM | disk | FTP | other *** search
- ;--------------------------------------------------------------------
- ; Author : Kevin Dahl :
- ; Last Revised : June 7, 1986 :
- ; :
- ; FILENAME - V7.ENH :
- ; :
- ; FILLROWATTRIB :
- ; This routine displays one or more copies of a single :
- ; attribute byte character to the screen. :
- ; ENTRY :
- ; [bp+6] = Color to be displayed :
- ; [bp+8] = Number of times the color is to be displayed on :
- ; the screen. :
- ; [bp+10] = Row the attribute byte is to be displayed in. :
- ; [bp+12] = Column the attribute byte is to start in. :
- ; :
- ; EXIT :
- ; Nothing is returned :
- ;--------------------------------------------------------------------
- fillrowattrib 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
- mov dl,ah ; save number columns per line
- cmp al,7 ; check for monochrome monitor
- je v28
- cmp al,3 ; check if text modes
- ja v32 ; graphics mode - no write
- mov cx,7 ; set for 40 col text modes
- cmp dl,80 ; check for num of cols
- jb v27 ; 40 cols if jmp
- inc cx ; if get here then 80 cols
- v27:
- 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 v29
- v28:
- mov ax,0B000h ; monochrome monitor address
- v29:
- mov es,ax ; video address into es
- mov ax,[bp+10] ; row coordinate
- mov bx,[bp+12] ; col coordinate
- dec ax ; (row - 1)
- mul dx ; (row - 1) * number of columns
- add ax,bx ; (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 ; offset in display scrn for attribute
- inc di ; set for attribute bytes
- mov cx,[bp+8] ; number of times to display color byte
- cmp cx,1
- jb v32 ; no bytes to display
- mov ah,[bp+6] ; color byte into ah
- mov dx,03DAh ; status port
- cld ; clear direction flag
- cli ; clear interrupts
- v30:
- in al,dx ; get status
- test al,1 ; is it low?
- jnz v30 ; wait until it is
- v31:
- in al,dx ; get status
- test al,1 ; is it high?
- jz v31 ; wait until it is
- mov es:byte ptr[di],ah ; display attribute byte
- add di,2 ; skip to next char position
- loop v30 ; repeat until column is filled
- sti ; turn interrupts back on
- v32:
- mov sp,bp ; restore stack
- pop bp ; restore base pointer
- pop ds ; restore data segment
- ret 8 ; remove parameters and return
- fillrowattrib endp