Author Topic: Faster LCD update?  (Read 6109 times)

0 Members and 1 Guest are viewing this topic.

Offline Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Faster LCD update?
« on: February 21, 2012, 08:35:47 pm »
I had this idea that I plan to apply to Grammer once I totally free up saveSScreen of other uses. During the wait loops of updating the LCD, I can compare the current byte wanting to be updated with the corresponding one in saveSScreen (or some other buffer). If they are the same, don't update and go to the next byte. If they are different, copy the new byte to the saveSScreen location and update that spot on the LCD. At the worst, it will use the same amount of time to update the screen. I know this isn't the best for situations where consistent timing is important, but where you want purely speed (like 3D rendering and whatnot), this could be very useful. I figured this might save a few frames per second for folks :)

I'll try to write up some code when I have time .___.

EDIT: Also, what are some other ways that I can use to update the LCD as fast as possible (that will work in all cases).

Offline calc84maniac

  • eZ80 Guru
  • Coder Of Tomorrow
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2912
  • Rating: +471/-17
    • View Profile
    • TI-Boy CE
Re: Faster LCD update?
« Reply #1 on: February 21, 2012, 08:38:36 pm »
There already exists such a routine at http://wikiti.brandonw.net/index.php?title=Z80_Routines:Graphic:Fastcopy#Double-buffered_copy, but maybe you would be able to make an even better one :)
"Most people ask, 'What does a thing do?' Hackers ask, 'What can I make it do?'" - Pablos Holman

Offline Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: Faster LCD update?
« Reply #2 on: February 21, 2012, 08:40:41 pm »
Ah, cool O.O And I am glad that uses safe mode. Also, why would it take more time if it is updating a lot? I'll look at the code to figure it out...

Offline Quigibo

  • The Executioner
  • CoT Emeritus
  • LV11 Super Veteran (Next: 3000)
  • *
  • Posts: 2031
  • Rating: +1075/-24
  • I wish real life had a "Save" and "Load" button...
    • View Profile
Re: Faster LCD update?
« Reply #3 on: February 22, 2012, 03:20:54 am »
Ah, cool O.O And I am glad that uses safe mode. Also, why would it take more time if it is updating a lot? I'll look at the code to figure it out...

I assume the reason it would take longer is because the overhead of the buffer checking is actually longer than the required delay to the LCD port when a difference is detected.  By the looks of it though, I bet you can optimize this and replace the LCD waiting code with a sufficiently long pause to speed it up to be just as fast as a regular LCD update. :)
___Axe_Parser___
Today the calculator, tomorrow the world!

Offline Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: Faster LCD update?
« Reply #4 on: February 22, 2012, 07:57:55 am »
I made an attempt at this and that was the problem that I ran into. The overhead was about 20 cycle longer than the delay in 6MHz. Of course, that still made it faster than my current routine (because I didn't use the method of drawing columns first).

Offline tr1p1ea

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 647
  • Rating: +110/-0
    • View Profile
Re: Faster LCD update?
« Reply #5 on: February 23, 2012, 05:41:46 am »
I do believe qarnos made uses a routine like this in his 3d engine. Im not away of how efficient his implementation is however.
"My world is Black & White. But if I blink fast enough, I see it in Grayscale."


Offline Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: Faster LCD update?
« Reply #6 on: February 23, 2012, 07:46:33 am »
Wow, I just checked it out on youtube and I am going to check it out on MaxCoderz. That looks really neat O.O Also, that seems like a great example of where this kind of update would speed things up. Often there is a lot of black space that does not change. For the curious,

* Xeda112358 was really tempted to link to a Rick Roll, by the way