You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Executing the SRCH command returns the result of whether a boundary was detected in S#2 bit4 (BD).
Testing this on a V9958 (FS-A1GT) hardware unit confirmed that it clears when S#2 is read.
However, in OpenMSX 20, it does not clear no matter how many times it is read.
I am reporting this discovery of such a difference in behavior.
Thanks a lot for reporting this!
Also thanks for the test program. My own MSX computers are in storage, so I can't easily run tests on real machines myself. So thanks for including the screenshots.
I'll try to fix this in openMSX soon (but right now I'm working on other stuff).
Same for the LINE stuff your reported in #1961. Thanks for that report, I'll also try to look at that soon.
Thanks again. I've pushed a fix for openMSX, and now the test program produces 100% the same output on openMSX as on the real machine.
But I have a follow-up question.
Today openMSX does the following:
When a SRCH command ends it sets or resets the BD bit if the color was respectively found or not found.
(New since today) After reading S#2 we reset the BD bit.
But I wonder if step 1 is correct:
Does the SRCH command reset the bit when not found, or does it just leave the bit unchanged?
E.g. what if I do a SRCH command that sets BD, then NOT read S#2, and perform another SRCH that does not find the color. Is BD now 0 or 1?
Maybe SRCH resets BD at the start of the command instead of only at the end?
What if we already start reading S#2 while the command is still running? Will that always return 0 (indicating the color has not yet been found)? Or will it return the value from before the command started?
I'm sorry! I misunderstood.
The BD flag won't clear even after reading S#2.
It will clear after reading either S#8 or S#9. I'll confirm which one—S#8 or S#9—it is shortly.
The test program has been changed to a hex dump to display more information.
It has also been rearranged to match the read order as closely as possible.
I made a change in openMSX, and now openMSX matches the output of your test program on FS-A1GT. At least the previous version, before your bug fix. Can you also send that corrected version (you only send a photo of the output)?
OpenMSX now behaves like this:
The BD bit is reset when reading S#9. This is the ONLY condition that resets the bit.
The BD bit is set when the SRCH command stops because it found the requested color.
Note: when the SRCH command stops without finding the requested color, it does NOT reset the BD bit.
Does this match your interpretation of your test program?
OpenMSX also matches the output of the bug-fixed version.
I'm closing this issue now.
Thanks a lot for your help!
While working on fixing openMSX I still noticed this line in the openMSX source code. It's about the execution speed of the SRCH command. At the moment it takes 88 VDP cycles (@ 21.47MHz) per pixel. But this was only a guess (roughly based on the execution speed of the LINE command).
I'm not asking you to create new tests for this. Only if you happen to know the speed already, then I am interested in that information.
The execution speed of the LINE and block commands should already be accurate in openMSX.
I'm sorry.
Regarding the speed, I don't have any information either.
==================
Regarding the BD bit, even if you set BD=1 beforehand and then execute “SRCH expecting BD=0” without clearing it, it seems to maintain BD=1.
The section highlighted in red shows the results of test019.
For test019, BD is set to 1 beforehand.
That SRCH waits for completion by holding for a fixed time without reading S#2, S#8, or S#9 at all.
In other words, it does not clear BD=1.
In that state, executing an SRCH expecting BD=0 and reading S#2 after waiting for a fixed time results in BD=1, CE=0 at completion—this is the first 10h.
The second instance is the value 10h read from S#2 immediately afterward.
The third instance is the value 10h read from S#2 again after reading S#8.
The value to its right is 00h, read from S#2 again after reading S#9.
From these results, I understand that the BD flag is updated upon SRCH completion to the value obtained by ORing the current BD flag with the resultant BD flag.
Activity
m9710797 commentedon Aug 30, 2025
Thanks a lot for reporting this!
Also thanks for the test program. My own MSX computers are in storage, so I can't easily run tests on real machines myself. So thanks for including the screenshots.
I'll try to fix this in openMSX soon (but right now I'm working on other stuff).
Same for the LINE stuff your reported in #1961. Thanks for that report, I'll also try to look at that soon.
VDPCmdEngine: reset BD bit after reading S#2
m9710797 commentedon Aug 31, 2025
Thanks again. I've pushed a fix for openMSX, and now the test program produces 100% the same output on openMSX as on the real machine.
But I have a follow-up question.
Today openMSX does the following:
But I wonder if step 1 is correct:
Updates on Aug 31, 2025 14:43
hra1129 commentedon Sep 1, 2025
To address that question, I added three test patterns to the test program and verified the results.
https://github.com/hra1129/TangCartMSX/blob/main/RTL/tangnano20k_vdp_cartridge_step7/src/th9958/soft_vdp_test/SC5SRCH.COM
https://github.com/hra1129/TangCartMSX/blob/main/RTL/tangnano20k_vdp_cartridge_step7/src/th9958/soft_vdp_test/sc5srch.asm
https://github.com/hra1129/TangCartMSX/blob/main/RTL/tangnano20k_vdp_cartridge_step7/src/th9958/soft_vdp_test/sc5srch.txt
Result of FS-A1GT

test019: 65280 000 000
test020: 65280 016 017
test021: 65280 000 017
test022: 65280 000 001
m9710797 commentedon Sep 1, 2025
Thanks for the new test program.
OpenMSX gives this output for the last 4 tests:
Can you help me interpret this result? What does the value in the 2nd column mean (
000vs016)? Any idea what to fix in openMSX?Thanks!
hra1129 commentedon Sep 1, 2025
I'm sorry! I misunderstood.
The BD flag won't clear even after reading S#2.
It will clear after reading either S#8 or S#9. I'll confirm which one—S#8 or S#9—it is shortly.
hra1129 commentedon Sep 2, 2025
FS-A1GT Result

OpenMSX 20 Result

The BD flag is cleared by reading S#9.
SRCH results are reflected in the BD at the time the SRCH command completes.
https://github.com/hra1129/TangCartMSX/blob/main/RTL/tangnano20k_vdp_cartridge_step7/src/th9958/soft_vdp_test/SC5SRCH.COM
The test program has been changed to a hex dump to display more information.
It has also been rearranged to match the read order as closely as possible.
hra1129 commentedon Sep 2, 2025
I fixed a bug in the test program SR5SRCH.
Result of FS-A1GT

VDPCmdEngine: tweak BD bit in S#2
m9710797 commentedon Sep 2, 2025
Thanks again!
I made a change in openMSX, and now openMSX matches the output of your test program on FS-A1GT. At least the previous version, before your bug fix. Can you also send that corrected version (you only send a photo of the output)?
OpenMSX now behaves like this:
BDbit is reset when readingS#9. This is the ONLY condition that resets the bit.BDbit is set when theSRCHcommand stops because it found the requested color.Note: when the
SRCHcommand stops without finding the requested color, it does NOT reset theBDbit.Does this match your interpretation of your test program?
hra1129 commentedon Sep 2, 2025
The test program on GitHub has been updated to the bug-fixed version.
https://github.com/hra1129/TangCartMSX/blob/main/RTL/tangnano20k_vdp_cartridge_step7/src/th9958/soft_vdp_test/SC5SRCH.COM
m9710797 commentedon Sep 2, 2025
OpenMSX also matches the output of the bug-fixed version.
I'm closing this issue now.
Thanks a lot for your help!
While working on fixing openMSX I still noticed this line in the openMSX source code. It's about the execution speed of the
SRCHcommand. At the moment it takes 88 VDP cycles (@ 21.47MHz) per pixel. But this was only a guess (roughly based on the execution speed of theLINEcommand).I'm not asking you to create new tests for this. Only if you happen to know the speed already, then I am interested in that information.
The execution speed of the
LINEand block commands should already be accurate in openMSX.hra1129 commentedon Sep 2, 2025
I'm sorry.
Regarding the speed, I don't have any information either.
==================
Regarding the BD bit, even if you set BD=1 beforehand and then execute “SRCH expecting BD=0” without clearing it, it seems to maintain BD=1.
The section highlighted in red shows the results of test019.
For test019, BD is set to 1 beforehand.
That SRCH waits for completion by holding for a fixed time without reading S#2, S#8, or S#9 at all.
In other words, it does not clear BD=1.
In that state, executing an SRCH expecting BD=0 and reading S#2 after waiting for a fixed time results in BD=1, CE=0 at completion—this is the first 10h.
The second instance is the value 10h read from S#2 immediately afterward.
The third instance is the value 10h read from S#2 again after reading S#8.
The value to its right is 00h, read from S#2 again after reading S#9.
From these results, I understand that the BD flag is updated upon SRCH completion to the value obtained by ORing the current BD flag with the resultant BD flag.
Updates on Sept 02, 2025 18:38