// WRITEPA0.C  
//Program toggles leds on dev boards of BL18XX, RCM20XX, and RCM21XX
// Also toggles leds on BL2000

main()
{


;	
#asm
		ld		a, 0xA0		; disable clock pin and status line outputs
ioi		ld		(GOCR), a
		ld	a, 0x84
ioi	ld(SPCR),a				; set Port A as output			

		ld	a, 0xAA
		push	af
top:
		ld	bc,0x0001			; set up bc for subtraction
		ld	hl, 0x3fff			; max delay in hl
		or	a						; clear z flag
		pop	af					;
		push	af

wait0:
		nop
		sbc	hl, bc
		jr		nz,wait0			; wait for delay to end
		
ioi	ld	(PADR), a			;contents of a to PADR
		pop	af					; recover af
		rlca						; rotate left thru carry, arithmetically
		push	af					; save results
		jr	top

#endasm
}			