Sujet : Re: Intel
De : blockedofcourse (at) *nospam* foo.invalid (Don Y)
Groupes : sci.electronics.designDate : 04. Aug 2024, 20:22:06
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <v8okcv$6o40$1@dont-email.me>
References : 1 2 3 4 5 6 7
User-Agent : Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.2.2
On 8/4/2024 11:27 AM, Edward Rawde wrote:
Yes, the 1802 was great, the address bus was muxed high byte low bytes so
interfacing to DRAM was extremely easy.
I never used the 1802 but it did look like a nice architecture to me at the time.
Is that the one which stored the return address in the first two addresses of a subroutine or am I thinking of something else?
The 1802 made the programmer "manually" alter the PC and, later, restore
it.
You essentially told the processor to use a different register
as the PC -- after having placed the address (registers are 16b)
in that register. You similarly would re-alter it to get back to
the point (following) where you made the change.
[This is a cruder version of the more modern BAL -- where the
programmer specifies the link register]
There are a couple of different ways of doing this but none is really
as clean (or efficient) as a CALL/JSR/BAL. You had to write code
to BUILD the CALL/JSR *mechanism* and then use that "subroutine"
as a linkage to invoke your desired "subroutine" while stacking the
return address so YOU could perform the reverse linkage when
the subroutine was complete.
I.e., think about what a "normal" processor does when it encounters
a CALL:
copy the address following the instruction onto a stack...
... that is indexed by a "stack pointer" register...
... updating that register in preparation for the next use...
place the destination address into the program counter
<your code here>
retrieve the stacked address "before" the referenced SP location...
...update the "stack pointer" register...
place the retrieved address into the program counter
Code for each of the above steps had to be WRITTEN by the programmer
to emulate a CALL (and RETURN) facility.
This was incredibly inefficient -- especially for a slow processor.
Newer processor designs avoid storing the return address on a
memory-based stack as this often causes needless memory accesses.
I.e., if your subroutine isn't going to "call" anything, then
why do you need to store more than the most recent return
address... IN A REGISTER!
[If you are going to need to call another subroutine, then you
take steps to preserve the state of any registers that could
be clobbered in that action -- like the "link" register!]