]> git.sur5r.net Git - cc65/blob - libsrc/atari/dio_cts.s
Removed (pretty inconsistently used) tab chars from source code base.
[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 ;                                            unsigned *sectnum);        /* output */
14 ;
15 ; dhandle_t - 16bit (ptr)
16 ;
17
18         .export         _dio_phys_to_log
19         .import         popax,__oserror
20         .importzp       ptr1,ptr2,ptr3
21         .include        "atari.inc"
22
23 .proc   _dio_phys_to_log
24
25         sta     ptr1
26         stx     ptr1+1          ; pointer to result
27
28         jsr     popax
29         sta     ptr2
30         stx     ptr2+1          ; pointer to input structure
31
32         jsr     popax
33         sta     ptr3
34         stx     ptr3+1          ; pointer to handle
35
36         ldy     #sst_flag
37         lda     (ptr3),y
38         and     #128
39         beq     _inv_hand       ; handle not open or invalid
40
41 ; ignore head and track and return the sector value
42
43         ldy     #diopp_sector
44         lda     (ptr2),y
45         tax
46         iny
47         lda     (ptr2),y
48         ldy     #1
49         sta     (ptr1),y
50         dey
51         txa
52         sta     (ptr1),y
53
54         ldx     #0
55         txa
56 ret:
57         sta     __oserror
58         rts                     ; return success
59
60 ; invalid handle
61
62 _inv_hand:
63         ldx     #0
64         lda     #BADIOC
65         bne     ret
66
67 .endproc
68