HP Forums
HP50 Grayscale programming (Updated) - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html)
+--- Forum: General Forum (/forum-4.html)
+--- Thread: HP50 Grayscale programming (Updated) (/thread-8029.html)



HP50 Grayscale programming (Updated) - sunhp - 03-24-2017 09:16 PM

Hello

Grayscale demo for HP49/50 written in MASD with Debug4x

Source : https://github.com/brizzly/sunhpgames/blob/master/HP50/Misc/grayscales.s

Working fine on Emu50
[Image: grayscale.png?raw=true]

Flicker a lot on a real 50g calc
[Image: realcalc50.jpg?raw=true]

Hardware grayscale are not possible in HP50 / Saturn ASM.

Whoever knows how to mix Hardware Grayscale in ARM code into Debug4X listing I will be happy to upgrade this code sample.

sunhp.


RE: HP50 Grayscale programming ? - sunhp - 03-25-2017 05:10 AM

Well well.. SATURN emulation layer that is run by the HP 50g ARM CPU so poorly render grayscale based on a old trick V-sync / interruption handler. And voila it seems to my eyes that only a native ARM display code could render "hardware" grayscale without flickering etc. Any code snippet or any help is welcome. Thanks.
sunhp.


RE: HP50 Grayscale programming ? - snrowe - 03-25-2017 05:35 AM

(03-25-2017 05:10 AM)sunhp Wrote:  Well well.. SATURN emulation layer that is run by the HP 50g ARM CPU so poorly render grayscale based on a old trick V-sync / interruption handler. And voila it seems to my eyes that only a native ARM display code could render "hardware" grayscale without flickering etc. Any code snippet or any help is welcome. Thanks.
sunhp.

Nice to see you back you make great games!

Not sure if this utility would help you, but it does a good job with greyscale on the hp50G. http://www.hpcalc.org/details/6134


RE: HP50 Grayscale programming (Updated) - sunhp - 03-26-2017 01:11 AM

(03-25-2017 05:35 AM)snrowe Wrote:  
(03-25-2017 05:10 AM)sunhp Wrote:  Well well.. SATURN emulation layer that is run by the HP 50g ARM CPU so poorly render grayscale based on a old trick V-sync / interruption handler. And voila it seems to my eyes that only a native ARM display code could render "hardware" grayscale without flickering etc. Any code snippet or any help is welcome. Thanks.
sunhp.

Nice to see you back you make great games!

Not sure if this utility would help you, but it does a good job with greyscale on the hp50G. http://www.hpcalc.org/details/6134

Thanks for your kind message!
OpenFire By Mario Lohajner (manjo) is really impressive. We don't know if an external lib is mandatory. Let's hope Mario see this thread and accept to share with us code sample and ideas.


RE: HP50 Grayscale programming (Updated) - manjo - 03-26-2017 10:46 AM

Hi :-)

-the idea is to make PICT (your framebuffer) big enough to fit the grayscale buffer
-then setup the ARM LCD controller to use the PICT as framebuffer
-there are a couple of tricks and things to take care when doing this
-ofcourse OPENFIRE does all this for you and more

as far as I know almost all HP50G users put OPENFIRE in their calcs to be able to browse GRO4 and GRO2 images so...
at this point it's not a big deal if you expect/require Openfire to be installed.

Install openfire to Flash (there is a lot of space) it's location is not critical for gamespeed, but the location of the game itself runs fastest in port0, somewat slower in port1 and slowest from flash.

If I had enough time I would go for a adventure engine in port0 with TONS of levels graphics even sound in SD card. Loaded on demand.

best regards,
manjo


RE: HP50 Grayscale programming (Updated) - sunhp - 03-26-2017 02:25 PM

Hey Mario thank you very much for sharing infos. Would you share sources or docs about the ARM LCD controller ?


RE: HP50 Grayscale programming (Updated) - manjo - 03-26-2017 11:10 PM

Well my sources are in the archive somewhere please note "open" in open fire doesn't mean open source it rather means like... "fire away" :-)
for documentation:
-there is a detailed PDF from Samsung, just google for:
samsung S3C2410X pdf

once again, if your game is in "Saturn domain" and if it works right on older 48 series I very much recommend using OpenFire to initialize the REALPF (read readme.txt for detailed instructions) grayscale mode, if the game is in "ARM domain" HPGCC has all the things you need C style ofcourse.
There is really no need to "reinvent the wheel"

If your game already works page-flipping, properly handling page timing and everything. All you need to do is initialize PF (page flipping mode) and when flipping frame buffers just call appropriate OpenFire routine and you'll get flicker free page-flipped grayscale. (this is meant for porting of older games, 32 gray scale image viewers and so on...)

OpenFire supports page-flipping grayscale it fixes some bugs (in fact emulates the "bugs") exactly as they were on the 48 series.

Check out the hpcalc.org for Lilian's games ported to HP50G using OpenFire.
These games are originally made for 48S and G series, Lilian ported these to 50G by modifying a couple of jumps/calls so these work as intended in 50G gray scale.
most gray scale classics like: ice cube, dune, cyclo, dr.barjo
If I remember right some of them he modified actually without the proper source code (just adding/modifying opcodes in binary). just added a far jump (GOSBVL) to page-flipping routine.

keep up the good work,
manjo


RE: HP50 Grayscale programming (Updated) - sunhp - 03-27-2017 12:50 AM

Found a detailed PDF from Samsung CPU: http://pdf.datasheetcatalog.com/datasheet/SamsungElectronic/mXyztxrx.pdf
Do you have a simple asm code sample (GOSBVL ****) using OpenFire to initialize the REALPF ?
Also, your website is broken : http://fly.srk.fer.hr/~manjo/openfire/
Thanks!


RE: HP50 Grayscale programming (Updated) - manjo - 03-28-2017 06:29 PM

Yes I'm aware, sadly the student organization at faculty used to maintain this server doesn't have the resources anymore :-( so I'll probably upload all my stuff to hpcalc.org or build a new site somewhere.

openfire has a readme.txt included in zip, REALPF is described there,
from readme:

REALPF
------
doesn't need palette to be set since it uses flipping in monochrome mode

-compatible with INITPF, it uses monochrome mode to display gray shades using
page-flipping technique
-game is responsible for the accurate page-timing
-works similar to the way how 48 series and 49G used to produce shades

It expects 2 arguments
2: #822C0 -memory location to be used as LCD hardware buffer
1: #83BC0 -address where compatibility routines will be installed to

call page flipping routine when #120 register is set to your screen
example:
D0= 00120
LA address
DAT0=A A
GOSBVL 83BC0

manjo


RE: HP50 Grayscale programming (Updated) - Egan Ford - 03-29-2017 07:11 PM

(03-28-2017 06:29 PM)manjo Wrote:  Yes I'm aware, sadly the student organization at faculty used to maintain this server doesn't have the resources anymore :-( so I'll probably upload all my stuff to hpcalc.org or build a new site somewhere.

Github perhaps?


RE: HP50 Grayscale programming (Updated) - Han - 04-04-2017 07:27 PM

The Open Fire website can still be accessed via the Wayback Machine.


RE: HP50 Grayscale programming (Updated) - sunhp - 09-19-2017 08:48 AM

Hello,

@manjo : Would you release source code with us please ?

I still need the code sample for native HP50 grayscale within Saturn ASM..

Cyrille maybe ? Smile

Thanks,
Julien (SunHp)