Task

Write a program that does the following in this order:

 Input an amount of time to sleep in whatever units are most natural for your language (milliseconds, seconds, ticks, etc.). This unit should be noted in comments or in a description.
 Print "Sleeping..."
 Sleep the main thread for the given amount of time.
 Print "Awake!"
 End.


Related task

   Nautical bell


ORG RESET
	jmp main
ORG TIMER0
	; timer interrupt only used to wake the processor
	clr tr0
	reti
 
main:
	setb ea		; enable interrupts
	setb et0	; enable timer0 interrupt
	mov tl0, #0	; start timer counter at zero
	mov th0, #0	; these two values dictate the length of sleep
 
	mov a, pcon	; copy power control register
	setb a.0	; set idl bit
	setb tr0	; start timer
	; sleeping...
	mov pcon, a	; move a back into pcon (processor sleeps after this instruction finishes)
 
	; when the timer overflows and the timer interrupt returns, execution will resume at this spot
 
	; Awake!
	jmp $