1;
2; Small C z88 Misc functions
3;
4; sleep(time)
5;
6; Pause for time seconds
7;
8; djm 22/3/2000 Rewritten to:
9;		 - Not loop (was causing problems)
10;		 - Return number of seconds left
11;
12; -----
13; $Id: sleep.asm,v 1.9 2016-07-02 15:44:16 dom Exp $
14
15
16		MODULE  sleep_z88
17		INCLUDE "time.def"
18
19		SECTION	  code_clib
20		PUBLIC    sleep
21		PUBLIC    _sleep
22		EXTERN	l_mult
23		EXTERN	l_div_u
24		PUBLIC ASMDISP_SLEEP
25
26;sleep(int time);
27
28
29.sleep
30._sleep
31        pop     hl
32        pop     de      ;number of seconds..
33        push    de
34        push    hl
35
36.asmentry
37
38	ld	hl,100
39	call	l_mult
40	ld	c,l
41	ld	b,h
42        call_oz(os_dly)
43	ld	hl,0
44	ret	nc	;NULL - normal
45; Now found out how long is left to sleep for..
46	ld	e,c
47	ld	d,b
48	ld	hl,100
49	call	l_div_u
50	ld	c,l
51	ld	b,h
52	ret
53
54DEFC ASMDISP_SLEEP = asmentry - sleep
55
56