(Comp.sys.hp48) Item: 1207 by flavio@cflav.sublink.org [Flavio Casetta] Subj: MatrixWriter bug explained & eliminated Date: Fri Jun 05 1992 ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ» º CAUTION!!! USE THIS PROGRAM ONLY IF YOUR HP48 IS REV 'A' THROUGH 'E' !!!! º º º º DO *NOT* RUN THIS PROGRAM ON A REV 'J' MACHINE (OR HIGHER)!!!! º º º º THE BUG THAT THIS PROGRAM IS INTENDED TO FIX WAS FIXED IN REV J, º º SO REV J OWNERS (AND HIGHER) DO NOT NEED THIS PROGRAM ANYWAY. -jkh- º ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ ³ Mini-instructions: *AFTER* pressing blue-ENTER (to start the ³ ³ MatrixWriter) press VAR PATCH ENTER. Bug will be eliminated.³ ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ mgcomms@cix.COMpulink.co.UK (Mercantile and General PLC) writes: > > Has anyone found a simple work-around for the bug in the matrix > environment? The bug is any cell containing an absolute value > between 1E5 and 1E6 can't be copied to the stack. (there's a beep > and no other response). > Dear 48er, On the wave of your request, I investigated the strange bug of the MatrixWriter. The Symbolic MatrixWriter built in the SmartROM is not affected by this bug. The reason is quite simple: we rewrote all the storage/retrieval system of the MatrixWriter in order to allow symbolics. But what about the original MatrixWriter ? Here is the answer. It took me more than 20 minutes to find out the source of the problem. In effect it's hard to say if the bug is due to a subroutine misbehavior or to a misuse of that subroutine. Things are as follows: when you press [->STK] a subroutine recalls the current matrix (or vector) along with the cursor coordinates. Then a subroutine extracts the element from the matrix according with the actual dimension of the array. If the element does not exist it returns a null string. Then a subroutine checks for the presence of a null string. And here is the pitfall ! The routine checking for the null string does not attempt to check in advance the object type lying on the stack. Numbers in the range 100000-999999 have the first five nibbles (3 of exponent and 2 of mantissa) matching the null string pattern. Try out with ->ASC ! Nevertheless the bug applies also to Complex numbers within the Real part in the same range. In effect if you supply a number like 100000.111111, you will find that the [->STK] works because the last two digits of the mantissa are no longer zeros. Thus the actual range of numbers is 100000-999999 rounded to 10 decimal significant digits. In conclusion the bug is due to a call to a subroutine whose expected argument is a string and not a number. The main routine is located at #63209h and always returns the original object plus a flag. A TRUE means that the string is null, a FALSE means it is not null. Notice that it is not a buggy routine. Simply it should not be called unless you have a string on the stack. I don't see a possible workaround in the usual sense of the word, unless you enter all numbers with at least 11 significant digits. What can be done is a patch routine in RAM consisting of a menu that fixes the problem. ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ ³ Please keep in mind that when the Matrix Writer is not running,³ ³ you may corrupt the memory by calling any of these subroutines.³ ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ In order to use it, store the new menu in the global name 'PATCH' and call it from the matrix writer environment as follows: PATCH [ENTER]. PATCH simply changes the aforementioned routine with 62154h which returns FALSE if the object is not a string. Remember that when you press [BLUE] [ENTER] you restore the OLD menu ! Hope it helps __________________________________________________________________________ flavio@cflav.sublink.org (Flavio Casetta) In HP we trust. HP Fanatics <==> Imagination at work ! VOICE +59 440404 FAX +59 304490 Via Varese 67 41100 Modena Italy