]> git.sur5r.net Git - cc65/blob - libsrc/atari/diopncls.s
always use setcursor to update cursor settings
[cc65] / libsrc / atari / diopncls.s
1 ;
2 ; Christian Groessler, October 2000
3 ;
4 ; This file provides the __dio_open and __dio_close functions
5 ; Since on the Atari no real open and close is necessary, they
6 ; do not much. The __dio_open sets the sector size of the
7 ; drive which is later used by the _dio_read and _dio_write
8 ; functions.
9 ;
10 ; dhandle_t     __fastcall__ dio_open  (driveid_t drive_id);
11 ; unsigned char __fastcall__ dio_close (dhandle_t handle);
12 ;
13
14         .export         _dio_open,_dio_close
15         .export         sectsizetab
16         .import         __oserror
17         .importzp       ptr1,tmp1
18         .include        "atari.inc"
19
20
21 .bss
22
23 sectsizetab:
24         .res    NUMDRVS * sst_size
25
26 .code
27
28
29 .proc   _dio_open
30
31         cmp     #NUMDRVS        ; valid drive id?
32         bcs     _inv_drive
33         tay                     ; drive #
34         asl     a               ; make index from drive id
35         asl     a
36         tax
37         lda     #128            ; currently hardcoded (until I get an 815 :-)
38         sta     sectsizetab+sst_sectsize,x
39         sta     sectsizetab+sst_flag,x          ; set flag that drive is "open"
40         lda     #0
41         sta     sectsizetab+sst_sectsize+1,x
42         sta     __oserror                       ; success
43         tya
44         sta     sectsizetab+sst_driveno,x
45 ;       lda     #SSTIDVAL
46 ;       sta     sectsizetab+sst_id+1,x
47         stx     tmp1
48         lda     #<sectsizetab
49         clc
50         adc     tmp1
51         sta     tmp1
52         lda     #>sectsizetab
53         adc     #0
54         tax
55         lda     tmp1
56         rts
57
58 _inv_drive:
59         lda     #NONDEV         ; non-existent device
60         sta     __oserror
61         lda     #0
62         tax
63         rts                     ; return NULL
64
65 .endproc
66
67 .proc   _dio_close
68
69         sta     ptr1
70         stx     ptr1+1
71         lda     #0
72         ldy     #sst_flag
73         sta     (ptr1),y
74         sta     __oserror       ; success
75         tax
76         rts                     ; return no error
77
78 .endproc
79