]> git.sur5r.net Git - cc65/blob - libsrc/atari/dio_stc.s
DEFAULT_DEVICE; replaced some spaces with tabs
[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 ;                                            sectnum_t *sectnum,        /* input */
12 ;                                            dio_phys_pos *physpos);    /* output */
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     ptr2
26         stx     ptr2+1          ; pointer to output structure
27
28         jsr     popax
29         sta     ptr1
30         stx     ptr1+1          ; save pointer to input data
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         txa
61 ret:
62         sta     __oserror
63         rts                     ; return success
64
65 ; invalid handle
66
67 _inv_hand:
68         ldx     #0
69         lda     #BADIOC
70         bne     ret
71
72 .endproc
73