home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Overload
/
ShartewareOverload.cdr
/
progm
/
gvb-int.zip
/
GVB-INT.ASM
next >
Wrap
Assembly Source File
|
1988-06-15
|
5KB
|
88 lines
; GVB-INT.SHR - 1988 by Simon Kane
;
; This DESQview 'Shared Program' provides a means to allow a program
; that writes directly to the screen to use the DV-supplied alternate
; video buffer without making major changes or requiring a loader.
;
; Refer to GVB-INT.DOC for more information.
;
code segment para public 'code'
assume cs:code
org 00h
begin: cmp cx,0 ; initialization call ?
je initialize ; yes - continue
retf ; no - ignore it
;
copyright db 'Copyright 1988 Simon Kane'
;
initialize proc far
USER_INT: mov al,67h ; Interrupt # to be trapped
push cs ; Point DS to ourselves
pop ds ; * (but don't ASSUME it)
mov dx,offset interrupt ; Point DX to intrpt routine
mov ah,25h ; Function is Set I-vector
int 21h ; Call DOS
clc ; Tell DESQview we're OK
ret 12 ; Return to DESQview
initialize endp
;
interrupt proc
; pushf ; Left on stack by INT
; push cs ; * BP+20 after pushes
; push ip ; * BP+18 * and BP setup
push es ; Save registers
push ds ; * BP+14
push di ; * 12
push si ; * 10
push bp ; * 08
push bx ; * 06
push dx ; * 04
push cx ; * 02
push ax ; * BP+00
mov bp,sp ; set stack base for mugging
; get segment:offset of operand byte, fix return address
mov ds,[BP+20] ; get segment of operand
mov si,[BP+18] ; get offset of operand
get_DV_buf: mov ah,0FEh ; Func is get_video_buffer
int 10h ; Returned by DV in ES:DI
mov al,[SI] ; get operand byte in AL
; fix return address
inc si ; bump past it
mov [BP+18],si ; and save for IRET
; put video address where caller wants it
cmp al,0C0h ; Output to Register?
jb try_mem_op ; * no
cmp al,0C8h ; * yes - is it ES?
je save_g_reg ; * * yes - go save it
jb out_g_reg ; * * no - it's a g_reg
cmp al,0CBh ; * * no - is it DS?
jne bad_op_code ; * * * no - error!
mov al,7 ; * * * yes - set index
jmp save_g_reg ; * * * * and go save it
out_g_reg: cmp al,0C4h ; * is it SP?
je bad_op_code ; * * yes - error!
jb save_g_reg ; * it's 0-3 - offset OK
dec al ; * 5-7 is now 4-6
save_g_reg: and ax,000Fh ; * clean up register
shl al,1 ; * times 2 for stack offset
mov di,ax ; * set stack frame offset
mov [BP+DI],es ; * put it into stack frame
jmp done ; * and return it to caller
try_mem_op: jmp bad_op_code ; memory ops not implemented
done: pop ax ; Restore registers
pop cx ; * (one of which might've
pop dx ; * been mugged to be the
pop bx ; * DV v-buffer seg addr)
pop bp ; *
pop si ; *
pop di ; *
pop ds ; *
pop es ; *
iret ; Return to caller
; Invalid destination operand (operand code byte is bad)
bad_op_code: mov ax,4CF0h ; terminate w/ RC=240
int 21h
interrupt endp
code ends
end begin