Prev: Extable download
Next: Sudoku Player
From: Han on 26 Jun 2010 00:01 Within CK&DIPATCH1 is a jump to #20E34h in the case where an integer is allowed as an alternate argument type for real numbers. The code jumps to #20E34h when, upon converting the integer to a real number, an overflow or underflow occurs. The code is as follows: L20E34 sstdsp_overflow D0=(5) (=SystemFlags)+5 A=DAT0 B ?ABIT=1 0 GOYES + GOSBVL =GETPTR LC(5) =ofloerr GOVLNG =GPErrjmpC + LC(5) =%MAXREAL ?D=0 S GOYES + LC(5) =%-MAXREAL + D0=(5) (=SystemFlags)+6 A=DAT0 B ABIT=1 0 DAT0=A B GOTO sstdsp_push% There is a check in the system flags whether an error is generated or +/-MAXREAL constants are pushed. The first bug is that the routine checks if the overflow flag is set, and if so, it pushes the constants. It should instead check if the flag is cleared! Secondly, the routine sstdsp_push% overwrites the pointer to the original integer with the pointer to the real (in TEMPOB), and takes its input from A[A]. The problem is that A[A] is used to check the system flags, and the actual address to push is in C[A]. So the routine above is missing an opcode: A=C A
From: Han on 26 Jun 2010 00:34 Additionally, here's how to test: TESTPRG :: CK&DISPATCH1 BINT1 %1 ; Make sure to turn on exact mode. Also check that flag -21 is clear (overflow returns +/-MAXREAL). Create an integer larger than 1E499 by typing: 1E499 R->I 1000 * With this integer on the stack, run TESTPRG and you will get an overlflow error. This should not happen with flag -21 cleared! We are supposed to see %MAXREAL on the stack! Now, set flag -21 (overflow results in an error) and run TESTPRG. You will instead get a bad argument error (instead of an overflow error). Moreover, the integer is now turned into PTR 505 (on my calculator, anyway).
From: HM on 26 Jun 2010 12:05 Did the test on a 50g with ROM 2.09. Got exactly the same results as you reported.
|
Pages: 1 Prev: Extable download Next: Sudoku Player |