The kids need a TI-84-Plus for school (no CE !), so I bought one and started to port some of my old TI-86 assembly-games I wrote at the end of the '90s. Nothing special so far.

But the games run sooo slooow on the TI-84-Plus! For example, the sysroutine vputmap runs more than 3 times slower on the TI-84-Plus compared to the TI-86. (With the TI-86 @ 6MHz, and the TI-84-Plus in slow modus also @ 6MHz).

Is this real? Am I doing something wrong here?

How to work around this? Writing directly to the display-driver via OUT?

Thanks for the help; no fun to play when even grandma can finish the shoot'em ups!
Id say potentially as there are some drastic LCD differences between the 86 and the 84+ ... that being said I'm not sure why overall your entire program is running so slow? How many times per frame are you calling vPutMap?

Have you considered running the calc @ 15MHz?
The LCD on the 86 is memory-mapped (writing to the buffer would automatically update the screen) which makes updating the screen very fast. This is not the case on the 83(+)/84+ (monochrome) calculators; the LCD update has to be done in software, and rather slow software at that. The fastest fullscreen update possible is around 8ms (12 columns, 64 bytes per column plus one control byte to move to the next column, ~10Ás required delay between each LCD write), so if there's significant onscreen changes, you will want to wait until you're done writing to the buffer for that frame before writing to the screen.

To do that when using VPutMap, you'll want to set the flag

Code:
 textWrite,(iy+sGrFlags)

to avoid drawing to the LCD until you're ready to update the screen from the buffer.

To actually write the buffer to the LCD, you can use TI's (slow) GrBufCpy routine, or use one of the many fastCopy routines floating around
Some more information, to make things clear.

-In the first place I avoided writing to the memory-mapped display on the ti-86 because back then I thought about that not being really portable in the future. So luckily I did (almost) everything with vputmap and friends.
-I'm refraining from running @ 15MHz because the game ran fine (i.e. fast) at 6MHz before, so it should now as well.
-I'm also fully aware of textwrite, but the fact is that on the TI-86 that didn't matter (for this specific game at least). In fact, I checked the old code and textwrite was reset (!) and still it ran fine. A large number of halt's were needed to actually slow it down.

I just wrote a small test program to write 4096 times the character "0", and see which calculator finishes earliest. The code for the TI-86 is below; just change the comments to make the equivalent TI-84-Plus code. It really looks like vputmap is 3 times slower... So, writing to the buffer will solve this issue. I was just flabbergasted that the internal vputmap-code is so slow and I wanted some confirmation of this. The code without vputmap runs, evidently, about as fast on both machines.

Disclaimer: this is my first Z80-code after more than 20 years. Can be improved...

Code:

;.nolist
;#include "ti83plus.inc"
;#define ProgStart $9D95
;.list
;.org ProgStart - 2
;.db t2ByteTok, tAsmCmp

#define equ =
#define EQU =
#include "ti86asm.inc"
#include "ti86ops.inc"
#include "ti86abs.inc"
.org   _asm_exec_ram

begin:
        ld      hl,data1
        ld      (hl),0
        ld      hl,data2
        ld      (hl),16
;       b_call(_clrScrn)
        call    _clrScrn
        ld      a,0                 ; Better use xor, but that does not matter for this test
lus:
;       ld      (penRow),a
        ld      (_penRow),a
;       ld      (penCol),a
        ld      (_penCol),a
        ld      a,$30
;       b_call(_vputmap)            ; Display the text
        call    _vputmap            ; Display the text
        ld      a,0                 ; Better use xor, but that does not matter for this test
        ld      hl,data1
        dec     (hl)
        cp      (hl)
        jr      nz,lus
        ld      hl,data2
        dec     (hl)
        cp      (hl)
        jr      nz,lus
exit:
        ret

data1:
        .db 0
data2:
        .db 0
.end
On the 84+ the LCD isn't memory mapped like on the 86. Even though you are using a romcall for portability - on the 84+ if it draws direct to the LCD it needs to send commands + pixel data via ports to the LCD controller, which is VERY slow. After each write to an LCD port there is an amount of time that you have to wait before writing again. On the 86 it just manipulates bytes in RAM instead - way faster.

If you set the textwrite flag then vPutMap should write to a buffer in RAM which you can copy over once per frame.

Unfortunately this is a fact of life on the 84+ ... it is a key difference between the 2 calculators.

That being said, for this test it is only 1 character. I was wondering what your timings for both calcs are?

Out of curiosity do you still have your old 86 btw? Or are you using an emulator?
Very clear now; the vputmap on the TI-84-Plus is so slow because it needs to pass via the controller. So working with OUT myself won't make it faster. I can only expect speed gain via the buffer and showing it only every other <x> milliseconds. Here some timings... Please note that I can't connect with my TI-86 anymore, because it only has a serial cable and my old PC is in the attic somewhere. But it's still in working condition, just like my TI-85 and HP48G! EDIT: I saw they're selling a USB-I/O cable for the TI-86 which would revive the machine in its entirety. I might consider one of those but they're not cheap...

Code:

TI-84-Plus       TI-86
Real   Emu    Real Emu
 10s   10s       ?  3s

Thanks for the answers BTW!
I imagine the routine for the 86 is very straightforward which explains the speed.

Even going to check a flag and then doing some branches is going to cause delay if you do it 4096 times. I imagine the 84+ routine could only be half as fast just drawing to memory.

It might be better to make a custom routine for this or consider an alternative method for drawing.

What is the game btw?
Yep, I understand you entirely. I'm gonna look into that... Thx for the suggestions!

The game I'm currently porting is my first assembly-game on the TI-86, so it's nothing spectacular, a simple snake. See https://www.ticalc.org/archives/files/fileinfo/367/36766.html I last updated this in 2016, because a colleague wanted to see/understand it (it contains lots of comments (in Dutch Smile )).

If you have any suggestions on how I can improve this code, feel free to point me to any mistakes or optimizations I can apply. I would be very grateful for that. I'm teaching the kids z80-assembly nowadays, so I'm interested in any rookie-mistakes I made myself back then! Smile
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are GMT - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement