]> git.sur5r.net Git - cc65/blob - libsrc/atari/dio_cts.s
always use setcursor to update cursor settings
[cc65] / libsrc / atari / dio_cts.s
1 ;
2 ; Christian Groessler, October 2000
3 ;
4 ; this file provides the _dio_phys_to_log function
5 ; (previously called _dio_chs_to_snum, so the filename)
6 ;
7 ; on the Atari this function is a dummy, it ignores
8 ; cylinder and head and returns as sector number the
9 ; sector number it got
10 ;
11 ; unsigned char __fastcall__ dio_phys_to_log(dhandle_t handle,
12 ;                                            dio_phys_pos *physpos,     /* input */
13 ;                                            sectnum_t *sectnum);       /* output */
14 ;
15 ; dhandle_t - 16bit (ptr)
16 ; sectnum_t - 16bit
17 ;
18
19         .export         _dio_phys_to_log
20         .import         popax,__oserror
21         .importzp       ptr1,ptr2,ptr3
22         .include        "atari.inc"
23
24 .proc   _dio_phys_to_log
25
26         sta     ptr1
27         stx     ptr1+1          ; pointer to result
28
29         jsr     popax
30         sta     ptr2
31         stx     ptr2+1          ; pointer to input structure
32
33         jsr     popax
34         sta     ptr3
35         stx     ptr3+1          ; pointer to handle
36
37         ldy     #sst_flag
38         lda     (ptr3),y
39         and     #128
40         beq     _inv_hand       ; handle not open or invalid
41
42 ; ignore head and track and return the sector value
43
44         ldy     #diopp_sector
45         lda     (ptr2),y
46         tax
47         iny
48         lda     (ptr2),y
49         ldy     #1
50         sta     (ptr1),y
51         dey
52         txa
53         sta     (ptr1),y
54
55         ldx     #0
56         txa
57 ret:
58         sta     __oserror
59         rts                     ; return success
60
61 ; invalid handle
62
63 _inv_hand:
64         ldx     #0
65         lda     #BADIOC
66         bne     ret
67
68 .endproc
69