.model medium
.stack 20h
.386

.data
PUBLIC gsclipx1,gsclipx2,gsclipy1,gsclipy2
gsclipx1 dw 0
gsclipx2 dw 319
gsclipy1 dw 0
gsclipy2 dw 199

.code
public gssetbbox
gssetbbox proc
;sub gssetbbox (x1,y1,x2,y2)
;stack:
;x1          10
;y1         8
;x2        6
;y2       4
;retseg  2
;retofs 0
finit
mov dx,bp
mov bp,sp
mov bx,[bp+10]
mov cx,[bp+6]
cmp bx,cx
jle noswapx
xchg bx,cx
noswapx:
mov gsclipx1,bx
mov gsclipx2,cx
mov bx,[bp+8]
mov cx,[bp+4]
cmp bx,cx
jle noswapy
xchg bx,cx
noswapy:
mov gsclipy1,bx
mov gsclipy2,cx
mov bp,dx

ret 8
gssetbbox endp

;;:::::::::::::::::::::::::::::::::::::
gsint3d proc
push bp
mov bp, sp
push di
push es
les di, [bp + 2] ;; es:di ptr to return address
mov word ptr es:[di - 2], 0C089h ;; mov ax,ax (faster than nop,nop)
pop es
pop di
pop bp
iret
gsint3d endp
;;:::::::::::::::::::::::::::::::::::::
public gsinit
gsinit proc
push ds
mov ax, cs
mov ds, ax
mov dx, offset gsint3d
mov ax, 253Dh ;; (set interrupt vector)
int 21h
pop ds
ret
gsinit endp

end
