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
69 lda #DEV_NOT_FOUND ; unknown device
98 ; - compare with table to find track
99 ; - subtract and find sector
101 ldx #0 ; index=(track-1)
104 cmp sectab_1541_h+1,x
107 cmp sectab_1541_l+1,x
126 ; - check size, if too big - subtract and add 35 to track
127 ; - fall down to 1541
143 jsr dio_stc1541 ; will fall through here
154 ; - subtract 40 in loop (at most 80 times) to find track
155 ; - the remainder is sector
157 ldx #0 ; index=(track-1)