;:sys36864
	;.opt oo
	*=$c000
tmp	=2
getkoord	=$b7eb
xcoord	=20
illquan	=$b248
vic	=$d000
bank	=56576
page	=648
getx	=$b7f1
scrn	=$c400
graf	=$e000
komma	=$aefd
av	=4
port	=1
	jmp on
	jmp off
	jmp clr
	jmp set
on	jsr getx
	txa
	ldy #0
	sty tmp
	ldx #>scrn
	stx tmp+1
	ldx #4
colin	sta (tmp),y
	dey
	bne colin
	inc tmp+1
	dex
	bne colin
	lda #0
	sta bank
	lda #196
	sta page
	lda #59
	sta vic+17
	lda #29
	sta vic+24
	rts
off	lda #4
	sta page
	lda #3
	sta bank
	lda #21
	sta vic+24
	lda #27
	sta vic+17
	rts
clr	ldx #32
	lda #>graf
	sta tmp+1
	ldy #0
	sty tmp
	tya
gclr	sta (tmp),y
	dey
	bne gclr
	inc tmp+1
	dex
	bne gclr
	rts
set	jsr komma
	jsr getkoord
plot	sei
	cpx #200
	bcs ill
	lda xcoord+1
	cmp #>320
	bcc drin
	bne ill
	lda xcoord
	cmp #<320
	bcc drin
ill	cli
	rts
drin	txa
	lsr
	lsr
	lsr
	asl
	tay
	lda mult+1,y
	sta av+1
	txa
	and #7
	clc
	adc mult,y
	sta av
	lda xcoord
	and #$f8
	adc av
	sta av
	lda av+1
	adc xcoord+1
	sta av+1
	lda xcoord
	and #7
	tax
	lda grbit,x
	ldx #48
	stx port
	ldy #0
	ora (av),y
	sta (av),y
	lda #55
	sta port
	cli
	rts
grbit	.byt $80,$40,$20,$10,8,4,2,1
mult	=*
	.word $e000,$e140,$e280,$e3c0
	.word $e500,$e640,$e780,$e8c0
	.word $ea00,$eb40,$ec80,$edc0
	.word $ef00,$f040,$f180,$f2c0
	.word $f400,$f540,$f680,$f7c0
	.word $f900,$fa40,$fb80,$fcc0
	.word $fe00
