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N	B54F
*
B557	LODI,R2	MSSG0-MSSG0
I559	BSTA,UN	DMSSG
	LODI,R3	H'B'
	LODI,R1	A'.'
I560	BSTA,UN	MULCHAR
	BSTR,UN	B583
	BSTR,UN	*I559+1
I567	BCTA,UN	ZSTART
*
B56A	BSTR,UN	B580
	LODI,R2	MSSG1-MSSG0
	BSTR,UN	*I559+1
	BCTR,UN	*I567+1
*
B572	COMI,R2	0
	BCTR,LT	B557
	BCFR,EQ	B547
	LODI,R2	MSSG2-MSSG0
	BSTR,UN	*I559+1
	BSTR,UN	B580
	BCTR,UN	*I567+1
*
B580	BSTA,UN	CRLF
B583	LODI,R3	H'C'
	LODI,R1	H'2D'	-
	BSTR,UN	*I560+1
	BSTR,UN	*B580+1
	BCTR,UN	*B580+1
*
MULCHAR	LODZ,R1
I58E	BSTA,UN	PRINDLY
	BDRR,R3	MULCHAR
	RETC,UN
*
DMSSG	LODA,R0	MSSG0-1,R2+
	RETC,EQ
	BSTR,UN	*I58E+1
	BCTR,UN	DMSSG
*
MSSG0	DATA	A'** SPLAT!',0
	DATA	A'Condolences will be sent'
	DATA	A' to your relatives.',0
MSSG1	DATA	CR,LF,A'You have escaped from the'
	DATA	A' Moon',H'27',A's gravity.',CR,LF
	DATA	A'You will die from lack of food.',0
MSSG2	DATA	A']> Good Flying!',0
MSSG3	DATA	CR,LF,A'|Use',0
MSSG4	DATA	CR,LF,A'|F | V | D |',CR,LF,0
M645	DATA	H'50,EC,34'	P_4
S648	RES	1
M649	DATA	H'EC'	_
M64A	DATA	H'34,0,0,0,0,0'	4_____
*
GCHR	BCTA,UN	CHIN
*
*
	ADDZ,R0
	WRTC,R0
	LODI,R1	0
	LODI,R2 H'08'
	SPSU
	BCTR,LT	GCHR
	EORZ,R0
	WRTC,R0
	BSTR,UN	B677
B660	BSTR,UN	B672
	SPSU
	ANDI,R0	H'80'
	RRR,R1
	IORZ,R1
	STRZ,R1
	BDRR,R2	B660
	BSTR,UN	B672
	ANDI,R1	H'7F'
	LOD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