enter image description here

If it's for Interrupt Service Routine (ISR) in which microprocessor pushes the content of program Counter(PC) to stack and then loads the Vector address in PC and starts executing the ISR stored in this vector address then what if the ISR needs more address locations. Will it overwrite the next interrupt's vector address? In fact for RST 4, TRAP(RST 4.5), RST 5, RST 5.5, RST6, RST 6.5, RST 7, RST 7.5 chain there's only 4 locations for ISR.

  • 6
    \$\begingroup\$ It's (1) to allow room for at least one 3-byte JMP instruction, and (2) it is convenient in hardware to align on a power of 2 boundary. \$\endgroup\$ – jonk Jun 6 '17 at 14:43
  • 3
    \$\begingroup\$ Plus, some ISRs in embedded applications don't need more than 8 bytes of instructions. Just set a flag and return. \$\endgroup\$ – Dave Tweed Jun 6 '17 at 14:57
  • \$\begingroup\$ @jonk: Why not post that as an answer? \$\endgroup\$ – JRE Jun 6 '17 at 15:01
  • \$\begingroup\$ @DaveTweed Agreed, often wished they left a little more room. \$\endgroup\$ – Trevor_G Jun 6 '17 at 15:07
  • 1
    \$\begingroup\$ @Sourabh_Tapas If you need more space, JMP to where you have more space. The vector addresses are hard-wired. But that doesn't limit what you do with the code. By the way, my first Altair 8800 (before I bought two 4k dynamic ram cards for it) had exactly 256 static ram locations. That was it. I couldn't afford the price to fill the 3 sockets available to make that 1024 static ram locations and by the time I could, the 4k dynamic ram cards were available at about the same cost. So I went that way (though the cards didn't work and that's actually what forced me to learn more electronics.) \$\endgroup\$ – jonk Jun 8 '17 at 6:01

It makes this piece of address-translating circuitry easier to implement if the vectored-to addresses are a power of two apart. That was very important in this gate-starved design of 1974-odd.

The 8 bytes is long enough for a 3-byte JumP instruction to an ISR, a RET/RETI for unused ReSTarts or a brief handler routine. And its short enough that's its only committing 64 bytes of precious program memory if you're using all of the restarts, or running programs like an OS does, where you can't risk not having a handler for each RST. That's all said from the 1974 perspective of its design.

This was adopted into the Z80, which was a superset of the 8080 architecture and instruction set. The ZX Spectrum used the Z80 and its ROM listing shows how several of the 8-byte RST service routines contained part or all of a routine, not just JPs.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.