CodeWalrus

Development => Calculators => Calc Projects, Programming & Tutorials => Topic started by: alexgt on June 20, 2015, 11:33:47 PM

Title: UtilPack/ UtilComp [hp prime][lib]
Post by: alexgt on June 20, 2015, 11:33:47 PM
This is UtilPack and UtilComp (I will post a download tomorrow). UtilPack is a lib for the HP Prime! Right now it has three functions:
[spoiler=Functions]GETTIME(); returns the time in a list: {H,M,S}
GETDATE(); returns the date in a list: {Y,M,D}
RUNPROG(Prog); runs Prog (but has the same limitation as SIFS right now (it cannot run programs with arguments in the main function :())[/spoiler]

UtilComp will be a UtilPack compiler so when you release the program/ game to the public the user won't have to have UtilPack on their calc.
NOTE: if you have UtilPack on your calc and you are a developer you don't need to compile it because it uses the functions right out of UtilPack ;)
Title: Re: UtilPack/ UtilComp
Post by: Unicorn on June 20, 2015, 11:41:17 PM
So is UtilPack kind of like a third party library?
Title: Re: UtilPack/ UtilComp
Post by: Dream of Omnimaga on June 21, 2015, 04:12:51 AM
Seems very nice. I am curious if eventually this could be developed into some sort of library for use by HP PPL programmers to make it easier to program games.
Title: Re: UtilPack/ UtilComp [hp prime][lib]
Post by: Snektron on June 21, 2015, 04:18:24 PM
Would definitely be awesome :D also we still need a cross compiled language that supports TI 84 +/ CSE / CE and HP Prime too <_<
Title: Re: UtilPack/ UtilComp [hp prime][lib]
Post by: alexgt on June 21, 2015, 05:24:26 PM
Quote from: Unicorn on June 20, 2015, 11:41:17 PM
So is UtilPack kind of like a third party library?
Yup.

Quote from: DJ Omnimaga on June 21, 2015, 04:12:51 AM
Seems very nice. I am curious if eventually this could be developed into some sort of library for use by HP PPL programmers to make it easier to program games.
Yeah, that would be awesome! Also anyone can make a Utility for UtilPack, or if you have an idea just post it here and I will try to make it work ;)

Quote from: Cumred_Snektron on June 21, 2015, 04:18:24 PM
Would definitely be awesome :D also we still need a cross compiled language that supports TI 84 +/ CSE / CE and HP Prime too <_<
If only.......

EDIT: Here is a download :)
Title: Re: UtilPack/ UtilComp
Post by: Dream of Omnimaga on June 25, 2015, 12:37:11 AM
Ok I'll try this soon :) Sorry for not checking sooner, I was quite busy and had lots of posts to catch up on. D:
Title: Re: UtilPack/ UtilComp [hp prime][lib]
Post by: alexgt on June 25, 2015, 02:38:43 PM
Meh, all it does right now is tell you the date and time and execute programs semi reliably :P

the real coolness is when I get UtilComp working where it will replace all of the GETTIME(); with the actual code to get the time inside the program O.O
Title: Re: UtilPack/ UtilComp [hp prime][lib]
Post by: Snektron on June 25, 2015, 03:12:06 PM
Sounds cool :D
You should add more functions too :P
Title: Re: UtilPack/ UtilComp
Post by: alexgt on June 25, 2015, 05:03:48 PM
Quote from: Cumred_Snektron on June 25, 2015, 03:12:06 PM
Sounds cool :D
You should add more functions too :P
I am kind of out of ideas (not that I have really been thinking about it)
I came up with the idea to make this when I got into getting the time (turns out it is allot more complicated than I thought) so I wanted it to be available to anybody :)
Also as I add features to SIFS I am going to add more stuff to this because SIFS is pretty much a UtilPack with a GUI and UtilPack is for easy neat coding :)

Also if anybody has ideas I will add them to UtilPack :)
Title: Re: UtilPack/ UtilComp
Post by: Unicorn on June 26, 2015, 01:39:05 AM
Quote from: DJ Omnimaga on June 25, 2015, 12:37:11 AM
Ok I'll try this soon :) Sorry for not checking sooner, I was quite busy and had lots of posts to catch up on. D:

Catching up on posts oh boy! :P

So will this Lib be included in Sifs?
Title: Re: UtilPack/ UtilComp
Post by: Dream of Omnimaga on June 29, 2015, 07:00:12 AM
I think a scrolling tilemap routine (that supports actual tilemaps, not just scrolling through a very large pic) would be nice.
Title: Re: UtilPack/ UtilComp
Post by: Unicorn on June 29, 2015, 10:10:05 PM
Would creating random tilemaps be feasible? IE a floppy bird thing? RAndom pipe lengths?
Title: Re: UtilPack/ UtilComp
Post by: Dream of Omnimaga on July 01, 2015, 05:00:46 AM
Perhaps not specific to Flappy Bird, but I think random maze generation would not be too slow in HP PPL if coded properly.
Title: Re: UtilPack/ UtilComp
Post by: Unicorn on July 01, 2015, 09:06:55 AM
Hmm, that woul be nice. (my mind emediatly went to drawing a maze on the CSE's graphscreen ) :P
Title: Re: UtilPack/ UtilComp [hp prime][lib]
Post by: alexgt on July 02, 2015, 05:29:00 PM
 :w00t: UPDATE! :w00t:
- Added TWAIT(Duration) Function that waits duration milliseconds :)

This is much better than the WAIT() command because the wait command goes down to 0.0001 (at times I needed a shorter wait believe it or not :P)
Title: Re: UtilPack/ UtilComp
Post by: Unicorn on July 02, 2015, 05:38:50 PM
Milliseconds? That's quite a specific function! What would it be used for?
Title: Re: UtilPack/ UtilComp
Post by: alexgt on July 02, 2015, 06:42:17 PM
In MinePrime I had a wait function for walking/running and I had the wait to 0.0001 in a for loop that ran 16 times for the smooth scrolling so it was more like 0.0016 seconds but usually WAIT() is fine.

I think my function is pretty exact since it only uses two short lines of code so there is no extra time added from running code :)
Title: Re: UtilPack/ UtilComp [hp prime][lib]
Post by: Snektron on July 02, 2015, 06:44:38 PM
Quote from: Unicorn on July 02, 2015, 05:38:50 PM
Milliseconds? That's quite a specific function! What would it be used for?

Milliseconds is quite anormal thing for these kind of functions. if you for instance want to run something at 60 fps, you need to wait about 16 ms each loop.
Also in Java you can get the current time in nanoseconds O.O
Title: Re: UtilPack/ UtilComp
Post by: alexgt on July 02, 2015, 06:46:48 PM
I didn't know that about Java O.O
Speaking of java I need to learn it <_<
Title: Re: UtilPack/ UtilComp [hp prime][lib]
Post by: Snektron on July 02, 2015, 06:48:24 PM
It's not that hard. Though there are a few more advanced things that can be quite hard :P (like lambda functions <_< hough ive not looked into them that much)
Title: Re: UtilPack/ UtilComp
Post by: Unicorn on July 02, 2015, 06:50:27 PM
Nano seconds? Next it'll be noseconds O.O
Title: Re: UtilPack/ UtilComp
Post by: alexgt on July 05, 2015, 03:22:00 PM
Next thing to add is a large matrix maker. With MAKEMAT() you will get an insufficient memory error if your matrix is too big. All you have to do is make two for loops with the size you want your matrix:

FOR A FROM 1 TO 500 DO //this is how many coloms you want here there will be 500
FOR B FROM 1 TO 100 DO //this is how many rows you want here there will be 100
MatrixName(B,A):=0 //it is B,A Because the coordinates are in row,col form
END;
END;

I still have to code it but it will be in the next update :)
Title: Re: UtilPack/ UtilComp
Post by: Unicorn on July 06, 2015, 09:43:45 PM
Nice, I like how you are just updating this with functions as you come torequire them :)
Title: Re: UtilPack/ UtilComp
Post by: alexgt on July 07, 2015, 02:27:19 PM
Quote from: Unicorn on July 06, 2015, 09:43:45 PM
Nice, I like how you are just updating this with functions as you come torequire them :)
That is the only time I think of them :P

Also updates will be less frequent now (I want to add more than one function to it :))
And remember everyone can come up with ideas :)
I also am designing this so you can copy/paste the code out of here and put it into a sub if you want and modify them to fit your needs, of course if you don't need to modify them stick to compiling them with UtilComp when I get around to coding it <_<
Title: Re: UtilPack/ UtilComp
Post by: alexgt on July 17, 2015, 11:50:17 PM
How does a custom rectangle/ polygon sound!!
Title: Re: UtilPack/ UtilComp
Post by: Unicorn on July 18, 2015, 02:57:16 AM
oo oo oo! That would be pretty nice!  make sure you can invert the rects colors! :)
Title: Re: UtilPack/ UtilComp
Post by: alexgt on July 19, 2015, 12:16:22 AM
Quote from: Unicorn on July 18, 2015, 02:57:16 AM
oo oo oo! That would be pretty nice!  make sure you can invert the rects colors! :)
I could do that with rect because there is actually a invert command but it is not polygon compatible :(, I don't think but I will check ;)
Title: Re: UtilPack/ UtilComp
Post by: Unicorn on July 19, 2015, 01:06:49 AM
Awe...But its still awesome! could you make a specialeffects thing too? Like a screen shift?
Title: Re: UtilPack/ UtilComp [hp prime][lib]
Post by: Strontium on July 19, 2015, 01:42:25 AM
Quote from: Cumred_Snektron on July 02, 2015, 06:48:24 PM
It's not that hard. Though there are a few more advanced things that can be quite hard :P (like lambda functions <_< hough ive not looked into them that much)

lambda functions being quite hard? I never had a very hard time grasping them, unless Java has a different idea of what a lambda function is than a lot of other languages.
Title: Re: UtilPack/ UtilComp
Post by: alexgt on July 19, 2015, 01:55:16 AM
Quote from: Unicorn on July 19, 2015, 01:06:49 AM
Awe...But its still awesome! could you make a specialeffects thing too? Like a screen shift?
I could replicate the Horizontal+ and - function in Axe :)
Title: Re: UtilPack/ UtilComp
Post by: Unicorn on July 19, 2015, 02:22:40 AM
Yeah, that would be cool.
Title: Re: UtilPack/ UtilComp
Post by: Dream of Omnimaga on July 19, 2015, 06:27:03 PM
You should definitively add some of the commonly used commands on other calcs. It would make it easier for people to port games :)
Title: Re: UtilPack/ UtilComp
Post by: alexgt on July 20, 2015, 12:02:59 AM
Quote from: DJ Omnimaga on July 19, 2015, 06:27:03 PM
You should definitively add some of the commonly used commands on other calcs. It would make it easier for people to port games :)
Definitly :), but I am heavily working on MinePrime 2.2 O.o
Title: Re: UtilPack/ UtilComp
Post by: Unicorn on July 20, 2015, 01:47:15 AM
Quote from: alexgt on July 20, 2015, 12:02:59 AM
Quote from: DJ Omnimaga on July 19, 2015, 06:27:03 PM
You should definitively add some of the commonly used commands on other calcs. It would make it easier for people to port games :)
Definitly :), but I am heavily working on MinePrime 2.2 O.o
First mineprime, then SIFS, then this. :) Well, what I think.
Title: Re: UtilPack/ UtilComp
Post by: alexgt on July 20, 2015, 02:09:05 PM
I think that I need to get the compiler done because there have been many times when I have had to hard code it in to MinePrime when I could have just compiled it <_<

the problem is that it will take ALLOT of debugging and messing around with, and I have to be super careful because it is super easy to delete a program and I wouldn't want someone's program being deleted because of me O.O
Title: Re: UtilPack/ UtilComp
Post by: Unicorn on July 20, 2015, 03:06:52 PM
Oh, yeah, emu's are good for that kind of thing though.
Title: Re: UtilPack/ UtilComp
Post by: alexgt on July 20, 2015, 03:27:54 PM
Yeah, I like to program on calc since I can judge the speed better, and I always have it in my pocket so I can program any where, (why I want to have a CW notifier for the Prime :P)
Title: Re: UtilPack/ UtilComp
Post by: Unicorn on July 20, 2015, 03:37:35 PM
Quote from: alexgt on July 20, 2015, 03:27:54 PM
Yeah, I like to program on calc since I can judge the speed better, and I always have it in my pocket so I can program any where, (why I want to have a CW notifier for the Prime :P)
Well.... If there was a wifi thingamabober and it was hacked... :P
Title: Re: UtilPack/ UtilComp
Post by: alexgt on July 20, 2015, 04:25:57 PM
There is a wireless connectivity thing for it so it would communicate with the computer and get data from CW
Title: Re: UtilPack/ UtilComp
Post by: Unicorn on July 20, 2015, 04:27:12 PM
Quote from: alexgt on July 20, 2015, 04:25:57 PM
There is a wireless connectivity thing for it so it would communicate with the computer and get data from CW
There is? Hmmm... It would probably require some ASM stuffs...
Title: Re: UtilPack/ UtilComp
Post by: alexgt on July 20, 2015, 04:29:07 PM
Nope, just a 3rd party program on the PC the takes the IRC messages from CW and sends the calc the message  (it is already programmed in so teachers can talk to students in tests or something.)
Title: Re: UtilPack/ UtilComp
Post by: Unicorn on July 20, 2015, 04:29:48 PM
Quote from: alexgt on July 20, 2015, 04:29:07 PM
Nope, just a 3rd party program on the PC the takes the IRC messages from CW and sends the calc the message  (it is already programmed in so teachers can talk to students in tests or something.)
Wait, so we would just have to alter the code of the program? Where did you learn about this?
Title: Re: UtilPack/ UtilComp
Post by: alexgt on July 20, 2015, 04:33:42 PM
No program on the calc would be necessary just one on the computer like this
https://www.youtube.com/watch?v=UVALe40TPkc
Title: Re: UtilPack/ UtilComp
Post by: Unicorn on July 20, 2015, 04:42:44 PM
Hmm so a linking procedure/software...
Title: Re: UtilPack/ UtilComp
Post by: Dream of Omnimaga on July 21, 2015, 06:13:04 AM
Now if only this could be used to access Internet from the calc. Of course it would require computer access like gCn for the 84+, but it would still be cool, especially since it would allow online games. Implementing this would be hard, though.
Title: Re: UtilPack/ UtilComp
Post by: Unicorn on July 21, 2015, 11:24:39 AM
Quote from: DJ Omnimaga on July 21, 2015, 06:13:04 AM
Now if only this could be used to access Internet from the calc. Of course it would require computer access like gCn for the 84+, but it would still be cool, especially since it would allow online games. Implementing this would be hard, though.
Very cool. But, online games! I had never thought of that being a possibility! O.O
Title: Re: UtilPack/ UtilComp
Post by: alexgt on July 22, 2015, 02:48:25 PM
O.O that would be awesome to compete against other calc users O.O
Title: Re: UtilPack/ UtilComp
Post by: Unicorn on July 22, 2015, 02:56:37 PM
Quote from: alexgt on July 22, 2015, 02:48:25 PM
O.O that would be awesome to compete against other calc users O.O
We could have like major contests and prizes and things O.O
Title: Re: UtilPack/ UtilComp
Post by: alexgt on July 22, 2015, 03:00:45 PM
And complex rendering/ calculations happen on the computer and then sent to the calc O.O
Title: Re: UtilPack/ UtilComp
Post by: Dream of Omnimaga on July 30, 2015, 01:09:53 AM
Indeed. THe only problem with contests though is that it would be easy to cheat, since anyone could just modify his copy of the game.

That's unless of course it's possible in HP PPL to send actual program code via USB or wireless, as well as reading the code of a program in the same way you can read string content. That would allow the game to scan the remote copy of the game then compare it with everyone else's to ensure that both are identical.
Title: Re: UtilPack/ UtilComp
Post by: Unicorn on July 30, 2015, 05:27:22 AM
Yeah, I guess that could be a problem. Maybe the score would be encrypted?
Title: Re: UtilPack/ UtilComp [hp prime][lib]
Post by: Snektron on July 30, 2015, 02:37:55 PM
If you're making online games, just store the score online while you're at it. A locally encrypted stored file can alway be modified (if the key is locally stored too).
Title: Re: UtilPack/ UtilComp
Post by: Dream of Omnimaga on August 10, 2015, 03:21:29 AM
This was an idea that was suggested once. That said, what could maybe be done is have KnightOS launch games automatically via an embedded emulator and highscores could be sent to the server, kinda like old forum arcades.
Title: Re: UtilPack/ UtilComp
Post by: Unicorn on August 10, 2015, 04:54:38 AM
That would work. Or, we could just do an honor system thing, like  friendly ;)
Title: Re: UtilPack/ UtilComp
Post by: Dream of Omnimaga on August 11, 2015, 06:32:17 AM
I am unsure what you mean. Do you mean adding highscores that people e-mail to us? That is definitively not the most reliable way I think.

Anyway we should perhaps move this emulator+highscore db discussion into another topic, since it's not guaranteed that alexgt would add such thing to UtilPack
Title: Re: UtilPack/ UtilComp
Post by: Unicorn on August 11, 2015, 06:40:45 AM
I mean that you could set it all up and things, but trust tha people don't editthe code. We could have them take a video of themselves playing though!
Title: Re: UtilPack/ UtilComp
Post by: Dream of Omnimaga on August 11, 2015, 07:23:34 AM
Yeah, a video would be ok, but ideally it would be better if it was a video like those on TASVideos, which are just keypress sequences.
Title: Re: UtilPack/ UtilComp
Post by: alexgt on August 17, 2015, 02:34:37 PM
I think that if it is possible I could make functions that communicate with the computer but my level of knowledge on how to do that is minimal so id won't happen right away :(
Title: Re: UtilPack/ UtilComp
Post by: Dream of Omnimaga on August 17, 2015, 02:57:09 PM
No problem. It definitively seems like it could be a challenge. Plus we don't even know if everything can be send to the computer and vice-versa.
Title: Re: UtilPack/ UtilComp
Post by: alexgt on August 17, 2015, 03:06:45 PM
We will probably need to hack it to do that and that is WAY outta my ally :P
Title: Re: UtilPack/ UtilComp
Post by: Dream of Omnimaga on August 17, 2015, 03:16:03 PM
It depends if the computer program that lets one communicate between his calc and computer is doing part of the job for us, though. :P
Title: Re: UtilPack/ UtilComp
Post by: alexgt on August 17, 2015, 03:18:05 PM
True but I would want to make my own communication program :-\
Title: Re: UtilPack/ UtilComp
Post by: Lionel Debroux on August 17, 2015, 03:34:33 PM
Making one's communication program is an interesting learning exercise, but for end user experience, it's probably better to help improve the existing portable and interoperable communication program - namely libhpcalcs (*) - and make a portable GUI for it :)

Erwin Ried's non-portable, non-interoperable program only supports severely outdated versions of the Prime firmware, so it's out of the picture for, er, communication programs. It has a pretty UI, though.
Title: Re: UtilPack/ UtilComp
Post by: alexgt on August 17, 2015, 04:05:24 PM
Yeah, this would be more for developers (although I am not sure how far we could push it if we can actually do something like this)
Title: Re: UtilPack/ UtilComp
Post by: Dream of Omnimaga on August 17, 2015, 04:07:09 PM
Yeah I heard that he could not figure out how to get it to work with newer firmwares or that he gave up on it. It's a shame because it had some nice features. Maybe at one point libhpcalcs could allow plugins that adds such features?


That said, communication tools for stuff we were discussed wouldn't necessarily be that useful either. The audience for online calculator gaming, especially for HP calcs, would be extremely small.
Title: Re: UtilPack/ UtilComp
Post by: alexgt on August 17, 2015, 04:12:36 PM
It would still be AWESOME O.O, and I could use it to make a on calc CW post notifier (i would use it if no one else would since I has no phone <_<)
Title: Re: UtilPack/ UtilComp
Post by: Lionel Debroux on August 17, 2015, 04:33:43 PM
QuoteYeah I heard that he could not figure out how to get it to work with newer firmwares or that he gave up on it.
He gave up on it, I'd say. The protocol is documented by libhpcalcs, which worked on older firmware versions, and keeps working on '2014 firmware releases without a major overhaul. Several external contributions have improved the communication, but unlike PrimeComm, libhpcalcs was fairly unharmed by the May 2014 firmware release.
The fact that there are few Prime users, which is sad, doesn't help finding time or motivation for working on tooling...

QuoteIt's a shame because it had some nice features.
UI-wise, yeah. The text editor with syntax coloring is unmatched.

QuoteMaybe at one point libhpcalcs could allow plugins that adds such features?
Such features should indeed be added to that unwritten portable GUI (equivalent to TILP) on top of libhpcalcs. However, for good software design (portability, interoperability, reusability), libhpcalcs is focused on communication stuff and should stay that way, like the libti* family, especially libticables + libticalcs, is :)
Title: Re: UtilPack/ UtilComp
Post by: Dream of Omnimaga on August 17, 2015, 05:02:24 PM
There are quite a lot of HP Prime users, but unfortunately most only care about using it for maths and science, kinda like 68K calcs nowadays. But I understand your concern.
Title: Re: UtilPack/ UtilComp
Post by: alexgt on August 17, 2015, 06:38:47 PM
Quote from: DJ Omnimaga on August 17, 2015, 05:02:24 PM
There are quite a lot of HP Prime users, but unfortunately most only care about using it for maths and science, kinda like 68K calcs nowadays. But I understand your concern.
Yeah not many people are trying to push the limits of the Prime (You can do amazing stuff that I haven't had the time to add to MinePrime/ SIFS)
Title: Re: UtilPack/ UtilComp
Post by: Dream of Omnimaga on August 20, 2015, 05:41:38 AM
Quote from: alexgt on August 17, 2015, 06:38:47 PM
(You can do amazing stuff that I haven't had the time to add to MinePrime/ SIFS)

MinePrime is now full 3D? O.O Just kidding, but if someone doesn't care about his 3D being very accurate, especially if he uses a lower resolution, then he can create some amazing graphics out of just multiple layers of 2D maps (have each layer scroll at different speeds like parallax scrolling but almost at the same speed as the front layer).
Title: Re: UtilPack/ UtilComp
Post by: alexgt on August 20, 2015, 01:25:21 PM
I would probably look into raycasting in my eventual 3D version (unless there comes up some hack for ASM coding for the prime and a super fast 3D world renderer happens) MinePrime started as a project to get used to HP PPL (One of my first projects and the worst written one (by re writing it I cleaned up ~8mb of code and did the same thing when I rewrote it in one line in a loop and a if statement O.O))
Title: Re: UtilPack/ UtilComp
Post by: Dream of Omnimaga on August 21, 2015, 04:27:22 AM
Wow that's quite a big cleanup O.O, good job. Anyway, I can't wait to see updates on MinePrime, this project and others :)
Title: Re: UtilPack/ UtilComp
Post by: alexgt on August 21, 2015, 06:07:09 PM
Well, I haven't been working on any calc projects lately but next week I will jump back into it ;)
Title: Re: UtilPack/ UtilComp
Post by: Unicorn on August 25, 2015, 04:05:14 AM
Yay! I'm ready for a playable emu demo... :P
Title: Re: UtilPack/ UtilComp
Post by: alexgt on August 26, 2015, 01:42:09 PM
Quote from: Unicorn on August 25, 2015, 04:05:14 AM
Yay! I'm ready for a playable emu demo... :P
?!
Title: Re: UtilPack/ UtilComp
Post by: alexgt on December 21, 2015, 10:42:55 PM
Bump. I am still out of ideas, just give me a few and I will start typing away ;)
Title: Re: UtilPack/ UtilComp
Post by: Dream of Omnimaga on December 24, 2015, 03:49:24 AM
What kind of stuff would you like? Libraries for games? Features like a calendar/notepad? etc?
Title: Re: UtilPack/ UtilComp
Post by: alexgt on December 31, 2015, 09:49:33 PM
I am thinking about stuff that would be useful for day-to day programming that there isn't a solid feature already implemented for the Prime already ex: Running a program externally. but it doesn't have to be limited to just games and stuff, it could be anything ;)

And I have date/time stuff in already BTW :P