mattgodbolt / jsbeeb

Javascript BBC micro emulator
GNU General Public License v3.0
350 stars 68 forks source link

Master Turbo should have 65c02 #298

Closed chromi closed 2 days ago

chromi commented 4 years ago

I think the parasite side of the Master Turbo emulation is running the NMOS 6502 model. It should be running a 65C02 model, while the host side runs a 65SC02 model. The latter is correctly implemented for the Master 128 emulation, but I see no sign in the code of handling the Rockwell instructions (SMBx, RMBx, BBSx, BBRx) on the 65C02.

Correct on the B and M128 models; "N" output for NMOS CPU, "S" for 65SC02: Screenshot 2020-01-30 01 20 19

Incorrect output on the M-Turbo model; should be "C" for 65C02 but is actually "N" for NMOS: Screenshot 2020-01-30 01 55 06

See http://forum.6502.org/viewtopic.php?f=2&t=5931&p=73319#p73319 for an explanation of the code listing.

chromi commented 4 years ago

Trying it today, the Master Turbo prints S, indicating a 65SC02. This is a worthwhile improvement, but really it should execute a $47 opcode as RMB4, and print C to indicate a full 65C02.

The following text can be pasted in as a test case:

MODE 0
AUTO
DIM TEST% 256
P%=TEST%
[ : OPT 3
LDA #0
STA &84
STA &85
LDA #&1D
STA &83
LDA #&6B
STA &1D
LDA #&4E
EQUW &8347  \ Magic opcode, RMB4 &83
EOR &83
CMP #&53    \ Additional check for naive NMOS emulators
BNE P%+6
EQUW &0280  \ BRA *+4
LDA #&6E
JSR &FFEE   \ Output for BBC Micro
JSR &FFE7
RTS
]
CALL TEST%
END
mattgodbolt commented 4 years ago

Thanks @chromi !

mattgodbolt commented 2 days ago

image