1;
2;	ZX Spectrum OPUS DISCOVERY specific routines
3;
4;	Stefano Bodrato - Jun. 2006
5;
6;	int opus_getblocks (int drive);
7;
8;	$Id: opus_getblocks.asm,v 1.4 2016-06-27 19:16:34 dom Exp $
9;
10
11		SECTION code_clib
12		PUBLIC 	opus_getblocks
13		PUBLIC 	_opus_getblocks
14
15		EXTERN	opus_rommap
16
17		EXTERN	P_DEVICE
18
19
20opus_getblocks:
21_opus_getblocks:
22		push	ix		;save callers
23		ld	ix,4
24		add	ix,sp
25
26		ld	hl,-1
27
28		ld	a,(ix+0)	; drive
29		and	a		; drive no. = 0 ?
30		jr	z,getblocks_exit		; yes, return -1
31		dec	a
32		cp	5		; drive no. >5 ?
33		jr	nc,getblocks_exit		; yes, return -1
34
35		;call	$1708		; Page in the Discovery ROM
36		call	opus_rommap
37		ld	a,(ix+0)	; drive
38		ld	bc,$0400	; inquire disk
39		call	P_DEVICE
40		call	$1748		; Page out the Discovery ROM
41					; HL = number of blocks
42.getblocks_exit
43		pop	ix		; restore callers
44		ret
45