If you have trouble logging in, try to disable JavaScript temporarily. If that doesn't work, please contact  a d m i n @ c o d e w a l r . u s  with your account nickname.

* WalrusIRC Shoutbox (Support and development thread)

You need to have 5 posts and not be part of restricted usergroups in order to use the WalrusIRC embedded shoutbox. However, you can also access our IRC channel called #CodeWalrus via EFnet.

Author Topic: HP Prime PPL language (split from birthday thread)  (Read 37 times)

0 Members and 1 Guest are viewing this topic.

Offline DJ Omnimaga

  • Omni founder & CW co-founder
  • CodeWalrus Staff
  • Super User
  • Forum Maintenance
  • Original 5
  • CodeWalrus Supporter
  • *
  • Topic Management
  • Posts: 14072
  • Post Rating Ratio: +71/-7
    • dj_omnimaga
    • DJOmnimaga.music
    • @DJOmnimaga
    • dj_omnimaga
    • @DJOmnimaga
    • /u/DJ_Omnimaga
    • DJOmnimaga
    • 112/11286
    • View Profile
    • DJ Omnimaga music store
  • Gender: Male
HP Prime PPL language (split from birthday thread)
« on: August 11, 2016, 07:58:04 pm »
EDIT by DJ: Topic split from Birthday thread https://codewalr.us/index.php?topic=1529.0
Thanks everyone. :) I decided to give the HP Prime a try, because it seems possible that I could create some nifty programs with good performance on it. Once I learn my way around, we'll see, provided I can get computer/calc transfer working.
Wow nice that you got a Prime. I need to start coding on it again. You can do amazing stuff that rivals some CE ASM and C games, in HP PPL.
« Last Edit: August 17, 2016, 05:06:05 am by DJ Omnimaga »


  • Calculators owned: TI-73, TI-80 (broken), TI-81, TI-82, TI-83, TI-83+ (broken), TI-83+ (broken), TI-83+SE (broken), TI-84+, TI-84+CSE, TI-84+CE, TI-85, TI-86, TI-89T, TI-92, TI-Nspire, TI-Nspire CX, HP 39gII, HP Prime, Casio fx-7000G, fx-7400G+, fx-7700GE, fx-9750G+, fx-9750GII, fx-9860G, cfx-9850G, FX-1.0+, fx-CG10, fx-CP400
  • Consoles, mobile devices and vintage computers owned: Samsung i5510, Nexus 5, Atari 2600, Lynx, SMS, Game Gear, Genesis, Dreamcast, NES, SNES, N64, GCN, Wii, Wii U, GBA, DS, 3DS, PS2, PS3, PS4, PSP, PSVita, XBox 360, XBOne

Bandcamp|Reverbnation|Facebook|Youtube|Twitter
Retired Omnimaga admin (2001-11) and editor (2012-14)

Offline Travis

  • Full User
  • Safe-haven access
  • Posts: 79
  • Post Rating Ratio: +2/-0
    • 8361
    • View Profile
  • Gender: Male
Re: Re: Birthday thread (vote in poll)
« Reply #1 on: August 12, 2016, 12:53:32 am »
Yeah, I stayed up late last night reading through the programming section of the user guide, and the programming language looks like it should be capable enough. :) Graphics programming looks interesting, as the GROB functionality in general looks quite similar to that on the HP 50g, including the ability to do double-buffering and stuff, which is pretty cool. I never did a whole lot of graphics stuff on the 50g (just a tiny bit), but I'm fairly familiar with how it works and what's possible.

One thing that may take me some getting used to is the lack of a true directory structure/file system, and of course the ability to back up/archive data on an SD card, which is how I was able to dodge the whole “how am I going to connect this thing to Linux, and will the third-party Linux software work well?” issue with the 50g: The SD card is FAT, which has worked fine on Linux for ages. I wish they had made the Prime emulate a normal USB FAT disk for file transfer and such; that would have been very simple and universal and would have avoided the need for special PC communication software.

I'm also a bit underwhelmed with the program editor, to be honest. It seems rather lacking in functionality compared to the 50g's editor. Apparently there's no search or quick navigation like jumping directly to subprogram definitions (I fear that navigating large, complex programs is going to be painful), and it's not even indentation aware. But looking through the available commands, I see there does appear to be commands to read and write to the actual program sources, so maybe it would be possible to write a better on-calc program editor. ;)
  • Calculators owned: TI-81, TI-82, TI-85, TI-86, TI-89, TI-89 Titanium, 2 × HP 50g
ticalc.org staff member—http://www.ticalc.org/

Offline DJ Omnimaga

  • Omni founder & CW co-founder
  • CodeWalrus Staff
  • Super User
  • Forum Maintenance
  • Original 5
  • CodeWalrus Supporter
  • *
  • Topic Management
  • Posts: 14072
  • Post Rating Ratio: +71/-7
    • dj_omnimaga
    • DJOmnimaga.music
    • @DJOmnimaga
    • dj_omnimaga
    • @DJOmnimaga
    • /u/DJ_Omnimaga
    • DJOmnimaga
    • 112/11286
    • View Profile
    • DJ Omnimaga music store
  • Gender: Male
Re: Re: Birthday thread (vote in poll)
« Reply #2 on: August 12, 2016, 02:54:19 am »
Oh, trust me, you'll be blown away by the language speed. I don't recommend updating to OS 10077 but apparently it has sprite opacity support. Previous OSes have no sprite opacity, but they're still very powerful. You can display your sprites at any zoom, on 9 graphic buffers and so on. I recommend displaying them on a small buffer at 100% zoom then displaying that buffer zoomed in to fit the screen. You could even make a 96x64 game if you wanted to. But the thing about this language is the speed. Here's a screenshot demonstrating the sprite/buffer scaling capabilities, where I scroll a background around, flash some text (all text is about 10 copies of the text because I wanted an outline) and displays the title logo in chunks at different zooms to create a wave effect:



The fade-in/out pixelating effects uses the buffer scaling capabilities. The only issue is that like with Z80 calcs, FOR instructions are slow it seems. A 20x15 tiles map will give you 15 FPS. But you can simply pre-render the current screen, then when you scroll around you only draw the edge that's missing.
  • Calculators owned: TI-73, TI-80 (broken), TI-81, TI-82, TI-83, TI-83+ (broken), TI-83+ (broken), TI-83+SE (broken), TI-84+, TI-84+CSE, TI-84+CE, TI-85, TI-86, TI-89T, TI-92, TI-Nspire, TI-Nspire CX, HP 39gII, HP Prime, Casio fx-7000G, fx-7400G+, fx-7700GE, fx-9750G+, fx-9750GII, fx-9860G, cfx-9850G, FX-1.0+, fx-CG10, fx-CP400
  • Consoles, mobile devices and vintage computers owned: Samsung i5510, Nexus 5, Atari 2600, Lynx, SMS, Game Gear, Genesis, Dreamcast, NES, SNES, N64, GCN, Wii, Wii U, GBA, DS, 3DS, PS2, PS3, PS4, PSP, PSVita, XBox 360, XBOne

Bandcamp|Reverbnation|Facebook|Youtube|Twitter
Retired Omnimaga admin (2001-11) and editor (2012-14)

Offline Travis

  • Full User
  • Safe-haven access
  • Posts: 79
  • Post Rating Ratio: +2/-0
    • 8361
    • View Profile
  • Gender: Male
Re: Re: Birthday thread (vote in poll)
« Reply #3 on: August 12, 2016, 04:16:32 am »
The fade-in/out pixelating effects uses the buffer scaling capabilities. The only issue is that like with Z80 calcs, FOR instructions are slow it seems. A 20x15 tiles map will give you 15 FPS. But you can simply pre-render the current screen, then when you scroll around you only draw the edge that's missing.

Ah, neat. Is the 15 FPS you mention when trying to redraw everything every single frame (all 300 tiles and all sprites)? I was thinking about this and was imagining that with a scrolling tilemap, I'd render all tiles once and then only render an additional column or row (depending on scroll direction) just before it scrolls on screen, possibly using a back-buffer GROB one tile larger than the screen in each direction to do so. It sounds like this is what you're describing. I figure that'd indeed be a lot faster.

Cool.
  • Calculators owned: TI-81, TI-82, TI-85, TI-86, TI-89, TI-89 Titanium, 2 × HP 50g
ticalc.org staff member—http://www.ticalc.org/

Offline DJ Omnimaga

  • Omni founder & CW co-founder
  • CodeWalrus Staff
  • Super User
  • Forum Maintenance
  • Original 5
  • CodeWalrus Supporter
  • *
  • Topic Management
  • Posts: 14072
  • Post Rating Ratio: +71/-7
    • dj_omnimaga
    • DJOmnimaga.music
    • @DJOmnimaga
    • dj_omnimaga
    • @DJOmnimaga
    • /u/DJ_Omnimaga
    • DJOmnimaga
    • 112/11286
    • View Profile
    • DJ Omnimaga music store
  • Gender: Male
Re: Re: Birthday thread (vote in poll)
« Reply #4 on: August 12, 2016, 04:56:03 am »
Yeah, redrawing 300 tiles every frame was done in 15 FPS. That is definitively more than enough, but of course for smoother gameplay you definitively want to use tricks as you mentioned. I never figured out how to do such scrolling routine, though.
  • Calculators owned: TI-73, TI-80 (broken), TI-81, TI-82, TI-83, TI-83+ (broken), TI-83+ (broken), TI-83+SE (broken), TI-84+, TI-84+CSE, TI-84+CE, TI-85, TI-86, TI-89T, TI-92, TI-Nspire, TI-Nspire CX, HP 39gII, HP Prime, Casio fx-7000G, fx-7400G+, fx-7700GE, fx-9750G+, fx-9750GII, fx-9860G, cfx-9850G, FX-1.0+, fx-CG10, fx-CP400
  • Consoles, mobile devices and vintage computers owned: Samsung i5510, Nexus 5, Atari 2600, Lynx, SMS, Game Gear, Genesis, Dreamcast, NES, SNES, N64, GCN, Wii, Wii U, GBA, DS, 3DS, PS2, PS3, PS4, PSP, PSVita, XBox 360, XBOne

Bandcamp|Reverbnation|Facebook|Youtube|Twitter
Retired Omnimaga admin (2001-11) and editor (2012-14)

Offline Travis

  • Full User
  • Safe-haven access
  • Posts: 79
  • Post Rating Ratio: +2/-0
    • 8361
    • View Profile
  • Gender: Male
Re: Re: Birthday thread (vote in poll)
« Reply #5 on: August 12, 2016, 05:27:29 am »
I haven't tried it myself before yet, but I think It's sort of similar to how a lot of games on old consoles like the NES worked, I think. They had pretty slow CPUs by today's standards (often even slower than the old Z80 calcs, I think), but even worse, they couldn't access video RAM at the same time as the video output hardware. The video hardware had to read it almost all of the time to send the signal to the TV (which required a constant 50/60 FPS depending on NTSC/PAL), and the game program only had just enough time between frames to update maybe a couple of rows of offscreen tiles at a time or something like that. In some games when there were too many things on the screen and they lagged, IIRC there would be graphical glitches if the CPU didn't finish updating video RAM in time before the controller started reading it again for the next frame. This happens in Zelda II and TMNT I, for instance (where the screen jumps up and down or the HUD flickers on and off during lag).

Thankfully, we don't have to worry about all that on the calcs :P

But anyway, in a platformer, for instance, you might have variables to keep track of the current X and Y scroll offset and add/subtract it when checking screen coordinates of the objects to figure out where on the screen they actually are while taking the scrolling in account. Or something like that. In my first games, I'll likely just have the scrolling happen either a screen or a tile at a time as an animation (either like Zelda I or in games like Final Fantasy where you move on a map only in tile increments, and nothing else happens during the actual scrolling), which should be easier to do.
  • Calculators owned: TI-81, TI-82, TI-85, TI-86, TI-89, TI-89 Titanium, 2 × HP 50g
ticalc.org staff member—http://www.ticalc.org/

Offline DJ Omnimaga

  • Omni founder & CW co-founder
  • CodeWalrus Staff
  • Super User
  • Forum Maintenance
  • Original 5
  • CodeWalrus Supporter
  • *
  • Topic Management
  • Posts: 14072
  • Post Rating Ratio: +71/-7
    • dj_omnimaga
    • DJOmnimaga.music
    • @DJOmnimaga
    • dj_omnimaga
    • @DJOmnimaga
    • /u/DJ_Omnimaga
    • DJOmnimaga
    • 112/11286
    • View Profile
    • DJ Omnimaga music store
  • Gender: Male
Re: Re: Birthday thread (vote in poll)
« Reply #6 on: August 12, 2016, 07:03:38 am »
Yeah I would say that HP PPL power would allow you to at least make games that look like SNES material, without the extra chips some cartridges used. It's a compiled language IIRC, and is most likely not as efficient as C due to being proprietary and designed to run on a math engine, plus I don't know if the hardware accelleration features of the HP Prime rumors are founded. The NES supported mappers at least.

In any case, I would like to port GalagACE to the Prime at some point, to see how far I can enhance it before it slows down.
  • Calculators owned: TI-73, TI-80 (broken), TI-81, TI-82, TI-83, TI-83+ (broken), TI-83+ (broken), TI-83+SE (broken), TI-84+, TI-84+CSE, TI-84+CE, TI-85, TI-86, TI-89T, TI-92, TI-Nspire, TI-Nspire CX, HP 39gII, HP Prime, Casio fx-7000G, fx-7400G+, fx-7700GE, fx-9750G+, fx-9750GII, fx-9860G, cfx-9850G, FX-1.0+, fx-CG10, fx-CP400
  • Consoles, mobile devices and vintage computers owned: Samsung i5510, Nexus 5, Atari 2600, Lynx, SMS, Game Gear, Genesis, Dreamcast, NES, SNES, N64, GCN, Wii, Wii U, GBA, DS, 3DS, PS2, PS3, PS4, PSP, PSVita, XBox 360, XBOne

Bandcamp|Reverbnation|Facebook|Youtube|Twitter
Retired Omnimaga admin (2001-11) and editor (2012-14)

Offline Travis

  • Full User
  • Safe-haven access
  • Posts: 79
  • Post Rating Ratio: +2/-0
    • 8361
    • View Profile
  • Gender: Male
Re: Re: Birthday thread (vote in poll)
« Reply #7 on: August 12, 2016, 07:38:10 pm »
I fooled around a little with a simple program that counts as fast as possible. Double-buffering definitely seems to be the way to go, even for fairly simple stuff. Screen updates are very smooth and flicker-free that way. Of course, it's even faster just writing text directly to the screen (G0), but not surprisingly it flickers like mad. :P Unfortunately, I think I see some evidence of tearing sometimes (I guess there's no way to sync blits to LCD refresh rate) but just being able to control when the screen updates is already a very important and powerful feature.

In response to IRC (I was AFK), I don't mind splitting this discussion. I was actually wondering if I was derailing the thread too much. :)
  • Calculators owned: TI-81, TI-82, TI-85, TI-86, TI-89, TI-89 Titanium, 2 × HP 50g
ticalc.org staff member—http://www.ticalc.org/

Offline Travis

  • Full User
  • Safe-haven access
  • Posts: 79
  • Post Rating Ratio: +2/-0
    • 8361
    • View Profile
  • Gender: Male
Re: HP Prime PPL language (split from birthday thread)
« Reply #8 on: August 20, 2016, 01:40:40 pm »
I just had to do it. I made a screen-inverting program that works pixel by pixel.

Not really, but I made something that isn't too far off (though a bit more useful). CONTOUR() is a very basic contour-type plotter that evaluates a function Z=F(X,Y) for every pixel and displays the Z value as a color. It's just a practice program, so it doesn't do a whole lot. On the calc it typically takes around a minute to graph a simple function in either grayscale or a rainbow-like spectrum. The last graph created is stored to G1 for further use. ENTER/ESC after graphing finishes returns to the screen for entering parameters (any other key can be used to brighten the backlight after it dims, for better viewing).

Warning: At least on my FW 8151 calc and the HP simulator, pressing ON to abort the program during graphing seems to lock up the OS and require a forced reboot with certain functions, like gcd() and lcm(). I don't know why. It might be best to wait for the program to finish, press ENTER/ESC to return to the input form, then use ESC to quit.

Code: [Select]
EXPORT XLO:=−10;
EXPORT XHI:=10;
EXPORT YLO:=−10;
EXPORT YHI:=10;
EXPORT ZLO:=−4;
EXPORT ZHI:=4;
EXPORT XPHI:=GROBW_P(G0);
EXPORT YPHI:=GROBH_P(G0);
EXPORT ZF:='SIN(X*Y)-COS(X)/TAN(Y)';
EXPORT PALETTE:=1;


EXPORT GETCOLOR(ZVAL)
BEGIN
 ZVAL:=(ZVAL-ZLO)/(ZHI-ZLO)*256;
 ZVAL:=MAX(MIN(IP(ZVAL),255),0);
 CASE
  IF PALETTE==2 THEN
   LOCAL ZNORM:=IP((ZVAL MOD 51.2)*(256/51.2));
   CASE
     IF ZVAL<52 THEN RETURN RGB(0,0,ZNORM); END;
     IF ZVAL<103 THEN RETURN RGB(0,ZNORM,255); END;
     IF ZVAL<154 THEN RETURN RGB(0,255,255-ZNORM); END;
     IF ZVAL<205 THEN RETURN RGB(ZNORM,255,0); END;
     IF ZVAL<256 THEN RETURN RGB(255,255-ZNORM,0); END;
     DEFAULT
   END;
  END;
  DEFAULT
   RETURN RGB(ZVAL,ZVAL,ZVAL);
 END;
END;

EXPORT GETERRCOLOR()
BEGIN
 CASE
  IF PALETTE==2 THEN
   RETURN RGB(255,255,255);
  END;
  DEFAULT
   RETURN RGB(255,0,0);
 END;
END;

EXPORT PLOT(XSTART,XSTOP,XSTEP,
            YSTART,YSTOP,YSTEP)
BEGIN
 LOCAL XPX,YPX;
 FOR YPX FROM YSTART TO YSTOP STEP YSTEP DO
  Y:=((YPHI-YPX)/YPHI)*(YHI-YLO)+YLO;
  FOR XPX FROM XSTART TO XSTOP STEP XSTEP DO
   X:=(XPX/XPHI)*(XHI-XLO)+XLO;
   IFERR Z:=EVAL(ZF);
   THEN PIXON_P(G0,XPX,YPX,GETERRCOLOR());
   ELSE PIXON_P(G0,XPX,YPX,GETCOLOR(Z));
   END;
  END;
 END;
END;

EXPORT CONTOUR()
BEGIN
WHILE 1 DO
 //Get function and range from user
 IF NOT INPUT({
  {ZF,[8],{15,84,0}},
  {PALETTE,{"Grayscale","Spectrum"},
   {15,84,1}},
  {XLO,[0],{15,41,3}},
  {XHI,[0],{58,41,3}},
  {YLO,[0],{15,41,4}},
  {YHI,[0],{58,41,4}},
  {ZLO,[0],{15,41,5}},
  {ZHI,[0],{58,41,5}}},
  "Simple countour plotter",
  {"Func:","Color:",
   "X Rng:","","Y Rng:","","Z Rng:",""},
  {"Graph function",
   "Palette used for graph",
   "Minimum X value","Maximum X value",
   "Minimum Y value","Maximum Y value",
   "Minimum Z value","Maximum Z value"}
 ) THEN BREAK; END;

 LOCAL XPX,YPX;
 
 //Plot
 RECT_P();
 PLOT(0,XPHI,2,0,YPHI,2);
 PLOT(1,XPHI,2,0,YPHI,2);
 PLOT(0,XPHI,1,1,YPHI,2);

 // Save last graph to G1 and wait
 DIMGROB_P(G1,XPHI,YPHI);
 BLIT_P(G1,G0);
 WHILE 1 DO
  LOCAL K:=WAIT(−1);
  IF TYPE(K)==0 THEN
   IF K==4 OR K==30 THEN BREAK; END;
  END;
 END;
END;

END;
  • Calculators owned: TI-81, TI-82, TI-85, TI-86, TI-89, TI-89 Titanium, 2 × HP 50g
ticalc.org staff member—http://www.ticalc.org/

 


You can also use the following HTML or bulletin board code to share it on your page or forum signature!


Also do not forget to check our affiliates below.
Planet Casio TI-Planet Calc.news BroniesQC BosaikNet Velocity Games