(HP50g) HpPascal and contrast of the screen
|
10-26-2017, 11:31 PM
(This post was last modified: 10-26-2017 11:40 PM by Gilles59.)
Post: #1
|
|||
|
|||
(HP50g) HpPascal and contrast of the screen
Hi All,
I wrote a breakout for the HP50g in HPPascal. See http://www.hpcalc.org/details/8662 For this program I have to change the contrast of the screen. So I use the procedure 'Contraste' in the "systemHP" unit of HPPascal. I would like that my program reset the initial contrast when it ends. The procedure to change the constrast in HPPascal is define like this : Code: procedure Contraste (c: byte); A function (that returns a value in Pascal) is define in HPPascal like this (for example) : Code: function Keypressed : boolean; I know nothing about saturn ASM. I want to create a function that returns the value of the contast of the screen, Something like : Code:
Could somenone help me for the ASM code ? In the documentation (in french) I found this : : Quote:Appel d'une fonction ou d'une procédure |
|||
10-27-2017, 03:35 AM
Post: #2
|
|||
|
|||
RE: (HP50g) HpPascal and contrast of the screen
The document you referenced seems to describe a different protocol than the examples provided. Whereas the documentation talks about data register D0 being used to designate storage locations that are set for function arguments and return values, the examples appear to expect a pointer to the parameter being passed in R1a. Is it possible the document provided is for a different version of HP Pascal? Or perhaps they are both right, but simply used in different contexts (possibly when only one argument/return value is needed?). In that case, it might make sense to mimic the methods used in the examples you provided (R1a holding a pointer to the passed argument/return value).
I believe it should be possible to do what you're wanting, probably with a fairly simple asm routine if the protocol can be verified. Also, unless I'm misunderstanding something (highly possible!), it appears that the "Contraste" function writes the low-order 4 bits of the supplied byte to address location 101 and then simply clears the hi bit (for contrast anyway) at location 102. This would imply that the function only succeeds at writing (param MOD 16) to the contrast I/O location. Is this something that you have noticed, or am I simply misunderstanding what it's doing? |
|||
10-27-2017, 01:33 PM
Post: #3
|
|||
|
|||
RE: (HP50g) HpPascal and contrast of the screen
pardon the someone what OT please.
Where is HPPascal? I tried a search on hpcalc.org but didn't find anything |
|||
10-27-2017, 02:35 PM
Post: #4
|
|||
|
|||
RE: (HP50g) HpPascal and contrast of the screen
(10-27-2017 01:33 PM)EugeneNine Wrote: pardon the someone what OT please. I believe this is what Gilles is referring to: http://www.hpcalc.org/details/6035 |
|||
10-27-2017, 03:04 PM
Post: #5
|
|||
|
|||
RE: (HP50g) HpPascal and contrast of the screen
Wikis are great, Contribute :) |
|||
10-27-2017, 05:02 PM
(This post was last modified: 10-27-2017 05:09 PM by Gilles59.)
Post: #6
|
|||
|
|||
RE: (HP50g) HpPascal and contrast of the screen
For information, I installed HPPascal 2.1 on Win10 but I had to change some settings in the W10 register (sorry i forgot exactly what ...). The help file is an old format no more supported in W10 but I found an utility to change the help file in a PDF format, if there is some interest I can put this PDF file somewhere for download.
HPPascal is an old project with no support since a long time. I'm not sure that the version published on HPCalc have the right units file (.UNT) for the HP50g and 130x80 screen. HPPascal works like this : you create your program on a PC, compile it, you get a .COD file for your HP50. With the emulator just drag ans dop the .COD and EVAL. The syntax remind me Turbo Pascal with major limitation. But it's very fast with dedicated units for graphics and sprites. HPPASCAL is describe as Open source but you cant download it freely on http://hppascal.free.fr/pages/home.htm If there is some interest I can also upload somewhere the .UNT files that as use to target the code for 49g+/50g |
|||
10-27-2017, 05:14 PM
Post: #7
|
|||
|
|||
RE: (HP50g) HpPascal and contrast of the screen
It seems that there is some interest, Gilles.
The sample that you provided in your first post translated reasonably well with google translate -- it clobbered the LA command as might be expected, but was quite clear for most things. Would you be able to post another example of an asm function that returns a BYTE value instead of boolean? That would help clarify that the data format is as expected, and should be a reasonable template for setting up your GetContrast command. |
|||
10-27-2017, 05:53 PM
Post: #8
|
|||
|
|||
RE: (HP50g) HpPascal and contrast of the screen
Based on the code samples, the following may do what you need. I would recommend trying this on an emulated system first, of course:
Code: function GetContrast: byte; |
|||
10-27-2017, 06:22 PM
(This post was last modified: 10-27-2017 07:10 PM by EugeneNine.)
Post: #9
|
|||
|
|||
RE: (HP50g) HpPascal and contrast of the screen
I played with google translate a little, got to this page
https://translate.google.com/translate?h...e_get.php3 looks like all the sources are there. A bunch of Microsoft Visual C++ 'extensions' rather than standard C++ though. |
|||
10-27-2017, 07:29 PM
(This post was last modified: 10-27-2017 07:35 PM by Gilles59.)
Post: #10
|
|||
|
|||
RE: (HP50g) HpPascal and contrast of the screen
I did not find an example of ASM with Byte.
But I changed this : Code: function readkey : char; with this : Code: function readkey2 : Byte; And this works fine with this program : Code: Program Texte; TU David, I will try your suggestion. |
|||
10-27-2017, 08:16 PM
(This post was last modified: 10-27-2017 08:17 PM by Gilles59.)
Post: #11
|
|||
|
|||
RE: (HP50g) HpPascal and contrast of the screen
(10-27-2017 05:53 PM)DavidM Wrote: Based on the code samples, the following may do what you need. I would recommend trying this on an emulated system first, of course: I get an error at compilation phase : Unknown instruction in " A=A&C B " |
|||
10-27-2017, 11:41 PM
Post: #12
|
|||
|
|||
RE: (HP50g) HpPascal and contrast of the screen
(10-27-2017 08:16 PM)Gilles59 Wrote:(10-27-2017 05:53 PM)DavidM Wrote: Based on the code samples, the following may do what you need. I would recommend trying this on an emulated system first, of course: Apparently HP-Pascal uses a different order for the registers in that command, as I now see in the definition of the Contraste function. Try replacing that command with "A=C&A B" instead. Some assemblers prefer that ordering over the first. |
|||
10-28-2017, 11:53 AM
(This post was last modified: 10-28-2017 11:53 AM by Gilles59.)
Post: #13
|
|||
|
|||
RE: (HP50g) HpPascal and contrast of the screen
(10-27-2017 11:41 PM)DavidM Wrote: Apparently HP-Pascal uses a different order for the registers in that command, as I now see in the definition of the Contraste function. Try replacing that command with "A=C&A B" instead. Some assemblers prefer that ordering over the first. That' perfect, it works. Thank you David ! |
|||
10-28-2017, 12:00 PM
(This post was last modified: 10-28-2017 12:26 PM by DavidM.)
Post: #14
|
|||
|
|||
RE: (HP50g) HpPascal and contrast of the screen | |||
10-28-2017, 01:32 PM
Post: #15
|
|||
|
|||
RE: (HP50g) HpPascal and contrast of the screen
(10-28-2017 12:00 PM)DavidM Wrote:(10-28-2017 11:53 AM)Gilles59 Wrote: That' perfect, it works. Thank you David ! Hummmm, No... Value >15 give a very low contrast ... It looks to works fine only with values between 10-15. Perhaps a difference between the 49-50g and 48 ? Or a problem with the initial Contrast program wich don't works fine ? Code: Program Test; |
|||
10-28-2017, 02:34 PM
(This post was last modified: 10-28-2017 11:39 PM by DavidM.)
Post: #16
|
|||
|
|||
RE: (HP50g) HpPascal and contrast of the screen
(10-28-2017 01:32 PM)Gilles59 Wrote: Hummmm, No... Value >15 give a very low contrast ... It looks to works fine only with values between 10-15. Perhaps a difference between the 49-50g and 48 ? Or a problem with the initial Contrast program wich don't works fine ? As I mentioned before, it appears that the Constraste routine ignores the hi-order bit of the byte you give it, thus only setting the contrast properly for values 0-15. You could easily test this in HP-Pascal by following Contraste(17); with: x := GetContrast; ...and then outputting x in whatever way makes sense. My suspicion is that x will be 1 if you do (contrast MOD 16), which would clearly indicate the problem. To make it easier, you may want to include a Contraste(14) step after the GetContrast call so that you don't have to manually reset it after running the code. The following may work better for setting the contrast: Code: procedure SetContrast(newValue: byte); It masks out the high-order 3 bits of the byte you give it (effectively doing x MOD 32), then adds back in the display bits from i/o location 102 before setting the new contrast value. If I've coded it properly (I can't test it myself ), you should also be able to do the previous test successfully with SetContrast/GetContrast to verify it. |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)