Register

Using SH7305 peripheral modules

Discuss anything related to calculators. For specific help on certain games/programs check the Released Projects subforum.
Member
User avatar
Posts: 39
Joined: Fri Aug 21, 2015 11:54 am
Location: France
Calculators: Casio fx-9750GII, Casio fx-9750GII (SH4), Casio fx-9860GII, Casio fx-CG50

Re: Using SH7305 peripheral modules

Postby lephe » Sun Aug 30, 2015 9:29 am

SimonLothar wrote:Though the SH7305 uses the same address 0xA44B0000 as the SH7724, the key scan interface is completely different.

Indeed, that's always surprising when writable registers don't hold written values...

SimonLothar wrote:Though - as always - I recommend to use the syscalls. Especially in this case because it works for the SH7305 only.

Actually, I think I've found a way to workaround the fact that syscall 0x24a enables keyboard interrupts by disabling them before the interrupt handling procedure is started, instead of handling them.

Senior Member
Posts: 100
Joined: Sun Mar 24, 2013 12:01 pm
Calculators: None

Re: Using SH7305 peripheral modules

Postby TeamFX » Sun Aug 30, 2015 11:09 am

You don't have to use the key-scan interface on SH-4A models.
Instead of using ports A/B/M, you now have to use ports Z/M/N.

Code: Select all
Ports (SH-4A):
PTZ(7:0) : col 0..7
PTM(5:0) : row 0..5
PTN(5:0) : row 6..B

Ports (SH-3):
PTA(7:0) : col 0..7
PTB(7:0) : row 0..7
PTM(3:0) : row 8..B

Refer to page "fx legacy schematics" in Simon's documentation.

However, this low-level access is only used in the boot code.
When used in the OS code, the fx-FD10 Pro OS sets the HIZCRB register (0xA405015A). I don't know whether this is only needed on the FD10 hardware.

Code: Select all
fx-FD10 Pro key matrix:
|      |      |      |      | DIAG |      | OSUPD|      |  0B  |  HIZB4
|      |      |      |      |      |      |      |      |  0A  |  HIZB3
|      |  F1  |  F2  |  F5  |  F6  |  F3  |  F4  |      |  09  |  HIZB2
|      | SHIFT| OPTN | MENU | EXIT | Left |  Up  |      |  08  |  HIZB1
|      | ALPHA| PROG |  DEL |      | Down | Right|      |  07  |  HIZB0
|      |      |      |      |      |      |      |      |  06  |  HIZB11
|      |      |      |      |      |      |      |      |  05  |  HIZB10
|      |  x^2 |   7  |   9  |  div | S-Up |   8  |      |  04  |  HIZB9
|      |  °'" |   4  |   6  |  mul |S-Down|   5  |      |  03  |  HIZB8
|      |   ,  |   1  |   3  |   -  | S-EXE|   2  |      |  02  |  HIZB7
|      |  Ans |   0  |      |   +  |  EXE |   .  |      |  01  |  HIZB6
|      |      |      |      |      |      |      |  AC  |  00  |  HIZB5
|  07  |  06  |  05  |  04  |  03  |  02  |  01  |  00  |      |

Copy this into a simple text editor and the formatting will be correct.

To check the [EXE] key, clear bit 1 in Port M data and clear bit 6 in register HIZCRB (HIZB6), then check if bit 2 of Port Z data is zero. The HIZCRB setting might be incompatible with non-FD10 calculators!

Some register initialization is also required:
Set bits 15:0 of port Z control to 0xAAAA (input mode).
Set bits 7:0 of keyboard register 0xA40501C6 to 0xFF.
Set bits 11:0 of port M control and port N control to 0x555 (output mode).
Set bits 7:0 of port M data and port N data to 0x3F.
Set bits 11:0 of register HIZCRB to 0xFFF.

We don't know what 8-bit register 0xA40501C6 does. Maybe it enables or disables the key-scan interface, since it is not used in this low-level FD10 keyboard routine.

Member
User avatar
Posts: 39
Joined: Fri Aug 21, 2015 11:54 am
Location: France
Calculators: Casio fx-9750GII, Casio fx-9750GII (SH4), Casio fx-9860GII, Casio fx-CG50

Re: Using SH7305 peripheral modules

Postby lephe » Mon Aug 31, 2015 9:53 am

TeamFX wrote:You don't have to use the key-scan interface on SH-4A models.
Instead of using ports A/B/M, you now have to use ports Z/M/N.

As you know, this way of analyzing the keyboard seems pretty tricky ; I tried to write my own function to realize the same operation as CheckKeyRow() using the doc information, but I couldn't manage to get rid of those side effects I described before.

TeamFX wrote:Refer to page "fx legacy schematics" in Simon's documentation.

I've checked this page from Simon Lothar's online documentations but didn't find anything related to SH-4A and port Z. Is it in the chm file ?

I think I'll give your method a try as soon as possible.

Senior Member
Posts: 100
Joined: Sun Mar 24, 2013 12:01 pm
Calculators: None

Re: Using SH7305 peripheral modules

Postby TeamFX » Mon Aug 31, 2015 10:45 am

I've checked this page from Simon Lothar's online documentations but didn't find anything related to SH-4A and port Z. Is it in the chm file?

No, it's outdated. There is no SH-4A information but it's still a good reference.

Member
User avatar
Posts: 39
Joined: Fri Aug 21, 2015 11:54 am
Location: France
Calculators: Casio fx-9750GII, Casio fx-9750GII (SH4), Casio fx-9860GII, Casio fx-CG50

Re: Using SH7305 peripheral modules

Postby lephe » Sun Sep 06, 2015 1:25 pm

SimonLothar wrote:The words at 0xA44B0000, 0xA44B0002...0xA44B000A seem to represent the actual hit key status.

That's wonderful, it just works flawlessly ! :D

I didn't even imagine it could be that simple: thanks to Casio's work probably, because I don't believe the MPU could natively handle the keyboard in such a simple way. :)

Senior Member
Posts: 100
Joined: Sun Mar 24, 2013 12:01 pm
Calculators: None

Re: Using SH7305 peripheral modules

Postby TeamFX » Sun Sep 06, 2015 5:24 pm

That key-scan interface is an SH-Mobile feature - you won't find it in standard SH processors.

There is probably some setup required before you can use this interface. It works in an add-in but does it work when the OS starts (i.e., after the boot code phase)?

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

Re: Using SH7305 peripheral modules

Postby SimonLothar » Fri Sep 11, 2015 7:21 am

TeamFX wrote:That key-scan interface is an SH-Mobile feature - you won't find it in standard SH processors.

Did you find some hints in SH-mobile MPU manuals?

TeamFX wrote:There is probably some setup required before you can use this interface. It works in an add-in but does it work when the OS starts (i.e., after the boot code phase)?

Definitly an initialization is required. The initialization takes place inside of syscall 0x117, just between the calls of syscall 0x240 and syscall 0x29. This involves several processor registers. You would need the details, if you want to write an OS replacement.
I'll be back!

Senior Member
Posts: 100
Joined: Sun Mar 24, 2013 12:01 pm
Calculators: None

Re: Using SH7305 peripheral modules

Postby TeamFX » Fri Sep 11, 2015 12:50 pm

Did you find some hints in SH-mobile MPU manuals?

I did a Google search for "renesas key-scan interface" and only mobile processors showed up.

This involves several processor registers. You would need the details, if you want to write an OS replacement.

Or use low-level ports Z/M/N for a start.

Previous

Return to General

Who is online

Users browsing this forum: No registered users and 5 guests