0
	page 65
title	galaxy	for	8080	system
subttl	copyright by Scelbi Computer Consulting Inc.
	aseg
	org	0100h
fdos	equ	0005h
main:	jmp	execut
	aseg
	.phase	100h
crstb:	db	2,0,2,377q,2,376q,1,376q,0,376q,377q,376q,376q,376q,376q
	db	377q,376q,0,376q,1,376q,2,377q,2,0,2,1,2,2,2,2,1
tp1:	db	0
tp2:	db	0
tp3:	db	0
tp4:	db	0
tp5:	db	0
tp6:	db	0
tp7:	db	0
tp8:	db	0
stats:	db	0
cf:	db	0
ci:	db	0
rnm:	db	0
rdc:	db	0
qc:	db	0
ssh:	db	0
ss1:	db	0
ss2:	db	0
ss3:	db	0
ss4:	db	0
ss5:	db	0
ss6:	db	0
ss7:	db	0
sst:	db	0
sa1:	db	0
sa2:	db	0
sa3:	db	0
me1:	db	0
me2:	db	0
se1:	db	0
se2:	db	0
ae1:	dw	0
ae2:	dw	0
ae3:	dw	0
qsh:	db	0
nt:	db	0
nss:	db	0
nas:	db	0
nsd:	db	0
dg1:	db	0
dg2:	db	0
dg3:	db	0
dg4:	db	0
dg5:	db	0
gxtb:	ds	4
gxtb1:	ds	73q
egxtb:	db	0
msg:	mov	a,m
	ana	a
	rz
	call	print
	inx	h
	jmp	msg
rotr4:	rrc
rotr3:	rrc
	rrc
	rrc
	ret
rn:	lxi	h,rnm
	mov	a,m
	mov	b,a
	rlc
	xra	b
	rrc
	inx	h
	mov	b,m
	inr	b
	mov	m,b
	add	b
	dcx	h
	mov	m,a
	ret
bndec:	lxi	b,dg1
	mvi	e,5
	xra	a
agn:	stax	b
	inx	b
	dcr	e
	jnz	agn
	mov	e,m
	dcr	d
	jz	bndc
	inx	h
	mov	d,m
bndc:	xchg
	lxi	d,0fc18h
	call	bd
	sta	dg4
	lxi	d,0ff9ch
	call	bd
	sta	dg3
	lxi	d,0fff6h
	call	bd
	sta	dg2
	mov	a,l
	lxi	h,dg1
	mov	m,a
	ret
bd:	mvi	b,0
bd1:	inr	b
	dad	d
	mov	a,h
	ana	a
	jp	bd1
	dcr	b
	mov	a,e
	cma
	adi	1
	mov	e,a
	mov	a,d
	cma
	aci	0
	mov	d,a
	dad	d
	mov	a,b
	ret
dcbn:	xra	a
	mov	b,a
	mov	c,a
	mov	h,a
	mov	l,a
	lda	dg4
	mov	l,a
	lda	dg3
	call	tobn
	lda	dg2
	call	tobn
	lda	dg1
	call	tobn
	shld	tp7
	xchg
	mvi	h,1
	ret
tobn:	mov	c,a
	mov	d,h
	mov	e,l
	dad	h
	dad	h
	dad	d
	dad	h
	dad	b
	ret
fnum:	mov	a,m
	cpi	060q
	rm
	sui	72q
	adi	200q
	ret
nwqd:	lxi	h,ss1
	mvi	e,13q
clr:	mvi	m,200q
	inx	h
	dcr	e
	jnz	clr
	mvi	l,qc and 00ffh
	mov	a,m
	ani	7
	mov	c,a
	mvi	e,ss1 and 00ffh
	cnz	locst
	mvi	l,qc and 00ffh
	mov	a,m
	call	rotr3
	ani	1
	mov	c,a
	mvi	e,sst and 00ffh
	cnz	locst
	mvi	l,qc and 00ffh
	mov	a,m
	call	rotr4
	ani	3
	mov	c,a
	mvi	e,sa1 and 00ffh
	cnz	locst
ldas:	call	rn
	mvi	l,ae1 and 00ffh
	call	las
	mvi	l,ae2 and 00ffh
	call	las
	mvi	l,ae3 and 00ffh
	jmp	las
las:	mov	m,a
	ani	3
	inx	h
	mov	m,a
	jmp	rn
locst:	call	rn
	ani	77q
	mov	b,a
	call	match
	jz	locst
	mov	l,e
	mov	m,b
	inr	e
	dcr	c
	jnz	locst
	ret
match:	mvi	l,ss1 and 00ffh
math1:	mov	a,m
	cmp	b
	rz
	mov	a,l
	inx	h
	cpi	sa3 and 00ffh
	jnz	math1
	adi	1
	ret
qcnt:	lxi	h,qsh
	mov	a,m
	adi	gxtb and 00ffh
	mov	l,a
	mov	a,m
	mvi	l,qc and 00ffh
	mov	m,a
	ret
load:	lxi	h,1388h
	shld	me1
	lxi	h,0
	shld	se1
	mvi	a,12q
	sta	nt
	ret
time:	lxi	h,m18
done:	call	msg
	jmp	galaxy
lost:	lxi	h,m20
	jmp	done
wpout:	lxi	h,m19
	jmp	done
eout:	lxi	h,m21
	jmp	done
dgprt:	mov	a,m
	adi	60q
	inx	h
	stax	d
	dcx	d
	dcr	b
	rz
	jmp	dgprt
rowst:	lxi	h,m3
	call	msg
	mvi	c,0
rwst1:	lxi	h,m4b
rclr:	mvi	m,40q
	inx	h
	mvi	a,m4c and 00ffh
	cmp	l
	jnz	rclr
	mov	a,c
	adi	61q
	mvi	l,m4a and 00ffh
	mov	m,a
	lxi	h,ssh
	call	rwpnt
	jnz	str
	mvi	m,'<'	;*******
	inx	h
	mvi	m,'*'
	inx	h
	mvi	m,'>'
str:	mvi	l,ss1 and 00ffh
str1:	mvi	h,1
	call	rwpnt
	jnz	nxstr
	inx	h
	mvi	m,'*'
	mov	l,e
nxstr:	inx	h
	mvi	a,sst and 00ffh
	cmp	l
	jnz	str1
	mvi	h,1
	call	rwpnt
	jnz	as
	mvi	m,'>'	;********
	inx	h
	mvi	m,'1'
	inx	h
	mvi	m,'<'
as:	mvi	l,sa1 and 00ffh
as1:	mvi	h,1
	call	rwpnt
	jnz	nxas
	mvi	m,'+'
	inx	h
	mvi	m,'+'
	inx	h
	mvi	m,'+'
	mov	l,e
nxas:	inx	h
	mvi	a,me1 and 00ffh
	cmp	l
	jnz	as1
	lxi	h,m4
	call	cmsg
	lda	stats
	ana	a
	jz	rwst2
	push	b
	call	stlnd
	pop	b
rwst2:	inr	c
	mvi	a,10q
	cmp	c
	rz
	jmp	rwst1
stlnd:	mov	a,c
	rlc
	mov	c,a
	mvi	b,0
	lxi	h,ststb
	dad	b
	mov	e,m
	inx	h
	mov	d,m
	xchg
	pchl
ststb:	dw	l1
	dw	l2
	dw	quad
	dw	l4
	dw	l5
	dw	l6
	dw	l7
	dw	l8
rwpnt:	mov	a,m
	ana	a
	rm
	call	rotr3
	ani	7
	cmp	c
	rnz
	mov	a,m
	ani	7
	mov	b,a
	rlc
	add	b
	adi	m4b and 00ffh
	mov	e,l
	mov	l,a
	mvi	h,14q
	xra	a
	ana	a
	ret
quad:	lxi	h,m7a
	lxi	d,qsh
	call	two
	mvi	l,m7 and 00ffh
	jmp	msg
two:	ldax	d
	mov	b,a
t1:	call	rotr3
	ani	7
	adi	61q
	mov	m,a
	mov	a,b
	ani	7
	adi	61q
	inx	h
	inx	h
	mov	m,a
	ret
ntn:	mvi	h,23q
nt1:	mvi	a,15q
	call	print
	mvi	a,12q
	call	print
nt2:	mvi	a,'-'
	call	print
	dcr	h
	jnz	nt2
	ret
qds1:	mvi	d,high m16
qdset:	mov	c,a
	call	rotr4
	ani	3q
	ori	60q
	stax	d
	inx	d
	mov	a,c
	call	rotr3
	ani	1
	ori	60q
	stax	d
	inx	d
	mov	a,c
	ani	7
	ori	60q
	stax	d
	ret
clc1:	xra	a
	jmp	lr3
clc2:	xra	a
	jmp	lr4
lrr:	mov	c,a
	adi	gxtb and 00ffh
	mov	b,a
	mov	a,m
	ani	7
	jz	clc1
	mov	a,b
	sui	1
	mov	l,a
	mov	a,m
lr3:	mvi	e,m16a and 00ffh
	call	qds1
	mov	l,b
	mvi	h,1
	mov	a,m
	mvi	e,m16b and 00ffh
	call	qds1
	mov	a,b
	sui	gxtb and 00ffh
	ani	7
	cpi	7
	jz	clc2
	mov	a,b
	adi	1
	mov	l,a
	mvi	h,1
	mov	a,m
lr4:	mvi	e,m16c and 00ffh
	call	qds1
lrp:	lxi	h,m16
	jmp	msg
elos:	lxi	h,tp4
	mov	m,e
	inx	h
	mov	m,d
	dcx	h
	mvi	d,2
	call	bndec
	lxi	d,m23a
	mvi	b,4
	call	dgprt
	lxi	h,m23
	call	cmsg
	mvi	l,tp4 and 00ffh
	mov	e,m
	inx	h
	mov	d,m
els1:	call	cksd
	jnc	fmsd
	mov	e,m
	inx	h
	mov	d,m
	call	fmsd
	call	tomn
	mvi	l,tp4 and 00ffh
	mov	e,m
	inx	h
	mov	d,m
sd0:	call	ckmn
	jc	eout
	call	fmmn
	lxi	h,m24
	call	cmsg
	mvi	b,2
	call	dvd
	call	ckmn
	jc	eout
	jmp	fmmn
cksd:	mvi	l,se2 and 00ffh
	jmp	ck1
ckmn:	mvi	l,me2 and 00ffh
ck1:	mov	a,m
	dcx	h
	cmp	d
	rnz
ck2:	mov	a,m
	cmp	e
	ret
fmsd:	mvi	l,se1 and 00ffh
	jmp	fm1
fmmn:	mvi	l,me1 and 00ffh
fm1:	mov	a,m
	sub	e
	mov	m,a
	inx	h
	mov	a,m
	sbb	d
	mov	m,a
	ret
tosd:	mvi	l,se1 and 00ffh
	jmp	to1
tomn:	mvi	l,me1 and 00ffh
to1:	mov	a,m
	add	e
	mov	m,a
	inx	h
	mov	a,m
	adc	d
	mov	m,a
	ret
dvd:	ana	a
	mov	a,d
	rar
	mov	d,a
	mov	a,e
	rar
	mov	e,a
	dcr	b
	jnz	dvd
	ret
elom:	call	ckmn
	jnc	fmmn
	mov	c,e
	mov	b,d
	mvi	l,se1 and 00ffh
	mov	e,m
	inx	h
	mov	d,m
	call	fmsd
	call	tomn
	mov	e,c
	mov	d,b
	jmp	sd0
ein:	lxi	h,dg5
	mvi	m,0
	mvi	l,dg4 and 00ffh
	call	input
	cpi	'-'
	jnz	en2
	inx	h
	mov	m,l
	dcx	h
en1:	call	input
en2:	mov	m,a
	call	fnum
	rm
	mov	a,m
	ani	17q
	mov	m,a
	dcx	h
	mvi	a,nsd and 00ffh
	cmp	l
	rz
	jmp	en1
dlet:	mvi	m,200q
	mov	b,l
	mvi	l,qsh and 00ffh
	mov	a,m
	adi	gxtb and 00ffh
	mov	l,a
	mov	a,b
	cpi	sst and 00ffh
	jnz	dlas
	mov	a,m
	ani	67q
	mov	m,a
	mvi	l,qc and 00ffh
	mov	m,a
	mvi	l,nss and 00ffh
	dcr	m
	rnz
	lxi	h,m38
cmsg:	call	msg
	mvi	h,1
	ret
dlas:	mov	a,m
	sui	20q
	mov	m,a
	mvi	l,qc and 00ffh
	mov	m,a
	mvi	l,nas and 00ffh
	dcr	m
	rnz
	lxi	h,m22
	jmp	done
drct:	call	input
	lxi	h,tp7
	cpi	'1'
	jc	zret
	cpi	'9'
	jnc	zret
	ani	17q
	rlc
	mov	m,a
	mvi	a,'.'
	call	print
	call	input
	cpi	'0'
	jz	cr1
	cpi	'5'
	jnz	zret
cr1:	ani	1
	add	m
	rlc
	sui	4
	mov	m,a
	rnz
	adi	1
	ret
zret:	xra	a
	ret
actv:	mvi	l,tp7 and 00ffh
	mov	l,m
	mov	c,m
	inx	h
	mov	d,m
	mvi	l,ssh and 00ffh
	mov	a,m
	mov	b,a
	ani	7
	mvi	l,tp7 and 00ffh
	rlc
	mov	m,a
	inx	h
	mov	a,b
	ani	70q
	rrc
	rrc
	mov	m,a
	ret
trk:	mvi	l,cf and 00ffh
	mvi	m,0
	mvi	l,tp7 and 00ffh
	mov	a,m
	add	c
	mov	m,a
	jp	nobk
	ani	17q
	mov	m,a
	mvi	l,cf and 00ffh
	mov	m,l
	mvi	l,qsh and 00ffh
	mov	a,m
	ani	7
	rz
	dcr	m
	jmp	rmv
nobk:	cpi	20q
	jc	rmv
	ani	17q
	mov	m,a
	mvi	l,cf and 00ffh
	mov	m,l
	mvi	l,qsh and 00ffh
	mov	a,m
	ani	7
	adi	1
	cpi	10q
	rz
	inr	m
rmv:	mvi	l,tp8 and 00ffh
	mov	a,m
	add	d
	mov	m,a
	jp	noup
	ani	17q
	mov	m,a
	mvi	l,cf and 00ffh
	mov	m,l
	mvi	l,qsh and 00ffh
	mov	a,m
	ani	70q
	rz
	mov	a,m
	sui	10q
	mov	m,a
	jmp	ckx
noup:	cpi	20q
	jc	ckx
	ani	17q
	mov	m,a
	mvi	l,cf and 00ffh
	mov	m,l
	mvi	l,qsh and 00ffh
	mov	a,m
	ani	70q
	adi	10q
	cpi	100q
	rz
	mov	a,m
	adi	10q
	mov	m,a
ckx:	mvi	l,tp1 and 00ffh
	mov	m,e
	inx	h
	mov	m,d
	inx	h
	mov	m,c
	rnz
	mvi	a,1
	ana	a
	ret
rwcm:	mvi	l,tp7 and 00ffh
	mov	a,m
	rrc
	ani	7
	mov	b,a
	inx	h
	mov	a,m
	rlc
	rlc
	ani	70q
	add	b
	mov	b,a
	ret
aspls:	mvi	e,317q
pls:	call	rn
	ani	77q
	adi	gxtb and 00ffh
	mov	l,a
	mov	a,e
	ana	m
	jmp	ot
sspls:	mvi	e,367q
	jmp	pls
asmns:	mvi	e,20q
mns:	call	rn
	ani	77q
	adi	gxtb and 00ffh
	mov	l,a
	mov	a,e
	ora	m
ot:	mov	m,a
	jmp	glxck
ssmns:	mvi	e,10q
	jmp	mns
over:	lxi	h,m39
	call	msg
	jmp	fend
red:	mvi	m,'R' or 80h
	inx	h
	mvi	m,'O' or 80h
	inx	h
	mvi	m,'T' or 80h
	inx	h
	mvi	m,0
	jmp	cnd
;##############################
galaxy:	lxi	h,m1
	call	msg
start:	call	rn
	call	inpck
	jp	start
	call	input
	ani	0dfh
	cpi	'N'
	jz	over
	mvi	e,gxtb and 00ffh
glxst:	call	rn
	ani	37q
	adi	rnglx and 00ffh
	mov	l,a
	mvi	h,high rnglx
	mov	a,m
	mov	l,e
	mvi	h,1
	mov	m,a
	inr	e
	mvi	a,egxtb and 00ffh
	cmp	e
	jp	glxst
glxck:	xra	a
	mov	d,a
	mov	c,a
	mvi	l,gxtb and 00ffh
gxck1:	mov	a,m
	ani	10q
	add	d
	mov	d,a
	mov	a,m
	ani	60q
	rrc
	rrc
	add	c
	mov	c,a
	inx	h
	mvi	a,egxtb and 00ffh
	cmp	l
	jp	gxck1
	mov	a,d
	rrc
	rrc
	rrc
	mov	d,a
	cpi	7
	jnc	sspls
	cpi	2
	jc	ssmns
	mov	a,c
	rrc
	rrc
	mov	c,a
	cpi	40q
	jnc	aspls
	cpi	12q
	jc	asmns
	mvi	l,nss and 00ffh
	mov	m,d
	inx	h
	mov	m,c
	mov	a,c
	adi	5
	inx	h
	mov	m,a
	mvi	d,1
	call	bndec
	lxi	d,m2b
	mvi	b,2
	call	dgprt
	lxi	h,nas
	mvi	d,1
	call	bndec
	lxi	d,m2a
	mvi	b,2
	call	dgprt
	lxi	h,nss
	mov	a,m
	ori	60q
	sta	m2c
	lxi	h,m2
	call	msg
	call	rn
	ani	77q
	sta	qsh
	call	qcnt
	call	load
	call	nwqd
	mvi	c,1
	mvi	e,ssh and 00ffh
	call	locst
srscn:	mvi	a,0
	sta	stats
	jmp	srsn1
srsan:	mvi	a,1
	sta	stats
srsn1:	call	rowst
	jmp	cmnd
crsts:	mvi	c,0
crst1:	push	b
	lxi	h,crlf
	call	msg
	call	stlnd
	pop	b
	inr	c
	mvi	a,10q
	cmp	c
	jz	cmnd
	jmp	crst1
crlf:	db	12q
	db	15q
	db	0
l1:	lxi	h,nsd
	mvi	a,62q
	sub	m
	mvi	l,tp8 and 00ffh
	mov	m,a
	mvi	d,1
	call	bndec
	lxi	d,m5a
	mvi	b,2
	call	dgprt
	lxi	h,m5
	jmp	cmsg
l2:	lda	qc
	lxi	h,m6a
	ani	60q
	jnz	red
	mvi	m,'G'
	inx	h
	mvi	m,'R'
	inx	h
	mvi	m,']'
	inx	h
	mvi	m,'N'
cnd:	mvi	l,m6 and 00ffh
	jmp	cmsg
l4:	lxi	h,m8a
	lxi	d,ssh
	call	two
	lxi	h,m8
	jmp	cmsg
l5:	lxi	h,me1
	mvi	d,2
	call	bndec
	lxi	d,m9a
	mvi	b,4
	call	dgprt
	lxi	h,m9
	jmp	cmsg
l6:	lxi	h,nt
	mvi	d,1
	call	bndec
	lxi	d,m10a
	mvi	b,2
	call	dgprt
	lxi	h,m10
	jmp	cmsg
l7:	lxi	h,se1
	mvi	d,2
	call	bndec
	lxi	d,m11a
	mvi	b,4
	call	dgprt
	lxi	h,m11
	jmp	cmsg
l8:	lxi	h,nas
	mvi	d,1
	call	bndec
	lxi	d,m40a
	mvi	b,2
	call	dgprt
	lxi	h,m40
	jmp	cmsg
cmnd:	lxi	sp,stack$top
	mvi	h,1
	lxi	d,000ah
	call	elom
	mvi	l,rdc and 00ffh
	inr	m
cmd:	lxi	h,m12
	call	cmsg
	call	input
	sui	'0'
	jz	crse
	dcr	a
	jz	srsan
	dcr	a
	jz	srscn
	dcr	a
	jz	crsts
	dcr	a
	jz	lrscn
	dcr	a
	jz	gxprt
	dcr	a
	jz	cmdtbl
	dcr	a
	jz	cmdtbl
	dcr	a
	jz	shen
	dcr	a
	jz	phsr
	sui	10q
	jz	trpd
	jmp	anschl
lrscn:	lxi	h,m15
	call	msg
	call	quad
	call	ntn
	lxi	h,qsh
	mov	a,m
	ani	70q
	jz	rwc1
	mov	a,m
	sui	10q
	call	lrr
lr1:	call	ntn
	lxi	h,qsh
	mov	a,m
	call	lrr
	call	ntn
	lxi	h,qsh
	mov	a,m
	cpi	70q
	jnc	rwc2
	adi	10q
	call	lrr
lr2:	call	ntn
	jmp	cmnd
rwc1:	call	rwc
	jmp	lr1
rwc2:	call	rwc
	jmp	lr2
rwc:	mvi	e,m16a and 00ffh
	xra	a
	call	qds1
	mvi	e,m16b and 00ffh
	xra	a
	call	qds1
	mvi	e,m16c and 00ffh
	xra	a
	call	qds1
	jmp	lrp
lgxpt:	mvi	h,31q
	mvi	a,1
	sta	stats
	jmp	gxpt1
rgxpt:	mvi	h,31q
	mvi	l,gxtb1 and 00ffh
	mvi	a,1
	sta	stats
	jmp	gxpt2
gxprt:	mvi	h,61q
	xra	a
	sta	stats
gxpt1:	mvi	l,gxtb and 00ffh
gxpt2:	push	h
	lxi	h,m32
	call	msg
	pop	h
gl4a:	call	nt1
	inr	h
gl1:	push	h
	lxi	h,m17b
	call	msg
	pop	h
gl1a:	lxi	d,m17a
	mvi	b,4
gl2:	mov	a,m
	call	qdset
	inx	h
	inx	d
	inx	d
	inx	d
	inx	d
	dcr	b
	jnz	gl2
gl3:	push	h
	lxi	h,m17
	call	msg
	pop	h
	lda	stats
	ana	a
	jz	gl4
	inx	h
	inx	h
	inx	h
	inx	h
gl4:	push	psw
	mvi	a,egxtb and 00ffh
	cmp	l
	jc	gl5
	pop	psw
	jnz	gl6
	mov	a,l
	sui	gxtb and 00ffh
	ani	7
	jnz	gl1a
	mvi	h,61q
	jmp	gl4a
gl5:	pop	psw
	jz	gl5a
	mvi	h,31q
	jmp	gl5b
gl5a:	mvi	h,61q
gl5b:	call	nt1
	jmp	cmnd
gl6:	mvi	h,31q
	jmp	gl4a
shen:	lxi	h,m25
	call	msg
	call	ein
	jm	shen
	call	dcbn
	lhld	tp7
	xchg
	lxi	h,dg5
	mov	a,m
	ana	a
	jz	pos
	call	cksd
	jc	ne
	call	fmsd
	call	tomn
	jmp	cmnd
pos:	call	ckmn
	jc	ne
	call	fmmn
	call	tosd
	jmp	cmnd
ne:	lxi	h,m26
	call	msg
	jmp	cmnd
crse:	lxi	h,m13
	call	msg
	call	drct
	jz	crse
wrp:	lxi	h,m14
	call	cmsg
	call	input
	cpi	'0'
	jc	wrp
	cpi	'8'
	jnc	wrp
	ani	7
	rlc
	rlc
	rlc
	mov	b,a
	mvi	a,'.'
	call	print
	call	input
	cpi	'0'
	jc	wrp
	cpi	'8'
	ani	7
	add	b
	jz	wrp
	mov	e,a
	call	actv
	xra	a
	sta	ci
move:	call	trk
	jz	lost
	mvi	l,cf and 00ffh
	mov	a,m
	ana	a
	jz	clsn
	inr	l
	mov	m,l
	lxi	d,0019h
	call	elom
	call	qcnt
	call	nwqd
clsn:	call	rwcm
	call	match
	jnz	mvdn
	mov	b,l
	mov	a,b
	cpi	sst and 00ffh
	lda	ci
	jz	ssout
	jnc	asout
	ana	a
	jz	wpout
mvdn:	push	h
	lhld	tp1
	xchg
	pop	h
	lda	tp3
	mov	c,a
	dcr	e
	jnz	move
	lda	ci
	ana	a
	jz	nox
	mvi	l,nsd and 00ffh
	dcr	m
	jz	time
nox:	call	rwcm
	mvi	l,ssh and 00ffh
	mov	m,b
	call	match
	cz	chng
	call	dked
	call	asret
	jmp	srscn
ssout:	ana	a
	jnz	mvdn
	mov	l,b
	call	dlet
	lxi	h,m30
	call	cmsg
	lxi	d,0258h
sso1:	call	elos
	jmp	mvdn
asout:	ana	a
	jnz	mvdn
	mov	l,b
	call	dlet
	lxi	d,05dch
	jmp	sso1
chng:	mov	e,l
	mvi	c,1
	jmp	locst
dked:	mvi	l,sst and 00ffh
	mov	a,m
	ana	a
	rm
	mov	a,b
	ani	70q
	mov	c,a
	mov	a,b
	ani	7
	mov	b,a
	mov	a,m
	ani	7
	mov	e,a
	mov	a,m
	ani	70q
	cmp	c
	rnz
	mov	a,b
	adi	1
	cmp	e
	jz	load
	sui	2
	cmp	e
	rnz
	jmp	load
asret:	call	rn
	ani	1
	rz
	lxi	h,sa1
	call	asrt1
	lxi	h,sa2
	call	asrt1
	lxi	h,sa3
asrt1:	mov	a,m
	ana	a
	rm
	xchg
	lxi	h,m34a
	call	two
	mvi	l,m34 and 00ffh
	call	cmsg
	mov	a,e
	sui	sa1 and 00ffh
	ani	3
	rlc
	adi	ae1 and 00ffh
	mov	l,a
	sta	tp4
	jmp	alos1
trpd:	lda	nt
	ana	a
	jz	ntpd
	lxi	d,00fah
	call	ckmn
	jc	ne
	call	fmmn
	mvi	l,nt and 00ffh
	dcr	m
tr1:	lxi	h,m27
	call	msg
	call	drct
	jz	tr1
	call	actv
	lda	qsh
	sta	tp6
tr2:	call	trk
	lda	cf
	ana	a
	jnz	qout
	call	rwcm
	mov	c,b
	lxi	h,m31a
	call	t1
	mvi	l,m31 and 00ffh
	call	cmsg
	mov	b,c
	call	match
	jz	hit
	mvi	l,tp1 and 00ffh
	mov	e,m
	inx	h
	mov	d,m
	inx	h
	mov	c,m
	jmp	tr2
hit:	mov	a,l
	cpi	sst and 00ffh
	jc	qout
	jz	ssta
	call	dlet
	lxi	h,m28
	call	msg
	jmp	cmnd
ssta:	call	dlet
	lxi	h,m30
	call	msg
qout:	lda	tp6
	sta	qsh
	lxi	h,m29
	call	cmsg
	lda	qc
	ani	60q
	jz	wast1
	call	asret
	jmp	cmnd
ntpd:	lxi	h,m37
	call	msg
	jmp	cmnd
phsr:	lxi	h,m33
	call	msg
	call	ein
	jm	phsr
	call	dcbn
	call	elom
	lda	qc
	ani	60q
	jz	waste
	call	rotr4
	dcr	a
	jz	ph1
	mov	b,a
	call	dvd
ph1:	lxi	h,tp7
	mov	m,e
	inx	h
	mov	m,d
	mvi	l,tp1 and 00ffh
	mov	m,e
	inx	h
	mov	m,d
	inx	h
	mvi	m,sa1 and 00ffh
	call	asph
	mvi	l,tp3 and 00ffh
	mvi	m,sa2 and 00ffh
	call	asph
	mvi	l,tp3 and 00ffh
	mvi	m,sa3 and 00ffh
	call	asph
	jmp	cmnd
asph:	mov	l,m
	mov	a,m
	ana	a
	rm
	xchg
	lxi	h,m34a
	call	two
	mvi	l,m34 and 00ffh
	call	cmsg
	mvi	l,ssh and 00ffh
	call	sprc
	xchg
	mov	e,c
	mov	d,b
	call	sprc
	mov	a,b
	sub	d
	jp	ph2
	cma
	adi	1
ph2:	mov	b,a
	mov	a,c
	sub	e
	jp	ph3
	cma
	adi	1
ph3:	add	b
	rrc
	rrc
	ani	3
	mov	b,a
	mov	c,l
	mvi	l,tp1 and 00ffh
	mov	e,m
	inx	h
	mov	d,m
	dcr	b
	inr	b
	cnz	dvd
	mov	a,c
	sui	sa1 and 00ffh
	ani	3
	rlc
	adi	ae1 and 00ffh
	mvi	l,tp4 and 00ffh
	mov	m,a
	mov	l,a
	call	fm1
	jm	dstr
	jnz	alos
	dcx	h
	mov	a,m
	inx	h
	ana	a
	jz	dstr
alos:	dcx	h
alos1:	mvi	d,2
	call	bndec
	lxi	d,m35a
	mvi	b,4
	call	dgprt
	lxi	h,m35b
	call	cmsg
	mvi	l,tp4 and 00ffh
	mov	l,m
	mov	e,m
	inx	h
	mov	d,m
	mvi	b,2
	call	dvd
	jmp	elos
dstr:	lxi	h,m28
	call	cmsg
	mvi	l,tp3 and 00ffh
	mov	l,m
	jmp	dlet
sprc:	mov	a,m
	ani	7
	mov	c,a
	mov	a,m
	call	rotr3
	ani	7
	mov	b,a
	ret
waste:	call	elom
wast1:	lxi	h,m36
	call	msg
	jmp	cmnd
m1:	db	15q,12q,'  Wollen Sie in den Raumkrieg ziehen? ',0
m2:	db	15q,12q,'  Sie m}~en  '
m2a:	db	'  Feindschiffe vernichten',15q,12q,'innerhalb von  '
m2b:	db	'  Sternentage, mit Hilfe von',15q,12q
m2c:	db	'  Raumstationen.',0
m3:	db	15q,12q,' -1--2--3--4--5--6--7--8-',0
m4:	db	15q,12q
m4a:	db	'0'
m4b:	db	'                        '
m4c:	db	0
m5:	db	' Sternentage  300'
m5a:	db	'0',0
m6:	db	' Zustand    '
m6a:	db	'     ',0
m7:	db	' Quadrat    '
m7a:	db	'X',54q,'Y',0
m8:	db	' Sector     '
m8a:	db	40q,54q,40q,0
m9:	db	' Energie       '
m9a:	db	40q,0
m10:	db	' Torpedos    '
m10a:	db	40q,0
m11:	db	' Schild        '
m11a:	db	40q,0
m12:	db	15q,12q,'Kommando?',0
m13:	db	15q,12q,'Richtung (1-8.5)? ',0
m14:	db	15q,12q,'Entfernung (0.1-7.7) ',0
m15:	db	15q,12q,'Weitenradar f}r',0
m18:	db	15q,12q,'Mission verloren',54q,15q,12q,'Sie haben'
	db	' zu lange gebraucht.Der Feind ist daaaaah!',0
m19:	db	15q,12q,'KRACH-BUMMS',54q,' Sie krachten in einen Stern,'
	db	15q,12q,'Ihr Schiff ist zermanscht.',0
m20:	db	15q,12q,'Sie verlie~en die Heimatgalaxis,',54q,15q,12q
	db	'Ihr Schiff ist verloren...verl o  r   e     n     .       .   ',0
m23:	db	15q,12q,'Energieverlust    '
m23a:	db	40q,0
m24:	db	15q,12q,1ch,'GEFAHR !',12h,'Schild nur 0000',0
m25:	db	15q,12q,'Abwehrschild-Energie }bertragen = ',0
m26:	db	15q,12q,1ch,' ZUWENIG ENERGIE ',12h,0
m27:	db	15q,12q,'Torpedo Laufrichtung (1-8.5)',72q,40q,0
m28:	db	15q,12q,'Feindschiff '
m28a:	db	'zerst|rt',0
m29:	db	15q,12q,'HEHE DANEBEN!',0
m30:	db	15q,12q,'Raumstation zerst|rt',0
m22:	db	15q,12q,'         GRATULIERE',54q,15q,12q
	db	' Sie haben alle Feindschiffe vernichtet.',0
m31:	db	15q,12q,'l{uft zu',72q,40q
m31a:	db	40q,54q,40q,0
m32:	db	15q,12q,'Galaxy Display',0
m33:	db	15q,12q,'Laserenergie f}r den Schu~ = ',0
m34:	db	15q,12q,'Feindschiff im Sector '
m34a:	db	40q,54q,40q,0
m35b:	db	15q,12q
m35:	db	'Energie =    '
m35a:	db	40q,0
m36:	db	15q,12q,'Kein Feindschiff! Schu~ war unn|tig! BL\DIAN',0
m21:	db	15q,12q,'Totenschiff! Keine Energie mehr!',0
m37:	db	15q,12q,'Kein Torpedo mehr vorhanden',0
m16:	db	15q,12q,'!',40q
m16a:	db	'    ! '
m16b:	db	'    ! '
m16c:	db	'    !',0
m38:	db	15q,12q,'letzte',0
m39:	db	0ch,1bh,16h,0ch,23h,1ch,' Feigling ',12h,0
m17b:	db	15q,12q,31h,0
m17:	db	40q
m17a:	db	'    !     !     !     !',0
m40:	db	' Feinde     '
m40a:	db	40q,0
rnglx:	db	0,1,4,43q,12q,3,7,0,0,35q,43q,5,3,24q,26q,22q,0
	db	0,0,0,0,5,4,27q,5,1,24q,0,0,4,5,0
lastb:	db	0
input:	push	h
	push	d
	push	b
	mvi	c,1
	call	fdos
	pop	b
	pop	d
	pop	h
	ret
print:	push	h
	push	d
	push	b
	push	psw
	mov	e,a
	mvi	c,2
	call	fdos
	pop	psw
	pop	b
	pop	d
	pop	h
	ret
inpck:	push	h
	push	d
	push	b
	mvi	c,0bh
	call	fdos
	rrc
	ana	a
	pop	b
	pop	d
	pop	h
	ret
	.dephase
fend:	lhld	old$sp
	sphl
	jmp	0000h		;Programmende
execut:		lxi	h,0
	dad	sp
	shld	old$sp
	lxi	sp,stack$top
	mvi	c,disk$reset
	call	fdos
versch:	lxi	h,0100h
	lxi	d,0103h
	lxi	b,fend - crstb
vers1:	ldax	d
	mov	m,a
	inx	h
	inx	d
	dcx	b
	mov	a,b
	ana	a
	jnz	vers1
	mov	a,c
	ana	a
	jnz	vers1
	lxi	d,mes1
	mvi	c,conspr
	call	fdos
	mvi	c,consin
	call	fdos
	ani	0dfh
	cpi	'N'
	jz	galaxy
	lxi	d,mes2
	mvi	c,conspr
	call	fdos
	jmp	galaxy
mes1:	db	0ch,'W}nschen Sie Informationen ? (J/N) >$'
mes2:	db	0ch,bl,bl,bl,bl,bl,bl,bl,bl
	db	1ch,'**********  GALAXY  **********',12h,0dh,0ah
	db	'Sie sind auf einem Raumschiff und haben die Aufgabe eine '
	db	'bestimmte Anzahl ',0dh,0ah,'feindlicher'
	db	' Raumschiffe zu zerst|ren. Das Problem dabei ist, da~ '
	db	'dazu nur ein ',cr,lf,'befristeter '
	db	'Zeitraum zur Verf}gung steht. Genauso ist Ihr Treibstoff'
	db	'vorrat be-',cr,lf,'grenzt. Sie m}~en '
	db	'ihn bei Bedarf an einer Raumstation auff}llen.Ihr '
	db	'Raumschiff ',cr,lf,'hat als Waffen'
	db	'Torpedos und Laser.F}r den Laser bestimmenSie die Schu~'
	db	'energie, ',cr,lf,'f}r die Torpedos '
	db	'die Richtung. Die Kommandos werden ',cr,lf
	db	'mit mit Nr.6 oder 7 angezeigt.',cr,lf,lf,lf,lf,lf,lf,'$'
mes3:	db	cr,lf
	db	'1 = Sectorkarte + Status    0 = Schiffsbewegung',cr,lf
	db	'2 = Sectorkarte ',cr,lf
	db	'3 = Status                  !        Richtung',cr,lf
	db	'4 = Umgebungskarte          !',cr,lf
	db	'5 = Galaxiskarte            ! 4.0  3.5  3.0  2.5  2.0',cr,lf
	db	'6+7 = Kommandotabelle       ! 4.5                 1.5',cr,lf
	db	'8 = Schild aufladen         ! 5.0       <*>       1.0',cr,lf
	db	'9 = Laserschu~              ! 5.5                 8.5',cr,lf
	db	'A = Torpedoschu~            ! 6.0  6.5  7.0  7.5  8.0',cr,lf
	db	'$'
anschl:	sui	20h
	jz	trpd
	jmp	cmd
cmdtbl:	lxi	d,mes3
	mvi	c,conspr
	call	fdos
	jmp	cmd
bl		equ	20h
cr		equ	0dh
lf		equ	0ah
consin		equ	01h
conspr		equ	09h
fdos		equ	05h
disk$reset	equ	13
old$sp:		dw	0
stack:		ds	32
stack$top	equ	$
	end	main
