Code: Select all
loop:
LDA $4032
AND #$01
BEQ loop ;if a disk is currently inserted, loop (e.g wait for eject)
LDA $4032
AND #$01
BNE loop ;if no disk is currently inserted, loop (e.g wait for insert, but the loop goes back to the first check!)
Code: Select all
wait_eject_loop:
LDA $4032
AND #$01
BEQ wait_eject_loop
LDY #$FF
JSR Delayms
wait_insert_loop:
LDA $4032
AND #$01
BNE wait_insert_loop
My 6502 assembly skills are pretty terrible, so I could be understanding this wrong, but I can actually get this behavior several times in a row in the games (Aspic, Ao no Senritsu) that use the first version (e.g doing eject disk -> wait -> insert disk causes the execution to go back to the first loop and the game doesn't react at all)
The only way the first version would "reliably" be able to exit its loop was if the value of the "drive is empty" bit quickly toggled between 0 and 1 a number of times when physically ejecting or inserting a disk?