]> git.sur5r.net Git - cc65/blob - libsrc/atari/dio_stc.s
renamed the functions; adapted them to the new parameters
[cc65] / libsrc / atari / dio_stc.s
1 ;
2 ; Christian Groessler, October 2000
3 ;
4 ; this file provides the _dio_log_to_phys function
5 ; (previously called _dio_snum_to_chs, so the filename)
6 ;
7 ; on the Atari this function is a dummy, it returns
8 ; cylinder and head 0 and as sector the sectnum it got
9 ;
10 ; unsigned char __fastcall__ _dio_log_to_phys(_dhandle_t handle,
11 ;                                             _dio_phys_pos *physpos,   /* output */
12 ;                                             _sectnum_t *sectnum);     /* input */
13 ;
14 ; _dhandle_t - 16bit (ptr)
15 ; _sectnum_t - 16bit
16 ;
17
18         .export         __dio_log_to_phys
19         .include        "atari.inc"
20         .importzp       ptr1,ptr2,ptr3
21         .import         popax,__oserror
22
23 .proc   __dio_log_to_phys
24
25         sta     ptr1
26         stx     ptr1+1          ; save pointer to input data
27
28         jsr     popax
29         sta     ptr2
30         stx     ptr2+1          ; pointer to output 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         lda     #0
42         tay
43         tax
44         sta     (ptr2),y        ; head
45         iny
46         sta     (ptr2),y        ; track (low)
47         iny
48         sta     (ptr2),y        ; track (high)
49         iny
50
51         lda     (ptr1,x)
52         sta     (ptr2),y
53         iny
54         inc     ptr1
55         bne     _l1
56         inc     ptr1+1
57 _l1:    lda     (ptr1,x)
58         sta     (ptr2),y
59
60         ldx     #0
61         txa
62 ret:
63         sta     __oserror
64         rts                     ; return success
65
66 ; invalid handle
67
68 _inv_hand:
69         ldx     #0
70         lda     #BADIOC
71         bne     ret
72
73 .endproc
74