2 ; Maciej 'YTM/Elysium' Witkowiak
5 ; unsigned char __fastcall__ dio_log_to_phys(dhandle_t handle,
6 ; sectnum_t *sectnum, /* input */
7 ; dio_phys_pos *physpos); /* output */
9 ; dhandle_t - 16bit (ptr)
13 .export _dio_log_to_phys
14 .importzp ptr1,ptr2,ptr3,tmp1,tmp2
15 .import popax,__oserror
16 .import sectab_1541_l, sectab_1541_h
17 .include "../inc/dio.inc"
18 .include "../inc/geossym.inc"
19 .include "../inc/const.inc"
21 .proc _dio_log_to_phys
25 stx ptr1+1 ; pointer to result (struct dio_phys_pos)
29 stx ptr2+1 ; pointer to input structure (pointer to int)
33 stx ptr3+1 ; pointer to handle
38 beq _inv_hand ; handle not open or invalid
45 sta (ptr1),y ; track <256
47 sta (ptr1),y ; sector <256
61 and #%00000011 ; this is for RamDrive compatibility
96 ; - compare with table to find track
97 ; - subtract and find sector
99 ldx #0 ; index=(track-1)
102 cmp sectab_1541_h+1,x
105 cmp sectab_1541_l+1,x
124 ; - check size, if too big - subtract and add 35 to track
125 ; - fall down to 1541
141 jsr dio_stc1541 ; will fall through here
152 ; - subtract 40 in loop (at most 80 times) to find track
153 ; - the remainder is sector
155 ldx #0 ; index=(track-1)