]> git.sur5r.net Git - cc65/blob - libsrc/atari/dio_stc.s
Merge remote-tracking branch 'upstream/master'
[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 ;                                            unsigned *sectnum,         /* input */
12 ;                                            dio_phys_pos *physpos);    /* output */
13 ;
14 ; dhandle_t - 16bit (ptr)
15 ;
16
17         .export         _dio_log_to_phys
18         .include        "atari.inc"
19         .importzp       ptr1,ptr2,ptr3
20         .import         popax,__oserror
21
22 .proc   _dio_log_to_phys
23
24         sta     ptr2
25         stx     ptr2+1          ; pointer to output structure
26
27         jsr     popax
28         sta     ptr1
29         stx     ptr1+1          ; save pointer to input data
30
31         jsr     popax
32         sta     ptr3
33         stx     ptr3+1          ; pointer to handle
34
35         ldy     #sst_flag
36         lda     (ptr3),y
37         and     #128
38         beq     _inv_hand       ; handle not open or invalid
39
40         lda     #0
41         tay
42         tax
43         sta     (ptr2),y        ; head
44         iny
45         sta     (ptr2),y        ; track (low)
46         iny
47         sta     (ptr2),y        ; track (high)
48         iny
49
50         lda     (ptr1,x)
51         sta     (ptr2),y
52         iny
53         inc     ptr1
54         bne     _l1
55         inc     ptr1+1
56 _l1:    lda     (ptr1,x)
57         sta     (ptr2),y
58
59         txa
60 ret:
61         sta     __oserror
62         rts                     ; return success
63
64 ; invalid handle
65
66 _inv_hand:
67         ldx     #0
68         lda     #BADIOC
69         bne     ret
70
71 .endproc
72