Sleep: Difference between revisions

Content added Content deleted
(Lua solution deleted. This was my solution and I'm retracting it.)
m (Applesoft BASIC)
Line 200: Line 200:
print (new line);
print (new line);
print ("Awake!")</lang>
print ("Awake!")</lang>

=={{header|Applesoft BASIC}}==
The cycles and times calculated should only be taken as a minimum delay.
<lang ApplesoftBasic> 10 POKE 768,169: POKE 770,76
20 POKE 771,168: POKE 772,252
30 INPUT "ENTER WAIT VALUE (1-256) : ";A
40 IF A < 1 OR A > 256 THEN 30
50 POKE 769,(A < 256) * A
60 LET C = (26 + 27 * A + 5 * A ^ 2) / 2
70 PRINT "WAIT FOR "C" CYCLES OR "
80 PRINT C * 14 / 14.318181" MICROSECONDS"
90 PRINT "SLEEPING": CALL 768: PRINT "AWAKE"</lang>
Output:<pre>ENTER WAIT VALUE (1-256) : 256
WAIT FOR 167309 CYCLES OR
163591.032 MICROSECONDS
SLEEPING
AWAKE
</pre>


=={{header|AutoHotkey}}==
=={{header|AutoHotkey}}==