;:sys36864
	;.opt oo
mo	= 53272
	*= 32768
bitmap	= 8
cr	= 13
rvs	= 18
off	= 15
roff	= rvs+128
ctrl	= $28d
rflg	= 5
inter	= $ea31
fa	= $ba
sa	= $b9
lf	= $b8
anzahl	= $c6
tmp	= $71
quot	= 4
irq	= 788
fnlen	= $b7
taste	= $c5
f1	= 4
f3	= 5
flg	= 2
open	= $ffc0
close	= $ffc3
clrch	= $ffcc
store	= $67
chrout	= $ffd2
chkout	= $ffc9
maxmem	= 56
strout	= $ab1e
getx	= 47006
komma	= $aefd
mod	= 3
high	= 648
return	= $aad7
chnkey	= $ea87
	jmp init
	jmp hcop
msg	.byte "\x93nss texthardcopy aktiv. <c> nss 30/12/85"
	.byt 13
	.byte "\x11 \x12 ctrl \x92 \x12 f1 \x92  hcopy modus 1"
	.byt 13
	.byte " \x12 ctrl \x92 \x12 f3 \x92  hcopy modus 2"
	.byt 13,13
	.byte "sys 32771,modus startet hcopy"
	.byt 13,13
	.byte "modus = 1 : mit zeilenabstand"
	.byt 13
	.byte "modus = 2 : ohne zeilenabst."
	.byt 13,0
err	.byte "\x11bad mode"
	.byt 0
init	sei 
	 lda #<neu 
	 ldy #>neu 
	 sta irq 
	 sty irq+1 
	 cli
	lda #128 
	 sta maxmem
	lda #<msg 
	 ldy #>msg 
	 jmp strout
neu	jsr chnkey 
	 lda ctrl 
	 and #4 
	 bne ctrlok
exit	jmp inter
ctrlok	lda taste 
	 cmp #f1 
	 beq hc1
	cmp #f3 
	 bne exit
	lda #2 
	 sta mod 
	 sta flg 
	 bne hc
hc1	lda #1 
	 sta mod 
	 sta flg 
	 bne hc
hcop	lda #0 
	 sta flg 
	 jsr komma 
	 jsr getx 
	 cpx #3 
	 bcc bon
e	lda #<err 
	 ldy #>err 
	 jmp strout
bon	cpx #1 
	 bcc e 
	 stx mod
hc	lda #4 
	 sta fa 
	 lda #121 
	 sta lf 
	 lda #0 
	 ldy high 
	 sta tmp
	sta fnlen 
	 lda mo 
	 and #6 
	 cmp #6 
	 beq gk
	lda #0 
	 beq tt
gk	lda #7
tt	sta sa 
	 sty tmp+1 
	 jsr open 
	 ldx lf 
	 jsr chkout
	jsr return 
	 dec mod 
	 ldx #25 
	 lda #0 
	 sta anzahl
loop	lda mod 
	 beq mod1 
	 lda #bitmap 
	 jsr chrout
mod1	jsr return 
	 lda #off 
	 jsr chrout
	ldy #0 
	 sty quot 
	 sty rflg
loop2	lda (tmp),y 
	 cmp #34 
	 bne noflip 
	 lda quot 
	 eor #255 
	 sta quot
	lda #34
noflip	cmp #162 
	 bne no162 
	 lda #167
no162	cmp #128 
	 bcc kl128
	bit quot 
	 bpl noquot
	sec 
	 sbc #128 
	 jmp out
noquot	sec 
	 sbc #128 
	 pha 
	 lda #rvs 
	 jsr chrout 
	 pla 
	 inc rflg
kl128	cmp #32 
	 bcc plu64
	cmp #96 
	 bcc nop64
plu64	clc 
	 adc #64 
	 jmp out
nop64	cmp #64 
	 bcc out
	clc 
	 adc #32
out	jsr chrout 
	 lda rflg 
	 beq norvs
	lda #roff 
	 jsr chrout 
	 dec rflg
norvs	iny 
	 cpy #40 
	 bcc loop2
	tya 
	 clc 
	 adc tmp 
	 sta tmp 
	 bcc noinc
	inc tmp+1
noinc	lda quot 
	 beq dx 
	 lda #34 
	 jsr chrout
dx	dex 
	 bne goloop
	jsr return
schluss	jsr clrch 
	 lda #121 
	 jsr close
	lda flg 
	 bne ex1 
	 rts
ex1	jmp inter
goloop	jmp loop
