Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BSNES/Lua: Value of V and H registers appear to always be equal. #2040

Closed
aexoden opened this issue May 24, 2020 · 3 comments
Closed

BSNES/Lua: Value of V and H registers appear to always be equal. #2040

aexoden opened this issue May 24, 2020 · 3 comments
Labels
Core: BSNES Super Nintendo Entertainment System (SNES) / Super Famicom (SFC) / Super Game Boy (SGB) core Repro: Affects 2.3/2.3.1/2.3.2 (2.3.3 has its own label) Repro: Fixed/added in 2.5

Comments

@aexoden
Copy link

aexoden commented May 24, 2020

Summary

When using the BSNES core (I have not tested others), the values of the V and H scanline registers appear to be identical at all times, as returned by the Lua emu.getregister() function.

Repro

This Lua script can demonstrate the behavior:

local function read_registers()
	pc = emu.getregister("PC")
	v = emu.getregister("V")
	h = emu.getregister("H")
	console.log(string.format("PC:%06X V:%3d H:%3d", pc, v, h))
end

event.onmemoryexecuteany(read_registers)

I have no interest in using onmemoryexecuteany, but event.onmemoryexecute targeted to the code of interest demonstrates the same behavior.

Output

This output was produced by the Lua script (truncated to only a few instructions for demo purposes):

PC:008F13 V:225 H:225
PC:000200 V:225 H:225
PC:009085 V:225 H:225
PC:009086 V:225 H:225
PC:009088 V:225 H:225
PC:009089 V:225 H:225
PC:00908A V:225 H:225
PC:00908B V:225 H:225
PC:00908C V:225 H:225

When doing a trace log of the same frame, the results are as follows:

008f13:  lda  $7d       [00067d]   A:0001 X:0010 Y:0050 S:02f9 D:0600 DB:00 nVMxdIzc V:225 H:  1
000200:  jml  $009085   [009085]   A:0001 X:0010 Y:0050 S:02f5 D:0600 DB:00 nVMxdIzc V:225 H: 22
009085:  php                       A:0001 X:0010 Y:0050 S:02f5 D:0600 DB:00 nVMxdIzc V:225 H: 30
009086:  rep  #$20                 A:0001 X:0010 Y:0050 S:02f4 D:0600 DB:00 nVMxdIzc V:225 H: 36
009088:  pha                       A:0001 X:0010 Y:0050 S:02f4 D:0600 DB:00 nVmxdIzc V:225 H: 41
009089:  phx                       A:0001 X:0010 Y:0050 S:02f2 D:0600 DB:00 nVmxdIzc V:225 H: 49
00908a:  phy                       A:0001 X:0010 Y:0050 S:02f0 D:0600 DB:00 nVmxdIzc V:225 H: 56
00908b:  phb                       A:0001 X:0010 Y:0050 S:02ee D:0600 DB:00 nVmxdIzc V:225 H: 64
00908c:  phd                       A:0001 X:0010 Y:0050 S:02ed D:0600 DB:00 nVmxdIzc V:225 H: 69

I've looked over some of the relevant BizHawk code and I don't see any obvious reason this should be the case, so I'd like to hope I'm simply doing something wrong.

Host env.

  • BizHawk 2.3.2; Win10 Pro 1909; Intel/NVIDIA
  • BizHawk 2.4.2; Win10 Pro 1909; Intel/NVIDIA
@YoshiRulz YoshiRulz added re: Lua API/scripting Relating to EmuHawk's Lua API (not the Lua Console) Repro: Affects 2.3/2.3.1/2.3.2 (2.3.3 has its own label) Repro: Affects 2.4.2 labels May 24, 2020
@YoshiRulz

This comment has been minimized.

@zeromus

This comment has been minimized.

@zeromus
Copy link
Contributor

zeromus commented May 24, 2020

note, this script is not likely to work the way you want due to the lua console.log being very limited for some reason and certainly not suitable for replicating the tracelog

@YoshiRulz YoshiRulz added Repro: Fixed/added in 2.5 Core: BSNES Super Nintendo Entertainment System (SNES) / Super Famicom (SFC) / Super Game Boy (SGB) core and removed Repro: Affects 2.4.2 re: Lua API/scripting Relating to EmuHawk's Lua API (not the Lua Console) labels May 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Core: BSNES Super Nintendo Entertainment System (SNES) / Super Famicom (SFC) / Super Game Boy (SGB) core Repro: Affects 2.3/2.3.1/2.3.2 (2.3.3 has its own label) Repro: Fixed/added in 2.5
Projects
None yet
Development

No branches or pull requests

3 participants