Host Engineering Forum

General Category => Do-more CPUs and Do-more Designer Software => Topic started by: MarkTTU on May 31, 2019, 09:28:26 AM

Title: Indirect Addressing - V vs custom memory
Post by: MarkTTU on May 31, 2019, 09:28:26 AM
Curiosity question more than anything... why is indirect addressing restricted to just V memory? If I've created my own memory block of unsigned words why can't I use one of those instead?

CustomString[V0] works
CustomString[CustomUnsignedWord0] doesn't work

Also, why can't I use an offset in an indirect address with a string?

CustomString[V0] works
CustomString[V0-1] doesn't work

but

CustomUnsignedWord[V0] works
CustomUnsignedWord[V0+1] also works
Title: Re: Indirect Addressing - V vs custom memory
Post by: BobO on May 31, 2019, 10:40:35 AM
Curiosity question more than anything... why is indirect addressing restricted to just V memory? If I've created my own memory block of unsigned words why can't I use one of those instead?

Implementation details mostly, but the simple answer is because we didn't have the extra byte to store a 2nd type.

Within the MATH box expression and output parameter fields there is no such limitation. The array index in either case can be a full expression.

CustomString[V0] works
CustomString[CustomUnsignedWord0] doesn't work

Also, why can't I use an offset in an indirect address with a string?

CustomString[V0] works
CustomString[V0-1] doesn't work

but

CustomUnsignedWord[V0] works
CustomUnsignedWord[V0+1] also works

Has nothing to do with strings, you can't do a negative displacement. The reason is related to the first answer. We had a certain number of free bits to store a displacement and chose 0 to 63 over -32 to 31.

Since you can do full expressions in MATH, of course negative is fine there.
Title: Re: Indirect Addressing - V vs custom memory
Post by: MarkTTU on May 31, 2019, 11:41:06 AM
Makes perfect sense. Thanks Bob!