HDD: Fixed SmartPort return address wrong when crossing page + some space-saving optimisations (Fixes #319)

This commit is contained in:
tomcw 2019-10-05 17:01:35 +01:00
parent 31b78aa09a
commit 94926b4f55
3 changed files with 12 additions and 21 deletions

Binary file not shown.

View File

@ -34,6 +34,7 @@
; . GH#370 (Robert Hoem, 27 Oct 2016): ; . GH#370 (Robert Hoem, 27 Oct 2016):
; . Added a check against open-apple during boot to route boot to slot 6 ; . Added a check against open-apple during boot to route boot to slot 6
; . This happens after the first two blocks are loaded from the HD. ; . This happens after the first two blocks are loaded from the HD.
; . GH#319: smartport return address wrong when crossing page
; TODO: ; TODO:
; . Make code relocatable (so HDD controller card can go into any slot) ; . Make code relocatable (so HDD controller card can go into any slot)
; . Remove support for Entrypoint_C746 (old AppleWin) & Entrypoint_C761 (Apple Oasis) ; . Remove support for Entrypoint_C746 (old AppleWin) & Entrypoint_C761 (Apple Oasis)
@ -108,14 +109,7 @@ Bootstrap
; error capturing code. Applewin is picky ; error capturing code. Applewin is picky
; about code assigning data to registers and ; about code assigning data to registers and
; memory. The safest method is via I/O port ; memory. The safest method is via I/O port
pha ror hd_error ; Post: C=0 or 1
lda hd_error
clc
cmp #1
bne noerr0
sec
noerr0
pla
bcc hdboot bcc hdboot
; no image ready, boot diskette image instead ; no image ready, boot diskette image instead
@ -129,12 +123,14 @@ BootSlot6
SmartPort SmartPort
pla pla
sta $46 sta $46
adc #3 ; Pre: C=0, Post: C=0 or 1
tay
pla pla
sta $47 ; ($47) = &cmd_hdr sta $47 ; ($46) = &cmd_hdr
adc #0
pha pha
lda $46 tya
adc #3 ; Pre: C=0, Post: assume C=0 pha ; (sp).w += 3
pha ; (sp).w += 3
ldy #1 ldy #1
lda ($46),y ; cmd lda ($46),y ; cmd
@ -143,7 +139,7 @@ SmartPort
bne SmartPort2 bne SmartPort2
;====================================== ;======================================
; 2 unused bytes ; 8 unused bytes
*= $c746 ; org $c746 *= $c746 ; org $c746
@ -237,12 +233,7 @@ cmdproc
bne skipSread bne skipSread
jsr sread jsr sread
skipSread skipSread
lda hd_error ror hd_error ; Post: C=0 or 1
clc
cmp #1
bne noerr2
sec
noerr2
pla pla
rts rts
@ -253,7 +244,7 @@ noerr2
; the emulated code increments the buffer by 1 on each read) to (memblock),y ; the emulated code increments the buffer by 1 on each read) to (memblock),y
; increment memblock+1 and read the second 256 bytes via hd_nextbyte. ; increment memblock+1 and read the second 256 bytes via hd_nextbyte.
; ;
; if I could figure out how to consistantly get applewin to update it's memory regions all ; if I could figure out how to consistently get applewin to update it's memory regions all
; this code can be moved into the emulation code (although, this is how I'd build the hardware ; this code can be moved into the emulation code (although, this is how I'd build the hardware
; anyway...) ; anyway...)
@ -299,7 +290,7 @@ SmartPort3
bne cmdproc bne cmdproc
;====================================== ;======================================
; 12 unused bytes ; 18 unused bytes
!zone data !zone data

Binary file not shown.