Closed sharpie7 closed 2 years ago
Defender is hanging because it's waiting for bit 7 on the user port to be high:
>> c
CPU free running...
Interrupted
16.594735 : 0E43 : 60 : RTS
>> special 3
NMI inhibited
IRQ inhibited
>> s 10
Stepping 10 instructions
16.594741 : 1378 : 10 FB : BPL $1375
16.594744 : 1375 : 20 40 0E : JSR $0E40
16.594750 : 0E40 : 2C 60 FE : BIT $FE60
16.594754 : 0E43 : 60 : RTS
16.594760 : 1378 : 10 FB : BPL $1375
16.594763 : 1375 : 20 40 0E : JSR $0E40
16.594769 : 0E40 : 2C 60 FE : BIT $FE60
16.594773 : 0E43 : 60 : RTS
16.594779 : 1378 : 10 FB : BPL $1375
16.594782 : 1375 : 20 40 0E : JSR $0E40
That port on BeebFPGA currently just reflects the last value written to Port B (&FE60).
On a real Beeb it just floats high.
In the debugger if I set &FE60 to &80 then continue the game starts.
What I'll do to improve compatibility is to make the value read back from an unconnected input be a '1'.
A bit more analysis...
There is code at E34 to set start configure 6522 timer T1 that includes the option to toggle PB7:
0E34 : A9 80 : LDA #$80
0E36 : 8D 6B FE : STA $FE6B
0E39 : 8E 64 FE : STX $FE64
0E3C : 8C 65 FE : STY $FE65
0E3F : 60 : RTS
There is code at E40 to test PB7.
0E40 : 2C 60 FE : BIT $FE60
0E43 : 60 : RTS
The bug in the original Defender seems to be that the code at E40 can be called before the code at E34.
I've just pushed a fix for this issue.
Dave
I always think it's a special level of emulation that allows buggy code the worked on the original hardware to run!
With your fix Defender does run fine, but if you don't mind getting deep in the weeds then the animation of the aliens appears wrong. You see them in old and new positions super-imposed which is guess is a pallet swap not working right.
TBH I am happy just to go with the Planetoid verison, but it is curious.
With your fix Defender does run fine, but if you don't mind getting deep in the weeds then the animation of the aliens appears wrong. You see them in old and new positions super-imposed which is guess is a pallet swap not working right.
This happens on a real Beeb as well, so it's a game bug rather than a BeebFPGA bug.
That particular version of DEFENDER is known to be very buggy.
I thought it was worth separating the discussion of Defender in to its own issue.
To follow up. Using the verisons on RetroClinic BEEB.MMB File v1.02 for MicroSPI. again:
I tested on both the AlanD (65C02) and PeterW (6502) cores. Interested if you have the same experience on the different versions.