Open g0me3 opened 3 years ago
ok, checked the core, all PC relative data instructions uses direct memory read handlers, they has no CDL code. so this for sure affects all PC relative instructions.
It will probably be a bit before I get to this. Are we saying that the genesis core (right now) doesn't support the D in CDL at all? move
is just a plain data read, after all. Or is this something specific to the addressing mode?
No. Currently, gensx core does data logging in functions for regular data fetch: m68kiread*_fc But all PC relative instructions uses m68ki_read_pcrel_X -> m68k_read_pcrelative_X functions which are just immediare memory fetches, without any data logging -> m68k_read_immediate_X For this core there is no difference between opcodes for load immediate operands and opcodes that fetches the data using the relative PC offset, which is causes they are not logged as data as in any other addressing methods.
MOVEQ XX,REG - fetches data operand at PC + 1 MOVEW OFS(PC,REG),REG - the same but data operand is at PC + REG + OFS first one does not need to set data log flags, but the secod one need it same for all other opcodes with PC relative addressing mode.
Got it. I wonder if this bears any similarity to https://github.com/TASVideos/BizHawk/issues/1760; if immediate/pc relative fetches occur very commonly in real code, then this might have an unacceptable speed loss for normal use. We'll see.
we need to separate immediate operand fetches from PC relative addressing first i think. PC relative operands are not so frequent, mostly used for switch-case constructions. the regular data fetches are much more frequent and there is no significant loss in speed with them just now.
when I find any code that heavily abuses pc relative operands I will test if for sure, but doubt I can spot the difference on any current pc ;)
Example. Game Toejam & Earl 2 (U) here MOVE.W OFF(PC,D0.L),D0 logged as code this opcode fetches one of the offsets in the table below no table entries logged as data so this one particular data fetch is missing from CDL (maybe there are others but this one I see for sure just now).