home *** CD-ROM | disk | FTP | other *** search
- ;--------------------------------------------------------------------
- ; Author : Kevin Dahl :
- ; Last Revised : June 7, 1986 :
- ; :
- ; FILENAME - V14.ENH :
- ; :
- ; PUTSCRN :
- ; Read the character and its attribute byte into the :
- ; character buffer passed. :
- ; ENTRY :
- ; [bp+6] = Segment of character array parameter :
- ; [bp+8] = Starting address within segment of the character :
- ; array parameter. :
- ; [bp+10] = Number of characters to display to the screen. :
- ; [bp+12] = The row of the first character to display. :
- ; [bp+14] = The column of the first character to display. :
- ; :
- ; EXIT :
- ; Nothing is return. :
- ;--------------------------------------------------------------------
- putscrn 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 v49
- cmp al,3 ; check if text modes
- ja v53 ; graphics mode - no write
- mov cx,7 ; set for 40 col text modes
- cmp dl,80 ; check for num of cols
- jb v48 ; 40 cols if jmp
- inc cx ; if get here then 80 cols
- v48:
- 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 v50
- v49:
- mov ax,0B000h ; monochrome monitor address
- v50:
- mov es,ax ; video address into es
- lds si,[bp+6] ; point ds to char array
- mov ax,[bp+12] ; row coordinate
- mov bx,[bp+14] ; 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 for string
- mov cx,[bp+10] ; number of character to display
- cmp cx,1
- jb v53 ; no characters to display
- mov dx,03DAh ; status port
- cld ; clear direction flag
- cli ; clear interrupts
- v51:
- in al,dx ; get status
- test al,1 ; is it low?
- jnz v51 ; wait until it is
- v52:
- in al,dx ; get status
- test al,1 ; is it high?
- jz v52 ; wait until it is
- movsw ; put char & attribute byte
- loop v51 ; repeat until done
- sti ; turn interrupts back on
- v53:
- mov sp,bp ; restore stack
- pop bp ; restore base pointer
- pop ds ; restore data segment
- ret 10 ; remove parameters and return
- putscrn endp