The Museum of HP Calculators

HP Forum Archive 21

[ Return to Index | Top of Index ]

HP Prime questions: I/O and Meta programming
Message #1 Posted by Andy Gryc on 31 Oct 2013, 10:28 p.m.

I've been an HP calc lover for a long time. (In fact, once upon a time I used to work at HP Corvallis, although on the HP100LX/200LX and not the calcs.) So when I heard about the HP Prime, I pretty much had to order one! I'm living in Canada these days; my order is on its way from HPCalc.org, but I don't expect it for a while. My experimentation to date is limited to emulator and reading the user manual. My last few calcs have been RPL. I never had one of the "BASIC" models. So I have some questions.

1) I have a Mac, so I think I'm stuck with either VMWare or WINE for running the HP Prime emulator. I'd rather not pay for a VM'ed Microsoft just to run the emulator, so I've got it in a WineBottle and it seems to mostly work. However, this simple program doesn't appear to work properly, and I'm wondering--is this an emulator problem, a WINE on Mac problem, or a bug?

EXPORT test()
BEGIN
 LOCAL c;
 c = RGB(0,0,255);
 FOR X FROM 0 TO 319 DO
  FOR Y FROM 0 to 239 DO
    PIXON_P(X,Y,c);
 END;
END;
FREEZE;
END;
I know there are simpler ways to do this (like with RECT), but this is just a test.

I would expect the screen to be all blue. I've tried several variants of things within the pixel loop, it's never a color other than black, regardless of what I put into the PIXON_P command. I suspect I'm seeing an artifact of the WineBottle containing the .exe for the Mac, but it'd be great if someone could help verify this. Could be a bug in my code too, but for the life of me I can't figure out what it might be.

2) Another problem that I think is related to WineBottle emulator (and not the Windows emulator) is that the code above partially paints the screen black from the left-hand side, but doesn't finish the whole screen UNTIL the mouse cursor is moved. Many other functions also don't appear to update the screen content until the mouse moves. Does this behavior show up on the Windows emulator too? If not, maybe there are some things I can mess with in the WINE configuration.

3) I'd like to do some significant programming on the Prime, but I think it will be painful to do it on the calc itself. I don't think it would be that much easier on the emulator (although at least you can touch type in the emulator :-). That lead me to wondering about creating an IDE for the Prime. Don't know if I'll get up the will to do this, but I was thinking Eclipse plug-in with syntax coloring for HP BASIC. However, it'd be great to actually connect to the Prime for debugging the program, just like a proper little embedded device. As best as I can tell, there's no way to do I/O over USB on the Prime side. I see people are trying to reverse engineer the PC/Mac side of the USB link, but that effort seems to be limited to duplicating what you could do for the Connectivity kit under Linux. That is, there's no way to build a Prime program that could receive arbitrary data. Is that a correct observation--no USB I/O on the calc itself?

4) Also on the debugging front, I'd need to be able to manipulate programs. That would include things like turning strings into programs, starting program in debug, single stepping program, etc.--all from programmatic control. I'm pretty sure that RPL could have done this--at least part of it--because there are handy to/from string functions that can create executable code. A careful reading of the Prime manual tells me that either those things aren't there, or they're well disguised in some "trick". Can you create a program that can create or debug another program?

5) Last question (for now). Is there any fundamental difference between these two constructs?

Value -> Variable;
Variable := Value;
Where of course, "->" is a two character representation of the solid right-pointing triangle character. The user manual seems to favor the first, but it's a lot less natural for programmer types like myself and just looks odd. Is there some execution speed or byte code size reason to prefer one over the other?
      
Re: HP Prime questions: I/O and Meta programming
Message #2 Posted by Han on 31 Oct 2013, 10:45 p.m.,
in response to message #1 by Andy Gryc

1) c:=RGB(0,0,255); // note the colon

2) sounds like a WINE issue

3) the connectivity kit and emulator in pair basically provide this for you; you can edit programs and apps on the conn. kit and save it to the emulator for testing without ever actually having to connect your calculator to your pc

4) you may be able to do this using expr(), which converts a string into a command -- the string itself could actually be a command that creates a brand new program from the command line

5) they are fundamentally the same -- one is for easy on-calc storage of values; the other is for easy touch-typing with a real keyboard

Edited: 31 Oct 2013, 10:48 p.m.

            
Re: HP Prime questions: I/O and Meta programming
Message #3 Posted by Andy Gryc on 31 Oct 2013, 11:22 p.m.,
in response to message #2 by Han

1) ARGGGGGGGG. Thank you Han. You know, with all the Pascal I used to do, you'd think I would have seen that!

2) Thanks. I'll try bottling it with different WineTricks to see if I can find the right combination.

3) Good to know. I doubt that the Connectivity kit will work on the Mac, so I'll have to see how that works with WINE.

4) Thanks for the hint.

5) Good to know, if I can just remember the colon.


[ Return to Index | Top of Index ]

Go back to the main exhibit hall