home *** CD-ROM | disk | FTP | other *** search
- ;--------------------------------------------------------------------
- ; Author : Kevin Dahl :
- ; Last Revised : June 7, 1986 :
- ; :
- ; FILENAME - V10.ENH :
- ; :
- ; GETSCRN :
- ; 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 retrieve from the screen.:
- ; [bp+12] = The row of the first character to retrieve. :
- ; [bp+14] = The column of the first character to retrieve. :
- ; :
- ; EXIT :
- ; [bp+6]:[bp+8] = Screen contents starting at [bp+12],[bp+14]:
- ; for [bp+10] words. :
- ;--------------------------------------------------------------------
- getscrn 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 v43
- cmp al,3 ; check if text modes
- ja v47 ; graphics mode - no write
- mov cx,7 ; set for 40 col text modes
- cmp dl,80 ; check for num of cols
- jb v42 ; 40 cols if jmp
- inc cx ; if get here then 80 cols
- v42:
- 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 v44
- v43:
- mov ax,0B000h ; monochrome monitor address
- v44:
- mov ds,ax ; video address into ds
- les di,[bp+6] ; point es 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 si,ax ; offset in display scrn for string
- mov cx,[bp+10] ; number of character to retrieve
- cmp cx,1
- jb v47 ; no characters to display
- mov dx,03DAh ; status port
- cld ; clear direction flag
- cli ; clear interrupts
- v45:
- in al,dx ; get status
- test al,1 ; is it low?
- jnz v45 ; wait until it is
- v46:
- in al,dx ; get status
- test al,1 ; is it high?
- jz v46 ; wait until it is
- movsw ; get char & attribute byte
- loop v45 ; repeat until column is filled
- sti ; turn interrupts back on
- v47:
- mov sp,bp ; restore stack
- pop bp ; restore base pointer
- pop ds ; restore data segment
- ret 10 ; remove parameters and return
- getscrn endp