;	Putpixel in 512*256 graphics mode		Optimized for speed.
;	 for SuperSoft C 1.2.3 compiler.
;	Prototype: putpixel (int x,int y);


PUBLIC	$putpixel

EXTRN	$SETCOL
EXTRN	$ELF

MACLIB	INTRFACE.LIB

$putpixel:
	LDA $ELF
	ORA A
	RZ
	lxi h,4
	dad sp
	mov e,m
	inx h
	mov a,m
	rrc
	mov a,e
	rar;		Horizontal coordinate
	lxi h,XPL2+1
	mvi m,0c0h
	jnc XPL1
	mvi m,0a0h
XPL1:	lxi h,2
	dad sp
	mov e,m;	Vertical coordinate
	mov d,a;	Horizontal coordinate
	INITGRAPH
	lxi h,PIXTAB
	mov b,a
	mov a,d
	ani 7
	mov c,a
	dad b
	mov b,m;	Masc from PIXTAB
	mov a,d
	ani 0f8h
	rrc
	rrc
	rrc
XPL2:	adi 0c0h
	mov h,a;	Real horizontal coordinate: PANEL_BASE+(0..1F)
	mov l,e;	Vertical coordinate
	lda $SETCOL
	ani 6
	mov a,b
	jz XPL3
	ora m
	mov m,a
	CLOSEGRAPH
XPL3:	cma
	ana m
	mov m,a
	CLOSEGRAPH

PIXTAB:	DB 80H,40H,20H,10H,8,4,2,1

	END
