Yes Godzil. I tried with four different disks. Same problem. Silicebit also had problems with Pushing the Envelope, so it is a quite repeatable issue.
I have some news (rather good, I think). I decided to put some color bars on the bottom trying to detect the place where the bootloader was getting stuck. I altered the microdisc boot code as this: (COLOR is a macro - the same that appears in the loader.asm file).
Code: Select all
;
; Read sector data
;
ldy #4
sty retry_counter
read_sectors_loop
readretryloop
nop
nop
nop
read_one_sector
;
; Check if we are on the correct track already and if not
; then send a SEEK command to the FDC to move the head to
; the correct track.
;
ldx #loader_track_position
cpx FDC_track_register
beq track_ok
COLOR(1)
; Write the track number in the FDC data register
stx FDC_data
wait_drive2
lda FDC_drq ; We are waiting for the drive maybe not useful if drive is ready after the eprom boot
bmi wait_drive2
;
; Send a SEEK command (change track)
;
lda #CMD_Seek
sta FDC_command_register
;
; Command words should only be loaded in the Command Register when the Busy status bit is off (Status bit 0). The one exception is the Force Interrupt command.
; Whenever a command is being executed, the Busy status bit is set.
; When a command is completed, an interrupt is generated and the busy status bit is reset.
; The Status Register indicates whethter the completed command encountered an error or was fault free. For ease of discussion, commands are divided into four types (I, II, III, IV).
ldy #4
r_wait_completion
dey
bne r_wait_completion
r2_wait_completion
lda FDC_status_register
lsr
bcs r2_wait_completion
asl
track_ok
COLOR(2)
; Write the sector number in the FDC sector register
__auto__sector_index
lda #loader_sector_position
sta FDC_sector_register ;
; Interdire les IRQ du fdc ICI !
;lda #%10000101 ; on force les le Microdisk en side0, drive A ... Set le bit de données !!!
lda #%10000100 ; on force les le Microdisk en side0, drive A ... Set le bit de données !!!
sta FDC_flags
;
; Send a READSECTOR command
;
lda #CMD_ReadSector
sta FDC_command_register
ldy #wait_status_floppy
waitcommand
nop ; Not useful but for old Floppy drive maybe
nop ; Not useful but for old Floppy drive maybe
dey
bne waitcommand
COLOR(3)
;
; Read the sector data
;
ldy #0
fetch_bytes_from_FDC
lda FDC_drq
bmi fetch_bytes_from_FDC
lda FDC_data
__auto_write_address
sta location_loader,y
iny
bne fetch_bytes_from_FDC
; Done loading the sector
lda FDC_status_register
and #$1C
beq sector_OK
dec retry_counter
bne readretryloop
COLOR(4)
sector_OK
inc __auto__sector_index+1
inc __auto_write_address+2
dec sector_counter
bne read_sectors_loop
COLOR(6)
;
; Data successfully loader (we hope)
;
sei
lda #%10000001 ; Disable the FDC (Eprom select + FDC Interrupt request)
sta FDC_flags
ldx #FDC_OFFSET_MICRODISC
jmp location_loader
Guess what happened? Yes. It worked. I reset a lot of times and it booted properly all of them but once, where it got stuck with a green bar. I guess in this loop:
Code: Select all
fetch_bytes_from_FDC
lda FDC_drq
bmi fetch_bytes_from_FDC
I also experienced a loading error later in the game once, but those are very rare I think. Certainly the loading code is not very robust when there are read errors, but that is a minor thing.
Basically the pha,lda,sta,pla set is adding enough cycles at the precise moment to allow the FDD to perform the operation or something like that.
As Barbitoric boots properly I am quite sure Dbug will be able to spot where to add those cycles