Jump to content



Photo
- - - - -

Getting Grayscale Pixels On Sh4

sh4 grayscale monochrome lcd casio fx-9860g fx-9750gii graph85

  • Please log in to reply
1 reply to this topic

#1 Viliami

Viliami

    Casio Addict

  • Moderator
  • PipPipPip
  • 96 posts
  • Gender:Male
  • Location:New Zealand
  • Interests:C++ - OpenGL,SDL
    Python - Pygame
    Java - SFML
    C - Casio SDK

  • Calculators:
    FX-9750 GII upgraded to FX-9860 GII

Posted 29 November 2015 - 08:17 AM

Does anybody know how to get gray-scale pixels on SH4-type fx-9860gii model calculators.

I've read that Kucalc got it working back in 2007 but that only for sh3. I know C and C++ but I don't know how to write assembly.

 

The Casio fx-9860 model series only has a monochrome LCD, therefore it can only display pixels in black and white, but a lot of people found ways to emulate tones of gray(gray-scale) on the LCDs.

You have to switch the pixels on and off at a high frequency to trick our eyes to see gray. A darker gray can be achieved by displaying the black pixels for a little while longer.

I've already tried doing this in C, but the flicker speed is not even close to the speed needed to achieve a gray looking pixel.

 

I know it's possible because people have already done it for the 9860G, and they also achieved gray-scale on the TI-83+ using the same technique.

I've seen it used in Doodle Jump and Mario Land CE and it looks awesome. Games look so much better with gray-scale.

 

Please reply if you have any information/comments about gray-scale on the SH4-type CPUs.


Edited by Viliami, 01 December 2015 - 12:38 AM.

  • frankmar98 and imyxh like this

#2 imyxh

imyxh

    Newbie

  • Members
  • Pip
  • 1 posts
  • Gender:Male
  • Location:Washington, USA
  • Interests:reverse engineering

  • Calculators:
    fx-9860GII-2 (SH-4A)

Posted 19 August 2019 - 10:35 PM

Hello! I see it's been a while since this was posted. I took a look into PierrotLL's simplified version of kucalc's work and it looks like grayscale was implemented with a whole new Screen struct, holding a light buffer and a dark buffer on the heap as well as timing variables.

 

The interesting part was, I couldn't find any part of that code that seemed to switch between the buffers or any sort of loop like that. I suspect that there may have been some interfacing with underlying firmware or something of the sort to do this automatically?

 

I'm especially suspicious of this because of the following SuperH assembler code:

_reset_calc:
        mov.l   #h'A0000000, r0
        jmp     @r0
        nop

It appears that to turn off the grayscale mode PierrotLL's library jumps to the address 0xA0000000. Part of me wants to guess that that's an fxlib function address, perhaps Bdisp_AreaClr?

I'll be honest, despite being decent at x86 assembler, I can't read C code for shit. So I right now I'm caught up on this sort of thing:

#define INTC (*(volatile struct st_intc *)0xFFFFFEE0)
#define INTX (*(volatile struct st_intx *)0xA4000000)
#define TMU  (*(volatile struct st_tmu  *)0xFFFFFE92)
#define TMU0 (*(volatile struct st_tmu0 *)0xFFFFFE94)

If anyone knows what these expressions do, input would be appreciated.

 

TL;DR: I think the SH3 grayscale flickering was implemented in some weird low-level way, and perhaps, Viliami, you were trying to do it through the SDK which wouldn't let you flicker as quickly?







Also tagged with one or more of these keywords: sh4, grayscale, monochrome, lcd, casio, fx-9860g, fx-9750gii, graph85

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users