Xerxes a écrit:
Marcus von Cube a écrit:
Sera-t-il possible d'analyser le logiciel préprogrammé d'un FX-795P ? Peut-on faire une liste?
Usually the 4-bit CASIO pockets have no external ROM. The complete firmware is
hidden in the internal CPU ROM but the FX-795P seems to be the exception.
Due to the limited internal ROM, an external ROM was added to hold a part of
the math library. In contrast to the FX-880P some math routines are coded in
assembly and not in BASIC only. This external ROM can be accessed by MODE18
(=PEEK).
Thanks to Piotr, the complete BASIC part of the FX-795P math library:
Code:
........
........
........
........
The used MODE commands are: 18,20,21,26,27,28,29,90,91,92,93,94,95,96,97,99
Excuse moi pour l'anglais!
After examining of the quoted program library, and also reading of the forum, and playing with my Casio, I tried to make a list of the undocumented MODE commands. Most of them were already known, but some are not.
My tests showed that the matrices sizes are not limited to 9x9 as in the FXLibrary. Successful operations were done with 15x15 size for matrix inversion. We should take in mind that for not well defined matrices the inversion can give unreliable results.
Also I did some speed tests for the matrix operations. The "internal" matrix commands work roughly 5~6 times faster than BASIC written routines doing the same job (of course a difference of the algorithm plays a major role maybe). This was tested with random filled matrices 5x5.
Also I tested the calculator fx-5500LA with such 5x5 random matrices. It seems it is about twice faster than fx-795P. It is pity it is not programmable, and the fx-4500PA is obviously much slower than 5500LA - I decided not to make tests on it.
So, here is the list for now:
MODE 10
Standard truncation of the last digits after calculation. This mode is reset after turn-off/on of the device. Produces round results for integers.
(thanks to Xerxes)
MODE 11
No truncation of the last digits. This mode is canceled after turn-off/on of the device. Should be used if we suspect error accumulation in default mode. (more explanation on Page11 of the thread)
MODE18(A,B)
Gets from address A the HEX value as B$. The syntax is with brackets!
MODE19(A,B)
Puts in address A the value B. The syntax is with brackets!
MODE 20,A
Evaluates as expression the variable $ and puts the result in variable A
MODE 21,A,B
Waits for keypress and returns its character in A$ and its DEC code in B
MODE 22 unknown
MODE 23 unknown
MODE 24 unknown
MODE 25 unknown
MODE 26,A
Converts the value of $ variable (assumed to be a BIN number) to DEC variable A
MODE 27,A
Converts the value of $ variable (assumed to be a HEX number) to DEC variable A
MODE 28,A
Converts the value of variable A (DEC number) to LONG BIN string in variable $
MODE 29,A
Converts the value of variable A (DEC number) to SHORT BIN string in variable $
MODE 90,A,B,F
Matrix operation: inverse of matrix A goes to matrix B. Return code F is for success. If the value of F = 0 then the inversion operation was unsuccessful.
MODE 91,A,,D
Matrix operation: determinant of matrix A goes to variable D. Note the double comma! I tried to put variable there but an Error occurs.
MODE 92,A,B
Matrix operation: contents of matrix A goes to matrix B
MODE 93,A
Matrix operation: contents of matrix A is transposed
MODE 94,A,B,C
Matrix operation: matrix A multiplied by matrix B goes to C. C variable should not be an array. The command will create it as an array.
MODE 95,A
Equal to INPUT,A (used in the FXLibrary with error code reading from the memory)
MODE 96,Oper,A,B,C
Boolean operation.
Oper has the following options
0 is Twos complement,
1 is NOR,
2 is AND,
3 is OR,
4 is XOR
MODE 97,A,X,Y
Matrix operation: dimensions of matrix A go to X an Y
MODE 99,0 Breaks on Error (default behavior)
MODE 99,1 Continues execution on Error
I tried to find the address of the special $ variable. It seems to start from address 400.
The last entry line is at address 528. The FXLibrary is at address about 16400.
I also tried the "password erase" offered by Xerxes - it works. The password string is located at address 308.
The variables A-Z are stored backwards from the end of the memory: variable A is at address 16376. Variable B is 8 bits before at 16368 etc. Variable Z is at 16176.
The MEMO-databank seems to be at address 588.
The IN-OUT-CALC string seems to be after the program area - not at fixed address.
Well, another curious thing is that I managed to use 6 more characters from the code table (small D, small L, -1 index, thick /, b/, /c). I did this with using MODE19 to the address of a string variable. Maybe one day somebody will need to use those special chars. Functions like CHR$ and ASC can be substituted by short (1-row) programs, using MODE18 & MODE19.
Also the scan-codes of the special buttons for MODE21 are:
128 - SIN
129 - COS
130 - TAN
134 - LOG
135 - LN
136 - EXP
137 - SQR (square root sign)
152 - DEG(
182 - &H
183 - CUR (cubic root sign)
185 - HYP
205 - X^2
206 - X^3
207 - 10^x
219 - CLS
220 - ENG
222 - STAT
234 - MEMO
235 - EXT
239 - EXE
240 - INS
241 ->
242 <-
244 - STOP
245 - MODE
246 - ^R (return of the last entered line)
247 - Shift
251 - IN
252 - OUT
253 - CALC
The rest of the codes correspond to the letter or sign of the button depending on the char-code table.
I.e. for the key "G" we have 38, and of we are in EXT-mode the code will be 70 (for "g"). For the key "+" the code is 1.
Button BRK doesn't give code as the program execution breaks when it is pressed.