2000-10-12 21:02:50 +00:00
|
|
|
;
|
|
|
|
; Christian Groessler, October 2000
|
|
|
|
;
|
2000-10-20 21:59:05 +00:00
|
|
|
; this file provides the _dio_log_to_phys function
|
|
|
|
; (previously called _dio_snum_to_chs, so the filename)
|
2000-10-12 21:02:50 +00:00
|
|
|
;
|
|
|
|
; on the Atari this function is a dummy, it returns
|
|
|
|
; cylinder and head 0 and as sector the sectnum it got
|
|
|
|
;
|
2000-11-16 21:27:07 +00:00
|
|
|
; unsigned char __fastcall__ dio_log_to_phys(dhandle_t handle,
|
2013-05-09 11:56:54 +00:00
|
|
|
; unsigned *sectnum, /* input */
|
|
|
|
; dio_phys_pos *physpos); /* output */
|
2000-10-20 21:59:05 +00:00
|
|
|
;
|
2000-11-16 21:27:07 +00:00
|
|
|
; dhandle_t - 16bit (ptr)
|
2000-10-12 21:02:50 +00:00
|
|
|
;
|
|
|
|
|
2013-05-09 11:56:54 +00:00
|
|
|
.export _dio_log_to_phys
|
|
|
|
.include "atari.inc"
|
|
|
|
.importzp ptr1,ptr2,ptr3
|
|
|
|
.import popax,__oserror
|
2000-10-12 21:02:50 +00:00
|
|
|
|
2013-05-09 11:56:54 +00:00
|
|
|
.proc _dio_log_to_phys
|
2000-10-12 21:02:50 +00:00
|
|
|
|
2013-05-09 11:56:54 +00:00
|
|
|
sta ptr2
|
|
|
|
stx ptr2+1 ; pointer to output structure
|
2000-10-20 21:59:05 +00:00
|
|
|
|
2013-05-09 11:56:54 +00:00
|
|
|
jsr popax
|
|
|
|
sta ptr1
|
|
|
|
stx ptr1+1 ; save pointer to input data
|
2000-11-16 21:27:07 +00:00
|
|
|
|
2013-05-09 11:56:54 +00:00
|
|
|
jsr popax
|
|
|
|
sta ptr3
|
|
|
|
stx ptr3+1 ; pointer to handle
|
2000-10-20 21:59:05 +00:00
|
|
|
|
2013-05-09 11:56:54 +00:00
|
|
|
ldy #sst_flag
|
|
|
|
lda (ptr3),y
|
|
|
|
and #128
|
|
|
|
beq _inv_hand ; handle not open or invalid
|
2000-10-20 21:59:05 +00:00
|
|
|
|
2013-05-09 11:56:54 +00:00
|
|
|
lda #0
|
|
|
|
tay
|
|
|
|
tax
|
|
|
|
sta (ptr2),y ; head
|
|
|
|
iny
|
|
|
|
sta (ptr2),y ; track (low)
|
|
|
|
iny
|
|
|
|
sta (ptr2),y ; track (high)
|
|
|
|
iny
|
2000-10-20 21:59:05 +00:00
|
|
|
|
2013-05-09 11:56:54 +00:00
|
|
|
lda (ptr1,x)
|
|
|
|
sta (ptr2),y
|
|
|
|
iny
|
|
|
|
inc ptr1
|
|
|
|
bne _l1
|
|
|
|
inc ptr1+1
|
|
|
|
_l1: lda (ptr1,x)
|
|
|
|
sta (ptr2),y
|
2000-10-12 21:02:50 +00:00
|
|
|
|
2013-05-09 11:56:54 +00:00
|
|
|
txa
|
2000-10-20 21:59:05 +00:00
|
|
|
ret:
|
2013-05-09 11:56:54 +00:00
|
|
|
sta __oserror
|
|
|
|
rts ; return success
|
2000-10-12 21:02:50 +00:00
|
|
|
|
2000-10-20 21:59:05 +00:00
|
|
|
; invalid handle
|
2000-10-18 23:47:42 +00:00
|
|
|
|
2000-10-20 21:59:05 +00:00
|
|
|
_inv_hand:
|
2013-05-09 11:56:54 +00:00
|
|
|
ldx #0
|
|
|
|
lda #BADIOC
|
|
|
|
bne ret
|
2000-10-12 21:02:50 +00:00
|
|
|
|
|
|
|
.endproc
|
|
|
|
|