2 ; Maciej 'YTM/Elysium' Witkowiak
5 ; unsigned char __fastcall__ dio_log_to_phys (dhandle_t handle,
6 ; unsigned *sectnum, /* input */
7 ; dio_phys_pos *physpos); /* output */
10 .export _dio_log_to_phys
11 .importzp ptr1,ptr2,ptr3,tmp1,tmp2
12 .import popax,__oserror
13 .import sectab_1541_l, sectab_1541_h
16 .include "geossym.inc"
22 stx ptr1+1 ; pointer to result (struct dio_phys_pos)
26 stx ptr2+1 ; pointer to input structure (pointer to int)
30 stx ptr3+1 ; pointer to handle
35 beq _inv_hand ; handle not open or invalid
42 sta (ptr1),y ; track <256
44 sta (ptr1),y ; sector <256
58 and #%00000011 ; this is for RamDrive compatibility
66 lda #DEV_NOT_FOUND ; unknown device
95 ; - compare with table to find track
96 ; - subtract and find sector
98 ldx #0 ; index=(track-1)
101 cmp sectab_1541_h+1,x
104 cmp sectab_1541_l+1,x
123 ; - check size, if too big - subtract and add 35 to track
124 ; - fall down to 1541
140 jsr dio_stc1541 ; will fall through here
151 ; - subtract 40 in loop (at most 80 times) to find track
152 ; - the remainder is sector
154 ldx #0 ; index=(track-1)