Author Topic: Porting TI-BASIC to HP PPL  (Read 3926 times)

0 Members and 1 Guest are viewing this topic.

gogogoluke

• Full User
• Join Date: Dec 2015
• Location:
• Posts: 22
• Post Rating Ratio: +0/-0
• Gender:
Porting TI-BASIC to HP PPL
« on: January 06, 2016, 07:41:31 pm »
I was porting some code to my new HP Prime, but I ran into a problem. I cannot find an alternative to the code "B》dim(LZ)", as it produces the error "Invalid input". What is a good alternative to setting the size of a list (or matrix) from a variable?

Entire TI-BASIC code (For context, nobody port this for me):
(click to show/hide)
« Last Edit: January 06, 2016, 07:45:04 pm by gogogoluke »

• Calculators owned: HP Prime, TI-84CSE
HP Prime, TI-84+CSE
Former Minecraft server owner
HP Prime enthusiast.

xlibman

• Omni founder & CW co-founder
• CodeWalrus Staff
• Super User
• Forum Maintenance
• Original 5
• CodeWalrus Supporter
• Join Date: Nov 2014
• Location: Quebec, Canada
• Posts: 19002
• Post Rating Ratio: +100/-5
• Gender:
Re: Porting TI-BASIC to HP PPL
« Reply #1 on: January 06, 2016, 07:59:06 pm »
Heya gogoluke and welcome to the forums. I don't remember what is the exact syntax to set a list dimension, but one trick I found that worked was to set a value to the highest list element you wanted.

For example, in Tunnel, I wanted my list to be 512 elements, so I just stored 0 in element 512 and it set the list dimension for me (or maybe it set it to 513? I forgot if lists start at 0 or 1 in HP PPL). That trick doesn't work if you want to set the list to a lower dimension afterwards, though (it only works upwards).

Code: [Select]
`0►LZ(B);`
(I actually wish that there was a TI-BASIC interpreter written in HP PPL, so that no porting would have been necessary, but since that doesn't exist yet)

Perhaps @alexgt might know if there is an actual dim command on the HP Prime?
• Calculators owned: TI-84 Plus C Silver Edition, TI-84 Plus CE, Casio fx-CG10
• Consoles, mobile devices and vintage computers owned: Samsung i5510, Nintendo Switch, Playstation TV
 Bandcamp|Reverbnation|Facebook|Youtube|Twitter Retired Omnimaga admin (2001-11) and editor (2012-14)

gogogoluke

• Full User
• Join Date: Dec 2015
• Location:
• Posts: 22
• Post Rating Ratio: +0/-0
• Gender:
Re: Porting TI-BASIC to HP PPL
« Reply #2 on: January 06, 2016, 08:12:34 pm »
Thanks, and I wish that there was an interpreter too, would be a lot faster than manually porting all of my programs. There is a dim function, but it appears to only report list/matrix dimensions, not set them. Lists are started at 1 in Non-CAS mode, but in CAS it starts at 0. On another note, what is the alternate for FILL(1,LZ)? (The game keeps track of HP via lists)
• Calculators owned: HP Prime, TI-84CSE
HP Prime, TI-84+CSE
Former Minecraft server owner
HP Prime enthusiast.

xlibman

• Omni founder & CW co-founder
• CodeWalrus Staff
• Super User
• Forum Maintenance
• Original 5
• CodeWalrus Supporter
• Join Date: Nov 2014
• Location: Quebec, Canada
• Posts: 19002
• Post Rating Ratio: +100/-5
• Gender:
Re: Porting TI-BASIC to HP PPL
« Reply #3 on: January 06, 2016, 08:32:33 pm »
Hm interesting that HP would let us view dimensions, but not set them. That seems rather limiting when it's like one of the most fundamental features of lists and matrices in maths. I don't exactly remember if there is a FILL command, but since HP PPL runs so fast, you can probably fill the elements one by one via a FOR loop and it will almost be instant.
• Calculators owned: TI-84 Plus C Silver Edition, TI-84 Plus CE, Casio fx-CG10
• Consoles, mobile devices and vintage computers owned: Samsung i5510, Nintendo Switch, Playstation TV
 Bandcamp|Reverbnation|Facebook|Youtube|Twitter Retired Omnimaga admin (2001-11) and editor (2012-14)

gogogoluke

• Full User
• Join Date: Dec 2015
• Location:
• Posts: 22
• Post Rating Ratio: +0/-0
• Gender:
Re: Porting TI-BASIC to HP PPL
« Reply #4 on: January 06, 2016, 08:38:50 pm »
I was hoping that wasn't the case, but at least it will be fast. I'm not filling insane amounts of list items anyways, so it shouldn't be a problem even if it were TI-BASIC.
• Calculators owned: HP Prime, TI-84CSE
HP Prime, TI-84+CSE
Former Minecraft server owner
HP Prime enthusiast.

alexgt

• Just your friendly neighborhood Ninja Stach Fancy Iron Man
• Super User
• Join Date: Dec 2014
• Location: Behind you
• Posts: 2615
• Post Rating Ratio: +6/-1
• Something should go here...
• Gender:
Re: Porting TI-BASIC to HP PPL
« Reply #5 on: January 06, 2016, 09:48:00 pm »
Use the MAKELIST(Expr,Var,Start,End) command

Or I can make a program for UtilPack
• Calculators owned: Ti-84+, Ti-Nspire, Hp Prime, Broken HP Prime, HP 48SX

xlibman

• Omni founder & CW co-founder
• CodeWalrus Staff
• Super User
• Forum Maintenance
• Original 5
• CodeWalrus Supporter
• Join Date: Nov 2014
• Location: Quebec, Canada
• Posts: 19002
• Post Rating Ratio: +100/-5
• Gender:
Re: Porting TI-BASIC to HP PPL
« Reply #6 on: January 07, 2016, 12:54:28 am »
Ideally it would be best for him to use standalone solutions for now, since UltiPack dev is stalled for now. But thanks for the command. Does that set his list dimension alex?
• Calculators owned: TI-84 Plus C Silver Edition, TI-84 Plus CE, Casio fx-CG10
• Consoles, mobile devices and vintage computers owned: Samsung i5510, Nintendo Switch, Playstation TV
 Bandcamp|Reverbnation|Facebook|Youtube|Twitter Retired Omnimaga admin (2001-11) and editor (2012-14)

alexgt

• Just your friendly neighborhood Ninja Stach Fancy Iron Man
• Super User
• Join Date: Dec 2014
• Location: Behind you
• Posts: 2615
• Post Rating Ratio: +6/-1
• Something should go here...
• Gender:
Re: Porting TI-BASIC to HP PPL
« Reply #7 on: January 07, 2016, 01:15:06 pm »
yep Expr is the equation that you want evaluated (or just put zero in there if you want it to be a fresh list). Var is the variable you want to be a list and then just put 1 for the start and the DIM you want for End
• Calculators owned: Ti-84+, Ti-Nspire, Hp Prime, Broken HP Prime, HP 48SX

gogogoluke

• Full User
• Join Date: Dec 2015
• Location:
• Posts: 22
• Post Rating Ratio: +0/-0
• Gender:
Re: Porting TI-BASIC to HP PPL
« Reply #8 on: January 07, 2016, 06:48:16 pm »
Thank you. Do you happen to know of an alternative to output()? It appears to not exist for HP Prime.
• Calculators owned: HP Prime, TI-84CSE
HP Prime, TI-84+CSE
Former Minecraft server owner
HP Prime enthusiast.

xlibman

• Omni founder & CW co-founder
• CodeWalrus Staff
• Super User
• Forum Maintenance
• Original 5
• CodeWalrus Supporter
• Join Date: Nov 2014
• Location: Quebec, Canada
• Posts: 19002
• Post Rating Ratio: +100/-5
• Gender:
Re: Porting TI-BASIC to HP PPL
« Reply #9 on: January 07, 2016, 07:32:42 pm »
No, but there is an alternative to Text(), which is TEXTOUT_P() . Also Instead of ClrHome or ClrDraw you can use RECT_P(#FFFFFF).
• Calculators owned: TI-84 Plus C Silver Edition, TI-84 Plus CE, Casio fx-CG10
• Consoles, mobile devices and vintage computers owned: Samsung i5510, Nintendo Switch, Playstation TV
 Bandcamp|Reverbnation|Facebook|Youtube|Twitter Retired Omnimaga admin (2001-11) and editor (2012-14)

alexgt

• Just your friendly neighborhood Ninja Stach Fancy Iron Man
• Super User
• Join Date: Dec 2014
• Location: Behind you
• Posts: 2615
• Post Rating Ratio: +6/-1
• Something should go here...
• Gender:
Re: Porting TI-BASIC to HP PPL
« Reply #10 on: January 08, 2016, 01:45:22 am »
You can use some maths and take advantage of TEXTOUT_P(), like what DJ said. all of the characters except some special chars take up the same amount of pixels if that helps
• Calculators owned: Ti-84+, Ti-Nspire, Hp Prime, Broken HP Prime, HP 48SX

xlibman

• Omni founder & CW co-founder
• CodeWalrus Staff
• Super User
• Forum Maintenance
• Original 5
• CodeWalrus Supporter
• Join Date: Nov 2014
• Location: Quebec, Canada
• Posts: 19002
• Post Rating Ratio: +100/-5
• Gender:
Re: Porting TI-BASIC to HP PPL
« Reply #11 on: January 08, 2016, 08:21:16 am »
Wait, HP PPL text is monospace? I thought it wasn't. That's good to know, because on the 83+ text on the graph screen wasn't.
• Calculators owned: TI-84 Plus C Silver Edition, TI-84 Plus CE, Casio fx-CG10
• Consoles, mobile devices and vintage computers owned: Samsung i5510, Nintendo Switch, Playstation TV
 Bandcamp|Reverbnation|Facebook|Youtube|Twitter Retired Omnimaga admin (2001-11) and editor (2012-14)

alexgt

• Just your friendly neighborhood Ninja Stach Fancy Iron Man
• Super User
• Join Date: Dec 2014
• Location: Behind you
• Posts: 2615
• Post Rating Ratio: +6/-1
• Something should go here...
• Gender:
Re: Porting TI-BASIC to HP PPL
« Reply #12 on: January 08, 2016, 01:02:54 pm »
Well, at least for the built in program editor it is, but I am pretty sure it is also monospaced in regular TEXTOUT_P() functions but I haven't needed it to be so I haven't tested it.
• Calculators owned: Ti-84+, Ti-Nspire, Hp Prime, Broken HP Prime, HP 48SX

Strontium

• Full User
• Join Date: Apr 2015
• Location: CA
• Posts: 243
• Post Rating Ratio: +3/-2
• hey
• Gender:
Re: Porting TI-BASIC to HP PPL
« Reply #13 on: January 09, 2016, 05:38:12 am »
Last I tried doing something with text on the HP Prime, the text was definitely not monospaced. Unless something has changed since then.
• Calculators owned: TI Nspire CX, HP Prime
• Consoles, mobile devices and vintage computers owned: NES

alexgt

• Just your friendly neighborhood Ninja Stach Fancy Iron Man
• Super User
• Join Date: Dec 2014
• Location: Behind you
• Posts: 2615
• Post Rating Ratio: +6/-1
• Something should go here...
• Gender:
Re: Porting TI-BASIC to HP PPL
« Reply #14 on: January 09, 2016, 06:06:45 am »
really?! it must be only in CAS, Homeview, NOtes, and the Editor because I know they are in there.
• Calculators owned: Ti-84+, Ti-Nspire, Hp Prime, Broken HP Prime, HP 48SX

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.