;:sys65418:sys58451:sys36864
	;.opt oo
	*= 51234
sc	=$cc00
tmp	=2
tm2	=4
von	=181
hin	=247
zei	=249
zs	=$d000
	lda #<iq
	ldy #>iq
	sei
	sta 788
	sty 789
	ldx #0
	stx al
	inx
	stx ct
	lda #4
	sta 648
	cli
	jsr 65409
	lda #0
	sta 53280
	lda #6
	sta 53281
	lda #<bef
	ldy #>bef
	sta 776
	sty 777
	lda #<fkt
	ldy #>fkt
	sta 778
	sty 779
	lda #<hi
	ldy #>hi
	jmp $ab1e
hi	.byt 13
	.byte "\x93\x9e\x11magnify activated -"
	.byt 13
	.byte "\x12ctrl/c=\x92   to switch"
	.byt 13
	.byte "\x12ctrl/crsr\x92 to move"
	.byt 13
	.byte "nikolaus heusler  4.92"
	.byt 13,0
down	.byt 13
	.byte "\x01\x07\x0e\x09\x06\x09\x05\x04   "
	.byt 20,9,13,5,19,32,32,32
aul	.byte "48"
al	=1023
ct	=1020
x	=1022
y	=1021
hy	=1019
vy	=1018
vx	=1017
hx	=1016
byte1	=1013
byte2	=1014
zy	=1012
hx0	=1015
tab	.byt 32,124,126,226
	.byt 108,225,127,251
	.byt 123,255,97,236
	.byt 98,254,252,160
hoe	.byt 19,22
bre	.byt 30,35
small	.byt 0,$28,$50,$78,$a0,$c8,$f0
	.byt $18,$40,$68,$90,$b8,$e0
	.byt 8,$30,$58,$80,$a8,$d0,$f8,$20,$48,$70,$98,$c0
iq	jsr irq
	jmp 59953
irq	lda 653
	cmp #6
	bne irq2
	jsr turn
irq2	lda al
	beq irq55
	dec ct
	bne irq55
	ldx #5
	stx ct
	cmp #2
	bne irq4
	jsr rein8
	jmp irq3
irq4	jsr rein4
irq3	ldx #19
	ldy al
	lda aul-1,y
	sta down+10
irq3a	lda down,x
	sta 1984,x
	lda #32
	sta 2004,x
	dex
	bpl irq3a
	ldx al
	lda 653
	and #4
	beq irq5
	lda 203
	cmp #2
	bne irq6
	lda 653
	and #1
	beq irq7
	lda x
	beq irq5
	dec x
	bpl irq5
irq7	lda x
	cmp bre-1,x
	bcs irq5
	inc x
irq55	jmp irq5
irq6	cmp #7
	bne irq9
	lda 653
	and #1
	beq irq8
	lda y
	beq irq5
	dec y
	bpl irq5
irq8	lda y
	cmp hoe-1,x
	bcs irq5
	inc y
	bne irq5
irq9	cmp #51
	bne irq5
	lda #0
	sta x
	sta y
irq5	rts
turn	ldx al
	inx
	cpx #3
	bcc tu2
	ldx #0
tu2	stx al
	bne tu4
	ldy #4
	lda #>sc
	jsr copy
tu4	cpx #1
	bne tu3
	lda #4
	ldy #>sc
	jsr copy
	lda x
	cmp #31
	bcc tu5
	lda #30
	sta x
tu5	lda y
	cmp #20
	bcc tu3
	lda #19
	sta y
tu3	jsr $ea87
	lda #6
	cmp 653
	beq tu3
	rts
rein8	jsr alert
r81	jsr calcv
r82	jsr font
	sty zy
r83	lda (zei),y
	sta byte1
	ldx #8
	ldy hx
r84	lda #64
	asl byte1
	ror
	sta (hin),y
	iny
	dex
	bne r84
	lda hin
	clc
	adc #40
	sta hin
	bcc r86
	inc hin+1
r86	inc zy
	ldy zy
	cpy #8
	bcc r83
r89	inc vx
	lda #8
	clc
	adc hx
	sta hx
	cmp #40
	bcc r82
	inc vy
	lda hy
	clc
	adc #8
	sta hy
	cmp #22
	bcc r81
	jmp fill
rein4	jsr alert
r41	jsr calcv
r42	jsr font
r43	lda hx
	sta hx0
	lda (zei),y
	sta byte1
	iny
	lda (zei),y
	sta byte2
	iny
	sty zy
	ldx #4
r44	lda #0
	asl byte1
	rol
	asl byte1
	rol
	sta tmp
	lda #0
	asl byte2
	rol
	asl byte2
	rol
	asl
	asl
	ora tmp
	tay
	lda tab,y
	ldy hx
	sta (hin),y
	inc hx
	dex
	bne r44
	lda hx0
	sta hx
	lda hin
	clc
	adc #40
	sta hin
	bcc r45
	inc hin+1
r45	ldy zy
	cpy #8
	bcc r43
r46	inc vx
	lda #4
	clc
	adc hx
	sta hx
	cmp #40
	bcc r42
	inc vy
	lda hy
	clc
	adc #4
	sta hy
	cmp #22
	bcc r41
fill	lda #55
	sta 1
	ldx #4
	lda #216
	sta tmp+1
	ldy #0
	sty tmp
	lda 646
fi	sta (tmp),y
	iny
	bne fi
	inc tmp+1
	dex
	bne fi
	rts
font	ldy vx
	lda (von),y
	ldy #0
	sty zei+1
	asl
	rol zei+1
	asl
	rol zei+1
	asl
	rol zei+1
	sta zei
set	lda #0
	adc zei+1
	sta zei+1
	ldx hy
	lda small,x
	sta hin
	lda $d9,x
	and #3
	ora #4
	sta hin+1
	rts
alert	lda 53272
	and #2
	asl
	asl
	ora #>zs
	sta set+1
	lda #51
	sta 1
	ldx y
	stx vy
	ldx #0
	stx hy
	rts
copy	sty 648
	sty tm2+1
	sta tmp+1
	lda $d2
	jsr $e9f7
	ldy #0
	sty tmp
	sty tm2
	ldx #4
co	lda (tmp),y
	sta (tm2),y
	iny
	bne co
	inc tm2+1
	inc tmp+1
	dex
	bne co
	rts
calcv	lda #0
	sta hx
	lda x
	sta vx
	ldx vy
	lda small,x
	sta von
	lda $d9,x
	and #3
	ora 648
	sta von+1
	rts
bef	jsr 115
	jsr exec
	jmp $a7ae
exec	cmp #151
	beq poke
	cmp #139
	beq if
	jsr 121
	jmp $a7ed
poke	jsr 115
	jsr $b7eb
	jsr adapt
	jmp $b827
if	jsr 115
	jsr $ad9e
	jsr 121
	cmp #$89
	beq if1
	lda #$a7
	jsr $aeff
if1	lda $61
	bne if2
	jmp $a93b
if2	jsr 121
	bcs exec
	jmp $a8a0
fkt	lda #0
	sta $d
	jsr 115
	bcs fk1
	jmp $bcf3
fk1	cmp #$c2
	beq peek
	jmp $ae92
peek	jsr 115
	jsr $aef1
	lda $15
	pha
	lda $14
	pha
	jsr $b7f7
	jsr adapt
	ldy #0
	lda ($14),y
	tay
	pla
	sta $14
	pla
	jsr $b81f
	jmp $ad8d
adapt	lda $15
	cmp #4
	bcc ad1
	cmp #8
	bcs ad1
	cmp #7
	bne ad2
	ldy $14
	cpy #232
	bcs ad1
ad2	and #3
	ora 648
	sta $15
ad1	rts
