
;SUBROUTINE TO PLOT A POINT ON SCREEN 
;Medium res graphics mode 320 x 200 color
;Enter with:
;X -- coordinate in CX (column number:0-319)
;Y -- coordinate in DX (row number:0-199)
;color in AL (0=background, 1,2,3=colors)
;video address (B800h) is in ES
;-----------------------------------------------
plotsub proc far
	push	bx	  ;save BX
	push	cx	  ;save column
	push	dx	  ;save row
	push	ax	  ;save color
;multiply the row number by # of bytes per row 80
;but since already mult by 2,use 40
	push	dx	  ;save row for odd/even
	mov	al,40	  ;bytes/row div by 2
	add	dx,0feh	  ;mask off odd/even bit
	mul	dl	  ;AX now is row address
;If odd row number,should add 2000h 
;  for 2nd memory bank
	pop	dx	  ;get original row #
	test	dl,1	  ;test odd/even bit
	jz	not_odd	  ;jump on even row
	add	ax,2000h  ;add to get 2nd bank
not_odd:
	mov	bx,ax	  ;save row addr in BX
;add column address to row address
	push	cx	  ;save column address
	shr	cx,1	  ;shift it right to
	shr	cx,1	  ;kill bit_pos bits
	add	bx,cx	  ;add it to addr in BX
;use bit_pos bits to put color and mask
;  in the right position
	pop	cx	  ;get original col #
	and	cx,3	  ;save bit_pos bits
	inc	cx	  ;get one free shift
	pop	ax	  ;get color
	mov	dl,0fch	  ;DL=mask:11 11 11 00
shift:	ror	al,1	  ;AL=color:00 00 00 cc
	ror	al,1	  ;shift color 2 bits right
	ror	dl,1	  ;
	ror	dl,1	  ;shift mask 2 bits right
	loop	shift	  ;do it bit_pos times
;get contents of byte mask off all but color bits
;or on color bits
	and	es:[bx],dl ;mask off and
	or	es:[bx],al ;or on color value
	pop	dx
	pop	cx
	pop	bx
	ret
plotsub endp
;--------------------------------------------------
	end
 	