;:poke56,32:clr
;:sys36864
	;.opt oo
	*= $c000
g1	=$2000
g2	=$4000
g3	=$6000
tmp	=2
tmp2	=4
tmp3	=181
g1e	=g1+312
tmp4	=251
h1	=320*24
gg	=h1+7
g1x	=g1+gg
mode	=254
getx	=$b7f1
	jmp outline
	jmp exor
	jmp gron
	jmp right
	jmp left
	jmp up
	jmp down
norm	lda #>g3
	ldy #>g1
	jmp copy
; g1 arbeitsgrafik
; g2 oder-ansammlung der tricks
; g3 original
outline	jsr getx
	stx mode
	txa
	and #16
	beq aus
	jsr gron
aus	jsr clr2
	lda #>g1
	ldy #>g3
	jsr copy
lb0	lda mode
	and #1
	beq lb1
	jsr up
	jsr copy31
lb1	lda mode
	and #2
	beq lb2
	jsr down
	jsr copy31
lb2	lda mode
	and #4
	beq lb3
	jsr left
	jsr copy31
lb3	lda mode
	and #8
	beq lb4
	jsr right
	jsr oder
lb4	jmp exor
copy31	jsr oder
	lda #>g3
	ldy #>g1
	bne copy
gron	lda #59
	sta 53265
	lda #29
	sta 53272
	ldx #4
	stx tmp+1
	ldy #0
	sty tmp
	lda #1
gr	sta (tmp),y
	iny
	bne gr
	inc tmp+1
	dex
	bne gr
	rts
clr2	ldy #0
	ldx #32
	sty tmp
	lda #>g2
	sta tmp+1
	tya
c2	sta (tmp),y
	iny
	bne c2
	inc tmp+1
	dex
	bne c2
	rts
copy	sta tmp+1
	sty tmp2+1
	ldy #0
	sty tmp
	sty tmp2
	ldx #32
cy21	lda (tmp),y
	sta (tmp2),y
	iny
	bne cy21
	inc tmp+1
	inc tmp2+1
	dex
	bne cy21
	rts
oder	ldy #0
	sty tmp
	sty tmp2
	lda #>g1
	sta tmp+1
	lda #>g2
	sta tmp2+1
	ldx #32
or	lda (tmp),y
	ora (tmp2),y
	sta (tmp2),y
	iny
	bne or
	inc tmp+1
	inc tmp2+1
	dex
	bne or
	rts
exor	ldy #0
	sty tmp
	sty tmp2
	lda #>g2
	sta tmp+1
	lda #>g3
	sta tmp2+1
	sty tmp3
	lda #>g1
	sta tmp3+1
	ldx #32
xo	lda (tmp),y
	eor (tmp2),y
	sta (tmp3),y
	iny
	bne xo
	inc tmp3+1
	inc tmp+1
	inc tmp2+1
	dex
	bne xo
	rts
right	ldy #0
	sty tmp3
	lda #>g1
	sta tmp3+1
	lda #25
	sta tmp2+1
l1c	lda #8
	sta tmp2
	lda tmp3
	sta tmp
	lda tmp3+1
	sta tmp+1
l1b	clc
	php
	ldx #40
l1a	plp
	lda (tmp),y
	ror
	sta (tmp),y
	php
	lda tmp
	clc
	adc #8
	sta tmp
	bcc no1
	inc tmp+1
no1	dex
	bne l1a
	plp
	lda tmp
	sec
	sbc #<319
	sta tmp
	lda tmp+1
	sbc #>319
	sta tmp+1
	dec tmp2
	bne l1b
	lda tmp3
	clc
	adc #<320
	sta tmp3
	lda tmp3+1
	adc #>320
	sta tmp3+1
	dec tmp2+1
	bne l1c
	rts
left	ldy #<g1e
	lda #>g1e
	sty tmp3
	sta tmp3+1
	lda #25
	sta tmp2+1
	ldy #0
l2c	lda #8
	sta tmp2
	lda tmp3
	sta tmp
	lda tmp3+1
	sta tmp+1
l2b	clc
	php
	ldx #40
l2a	plp
	lda (tmp),y
	rol
	sta (tmp),y
	php
	lda tmp
	sec
	sbc #8
	sta tmp
	bcs no2
	dec tmp+1
no2	dex
	bne l2a
	plp
	lda tmp
	clc
	adc #<321
	sta tmp
	lda tmp+1
	adc #>321
	sta tmp+1
no2a	dec tmp2
	bne l2b
	lda tmp3
	clc
	adc #<320
	sta tmp3
	lda tmp3+1
	adc #>320
	sta tmp3+1
	dec tmp2+1
	bne l2c
	rts
up	ldy #<g1+1
	lda #>g1
	sty tmp4
	sta tmp4+1
	dey
	sty tmp3
	sta tmp3+1
	ldx #8
	stx tmp
	dex
	stx tmp+1
	lda #199
	sta tmp2
u2	ldx #40
u1	lda (tmp4),y
	sta (tmp3),y
	lda tmp4
	clc
	adc #8
	sta tmp4
	bcc nou1
	inc tmp4+1
nou1	lda tmp3
	clc
	adc #8
	sta tmp3
	bcc nou2
	inc tmp3+1
nou2	dex
	bne u1
	lda tmp4
	sec
	sbc #<319
	sta tmp4
	lda tmp4+1
	sbc #>319
	sta tmp4+1
	dec tmp
	bne nou3
	lda #8
	sta tmp
	lda tmp3
	clc
	adc #<312
	sta tmp3
	lda tmp3+1
	adc #>312
	sta tmp3+1
nou3	lda tmp3
	sec
	sbc #<319
	sta tmp3
	lda tmp3+1
	sbc #>319
	sta tmp3+1
	dec tmp+1
	bne nou4
	lda #8
	sta tmp+1
	lda tmp4
	clc
	adc #<312
	sta tmp4
	lda tmp4+1
	adc #>312
	sta tmp4+1
nou4	dec tmp2
	bne u2
fra	ldy #0
	ldx #40
fra2	tya
	sta (tmp3),y
	lda tmp3
	clc
	adc #8
	sta tmp3
	bcc fra1
	inc tmp3+1
fra1	dex
	bne fra2
	rts
down	lda #>g1x
	ldy #<g1x
	sty tmp3
	sta tmp3+1
	dey
	sty tmp4
	sta tmp4+1
	ldy #0
	ldx #7
	stx tmp+1
	inx
	stx tmp
	lda #199
	sta tmp2
d2	ldx #40
d1	lda (tmp4),y
	sta (tmp3),y
	lda tmp4
	clc
	adc #8
	sta tmp4
	bcc nod1
	inc tmp4+1
nod1	lda tmp3
	clc
	adc #8
	sta tmp3
	bcc nod2
	inc tmp3+1
nod2	dex
	bne d1
	lda tmp4
	sec
	sbc #<321
	sta tmp4
	lda tmp4+1
	sbc #>321
	sta tmp4+1
	dec tmp+1
	bne nod3
	lda #8
	sta tmp+1
	lda tmp4
	sec
	sbc #<312
	sta tmp4
	lda tmp4+1
	sbc #>312
	sta tmp4+1
nod3	lda tmp3
	sec
	sbc #<321
	sta tmp3
	lda tmp3+1
	sbc #>321
	sta tmp3+1
	dec tmp
	bne nod4
	lda #8
	sta tmp
	lda tmp3
	sec
	sbc #<312
	sta tmp3
	lda tmp3+1
	sbc #>312
	sta tmp3+1
nod4	dec tmp2
	bne d2
	jmp fra
; tmp3 unter tmp4
