Post Reply 
(11C) Indirect Line Number Branches
07-17-2019, 06:04 AM (This post was last modified: 07-17-2019 06:20 AM by Gamo.)
Post: #1
(11C) Indirect Line Number Branches
Going though the HP-11C User's Handbook on Page 137

Under Indirect Program Control there are two type:

1. Indirect Label Branches
2. Indirect Line Number Branches

According to the user manual state that
Indirect Label Branches the execution
is transfer downward in program memory.

But for Indirect Line Number Branches the manual doesn't said if it
going downward only like the Label Branches or not.

Remark: Is indirect label Branches only go downward in program memory..?

------------------------------------

This example program demonstrated that Indirect Line Number can be
branches either downward and upward in program memory.

Program to count down, count up and keep repeating.

Example:

5 [A] display 4..3..2..1..0..1..2..3..4..5..4..3........ to stop press [R/S]

Program:
Code:

001 LBL A
002 STO 1  // Store Integer to counts
003 STO 2  // Store Max Integer
004  1
005  6
006 CHS
007 STO I  // Indirect Line Number branches to line 016
008 LBL 0
009  1
010 STO-1
011 RCL 1
012 PSE  // display count down
013 X=0
014 GTO I  // Branch downward on line 016
015 GTO 0
016  1
017 STO+1
018 RCL 1
019 PSE  // display count up
020 RCL 2
021 X=Y
022 GTO 0
023 GTO I  // Branch upward to line 016

Gamo
Find all posts by this user
Quote this message in a reply
07-17-2019, 07:34 AM
Post: #2
RE: (11C) Indirect Line Number Branches
(07-17-2019 06:04 AM)Gamo Wrote:  According to the user manual state that
Indirect Label Branches the execution
is transfer downward in program memory.

It also says the same thing for a direct GTO, but that is not actually what happens or you would never be able to jump backwards in a program and perform loops.

Yes, the search is downwards from the position where the GTO is, but once the last line in the program is reached, the search continues from the beginning.

What this means is, if a label appears more than once in a program, e.g. once before your GTO and once after the GTO, then only the one below the GTO will ever be "seen" by the GTO.
Find all posts by this user
Quote this message in a reply
07-17-2019, 08:56 AM (This post was last modified: 07-17-2019 08:57 AM by Gamo.)
Post: #3
RE: (11C) Indirect Line Number Branches
Thanks for the feedback grsbanks

Just now I try the same program but use Indirect Label Branches

Program: Indirect Label Branches
Code:

LBL A
STO 1  // Store Count
STO 2  // Store Max Count
1
STO I  // Indirect Label branch to [LBL] 1
LBL 0
1
STO-1
RCL 1
PSE  // Count down display
X=0
GTO I  // branch downward to [LBL] 1
GTO 0
LBL 1 // This label use for Indirect Label Branching
1
STO+1
RCL 1
PSE  // Count up display
RCL 2
X=Y
GTO 0
GTO I  //  Branch upward to [LBL] 1

Program using Indirect Label Branching also look like it branch upward in
program as shown in above program. I did try it an it count down and up
the same as the first program that use Indirect Line Branches.

Remark:
The last line of this program is GTO I that branch to [LBL] 1 is it going upward?

Gamo
Find all posts by this user
Quote this message in a reply
07-17-2019, 09:28 AM
Post: #4
RE: (11C) Indirect Line Number Branches
I think you're over-complicating things. There is no "should I branch upwards or downwards?" There is simply "I need to find LBL 1, wherever it is, and jump there."

Whether you do effectively jump upwards or downwards is purely dependent on the position of the label relative to your current position, but you only have to start asking questions about how the calculator actually finds the label if it occurs more than once in the same program.
Find all posts by this user
Quote this message in a reply
07-19-2019, 03:16 PM
Post: #5
RE: (11C) Indirect Line Number Branches
Line junping to?
I'll read again to see this, as normally you can jump only tô labels.
If really possible, GTO linexxx Will go directly to that line, it doesn't matter If backward or forward.

ARTUR MARIO JUNIOR
BRAZIL
Find all posts by this user
Quote this message in a reply
07-19-2019, 03:23 PM
Post: #6
RE: (11C) Indirect Line Number Branches
(07-19-2019 03:16 PM)Artur - Brasil Wrote:  Line junping to?
I'll read again to see this, as normally you can jump only tô labels.
If really possible, GTO linexxx Will go directly to that line, it doesn't matter If backward or forward.

The key here is the word "INDIRECT".

Code:
1
STO I
GTO I

This does the same thing as "GTO 1". But if the value that you store in the index register is negative then it jumps to the line whose number is the absolute value of the index register. E.g. to jump to line 45:

Code:
45
CHS
STO I
GTO I
Find all posts by this user
Quote this message in a reply
Post Reply 




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