How to report a bug on BlueMSX?

Page 1/2
| 2

By tvalenca

Paladin (747)

tvalenca's picture

08-12-2016, 23:17

Hi folks,

I think I found a bug on BlueMSX. I wrote a piece of code that runs on BlueMSX and fails on OpenMSX. When I opened the debugger, I saw:

ld hl,(#c04d) (value #05a0 stored at this address)
ld bc,#059f
sbc hl,bc
jr nz,#c008
ret

On BlueMSX, sbc hl,bc sets zero flag, then the code doesn't jump to #c008 as I expected it to do, but OpenMSX doesn't set that flag, the code jumps and my program crashes.

now, I fixed my code, and now it runs on OpenMSX but doesn't on BlueMSX!

Login or register to post comments

By Louthrax

Prophet (2465)

Louthrax's picture

09-12-2016, 00:03

Mmmm... There would be a bug in the core Z80 emulation, with simple instructions? That would be quite surprising.

Have you checked the state of the Carry flag on both emulators when you perform your sbc hl,bc ? Carry is also substracted on sbc & adc instructions (not with add & sub instructions), but I suppose you know that Smile You have to do a "or a" before the "sbc" to reset the carry flag and perform the equivalent of a "sub", as "sub hl,bc" does not exist.

Check if HL=0 on both emulators to confirm.

By gdx

Enlighted (6213)

gdx's picture

09-12-2016, 01:16

BlueMSX has some bugs here and there.

By tvalenca

Paladin (747)

tvalenca's picture

09-12-2016, 02:19

Louthrax wrote:

Mmmm... There would be a bug in the core Z80 emulation, with simple instructions? That would be quite surprising.

Sure it does! but since I'm kinda novice on ASM, I always ask before making such an assumption...

Louthrax wrote:

Have you checked the state of the Carry flag on both emulators when you perform your sbc hl,bc ?

Carry? nope! Just the Zero flag...

Louthrax wrote:

Carry is also substracted on sbc & adc instructions (not with add & sub instructions), but I suppose you know that Smile

er... I know that but I may not have paid attention to this... I am using this to check if I got every piece of information I am copying. I am reading an entire 720k disk in 16k chunks, using page 2 as buffer. When I finish reading from page 2, I check how many times I did this (#05A0 divided by #20 times) and when done I escape.

Louthrax wrote:

You have to do a "or a" before the "sbc" to reset the carry flag and perform the equivalent of a "sub", as "sub hl,bc" does not exist.

Check if HL=0 on both emulators to confirm.

Will do, since I don't have access to a windows computer at home.

By tvalenca

Paladin (747)

tvalenca's picture

09-12-2016, 17:41

tvalenca wrote:
Louthrax wrote:

You have to do a "or a" before the "sbc" to reset the carry flag and perform the equivalent of a "sub", as "sub hl,bc" does not exist.

Check if HL=0 on both emulators to confirm.

Will do, since I don't have access to a windows computer at home.

Did the "or a" before "sbc hl,bc" and it worked on both emulators.

Now I have another issue, but I'll ask in another thread.

By Louthrax

Prophet (2465)

Louthrax's picture

09-12-2016, 23:39

Question remaining might be why is Carry set on one emulator and not the other one? Could be caused by different MSX-DOS versions, BIOS, maybe if you have things in the interruption routine (with slightly different timings between open&BlueMSX).

By tvalenca

Paladin (747)

tvalenca's picture

10-12-2016, 05:12

Louthrax wrote:

Question remaining might be why is Carry set on one emulator and not the other one? Could be caused by different MSX-DOS versions, BIOS, maybe if you have things in the interruption routine (with slightly different timings between open&BlueMSX).

good point, I think that I should pay attention for this details when developing for MSX, don't I?

Anyway, the windows machine I'm using for tests is on a closed network environment, so this means I don't have a lot of machine definitions on BlueMSX. But I'll redo the tests using the same configuration.

By Louthrax

Prophet (2465)

Louthrax's picture

10-12-2016, 12:39

I had some compatibility issues like that too in my MSX developer life Smile Some MSX-DOS versions are disabling interrupts after function calls, some are not. Registers are not always preserved the same way... In general, it's better not to make too much assumptions when calling MSX-DOS functions (BIOS versions are a bit more identicals).

By tvalenca

Paladin (747)

tvalenca's picture

12-12-2016, 17:02

Louthrax wrote:

I had some compatibility issues like that too in my MSX developer life Smile Some MSX-DOS versions are disabling interrupts after function calls, some are not. Registers are not always preserved the same way... In general, it's better not to make too much assumptions when calling MSX-DOS functions (BIOS versions are a bit more identicals).

Since we're talking about MSX-DOS... Is there any difference between when calling BDOS routines from BASIC (CALL #F37D) than from DOS (CALL #0005)?

By Louthrax

Prophet (2465)

Louthrax's picture

12-12-2016, 17:13

tvalenca wrote:
Louthrax wrote:

I had some compatibility issues like that too in my MSX developer life Smile Some MSX-DOS versions are disabling interrupts after function calls, some are not. Registers are not always preserved the same way... In general, it's better not to make too much assumptions when calling MSX-DOS functions (BIOS versions are a bit more identicals).

Since we're talking about MSX-DOS... Is there any difference between when calling BDOS routines from BASIC (CALL #F37D) than from DOS (CALL #0005)?

I do not remember exactly the reason behind, but it's better to always use #0005 when calling from a MSX-DOS program (and always #F37D from BASIC of course). I'm pretty sure the reason is explained somewhere in one of the MSX-DOS reference manuals... (probably something related to the slots).

The behavior of the functions should be the same from what I know.

By Shibito

Supporter (2)

Shibito's picture

12-01-2017, 15:19

I have a weird issue with BlueMSX. I could play SD snatcher and some other games, but then suddenly .dsk games stop working. It starts with remove a disk, then insert a new one. Then it asks if it can overwrite, but there is nothing to overwrite, which is already weird. After this BlueMSX gets a buffer overrun error and it closes itself. Then if i try to start any disk game after restarting, none of them work. I tried reset, hard reset, re-install, nothing works. Yeah if i remove the disk games from my hard drive and place them again from a different harddrive (my backup) then it works again.. until the issue comes back again. Drives me nuts.. any solution?! Bye the way, cartridge games always work.

Page 1/2
| 2