File: dio_stc.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 (70 lines) | stat: -rw-r--r-- 1,673 bytes parent folder | download | duplicates (2)
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
69
70
;
; Christian Groessler, October 2000
;
; this file provides the _dio_log_to_phys function
; (previously called _dio_snum_to_chs, so the filename)
;
; on the Atari this function is a dummy, it returns
; cylinder and head 0 and as sector the sectnum it got
;
; unsigned char __fastcall__ dio_log_to_phys(dhandle_t handle,
;                                            unsigned *sectnum,         /* input */
;                                            dio_phys_pos *physpos);    /* output */
;
; dhandle_t - 16bit (ptr)
;

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

.proc   _dio_log_to_phys

        sta     ptr2
        stx     ptr2+1          ; pointer to output structure

        jsr     popptr1         ; save pointer to input data

        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

        lda     #0
        tay
        tax
        sta     (ptr2),y        ; head
        iny
        sta     (ptr2),y        ; track (low)
        iny
        sta     (ptr2),y        ; track (high)
        iny

        lda     (ptr1,x)
        sta     (ptr2),y
        iny
        inc     ptr1
        bne     _l1
        inc     ptr1+1
_l1:    lda     (ptr1,x)
        sta     (ptr2),y

        txa
ret:
        sta     __oserror
        rts                     ; return success

; invalid handle

_inv_hand:
        ldx     #0
        lda     #BADIOC
        bne     ret

.endproc