I'm back home, and had a little time today to play around with the PC for a bit, so I thought I'd take a quick moment to write up a simple little demo of how and why folks might want to make use of hardware images. We really don't see them made use of in programs much, and it's honestly a shame, as you can see from below:
x = 18
x = x + 32
y = 18
y = y + 32
'CI = _COPYIMAGE(0, 33)
x = 0: y = 0
l = 300
Now this is nothing more than a simple little screen pattern which we scroll diagonally up and left across the screen. To start with, we run it in normal, software graphical mode, so you guys can pop open task manager and look at the CPU usage of our program.
Let it run for a bit and watch the CPU usage -- I've got a variable limit in here (you can tell by how fast the screen scrolls), so you can get a range of how much processing power your machine does on it with limits somewhere between 30 and 330.
On my PC, task manager tells me it's using from 8 to 14% CPU power -- which is enough to crank my fans up on my PC and make them sound like an airplane engine starting up!
And then, we go into the IDE and unremark out the line with the COPYIMAGE in it, and we remark the line below it:
'CI = _COPYIMAGE(0)
CI = _COPYIMAGE(0, 33)
This says we're now going to be using a hardware image for our main program. Once again, at this point, compile, run and watch the results for about a minute or so. There's no RANDOMIZER TIMER in this, so we're going to be getting the *exact* same LIMITs as what we had last time...
... And yet, all we're seeing here is from 0.8 to 2.1% CPU usage!!
Exact same program, with only one small change -- hardware over software images -- and yet it now has almost no effect on CPU usage. My fans never crank on. My airplane stays parked in my chassis, and life is GOOD!!
And here's to hoping that we'll be seeing more folks asking questions and playing around with hardware images in the future. *Cheers!*