home *** CD-ROM | disk | FTP | other *** search
- ;--------------------------------------------------------------------
- ; Author : Kevin Dahl :
- ; Last Revised : June 7, 1986 :
- ; :
- ; FILENAME - V5.ENH :
- ; :
- ; FILLCOLATTRIB :
- ; This routine displays a column of attribute bytes. :
- ; ENTRY :
- ; [bp+6] = Color to be displayed in the column :
- ; [bp+8] = Number of rows to be used for displaying the :
- ; attribute in the column specified :
- ; [bp+10] = Row the column of the attribute is to start in :
- ; [bp+12] = Column the attribute byte is to be displayed in :
- ; :
- ; EXIT :
- ; Nothing is returned :
- ;--------------------------------------------------------------------
- fillcolattrib 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 v16
- cmp al,3 ; check if text modes
- ja v20 ; graphics mode - no write
- mov cx,7 ; set for 40 col text modes
- cmp dl,80 ; check for num of cols
- jb v15 ; 40 cols if jmp
- inc cx ; if get here then 80 cols
- v15:
- 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 v17
- v16:
- mov ax,0B000h ; monochrome monitor address
- v17:
- mov es,ax ; video address into es
- mov ax,[bp+10] ; row coordinate
- mov bx,[bp+12] ; col coordinate
- push dx ; save number cols per line
- 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 byte
- pop bx ; # cols per screen
- shl bx,1 ; cols on display
- mov cx,[bp+8] ; number of rows to use
- cmp cx,1
- jb v20 ; no characters to display
- mov ah,[bp+6] ; attribute byte into ah
- mov dx,03DAh ; status port
- cld ; clear direction flag
- cli ; clear interrupts
- v18:
- in al,dx ; get status
- test al,1 ; is it low?
- jnz v18 ; wait until it is
- v19:
- in al,dx ; get status
- test al,1 ; is it high?
- jz v19 ; wait until it is
- mov es:byte ptr[di],ah ; display attribute byte
- add di,bx ; next row address
- loop v18 ; repeat until column is filled
- sti ; turn interrupts back on
- v20:
- mov sp,bp ; restore stack
- pop bp ; restore base pointer
- pop ds ; restore data segment
- ret 8 ; remove parameters and return
- fillcolattrib endp