include "m8c.inc"

;-----------------------------------------------
; Variable Allocation
;-----------------------------------------------
AREA InterruptRAM (RAM, REL, CON)

_sleepcounter:
_SLEEP_COUNTER:
SLEEP_COUNTER:     BLK   1

export _sleepcounter
export _SLEEP_COUNTER
export SLEEP_ISR
export _SLEEP_ISR


AREA UserModules (ROM, REL, CON)

_SLEEP_ISR:
SLEEP_ISR:
	// we don't modify A or X, so we don't need
	// to save them.
	inc [SLEEP_COUNTER]		
	and reg[INT_CLR0], 0xbf
	
	reti