Register

Add functions to Basic Casio programs

Topics on released projects. Only the author of a program should start a topic on it.
Senior Member
User avatar
Posts: 605
Joined: Sat Sep 15, 2012 6:59 am
Location: Krautland ****
Calculators: Casio fx-7400GII, Casio fx-7400GII (SH4), Casio fx-9750GII, Casio fx-9750GII (SH4), Casio fx-9860G, Casio fx-9860G SD, Casio fx-9860G Slim, Casio fx-9860GII SD, Casio fx-9860GII SD Power Graphic 2, Casio Classpad 330 plus, Casio fx-CG20, Casio fx-CG50, Casio Classpad fx-CP400

Postby SimonLothar » Fri May 25, 2012 3:41 pm

determination of a syscall's address (fx-9860):
get the pointer to the syscall-table from fileoffset 0001007C (for fx-9860)
f. i. it is 0x80151770 on OS 1.02 (the value is an example; it will be different with other OSes)
subtract 0x80000000 to get the fileoffset to the syscall table
->0x00151770
every syscall-address-entry in the syscall-table is 4 bytes long
if you look for a specific syscall address, do the following calculation

start of syscalltable + 4 * syscallnumber

f. i.
0x00151770 + 4 * 0xCB0 = 0x00154A30
at this fileoffset the address to the start of the syscall's code is stored:
0x800CB8A0 t. i. fileoffset 0x000CB8A0 (in case of OS 1.02)

now you know where to put the redirection code

BTW: the code should begin with the bytes 0x2F 0xE6 0x6E 0x53
If not, tell me the OS version (and calculator type) you are working on.

If you get along with this, we will proceed.
I'll be back!

Member
User avatar
Posts: 33
Joined: Sat Apr 07, 2012 10:08 am
Location: France

Postby Purobaz » Fri May 25, 2012 9:31 pm

Thanks, I've found the address to the start of the syscall's code.
On OS 2.00 it's 0x80187340.

Luckily it begins with the bytes 0x2F 0xE6 0x6E 0x53.
I changed then to 0xA5600200.

Does I have to adjust the OS-checksum ?
If yes how make the sum of the bytes ?

I'm going to try to copy with an addin the code (from an addin) at adress 0xA5600200.

Senior Member
User avatar
Posts: 605
Joined: Sat Sep 15, 2012 6:59 am
Location: Krautland ****
Calculators: Casio fx-7400GII, Casio fx-7400GII (SH4), Casio fx-9750GII, Casio fx-9750GII (SH4), Casio fx-9860G, Casio fx-9860G SD, Casio fx-9860G Slim, Casio fx-9860GII SD, Casio fx-9860GII SD Power Graphic 2, Casio Classpad 330 plus, Casio fx-CG20, Casio fx-CG50, Casio Classpad fx-CP400

Postby SimonLothar » Fri May 25, 2012 10:12 pm

Purobaz wrote:Thanks, I've found the address to the start of the syscall's code.
On OS 2.00 it's 0x80187340.
Luckily it begins with the bytes 0x2F 0xE6 0x6E 0x53.
Fine.

Purobaz wrote:I changed then to 0xA5600200.

No. You have to insert a jump to the redirection address, which should be 0xA5600600, just to be sure.
But not today. I am awfully tired.
I'll be back!

Senior Member
User avatar
Posts: 605
Joined: Sat Sep 15, 2012 6:59 am
Location: Krautland ****
Calculators: Casio fx-7400GII, Casio fx-7400GII (SH4), Casio fx-9750GII, Casio fx-9750GII (SH4), Casio fx-9860G, Casio fx-9860G SD, Casio fx-9860G Slim, Casio fx-9860GII SD, Casio fx-9860GII SD Power Graphic 2, Casio Classpad 330 plus, Casio fx-CG20, Casio fx-CG50, Casio Classpad fx-CP400

Postby SimonLothar » Sun May 27, 2012 9:51 pm

A jump to a certain address looks like this

Code: Select all
     mov.l   #h'A5600600, r2
     jmp     @r2
     nop


the assembler produces the following bytes (at a 4-aligned address)
D2 01 42 2B 00 09 00 00 A5 60 06 00

or these (at a 2-aligned but not 4-aligned address)
D2 01 42 2B 00 09 A5 60 06 00

F. i. 0x80187340 is 4-aligned.

If you have a 512k RAM-calculator, you could use RAM-address 0x88070000 as well, which is preferable.
(replace A5 60 06 00 by 88 07 00 00 in the examples above)

After replacing the syscall code by the designated bytes in your OS-imagefile, you have to adjust the checksum.
Then you can restore your OS to your calculator. If it comes up without complaints, the PRGM-command Send(...) or Send38k would jump to 0A5600600 or 0x88070000, where -at this stage- no usable code exists, of course. If you did not adjust the checksum correctly, the calculator will request an OS update. The code, which you have to load to the RAM, has to be assembled and linked in a special way. You cannot use an addin-binary for that.
I'll be back!

Member
User avatar
Posts: 33
Joined: Sat Apr 07, 2012 10:08 am
Location: France

Postby Purobaz » Mon May 28, 2012 11:24 am

I'm using a fx-9750Gii for tests.

So I will replace the syscall code by D2 01 42 2B 00 09 00 00 A5 60 06 00.
But I didn't understand how adjust the checksum ? How make the sum of the bytes ?

I will use your GCC to assembled and linked the code.

Senior Member
User avatar
Posts: 605
Joined: Sat Sep 15, 2012 6:59 am
Location: Krautland ****
Calculators: Casio fx-7400GII, Casio fx-7400GII (SH4), Casio fx-9750GII, Casio fx-9750GII (SH4), Casio fx-9860G, Casio fx-9860G SD, Casio fx-9860G Slim, Casio fx-9860GII SD, Casio fx-9860GII SD Power Graphic 2, Casio Classpad 330 plus, Casio fx-CG20, Casio fx-CG50, Casio Classpad fx-CP400

Postby SimonLothar » Mon May 28, 2012 12:56 pm

Purobaz wrote:I'm using a fx-9750Gii for tests.
So I will replace the syscall code by D2 01 42 2B 00 09 00 00 A5 60 06 00.

The fx-9750Gii has 512k RAM, so I recommend to use 88070000. Hence insert
D2 01 42 2B 00 09 00 00 88 07 00 00

BTW: Now I use my fx-9750GII as guinea-pig.

Purobaz wrote:I will use your GCC to assembled and linked the code.
That's not my GCC. Basically I use the CASIO SDK tools ASMSH, SHCPP and OPTLNK.
I'll be back!

Senior Member
User avatar
Posts: 605
Joined: Sat Sep 15, 2012 6:59 am
Location: Krautland ****
Calculators: Casio fx-7400GII, Casio fx-7400GII (SH4), Casio fx-9750GII, Casio fx-9750GII (SH4), Casio fx-9860G, Casio fx-9860G SD, Casio fx-9860G Slim, Casio fx-9860GII SD, Casio fx-9860GII SD Power Graphic 2, Casio Classpad 330 plus, Casio fx-CG20, Casio fx-CG50, Casio Classpad fx-CP400

Postby SimonLothar » Mon May 28, 2012 12:59 pm

Purobaz wrote:But I didn't understand how adjust the checksum ? How make the sum of the bytes ?

Do you have some SDK for your PC? A C-compiler? Anything to process files on your PC?
I'll be back!

Member
User avatar
Posts: 33
Joined: Sat Apr 07, 2012 10:08 am
Location: France

Postby Purobaz » Tue May 29, 2012 5:27 pm

I already have a SDK on my PC (I never used it :().

I did some research about checksum.
Is there a special algorithme for the Casio OS or can I use this algorithme ?
I think I'm OK with the checksum but it may take a long time because of exams.

Basically I use the CASIO SDK tools ASMSH, SHCPP and OPTLNK.

Can I use this tools with the command prompt on Windows.
Is there some special commands ?


Concerning the memory address 88070000, can I inject the function at this address thanks to an addin ?

Senior Member
User avatar
Posts: 605
Joined: Sat Sep 15, 2012 6:59 am
Location: Krautland ****
Calculators: Casio fx-7400GII, Casio fx-7400GII (SH4), Casio fx-9750GII, Casio fx-9750GII (SH4), Casio fx-9860G, Casio fx-9860G SD, Casio fx-9860G Slim, Casio fx-9860GII SD, Casio fx-9860GII SD Power Graphic 2, Casio Classpad 330 plus, Casio fx-CG20, Casio fx-CG50, Casio Classpad fx-CP400

Postby SimonLothar » Tue May 29, 2012 6:10 pm

Purobaz wrote:I already have a SDK on my PC (I never used it :().
I did some research about checksum.
Is there a special algorithme for the Casio OS or can I use this algorithme ?
I think I'm OK with the checksum but it may take a long time because of exams.

No worries. There is no need to be hasty. Take your time. I stay put.
The checksum thingy is not as complicated, involves no special algorithm.

On fx9860-OSes 2.xx it is the sum of the bytes in the OS address-range 0x80010000 to 0x8024FFF7.
It is stored as int at 0x8024FFF8

EDIT
F. i. on-calc it could look like that:
Code: Select all
   result = 0;
   for ( address = 0x80010000; address <= 0x8024FFF7; address++ ) result += *(unsigned char*)address;



So you need a program that simply adds the bytes in the fileoffset-range 0x00010000 to 0x0024FFF7 into an int-variable.
Then the program has to write the sum to fileoffset 0x0024FFF8.

Purobaz wrote:Can I use this tools with the command prompt on Windows.
Is there some special commands ?
Yes. No worries again. If you get along with the checksums, I will give you as detailed information as you need. HMAKE-files, parameters a. s. o..

Purobaz wrote:Concerning the memory address 88070000, can I inject the function at this address thanks to an addin ?
Exactamundo. Again. I will give you detailed information, t. i. sources, if you need. But let's go step by step.
I'll be back!

Member
User avatar
Posts: 23
Joined: Fri Apr 20, 2012 6:13 am

Postby Eiyeron » Wed May 30, 2012 3:54 pm

It's a it uninimaginable... Os Modding... Never saw something like this? I saw some tools on Insight or older verisons. What was their [usage]?
ImageImageImage
ImageImage

PreviousNext

Return to Released Projects

Who is online

Users browsing this forum: No registered users and 5 guests