Compucolor.org – Virtual Media

Listing of file='LIFE.MAC;06' on disk='vmedia/life-sector.ccvf'


;--------------------------------------------------------
;		   GAME OF LIFE
;		     FOR  CCII
;	     WRITTEN BY B. BARLOW  11-80
;	MODIFIED BY TREVOR TAYLOR  01-81
;
;  THIS LIFE PROGRAM USES THE SUITS CYCLINDRICAL WORLD,
;  AND THE "LET ME BE YOUR NEIGHBOR" ALGORITHM.
;  THE PROGRAM FEATURES:
;    .SPEED (ASSEMBLY LANGUAGE)
;    .EASY STARTING DEFINITIONS WITH THE CURSOR PAD
;    .STOPS ON DEAD OR STABLE WORLDS
;    .PAUSES ON COMMAND
;
;---------------------------------------------------------
;
KBDFL	EQU	81DFH
INPVECT	EQU	81C5H

	EXTRN	DEFPOP,ERASE,GETCH,GROW,INSTR,JMPVEC,OSTR
;
;	START OF MAIN PROGRAM
;
LIFE:	LXI	H,0
	DAD	SP
	SHLD	FCSSP
	LXI	SP,STACK
	CALL	JMPVEC
;
	CALL	ERASE
	MVI	A,12
	STA	KBDFL	;POINT TO DUMP
;
	CALL	INSTR	;PRINT INSTRUCTIONS
REPEAT:	CALL	DEFPOP	;SET UP INITIAL POPULATION
	CALL	GROW	;LET IT GROW, LET IT GROW, LET IT GROW
;
;	 ANOTHER RUN?
;
ANOTHER:
	LXI	H,REPMSG
	CALL	OSTR
	CALL	GETCH
	CPI	'Y'
	JZ	REPEAT
	CPI	'N'
	JZ	EXIT
	JMP	ANOTHER
;
;	EXIT/LEAVE
;
EXIT:	CALL	ERASE
	LHLD	FCSSP
	SPHL		;RESTORE FCS STACK
	MVI	B,0	;SIGNAL NO ERRORS
	RET
;
;------------------------DATA-------------------------------

REPMSG:	DB	3,0,31,6,2,'ANOTHER ROUND? ',239

	DS	100
STACK:	DS	2
FCSSP:	DS	2

	END LIFE