home *** CD-ROM | disk | FTP | other *** search
- ;--------------------------------------------------------------------
- ; Author : Kevin Dahl :
- ; Last Revised : June 7, 1986 :
- ; :
- ; FILENAME - V21.ENH :
- ; :
- ; WAITMSG :
- ; This routine displays a message on the screen and will :
- ; wait until the specified key is pressed before returning. :
- ; ENTRY :
- ; [bp+10 = Set of terminating characters :
- ; [bp+42] = Length of string to be displayed :
- ; [bp+43] = First character of string to be displayed :
- ; [bp+298] = Row the string is to be displayed on :
- ; [bp+300] = Column the string is to start in :
- ; :
- ; EXIT :
- ; [bp+6] = Terminating character (3 bytes) :
- ;--------------------------------------------------------------------
- waitmsg 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 v77
- cmp al,3 ; check if text modes
- ja v81 ; graphics mode - no write
- mov cx,7 ; set for 40 col text modes
- cmp dl,80 ; check for num of cols
- jb v76 ; 40 cols if jmp
- inc cx ; if get here then 80 cols
- v76:
- 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 address to display string
- jmp v78
- v77:
- mov ax,0B000h ; monochrome monitor address
- v78:
- mov es,ax ; video address into es
- mov ax,[bp+298] ; row coordinate
- mov bx,[bp+300] ; 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 string
-
- mov cl,[bp+42] ; length of string
- xor ch,ch ; zero out ch
- cmp cx,1
- jb v81 ; no string to display
- mov ax,bp ; address of base page into ax
- add ax,43 ; calc offset of string in stack
- mov si,ax ; move offset of string into si
- mov ax,ss
- mov ds,ax ; stack segment into data segment
- mov dx,03DAh ; status port
- cld ; clear direction flag
- cli ; clear interrupts
- v79:
- in al,dx ; get status
- test al,1 ; is it low?
- jnz v79 ; wait until it is
- v80:
- in al,dx ; get status
- test al,1 ; is it high?
- jz v80 ; wait until it is
- movsb ; display character
- inc di ; skip attribute byte
- loop v79 ; repeat until all characters displayed
- sti ; turn interrupts back on
- v81:
- mov ah,0 ; read keyboard char
- int 16h ; using BIOS serives
-
- cmp ax,011Bh ; esc pressed?
- je v82
-
- cmp ax,0E7Fh ; ctrl-BS pressed?
- je v82
-
- cmp al,0 ; alt & other key comb?
- jne v84
- v82:
- mov al,ah
- xor ah,ah
- jmp v87
- v84:
- cmp ax,0E08h ; back space pressed?
- je v85
-
- cmp ax,0F09h ; tab pressed?
- je v85
-
- cmp ax,01C0Ah ; ctrl-enter pressed?
- je v85
-
- cmp ax,01C0Dh ; Enter pressed?
- jne v86
- v85:
- xor ah,ah
- jmp v87
- v86:
- xor ah,ah
- add al,132
- v87:
- push ax ; save element number
- mov cx,8 ; set up for division by 8
- div cl ; remainder in ah
- ; quotient in al
- mov cl,ah ; bit number of element in byte
- xor ah,ah ; zero out ah
- mov di,ax ; byte element is in into di
- xor ax,ax ; zero out ax
- mov al,[bp+di+10] ; move byte element is in into bx
-
- mov bx,1 ; set up for element check
- rol bl,cl ; by setting bit to check
- and al,bl ; is element in set?
- jnz v88 ; it is so exit
- pop ax ; element not in set so,
- jmp v81 ; go read keyboard char
- v88:
- pop cx
-
- ;
- ; sets up char code of element for moving into returning variable
- ;
-
- mov ax,cx ; ah = ch[1] -- al = ch[2]
- mov bl,2 ; bl = ch[0]
- cmp cx,133
- jb v89
- sub ax,132
- cmp ax,32
- jb v90
- xchg ah,al
- dec bl
- jmp v90
- v89:
- mov ah,27
- v90:
- lds di,[bp+6]
- mov [di],bl
- xchg al,ah
- mov [di+1],ax
-
- mov sp,bp ; restore stack
- pop bp ; restore base pointer
- pop ds ; restore data segment
- ret 296 ; remove parameters and return
- waitmsg endp
-