.model medium, basic
.stack 20h
.386

EXTRN gsclipx1:WORD
EXTRN gsclipx2:WORD
EXTRN gsclipy1:WORD
EXTRN gsclipy2:WORD

.code

public gspset 
gspset proc
;sub gspset (x,y,seg,ofs,col)
;stack:
;bp+14  x
;bp+12  y
;bp+10  seg
;bp+8   ofs
;bp+6   col
;bp+4   retseg
;bp+2   retofs
;bp     bp
;

push bp

mov bp,sp
push es

;

mov dx, [bp+12]  ;dx=y
mov bx, [bp+14]

cmp dx, gsclipy1
jl endpset

cmp dx, gsclipy2
jg endpset

cmp bx, gsclipx1
jl endpset

cmp bx, gsclipx2
jg endpset

lea edx, [edx*4+edx]
mov di, [bp+8]

shl dx, 6        ;dx = y*5 *64 = y*320
add di, bx

add di, dx
mov es, [bp+10]

mov ax, [bp+6]

mov es:[di], al
endpset: pop es

pop bp

ret 10

gspset endp

end
