Intel 8008 CPU has an internal stack, implemented as an 8 x 16-bit scratchpad.
No, it's entries are 'only' 14 bit long, as all addressing on the 8008 supports only 14 bit (*1).
How does it work exactly? Is there any "invisible 3-bit stack pointer"?
Yes. In reality it's not a stack pointer, but selects the active PC.
A three-bit address pointer is used to designate the present
location of the program counter.
(From the 1973 User Manual section III.B.1 p.7)
I want to know what happens when the stack is full and call operation is performed.
It simply cycles (7->0).
When the capacity of the stack is exceeded, the address pointer
recycles and the content of the lowest level register is destroyed.
(From the 1973 User Manual section III.B.1 p.7)
Is the stack "infinite" and the oldest value is dropped, or the oldest saved return address is overwritten?
Erm, not clear what 'dropping' is supposed meant. The stack pointer simply runs over, reusing the oldest entry (see above)
And what happens when the stack is "empty" and return operation is performed? Does it read any undefined/unpredictable value?
It switches to the previous PC, which my hold an undefined value - or to be exact, whatever has been left here by some previous use.
The manual states that all registers, as well as stack pointer and stack are cleared (*2) on startup (*3).
When power (Voo ) and clocks (cP1 , cP2 ) are first turned on, a flip-flop internal to the
8008 is set by sensing the rise of Voo . This internal signal forces a HALT (00000000)
into the instruction register and the 8008 is then in the STOPPED state. The following
sixteen clock periods after entering the STOPPED state are required to clear (logic "0")
memories (accumulator, scratch pad, program counter, and stack). During this time the
interrupt line has been at logic "0". Any ti me after the memories are cleared, the 8008
is ready for normal operation.
(From the 1973 User Manual section V.A.2 p.20)
*1 - The top two bits of the second address byte signal the access type as
- Program
- Memory Read
- IO
- Memory Write
*2 - Personally I'd be a bit careful here, as 16 cycles do not really seam enough to do all of this.
*3 - The 8008 has no Reset input, but uses power-up to initialize.