1
0
mirror of https://github.com/cc65/cc65.git synced 2025-01-12 17:30:50 +00:00

renamed the functions; adapted them to the new parameters

git-svn-id: svn://svn.cc65.org/cc65/trunk@388 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
cpg 2000-10-20 21:59:05 +00:00
parent 99083a83db
commit 7eae698264
2 changed files with 90 additions and 54 deletions

View File

@ -1,51 +1,69 @@
; ;
; Christian Groessler, October 2000 ; Christian Groessler, October 2000
; ;
; this file provides the _dio_chs_to_snum function ; this file provides the _dio_phys_to_log function
; (previously called _dio_chs_to_snum, so the filename)
; ;
; on the Atari this function is a dummy, it ignores ; on the Atari this function is a dummy, it ignores
; cylinder and head 0 and returns as sector number the ; cylinder and head and returns as sector number the
; sector number it got ; sector number it got
; ;
; _sectnum_t __fastcall__ _dio_chs_to_snum(_dhandle_t handle, ; unsigned char __fastcall__ _dio_phys_to_log(_dhandle_t handle,
; unsigned int cyl, ; _dio_phys_pos *physpos, /* input */
; unsigned int head, ; _sectnum_t *sectnum); /* output */
; unsigned int sector); ;
; _dhandle_t - 16bit (ptr) ; _dhandle_t - 16bit (ptr)
; _sectnum_t - 16bit ; _sectnum_t - 16bit
; ;
.export __dio_chs_to_snum .export __dio_phys_to_log
.import addsp4,popax .import popax,__oserror
.importzp ptr1 .importzp ptr1,ptr2,ptr3
.include "atari.inc" .include "atari.inc"
.proc __dio_chs_to_snum .proc __dio_phys_to_log
pha ; save sector value sta ptr1
txa stx ptr1+1 ; pointer to result
pha
jsr addsp4 ; ignore other parameters
jsr popax jsr popax
sta ptr1 sta ptr2
stx ptr1+1 stx ptr2+1 ; pointer to input structure
jsr popax
sta ptr3
stx ptr3+1 ; pointer to handle
ldy #sst_flag ldy #sst_flag
lda (ptr1),y lda (ptr3),y
and #128 and #128
beq _inv_hand ; handle not open or invalid beq _inv_hand ; handle not open or invalid
pla ; ignore head and track and return the sector value
tay
pla ldy #diopp_sector
rts lda (ptr2),y
tax
iny
lda (ptr2),y
ldy #1
sta (ptr1),y
dey
txa
sta (ptr1),y
ldx #0
txa
ret:
sta __oserror
rts ; return success
; invalid handle
_inv_hand: _inv_hand:
pla ldx #0
pla lda #BADIOC
ldx #255 bne ret
txa
rts
.endproc .endproc

View File

@ -1,56 +1,74 @@
; ;
; Christian Groessler, October 2000 ; Christian Groessler, October 2000
; ;
; this file provides the _dio_snum_to_chs function ; 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 ; on the Atari this function is a dummy, it returns
; cylinder and head 0 and as sector the sectnum it got ; cylinder and head 0 and as sector the sectnum it got
; ;
; void __fastcall__ _dio_snum_to_chs(_dhandle_t handle, ; unsigned char __fastcall__ _dio_log_to_phys(_dhandle_t handle,
; _sectnum_t sect_num, ; _dio_phys_pos *physpos, /* output */
; unsigned int *cyl, ; _sectnum_t *sectnum); /* input */
; unsigned int *head, ;
; unsigned int *sector);
; _dhandle_t - 16bit (ptr) ; _dhandle_t - 16bit (ptr)
; _sectnum_t - 16bit ; _sectnum_t - 16bit
; ;
.export __dio_snum_to_chs .export __dio_log_to_phys
.include "atari.inc" .include "atari.inc"
.importzp ptr1,ptr2 .importzp ptr1,ptr2,ptr3
.import popax,addsp2 .import popax,__oserror
.proc __dio_snum_to_chs .proc __dio_log_to_phys
sta ptr1 sta ptr1
stx ptr1+1 ; save pointer to sector # stx ptr1+1 ; save pointer to input data
jsr popax ; get pointer to head
jsr popax
sta ptr2 sta ptr2
stx ptr2+1 stx ptr2+1 ; pointer to output structure
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 lda #0
tay tay
sta (ptr2),y ; set head number tax
sta (ptr2),y ; head
iny iny
sta (ptr2),y sta (ptr2),y ; track (low)
jsr popax ; get pointer to cyl iny
sta ptr2 sta (ptr2),y ; track (high)
stx ptr2+1
dey
tya
sta (ptr2),y ; set cylinder number
iny iny
sta (ptr2),y
jsr popax ; get sector #
dey lda (ptr1,x)
sta (ptr1),y sta (ptr2),y
iny iny
inc ptr1
bne _l1
inc ptr1+1
_l1: lda (ptr1,x)
sta (ptr2),y
ldx #0
txa txa
sta (ptr1),y ret:
sta __oserror
rts ; return success
jsr addsp2 ; invalid handle
rts _inv_hand:
ldx #0
lda #BADIOC
bne ret
.endproc .endproc