;
;  Kill the Bit game by Dean McDaniel, May 15, 1975
;
;  Object: Kill the rotating bit. If you miss the lit bit, another
;	   bit turns on leaving two bits to destroy. Quickly 
;	   toggle the switch, don't leave the switch in the up
;	   position. Before starting, make sure all the switches
;	   are in the down position.	   
;
;  Modified by Mike Douglas, July 2019, to demonstrate use of the
;  incrementer/decrementer in the 8080, which as a side effect,
;  drives the address bus, and hence, the front panel LEDs, during
;  the execute cycle of 16 bit increment and decrement instructions.

	org	0

	lxi	h,0		;initialize counter
	lxi	d,8000h		;D=display bit, C=0
	lxi	b,0Eh		;higher value = faster

loop	inx	d		;display bit pattern on
	inx	d		;  upper 8 address lights
	inx	d		;  and keep C close to zero
	dcx	d		;  so only a few lower 
	dcx	d		;  address lights are on
	dcx	d

	dad	b		;increment timer
	jnc	loop		;loop until timer wraps
	
	in	0FFh		;input data from sense switches
	xra	d		;kill bits in D with switch
	rrc			;rotate display right one bit
	mov	d,a		;move data to display reg
	jmp	loop		;repeat sequence

	end
