mattgodbolt / jsbeeb

Javascript BBC micro emulator

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Master Turbo should have 65c02

chromi opened this issue · comments

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.

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

Thanks @chromi !