gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

DS development > DSEMU problem with BIOS SWI 9 not handling negative values

#62574 - winneymj - Fri Dec 02, 2005 3:44 pm

Hi,
After some experimentation it seems that the DSEMU assember for the BOIS SWI 9 can handle postive divides ok (example: 1970 / 10 = 197, 1970 % 10 = 0), BUT negative divides produce incorrect results (example -1970 / 10 = ?????? (not sure of number), -1970 % 10 = 6).
Looking at the assember (I am not very familiar with x86) I can see it is doing an IDIV, which is a signed divide, but still the results are incorrect.

Until there is a fix I have built my own local version of DSEMU from the source and replaced the ASM with C code, so I can continue development.

Thanks

#62676 - doublec - Sun Dec 04, 2005 8:05 am

If you can send me the C code, or a darcs patch I'll fix the dsemu code.

Chris.