File: dio_cts.s

package info (click to toggle)
cc65 2.19-2
  • links: PTS
  • area: main
  • in suites: forky, sid, trixie
  • size: 20,268 kB
  • sloc: ansic: 117,151; asm: 66,339; pascal: 4,248; makefile: 1,009; perl: 607
file content (68 lines) | stat: -rw-r--r-- 1,600 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
;
; Christian Groessler, October 2000
;
; this file provides the _dio_phys_to_log function
; (previously called _dio_chs_to_snum, so the filename)
;
; on the Atari this function is a dummy, it ignores
; cylinder and head and returns as sector number the
; sector number it got
;
; unsigned char __fastcall__ dio_phys_to_log(dhandle_t handle,
;                                            dio_phys_pos *physpos,     /* input */
;                                            unsigned *sectnum);        /* output */
;
; dhandle_t - 16bit (ptr)
;

        .export         _dio_phys_to_log
        .import         popax,__oserror
        .importzp       ptr1,ptr2,ptr3
        .include        "atari.inc"

.proc   _dio_phys_to_log

        sta     ptr1
        stx     ptr1+1          ; pointer to result

        jsr     popax
        sta     ptr2
        stx     ptr2+1          ; pointer to input structure

        jsr     popax
        sta     ptr3
        stx     ptr3+1          ; pointer to handle

        ldy     #sst_flag
        lda     (ptr3),y
        and     #128
        beq     _inv_hand       ; handle not open or invalid

; ignore head and track and return the sector value

        ldy     #diopp_sector
        lda     (ptr2),y
        tax
        iny
        lda     (ptr2),y
        ldy     #1
        sta     (ptr1),y
        dey
        txa
        sta     (ptr1),y

        ldx     #0
        txa
ret:
        sta     __oserror
        rts                     ; return success

; invalid handle

_inv_hand:
        ldx     #0
        lda     #BADIOC
        bne     ret

.endproc