;:sys36864
; superinput
; sys 49152,zeile,spalte,laenge,typ,str.variable
; sys 49155,zeile1,spalte1,zeile2,spalte2
; sys 49158,zeile,spalte,druckliste
; sys 49161
; <c> nss 10.12.1985
;
	;.opt oo
	*= 49152
getkey	= 65508
print	= $aaa0
getx	= $b7f1
clrscr	= $e544
chkcom	= $aefd
quote	= 212
cur1	= 204
cur2	= 205
cur3	= 207
findvar	= $b08b
frestr	= $b6a3
strres	= $b475
varadr	= $49
para	= $61
latch	= 679
latchlen	= 86
len	= 166
toolong	= $a571
illquan	= $b248
setcr	= 58732
zeile	= 214
spalte	= 211
maxz	= 25
maxs	= 40
typ	= 167
cr	= 13
f7	= "\x88"
ptr	= 168
del	= 20
strout	= $ab1e
chrout	= $ffd2
x1	= 251
y1	= 252
x2	= 253
y2	= 254
ladr	= 209
temp	= 2
y0	= 181
x0	= 182
home	= "\x13"
up	= "\x91"
down	= "\x11"
right	= "\x1d"
left	= "\x9d"
cler	= "\x93"
f1	= "\x85"
sret	= 141
ins	= 148
bild	= 3
akt	= 5
loesch	= 13
keymem	= 828
	jmp inputf
	jmp screen
	jmp kprint
	jmp superclr
dels	.byte "\x9d \x9d" 
	 .byt 0
curon	lda #0
seton	sta cur1
	rts
curaus	lda #2
	sta cur2
waitoff	lda cur3
	and #1
	bne waitoff
	lda #1
	jmp seton
putvar	jsr chkcom
	jsr findvar
	sta varadr
	sty varadr+1
	jsr frestr
	lda len
	jsr strres
	ldy #2
store	lda para,y
	sta (varadr),y
	dey
	bpl store
	iny
fetch	lda latch,y
	sta (para+1),y
	iny
	cpy para
	bne fetch
	rts
getlen	jsr getx
	cpx #latchlen
	bcc lenok
	jmp toolong
lenok	cpx #0
	bne lok
ill	jmp illquan
lok	stx len
	rts
getkoor	jsr getx
	cpx #maxz
	bcs ill
	stx zeile
	jsr getx
	cpx #maxs
	bcs ill
	stx spalte
	jmp setcr
gettyp	jsr getx
	cpx #2
	bcs ill
	stx typ
	rts
clear	ldx len
	lda #" "
clr	sta latch,x
	dex
	bpl clr
	inx
	stx ptr
	rts
inputf	jsr getkoor
	jsr getlen
	jsr gettyp
	jsr clear
main	jsr curon
key	jsr getkey
	beq key
	pha
	lda #0
	sta quote
	jsr curaus
	pla
	sta keymem
	ldx ptr
	cmp #cr
	bne noend
end	jmp putvar
noend	cmp #f7
	beq end
	cmp #del
	bne nodel
	cpx #0
	beq main
	lda #32
	sta latch-1,x
	dex
	stx ptr
	lda #<dels
	ldy #>dels
	jsr strout
mai	jmp main
nodel	ldy typ
	bne nosig
	cmp #58
	bcc nolet
	cmp #"_"+1
	bcc ok
nolet	cmp #"A"
	bcc nogre
	cmp #"Z"+1
	bcc ok
nogre	cmp #" "
	bcc nosig
	cmp #"/"+1
	bcc ok
nosig	cmp #"-"
	beq ok
	cmp #"."
	beq ok
	cmp #"0"
	bcc mai
	cmp #"9"+1
	bcs mai
ok	cpx len
	bcs mai
	sta latch,x
	inx
	stx ptr
	jsr chrout
	jmp main
sclr	lda y1
	sta temp
l1	lda temp
	sta zeile
	jsr setcr
	ldy x1
	lda #" "
l2	sta (ladr),y
	iny
	cpy x2
	beq l2
	bcc l2
	ldy temp
	inc temp
	cpy y2
	bcc l1
	jmp shome
getk	jsr getx
	cpx #maxz
	bcc gut
il	jmp illquan
gut	stx y0
	jsr getx
	cpx #maxs
	bcs il
	stx x0
	rts
shome	lda x1
	sta spalte
	lda y1
	sta zeile
	jmp setcr
sup	dec zeile
	lda zeile
	cmp y1
	bcs n1
	lda y2
	sta zeile
n1	jmp setcr
sdown	inc zeile
	lda zeile
	cmp y2
	beq n2
	bcc n2
	lda y1
	sta zeile
n2	jmp setcr
sright	inc spalte
	lda spalte
	cmp x2
	bcc n2
	beq n2
nextline	lda x1
	sta spalte
	jmp sdown
sleft	dec spalte
	lda spalte
	cmp x1
	bcs n2
	lda x2
	sta spalte
	jmp sup
screen	jsr getk
	lda x0
	sta x1
	lda y0
	sta y1
	jsr getk
	lda x0
	sta x2
	lda y0
	sta y2
	jsr sclr
ma	jsr curon
ky	jsr getkey
	beq ky
	pha
	jsr curaus
	lda #0
	sta quote
	pla
	cmp #cler
	bne u1
	jsr sclr
	jmp ma
u1	cmp #home
	bne u2
	jsr shome
	jmp ma
u2	cmp #down
	bne u3
	jsr sdown
	jmp ma
u3	cmp #up
	bne u4
	jsr sup
	jmp ma
u4	cmp #right
	bne u5
	jsr sright
	jmp ma
u5	cmp #left
	bne u6
	jsr sleft
	jmp ma
u6	cmp #f1
	bne u7
en	rts
u7	cmp #f7
	beq en
	cmp #cr
	bne nocr
ret	lda x1
	sta spalte
	jsr sdown
	jmp ma
aus	jsr chrout
	lda spalte
	cmp x2
	bcc noop
	beq noop
	jsr nextline
noop	jmp ma
nocr	cmp #sret
	beq ret
	cmp #ins
	beq noop
	cmp #del
	bne aus
	jsr sleft
	jmp ma
kprint	jsr getkoor
	jsr chkcom
	jmp print
superclr	lda #0
	sta temp
	jsr getspeed
ll1	lda #0
	sta bild
	sta akt
	lda #4
	sta bild+1
	sta akt+1
ll2	ldy #0
	lda #" "
	sta (akt),y
	lda bild
	clc 
	 adc #loesch
	sta bild
	lda bild+1
	adc #0
	sta bild+1
	lda bild
	sec 
	 sbc temp
	sta akt
	lda bild+1
	sbc #0
	sta akt+1
	cmp #8
	bcc ll2
	jsr pause
	inc temp
	lda temp
	cmp #loesch-1
	bne ll1
	jmp clrscr
pause	ldy #255
	ldx #255
lll2	dex
	bne lll2
	dey
	bne lll2
	rts
getspeed	jsr getx
	stx pause+1
	rts
