Merge pull request #595 from greg-king5/geo-dio

Fix sector-number conversions in the CBM GEOS DIO code.
This commit is contained in:
Oliver Schmidt
2018-02-24 10:54:26 +00:00
committed by GitHub
6 changed files with 38 additions and 27 deletions

View File

@@ -1,6 +1,6 @@
; ;
; Maciej 'YTM/Elysium' Witkowiak ; 2001-07-02, Maciej 'YTM/Elysium' Witkowiak
; 2.7.2001 ; 2015-08-26, Greg King
; ;
; ;
; unsigned char __fastcall__ dio_phys_to_log (dhandle_t handle, ; unsigned char __fastcall__ dio_phys_to_log (dhandle_t handle,
@@ -59,7 +59,7 @@ _dio_phys_to_log:
lda (ptr3),y lda (ptr3),y
tay tay
lda driveType,y lda driveType,y
and #%00000011 ; this is for RamDrive compatibility and #%00001111 ; remove ramDisk flags
cmp #DRV_1541 cmp #DRV_1541
beq dio_cts1541 beq dio_cts1541
cmp #DRV_1571 cmp #DRV_1571
@@ -67,7 +67,7 @@ _dio_phys_to_log:
cmp #DRV_1581 cmp #DRV_1581
beq dio_cts1581 beq dio_cts1581
lda #DEV_NOT_FOUND ; unknown device lda #INCOMPATIBLE ; unsupported device
ldx #0 ldx #0
beq ret beq ret
@@ -91,7 +91,7 @@ _inv_data:
lda #INV_TRACK lda #INV_TRACK
.byte $2c .byte $2c
_inv_hand: _inv_hand:
lda #INCOMPATIBLE lda #DEV_NOT_FOUND
ldx #0 ldx #0
beq ret beq ret

View File

@@ -1,8 +1,8 @@
; ;
; Maciej 'YTM/Elysium' Witkowiak ; 2001-07-02, Maciej 'YTM/Elysium' Witkowiak
; 2015-08-24, Greg King
; ;
; based on Atari version by Christian Groessler ; based on Atari version by Christian Groessler
; 2.7.2001
; ;
; dhandle_t __fastcall__ dio_open (unsigned char device); ; dhandle_t __fastcall__ dio_open (unsigned char device);
; unsigned char __fastcall__ dio_close (dhandle_t handle); ; unsigned char __fastcall__ dio_close (dhandle_t handle);
@@ -27,11 +27,13 @@ sectsizetab:
.code .code
_dio_open: _dio_open:
pha cmp #4
bcs _inv_drive
tax tax
lda driveType,x ; check if there's a device lda driveType,x ; check if there's a device
beq _inv_drive beq _inv_drive
txa txa
pha
clc clc
adc #8 ; normalize devnum adc #8 ; normalize devnum
sta curDevice sta curDevice

View File

@@ -1,6 +1,6 @@
; ;
; Maciej 'YTM/Elysium' Witkowiak ; 2001-07-02, Maciej 'YTM/Elysium' Witkowiak
; 2.7.2001 ; 2015-08-27, Greg King
; ;
; this file provides the _dio_read function ; this file provides the _dio_read function
; ;
@@ -15,7 +15,9 @@
_dio_read: _dio_read:
jsr dio_params jsr dio_params
tay
bne err
jsr ReadBlock jsr ReadBlock
stx __oserror stx __oserror
txa txa
rts err: rts

View File

@@ -1,6 +1,6 @@
; ;
; Maciej 'YTM/Elysium' Witkowiak ; 2001-07-02, Maciej 'YTM/Elysium' Witkowiak
; 2.7.2001 ; 2015-08-27, Greg King
; ;
; unsigned char __fastcall__ dio_log_to_phys (dhandle_t handle, ; unsigned char __fastcall__ dio_log_to_phys (dhandle_t handle,
; unsigned *sectnum, /* input */ ; unsigned *sectnum, /* input */
@@ -55,7 +55,7 @@ _dio_log_to_phys:
lda (ptr3),y lda (ptr3),y
tay tay
lda driveType,y lda driveType,y
and #%00000011 ; this is for RamDrive compatibility and #%00001111 ; remove ramDisk flags
cmp #DRV_1541 cmp #DRV_1541
beq dio_stc1541 beq dio_stc1541
cmp #DRV_1571 cmp #DRV_1571
@@ -63,7 +63,7 @@ _dio_log_to_phys:
cmp #DRV_1581 cmp #DRV_1581
beq dio_stc1581 beq dio_stc1581
lda #DEV_NOT_FOUND ; unknown device lda #INCOMPATIBLE ; unsupported device
ldx #0 ldx #0
beq _ret beq _ret
@@ -86,7 +86,7 @@ _inv_data:
lda #INV_TRACK lda #INV_TRACK
.byte $2c .byte $2c
_inv_hand: _inv_hand:
lda #INCOMPATIBLE lda #DEV_NOT_FOUND
ldx #0 ldx #0
beq _ret beq _ret
@@ -102,8 +102,8 @@ _loop41:
bne _nxt bne _nxt
lda tmp1 lda tmp1
cmp sectab_1541_l+1,x cmp sectab_1541_l+1,x
bcc _found _nxt: bcc _found
_nxt: inx inx
cpx #35 cpx #35
bne _loop41 bne _loop41
beq _inv_data beq _inv_data
@@ -124,12 +124,11 @@ dio_stc1571:
; - fall down to 1541 ; - fall down to 1541
lda tmp2 lda tmp2
cmp #>683 cmp #>683
bne _cnt71 bne _if71
lda tmp1 lda tmp1
cmp #<683 cmp #<683
bcc dio_stc1541 _if71: bcc dio_stc1541
_cnt71:
lda tmp1 lda tmp1
sec sec
sbc #<683 sbc #<683
@@ -138,6 +137,8 @@ _cnt71:
sbc #>683 sbc #>683
sta tmp2 sta tmp2
jsr dio_stc1541 ; will fall through here jsr dio_stc1541 ; will fall through here
tay
bne _ret ; result beyond track 70
ldy #diopp_track ldy #diopp_track
lda (ptr1),y lda (ptr1),y
@@ -166,7 +167,7 @@ _sub81: lda tmp1
sbc #0 sbc #0
sta tmp2 sta tmp2
inx inx
cpx #81 cpx #80
bne _loop81 bne _loop81
beq _inv_data beq _inv_data

View File

@@ -1,6 +1,6 @@
; ;
; Maciej 'YTM/Elysium' Witkowiak ; 2001-07-02, Maciej 'YTM/Elysium' Witkowiak
; 2.7.2001 ; 2015-08-27, Greg King
; ;
; this file provides the _dio_write function ; this file provides the _dio_write function
; ;
@@ -15,5 +15,9 @@
_dio_write: _dio_write:
jsr dio_params jsr dio_params
tay
bne err
jsr WriteBlock jsr WriteBlock
jmp setoserror jmp setoserror
err: rts

View File

@@ -1,6 +1,6 @@
; ;
; Maciej 'YTM/Elysium' Witkowiak ; 2001-07-02, Maciej 'YTM/Elysium' Witkowiak
; 2.7.2001 ; 2015-08-27, Greg King
; ;
; this file provides the _dio_write function ; this file provides the _dio_write function
; ;
@@ -15,7 +15,9 @@
_dio_write_verify: _dio_write_verify:
jsr dio_params jsr dio_params
tay
bne err
jsr VerWriteBlock jsr VerWriteBlock
stx __oserror stx __oserror
txa txa
rts err: rts