Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

indirect addressing of page 0

74 views
Skip to first unread message

curious stranger

unread,
May 19, 2013, 10:15:42 AM5/19/13
to
since op codes 1 thru 5 let you select the current page or page 0, are
there reasons to use the indirect addressing bit with the page select bit
set to 0 other than to use auto-incrementing registers?

Johnny Billquist

unread,
May 19, 2013, 6:55:57 PM5/19/13
to
Opcodes 0 to 5, please. :-)
And sure. If you want to share a pointer, just as you might want to
share a constant, it might pay off to just have one copy in page 0
instead of individual ones on each page.
This is, in fact, no different than page 0 references without the
indirect bit set. Why would you use values in page 0 instead of in the
current page?

Johnny

--
Johnny Billquist || "I'm on a bus
|| on a psychedelic trip
email: b...@softjar.se || Reading murder books
pdp is alive! || tryin' to stay hip" - B. Idol

curious stranger

unread,
May 19, 2013, 7:29:53 PM5/19/13
to
Johnny Billquist <b...@softjar.se> wrote in
news:knbl9t$brc$1...@Iltempo.Update.UU.SE:

> On 2013-05-19 16:15, curious stranger wrote:
>> since op codes 1 thru 5 let you select the current page or page 0,
>> are there reasons to use the indirect addressing bit with the page
>> select bit set to 0 other than to use auto-incrementing registers?
>
> Opcodes 0 to 5, please. :-)
> And sure. If you want to share a pointer, just as you might want to
> share a constant, it might pay off to just have one copy in page 0
> instead of individual ones on each page.
> This is, in fact, no different than page 0 references without the
> indirect bit set. Why would you use values in page 0 instead of in the
> current page?
>
> Johnny
>

Thanks for your insights.

yes 0-5 of course, my bad. ( I realized it the moment after I hit send)

And I can understand storing data on pg. 0 as a commonly available
scratchpad

My question was more along the thought of is there a reason it's better to
get onto page 0 by indirect address rather than just set the Z bit to get
there; other than to activate auto-increment.

Johnny Billquist

unread,
May 19, 2013, 7:51:59 PM5/19/13
to
I don't understand your question. You do not use the I bit to get to
page 0, ever. While possible, that is just an inefficient way that waste
time and memory.
However, I Z in combination have nothing to do with accessing page 0,
but accessing data anywhere in the current field, using a *pointer
located in page 0*. That pointer can be used from many bits and pieces,
and thus it makes sense to place the pointer in page 0, and just have
one reference instead to multiple. Not to mention that it can be thought
of as global state that can be manipulated from many different places.
Global variables, that hold pointers... No different than global
variables holding numbers.

Your question probably confuses me since you drag the auto-increment
cells, which actually have nothing to do with the Z bit (except on the
6120, which is odd).
Getting to page zero have nothing to do with the auto-increment register
at all. You can get to page zero in four ways:
1) Set the Z bit in the instruction
2) Set the I bit in the instruction, and have the direct memory content
contain an address in page 0.
3) Set both I and Z, and have the direct memory content (in page 0)
contain an address in page 0.
4) Execute the code while actually in page 0, and set neither I nor Z.

Of course, while executing in page 0, solution 1-3 are also still possible.

To get to any random address in memory, you *need* to use the I bit.
Without the Z bit, you need to have the pointer in the current page.
With the Z bit, the pointer needs to be in page 0.

The auto-increment cells is an addition when doing indirect references
through address 10-17, in which that the pointer is auto-incremented
before being dereferenced. Where they actually point to is a different
question, and hardly relevant here.

curious stranger

unread,
May 19, 2013, 9:47:56 PM5/19/13
to


>
> Your question probably confuses me since you drag the auto-increment
> cells, which actually have nothing to do with the Z bit (except on the
> 6120, which is odd).
> Getting to page zero have nothing to do with the auto-increment
> register at all. You can get to page zero in four ways:
> 1) Set the Z bit in the instruction
> 2) Set the I bit in the instruction, and have the direct memory
> content contain an address in page 0.
> 3) Set both I and Z, and have the direct memory content (in page 0)
> contain an address in page 0.
> 4) Execute the code while actually in page 0, and set neither I nor Z.
>
> Of course, while executing in page 0, solution 1-3 are also still
> possible.
>
> To get to any random address in memory, you *need* to use the I bit.
> Without the Z bit, you need to have the pointer in the current page.
> With the Z bit, the pointer needs to be in page 0.
>
> The auto-increment cells is an addition when doing indirect references
> through address 10-17, in which that the pointer is auto-incremented
> before being dereferenced. Where they actually point to is a different
> question, and hardly relevant here.
>
> Johnny
>

My interest (today) is the auto-incrementing registers.

I don't have a pdp/8 nor have I ever. I'm trying to make sense of what
I've read. I'd read they only auto-increment if you indirectly address
them. Which led me to believe I would have to use both I and Z.




glen herrmannsfeldt

unread,
May 19, 2013, 10:28:18 PM5/19/13
to
curious stranger <righthere.com> wrote:

(snip)
> My interest (today) is the auto-incrementing registers.

> I don't have a pdp/8 nor have I ever. I'm trying to make sense of what
> I've read. I'd read they only auto-increment if you indirectly address
> them. Which led me to believe I would have to use both I and Z.

Not having actually programmed a PDP-8, that doesn't sound right.

I think it should be indirectly addressing with them.

It would be slightly inconvenient for them to increment when you
load them (store into them), or fetch from them, but when you use them
to address something (indirectly) is when you want them to increment.

-- glen

Johnny Billquist

unread,
May 20, 2013, 9:26:29 AM5/20/13
to
You got it right, Glen.

Here is a very short exmaple code, which should make it pretty clear (I
hope):

/ A small program to print "HELLO WORLD!" on the console
START, JMS PRINT
TEXT
HLT

/ PRINT - A function that prints a text on the console.
/ It takes one argument, the pointer to the text to be
/ printed. NUL terminated.
/
/ AC is cleared on return.

PRINT, 0
CLA CMA
TAD I PRINT
ISZ PRINT
DCA 10
LOOP, TAD I 10
SNA
JMP I PRINT
JMS PUTC
JMP LOOP

/ PUTC - Output one character on the console.
/ In: AC - Character to print.
/
/ AC is cleared on return.

PUTC, 0
TLS
TSF
JMP .-1
CLA
JMP I PUTC

TEXT, 'H,'E,'L,'L,'O,' ,'W,'O,'R,'L,'D,'!,15,12,0

$

Now, if anyone have any questions about the code, just ask. And I just
wrote this off my head, so I might have done something wrong in there.
And unless you assemble this program to run in page 0, if course
references to address 10 will force the Z bit to be set. If you do
assemble it for running in page 0 however, the Z bit can be set or
cleared, and the functionality is the same.

Also, to answer the OP, no, the auto-increment stuff has nothing to do
with the Z bit. It is just a question of when you do an indirect access
through address 10-17. In that case, the content of the address is
incremented before it is used as the address to fetch the actual data from.

(However, as I mentioned before, the Harris 6120 is odd, in that
auto-increment does not happen unless the Z bit is set, in that specific
CPU. I'd claim it's a hardware bug of that CPU.)

glen herrmannsfeldt

unread,
May 20, 2013, 11:22:36 AM5/20/13
to
Johnny Billquist <b...@softjar.se> wrote:

(snip, I wrote)

>> I think it should be indirectly addressing with them.

>> It would be slightly inconvenient for them to increment when you
>> load them (store into them), or fetch from them, but when you use them
>> to address something (indirectly) is when you want them to increment.

> You got it right, Glen.

Reminds me of the 6502.

There is no indirect jump, or jump to the address in a register
on the 6502, so instead you push the address on the stack and RET.

But RET is funny. When you do a subroutine call, instead of pushing
the address of the next instruction on the stack (that would be
usual) it pushes one less than the address. (Presumably the
contents of the PC at the time.) So, RET adds one after popping
the address off the stack.

Seems to me that they could have designed that autoincrement to
apply in all accesses. You would then have to store the address
minus one, knowing that it would then increment.

-- glen

Johnny Billquist

unread,
May 20, 2013, 9:48:41 PM5/20/13
to
On 2013-05-20 17:22, glen herrmannsfeldt wrote:
> Johnny Billquist <b...@softjar.se> wrote:
>
> (snip, I wrote)
>
>>> I think it should be indirectly addressing with them.
>
>>> It would be slightly inconvenient for them to increment when you
>>> load them (store into them), or fetch from them, but when you use them
>>> to address something (indirectly) is when you want them to increment.
>
>> You got it right, Glen.
>
> Reminds me of the 6502.

Ugh. :-) But yes, in some ways it does.

> There is no indirect jump, or jump to the address in a register
> on the 6502, so instead you push the address on the stack and RET.
>
> But RET is funny. When you do a subroutine call, instead of pushing
> the address of the next instruction on the stack (that would be
> usual) it pushes one less than the address. (Presumably the
> contents of the PC at the time.) So, RET adds one after popping
> the address off the stack.

JMS stores the return address at the entry point. Which makes a return
pretty easy on a PDP-8, and you don't even need any extra instruction
for it.
However, it totally rules out reentrancy. To do that, you need to
implement a stack in software, and juggle a lot.

> Seems to me that they could have designed that autoincrement to
> apply in all accesses. You would then have to store the address
> minus one, knowing that it would then increment.

On the PDP-8? That would probably have been a very bad idea. You use
plenty of indirect addressing on the PDP-8, and you do not always want
auto-incrementing. In fact, most of the time you do not.

Quadibloc

unread,
May 20, 2014, 5:18:37 PM5/20/14
to
On Sunday, May 19, 2013 7:47:56 PM UTC-6, curious stranger wrote:

> I don't have a pdp/8 nor have I ever. I'm trying to make sense of what
> I've read. I'd read they only auto-increment if you indirectly address
> them. Which led me to believe I would have to use both I and Z.

The auto-increment registers do increment when you use both I and Z.

But that's not when you indirectly address those registers.

That's when you use those registers to indirectly address something else.

John Savard
0 new messages