Show: Today's Messages :: Show Polls :: Message Navigator |
Neo Geo Pocket (+Color): possible SIGFPE [message #5763] | Sun, 20 January 2019 08:06 | |||
| ||||
Mednafen 1.22.0: src/ngp/TLCS-900h/TLCS900h_interpret_reg.cpp MINC1, MINC2, MINC4, MDEC1, MDEC2, MDEC4 all perform modulo division. The value to divide by is fetch16()+1, stored into a uint16. As a result, if fetch16() returns 0xffff, this will result in num==0, which will result in rCodeW(rCode)%num producing a SIGFPE crash (well, maybe you catch raised signals, but ...) Also, the manual says this operation is only valid when num is 2^n (where n=1 to 15... or in other words: 2, 4, 8, ... 32768.) Since your code actually runs games, I'm gonna guess the +1 is in fact needed, but ... I would think that would allow n=16 if we bounded it from (1..65536), so ... I don't know. I don't have the ability to test this on hardware, sorry. In the mean time, changing if(size==1) to if(size==1&&num) should avoid the possible crash. void regMINC1() { uint16 num = fetch16() + 1; if (size == 1) { if ((rCodeW(rCode) % num) == (num - 1)) ... void regMDEC1() { uint16 num = fetch16() + 1; if (size == 1) { if ((rCodeW(rCode) % num) == 0) [Updated on: Sun, 20 January 2019 08:08] | ||||
|
Previous Topic: | [PSX] Koudelka - Freeze during the tile puzzle |
Next Topic: | psx and ss always at full-speed? |