Normalized coding style.
git-svn-id: svn://svn.cc65.org/cc65/trunk@5494 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
@@ -11,91 +11,92 @@
|
||||
; sectnum_t - 16bit
|
||||
;
|
||||
|
||||
.export _dio_phys_to_log
|
||||
.export sectab_1541_l, sectab_1541_h ; for log_to_phys
|
||||
.import popax,__oserror
|
||||
.importzp ptr1,ptr2,ptr3,tmp1,tmp2,tmp3,tmp4
|
||||
.include "dio.inc"
|
||||
.include "geossym.inc"
|
||||
.include "const.inc"
|
||||
.export _dio_phys_to_log
|
||||
.export sectab_1541_l, sectab_1541_h ; for log_to_phys
|
||||
.import popax,__oserror
|
||||
.importzp ptr1,ptr2,ptr3,tmp1,tmp2,tmp3,tmp4
|
||||
|
||||
.proc _dio_phys_to_log
|
||||
sta ptr1
|
||||
stx ptr1+1 ; pointer to result
|
||||
.include "dio.inc"
|
||||
.include "geossym.inc"
|
||||
.include "const.inc"
|
||||
|
||||
jsr popax
|
||||
sta ptr2
|
||||
stx ptr2+1 ; pointer to input 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
|
||||
|
||||
|
||||
ldy #diopp_head
|
||||
lda (ptr2),y
|
||||
bne _inv_data ; there is only head 0
|
||||
ldy #diopp_track
|
||||
lda (ptr2),y
|
||||
beq _inv_data ; there is no track 0
|
||||
sta tmp1
|
||||
_dio_phys_to_log:
|
||||
sta ptr1
|
||||
stx ptr1+1 ; pointer to result
|
||||
|
||||
jsr popax
|
||||
sta ptr2
|
||||
stx ptr2+1 ; pointer to input 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
|
||||
|
||||
|
||||
ldy #diopp_head
|
||||
lda (ptr2),y
|
||||
bne _inv_data ; there is only head 0
|
||||
ldy #diopp_track
|
||||
lda (ptr2),y
|
||||
beq _inv_data ; there is no track 0
|
||||
sta tmp1
|
||||
iny
|
||||
lda (ptr2),y
|
||||
bne _inv_data ; there are no more than 256 tracks
|
||||
dec tmp1 ; normalize track to start from 0
|
||||
ldy #diopp_sector
|
||||
lda (ptr2),y
|
||||
sta tmp2
|
||||
lda (ptr2),y
|
||||
bne _inv_data ; there are no more than 256 tracks
|
||||
dec tmp1 ; normalize track to start from 0
|
||||
ldy #diopp_sector
|
||||
lda (ptr2),y
|
||||
sta tmp2
|
||||
iny
|
||||
lda (ptr2),y
|
||||
bne _inv_data ; there are no more than 256 sectors
|
||||
lda (ptr2),y
|
||||
bne _inv_data ; there are no more than 256 sectors
|
||||
|
||||
; tmp1 (int) holds track+sector, translate it using device info
|
||||
|
||||
ldy #sst_driveno
|
||||
lda (ptr3),y
|
||||
ldy #sst_driveno
|
||||
lda (ptr3),y
|
||||
tay
|
||||
lda driveType,y
|
||||
and #%00000011 ; this is for RamDrive compatibility
|
||||
cmp #DRV_1541
|
||||
beq dio_cts1541
|
||||
cmp #DRV_1571
|
||||
beq dio_cts1571
|
||||
cmp #DRV_1581
|
||||
beq dio_cts1581
|
||||
|
||||
lda #DEV_NOT_FOUND ; unknown device
|
||||
ldx #0
|
||||
beq ret
|
||||
lda driveType,y
|
||||
and #%00000011 ; this is for RamDrive compatibility
|
||||
cmp #DRV_1541
|
||||
beq dio_cts1541
|
||||
cmp #DRV_1571
|
||||
beq dio_cts1571
|
||||
cmp #DRV_1581
|
||||
beq dio_cts1581
|
||||
|
||||
lda #DEV_NOT_FOUND ; unknown device
|
||||
ldx #0
|
||||
beq ret
|
||||
|
||||
dio_ctsend:
|
||||
ldy #1
|
||||
lda tmp2
|
||||
sta (ptr1),y
|
||||
ldy #1
|
||||
lda tmp2
|
||||
sta (ptr1),y
|
||||
dey
|
||||
lda tmp1
|
||||
sta (ptr1),y
|
||||
|
||||
ldx #0
|
||||
lda tmp1
|
||||
sta (ptr1),y
|
||||
|
||||
ldx #0
|
||||
txa
|
||||
ret:
|
||||
sta __oserror
|
||||
ret:
|
||||
sta __oserror
|
||||
rts ; return success
|
||||
|
||||
; errors
|
||||
|
||||
_inv_data:
|
||||
lda #INV_TRACK
|
||||
lda #INV_TRACK
|
||||
.byte $2c
|
||||
_inv_hand:
|
||||
lda #INCOMPATIBLE
|
||||
ldx #0
|
||||
beq ret
|
||||
lda #INCOMPATIBLE
|
||||
ldx #0
|
||||
beq ret
|
||||
|
||||
; device-depended stuff, tmp1=track-1, tmp2=sector
|
||||
|
||||
@@ -145,23 +146,23 @@ dio_cts1581:
|
||||
bcs _inv_data
|
||||
|
||||
; mul40 by Christian Groessler
|
||||
sta tmp4
|
||||
asl a
|
||||
rol tmp3
|
||||
asl a
|
||||
rol tmp3 ; val * 4
|
||||
adc tmp4
|
||||
bcc L1
|
||||
inc tmp3 ; val * 5
|
||||
L1: asl a
|
||||
rol tmp3 ; val * 10
|
||||
asl a
|
||||
rol tmp3
|
||||
asl a
|
||||
rol tmp3 ; val * 40 = AX
|
||||
ldx tmp3
|
||||
sta tmp3
|
||||
stx tmp4
|
||||
sta tmp4
|
||||
asl a
|
||||
rol tmp3
|
||||
asl a
|
||||
rol tmp3 ; val * 4
|
||||
adc tmp4
|
||||
bcc L1
|
||||
inc tmp3 ; val * 5
|
||||
L1: asl a
|
||||
rol tmp3 ; val * 10
|
||||
asl a
|
||||
rol tmp3
|
||||
asl a
|
||||
rol tmp3 ; val * 40 = AX
|
||||
ldx tmp3
|
||||
sta tmp3
|
||||
stx tmp4
|
||||
|
||||
_nomult:
|
||||
lda tmp2
|
||||
@@ -173,19 +174,17 @@ _nomult:
|
||||
sta tmp2
|
||||
jmp dio_ctsend
|
||||
|
||||
.endproc
|
||||
|
||||
.rodata
|
||||
|
||||
sectab_1541_l:
|
||||
.byte $00, $15, $2a, $3f, $54, $69, $7e, $93
|
||||
.byte $a8, $bd, $d2, $e7, $fc, $11, $26, $3b
|
||||
.byte $50, $65, $78, $8b, $9e, $b1, $c4, $d7
|
||||
.byte $ea, $fc, $0e, $20, $32, $44, $56, $67
|
||||
.byte $78, $89, $9a, $ab
|
||||
.byte $00, $15, $2a, $3f, $54, $69, $7e, $93
|
||||
.byte $a8, $bd, $d2, $e7, $fc, $11, $26, $3b
|
||||
.byte $50, $65, $78, $8b, $9e, $b1, $c4, $d7
|
||||
.byte $ea, $fc, $0e, $20, $32, $44, $56, $67
|
||||
.byte $78, $89, $9a, $ab
|
||||
sectab_1541_h:
|
||||
.byte $00, $00, $00, $00, $00, $00, $00, $00
|
||||
.byte $00, $00, $00, $00, $00, $01, $01, $01
|
||||
.byte $01, $01, $01, $01, $01, $01, $01, $01
|
||||
.byte $01, $01, $02, $02, $02, $02, $02, $02
|
||||
.byte $02, $02, $02, $02
|
||||
.byte $00, $00, $00, $00, $00, $00, $00, $00
|
||||
.byte $00, $00, $00, $00, $00, $01, $01, $01
|
||||
.byte $01, $01, $01, $01, $01, $01, $01, $01
|
||||
.byte $01, $01, $02, $02, $02, $02, $02, $02
|
||||
.byte $02, $02, $02, $02
|
||||
|
||||
Reference in New Issue
Block a user