Post Reply 
42S local label caching
11-11-2019, 06:56 PM
Post: #3
RE: 42S local label caching
That's very helpful, thanks!

(11-11-2019 06:18 PM)Sylvain Cote Wrote:  
(11-11-2019 05:54 PM)Dave Britten Wrote:  Is that distance literally stored directly in the GTO or XEQ instruction inside the program?
Yep! ... for local labels only, 2 bytes GTO/XEQ for short distance LBL 00 to LBL 14 and 3 bytes GTO/XEQ for long distance for LBL 15 and up

So GTO 10, for example, is a 2-byte instruction on my 42S. That would mean one byte encodes the GTO 10, and a second byte is reserved to store a +/-128-byte offset. And for GTO 99, which is 3 bytes, 13 bits could store +/-4,096, and the remaining 11 bits encode the GTO 99 itself. Do I have that right? XEQ instructions are always 3 bytes, so I'm not exactly sure how those are formed.

(11-11-2019 06:18 PM)Sylvain Cote Wrote:  
(11-11-2019 05:54 PM)Dave Britten Wrote:  What about if you XEQ a global label in a different program area? Will local label lookups inside that program be cached if you call that same external program multiple times inside your program?
Global GTO/XEQ are different beasts and global LBL are looked up every time.

Yeah, I know global (alpha) labels aren't cached, so I'm mostly wondering what happens if I have a program that calls XEQ "OTHER", which is part of a different program area/separated by ENDs. Will local GTO/XEQ inside "OTHER" be cached in the same way? I'm assuming yes since the offsets are stored directly in the GTO/XEQ instructions.

(11-11-2019 06:18 PM)Sylvain Cote Wrote:  Ref.: Synthetic Programming on the HP-41C, by W.C Wickes, pages 16 & 17

That's the one on the museum DVD/document set, right? I'll give it a look. I'm not going to do synthetic programming or anything like that, but I figure I can squeeze more performance out of my 42S if I understand how cached branches work, and how to avoid situations where it can't be used. Sounds like it's as simple as using LBL 00-14 only when doing short jumps, and LBL 15-99 for anything long.

And I'm assuming that the KEY...GTO/XEQ menu instructions don't do any caching, since the program pointer could be anywhere when you press the menu key. But that wouldn't have any real performance impact, since it's not like you can invoke menu keys inside a loop or something.
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
42S local label caching - Dave Britten - 11-11-2019, 05:54 PM
RE: 42S local label caching - Sylvain Cote - 11-11-2019, 06:18 PM
RE: 42S local label caching - Dave Britten - 11-11-2019 06:56 PM
RE: 42S local label caching - Sylvain Cote - 11-13-2019, 02:00 PM
RE: 42S local label caching - Sylvain Cote - 11-13-2019, 02:06 PM
RE: 42S local label caching - Andres - 11-11-2019, 07:06 PM
RE: 42S local label caching - Dave Britten - 11-11-2019, 07:28 PM
RE: 42S local label caching - Sylvain Cote - 11-14-2019, 04:00 AM
RE: 42S local label caching - Joe Horn - 11-14-2019, 10:54 PM
RE: 42S local label caching - Sylvain Cote - 11-15-2019, 05:42 PM
RE: 42S local label caching - Joe Horn - 11-15-2019, 09:48 PM
RE: 42S local label caching - Sylvain Cote - 11-16-2019, 03:25 PM
RE: 42S local label caching - Werner - 11-16-2019, 04:50 PM
RE: 42S local label caching - Sylvain Cote - 11-16-2019, 11:33 PM
RE: 42S local label caching - Sylvain Cote - 11-16-2019, 11:22 PM
RE: 42S local label caching - Joe Horn - 11-17-2019, 12:50 PM
RE: 42S local label caching - Werner - 11-17-2019, 09:37 AM
RE: 42S local label caching - J-F Garnier - 11-17-2019, 09:51 AM
RE: 42S local label caching - Werner - 11-17-2019, 07:03 PM



User(s) browsing this thread: 9 Guest(s)