Join us on Discord!
You can help CodeWalrus stay online by donating here.

HP FOR loops slowing things down?

Started by Dream of Omnimaga, December 25, 2014, 06:46:04 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Dream of Omnimaga

UPDATE: Why didn't I think about the following before? :banghead:

I previously said that if when scrolling I only updated the needed row or column of map tiles, I would not be able to use parallax scrolling. Well, I am wrong, because what I forgot is that since the HP Prime has transparency, then I can simply keep the background and the current 336x256 map area separate then draw the new tile columns in the map buffer. So I just need to update the map separately then re-paste the result over the background every frame.
  • Calculators owned: TI-82 Advanced Edition Python TI-84+ TI-84+CSE TI-84+CE TI-84+CEP TI-86 TI-89T cfx-9940GT fx-7400G+ fx 1.0+ fx-9750G+ fx-9860G fx-CG10 HP 49g+ HP 39g+ HP 39gs (bricked) HP 39gII HP Prime G1 HP Prime G2 Sharp EL-9600C
  • Consoles, mobile devices and vintage computers owned: Huawei P30 Lite, Moto G 5G, Nintendo 64 (broken), Playstation, Wii U

Dream of Omnimaga

By the way, when the first demo with a fully functional level comes out, I might start releasing the source publicly and cross-posting on other forums. Hopefully if the game runs fast enough, perhaps this speed, and the fact I plan to make the engine run at the same speed on both the hardware and emulator, could give people incentive to develop games using the emulator even though they don't have the calc itself?
  • Calculators owned: TI-82 Advanced Edition Python TI-84+ TI-84+CSE TI-84+CE TI-84+CEP TI-86 TI-89T cfx-9940GT fx-7400G+ fx 1.0+ fx-9750G+ fx-9860G fx-CG10 HP 49g+ HP 39g+ HP 39gs (bricked) HP 39gII HP Prime G1 HP Prime G2 Sharp EL-9600C
  • Consoles, mobile devices and vintage computers owned: Huawei P30 Lite, Moto G 5G, Nintendo 64 (broken), Playstation, Wii U

iconmaster

#17
As I found out in my speed testing, MAKELIST should be faster than FOR loops (unless the lists generated and thrown away take up too much memory, so testing is still needed). So, I suggest you try this to improve speed, perhaps:


WHILE 1 DO
BLIT_P(G9,0,0,320,240,G3,0,0,320,240);
MAKELIST(MAKELIST(BLIT_P(G9,mapTileX-A, mapTileY, mapTileX+16-A, mapTileY+16, G1,112,0,128,16,#666666),mapTileY,0,240,16),mapTileX,0,320,16);
A := A+1;
IF A>16 THEN
  A := 0;
END;
BLIT_P(G0,0,0,320,240,G9,0,0,160,120);
END;


EDIT: I also wonder if replacing your A:=A+1 code with A:= (A=1) MOD 16 and ditching the IF would be faster. I don't know.

Dream of Omnimaga

My brain just melted *.*

I'll be sure to look at MAKELIST more, though, if I can figure out how it works.  I tend to have an hard time deciphering how some instructions work sometimes. >.<
  • Calculators owned: TI-82 Advanced Edition Python TI-84+ TI-84+CSE TI-84+CE TI-84+CEP TI-86 TI-89T cfx-9940GT fx-7400G+ fx 1.0+ fx-9750G+ fx-9860G fx-CG10 HP 49g+ HP 39g+ HP 39gs (bricked) HP 39gII HP Prime G1 HP Prime G2 Sharp EL-9600C
  • Consoles, mobile devices and vintage computers owned: Huawei P30 Lite, Moto G 5G, Nintendo 64 (broken), Playstation, Wii U

Dream of Omnimaga

By the way, I just tried the code on the first page with only 1 row of tiles (20 total) and I got about 105 FPS. With 2 rows (40 tiles) I got roughly 70 FPS. So by using the scrolling method where you only draw the necessary map rows/columns and shift the rest of the screen around, frame rate should be more than good. And if someone wants to make a Sonic game he can simply add some frame skipping to speed things up even more.
  • Calculators owned: TI-82 Advanced Edition Python TI-84+ TI-84+CSE TI-84+CE TI-84+CEP TI-86 TI-89T cfx-9940GT fx-7400G+ fx 1.0+ fx-9750G+ fx-9860G fx-CG10 HP 49g+ HP 39g+ HP 39gs (bricked) HP 39gII HP Prime G1 HP Prime G2 Sharp EL-9600C
  • Consoles, mobile devices and vintage computers owned: Huawei P30 Lite, Moto G 5G, Nintendo 64 (broken), Playstation, Wii U

Travis

Whoa, parallax scrolling?!  O.O

The HP Prime is looking like a very interesting development platform.

Although hearing about bugs seems a bit scary. Is HP interested in hearing feedback and fixing issues? I know they never once bothered to fix the major hardware flaws of the HP 49g/50g series.  <_<
  • Calculators owned: TI-81, TI-82, TI-85, TI-86, TI-89, TI-89 Titanium, 2 × HP 50g

Dream of Omnimaga

Indeed it really has potential IMHO. The bugs are not as bad as they used to be, but it's still common to read about users who got their calc to reboot or even freeze. I think the current team wants to fix the bugs, but the issue is that unlike the HP 50g where it was maintained by a team of about 50-400 staff members, the HP Prime is maintained by about 3-4 people who are in constant danger of losing their job through HP mass layoffs.


EDIT: That reminds me, if someone ever wants to make a game and doesn't mind minimal NES like graphics, he can easily use RANDOM functions and generate tiles of two colors with it to save space. :P
  • Calculators owned: TI-82 Advanced Edition Python TI-84+ TI-84+CSE TI-84+CE TI-84+CEP TI-86 TI-89T cfx-9940GT fx-7400G+ fx 1.0+ fx-9750G+ fx-9860G fx-CG10 HP 49g+ HP 39g+ HP 39gs (bricked) HP 39gII HP Prime G1 HP Prime G2 Sharp EL-9600C
  • Consoles, mobile devices and vintage computers owned: Huawei P30 Lite, Moto G 5G, Nintendo 64 (broken), Playstation, Wii U

Travis

Quote from: DJ Omnimaga on February 09, 2015, 04:02:44 PM
Indeed it really has potential IMHO. The bugs are not as bad as they used to be, but it's still common to read about users who got their calc to reboot or even freeze. I think the current team wants to fix the bugs, but the issue is that unlike the HP 50g where it was maintained by a team of about 50-400 staff members, the HP Prime is maintained by about 3-4 people who are in constant danger of losing their job through HP mass layoffs.

Yikes. It would be a pretty smart move to lay off the only remaining OS developers. :P

To be fair, the HP 50g ROM had some updates for a while (I'm not even sure that the devs were still getting paid to do it), and I've heard that it's very difficult to modify due to so much being packed into the maximum available space, plus routines having to stay at fixed memory locations due to how RPL works. Supposedly, there's almost no room left for bug fixes (though I've also heard some argue there's room for optimization). However, my main gripe, I think, is with the ARM emulator or possibly the hardware design, which causes constant keystroke glitches, unreliable alarms when the calc is off (they're practically useless as a result), and even random freeze-ups.
  • Calculators owned: TI-81, TI-82, TI-85, TI-86, TI-89, TI-89 Titanium, 2 × HP 50g

Dream of Omnimaga

What are the keystroke glitches? Do keys just stop working randomly or become scrambled like on the Nspire?
  • Calculators owned: TI-82 Advanced Edition Python TI-84+ TI-84+CSE TI-84+CE TI-84+CEP TI-86 TI-89T cfx-9940GT fx-7400G+ fx 1.0+ fx-9750G+ fx-9860G fx-CG10 HP 49g+ HP 39g+ HP 39gs (bricked) HP 39gII HP Prime G1 HP Prime G2 Sharp EL-9600C
  • Consoles, mobile devices and vintage computers owned: Huawei P30 Lite, Moto G 5G, Nintendo 64 (broken), Playstation, Wii U

Snektron

Wait keys get scrambled on the NSpire?? wow that's bad. TI at it again.
  • Calculators owned: TI-84+
Legends say if you spam more than DJ Omnimaga, you will become a walrus...


Dream of Omnimaga

I forgot if that only happened with Ndless or not, but all keys would act as something else. For example 8 could have become Enter and Del might have become F
  • Calculators owned: TI-82 Advanced Edition Python TI-84+ TI-84+CSE TI-84+CE TI-84+CEP TI-86 TI-89T cfx-9940GT fx-7400G+ fx 1.0+ fx-9750G+ fx-9860G fx-CG10 HP 49g+ HP 39g+ HP 39gs (bricked) HP 39gII HP Prime G1 HP Prime G2 Sharp EL-9600C
  • Consoles, mobile devices and vintage computers owned: Huawei P30 Lite, Moto G 5G, Nintendo 64 (broken), Playstation, Wii U

Travis

Quote from: DJ Omnimaga on February 11, 2015, 05:18:47 PM
What are the keystroke glitches? Do keys just stop working randomly or become scrambled like on the Nspire?

Often when you press a key (especially when it's right at the moment the busy annunciator goes off) it will be "ignored", only to get processed with the next key you press. Also, keys like arrows and backspace sometimes "stick" and continue moving the cursor or deleting everything you wrote after you press once, until you press another key (or hit the thing with a hammer). Same with shift keys and alpha sometimes, or they'll work inconsistently or the annunciator won't come on or off when it should. Also, the Try to Recover Memory? prompt for some reason sometimes refuses to accept any keys until you press a different key followed by the original one. (They actually put a note in a manual about that last one, rather than actually fixing it.)
  • Calculators owned: TI-81, TI-82, TI-85, TI-86, TI-89, TI-89 Titanium, 2 × HP 50g

Dream of Omnimaga

Oh, that first thing is something the TI-84+CSE has issues with as well. In the slow program editor or home screen, when you type too fast some keystrokes get missed. I noticed that when a BASIC program is running, keys will not be memorized at all when the home screen is being updated too. In Mana Force, for example, the village used to be redrawn every frame, so when I ran the game on the CSE I was unable to move from house to house unless I started holding down an arrow key at the right moment. On the older calcs it's not a problem because of how fast the LCD is redrawn.

As for sticking keys I don't have this issue except on the HP Prime sometimes when I use the touchscreen to move the cursor somewhere in the program editor, but now it's no longer a real issue since they improved the editor speed considerably. I remember it would end up appearing somewhere when releasing the finger, only to appear one spot away a second later.

I guess back then HP was too lazy to fix HP 50g bugs. If only for the HP Prime they had as many people in charge of the OS as back then, this would probably become the perfect calc. But alas HP is in constant danger of going under since the last 8 years.
  • Calculators owned: TI-82 Advanced Edition Python TI-84+ TI-84+CSE TI-84+CE TI-84+CEP TI-86 TI-89T cfx-9940GT fx-7400G+ fx 1.0+ fx-9750G+ fx-9860G fx-CG10 HP 49g+ HP 39g+ HP 39gs (bricked) HP 39gII HP Prime G1 HP Prime G2 Sharp EL-9600C
  • Consoles, mobile devices and vintage computers owned: Huawei P30 Lite, Moto G 5G, Nintendo 64 (broken), Playstation, Wii U

timwessman

It would be nice to get a code blob with the so called "memory leaks" that you keep running into. As far as we can tell there isn't any relating to programming/graphic use. What does tend to happen though is that people keep making and creating full screen grobs which take 16bits per pixel internally and then *keeping* them around while making more. You just run out of memory quickly.

If I had an example though I could tell you if it is a problem on our side that needs fixing.
TW

Although I work for the HP calculator group, the comments and opinions I post here are my own.

Dream of Omnimaga

I will try to send you a copy of the program when I get some time. It could be something I am doing wrong but the lack of memory error messages and ability to store the amount of RAM and Flash in Ans to display it inside a program kinda makes things harder when debugging.


Welcome to the forums tim by the way. :)
  • Calculators owned: TI-82 Advanced Edition Python TI-84+ TI-84+CSE TI-84+CE TI-84+CEP TI-86 TI-89T cfx-9940GT fx-7400G+ fx 1.0+ fx-9750G+ fx-9860G fx-CG10 HP 49g+ HP 39g+ HP 39gs (bricked) HP 39gII HP Prime G1 HP Prime G2 Sharp EL-9600C
  • Consoles, mobile devices and vintage computers owned: Huawei P30 Lite, Moto G 5G, Nintendo 64 (broken), Playstation, Wii U

Powered by EzPortal