How does the Z80 determine which peripheral sent an interrupt? The Next CEO of Stack OverflowWhy does the Z80 have a half-carry bit?How fast is memcpy on the Z80?How can a C64 interrupt let the KERNAL keep operating?Which Z80 opcodes can I use without a stack?Why does the Z80 include the RLD and RRD instructions?Intel 8080 and Altair 8800. 256 I/0 ports, but only 7 free RST (interrupt subroutine) - how it works?Is it possible to switch the interrupt source of the C64 to VIC without changing the IRQ routine?Why do we need to acknowledge the interrupt from VIC-II?How do I Interface a PS/2 Keyboard without Modern Techniques?Where does the Z80 processor start executing from?

How do I transpose the 1st and -1th levels of an arbitrarily nested array?

If/When UK leaves the EU, can a future goverment conduct a referendum to join the EU?

Why am I allowed to create multiple unique pointers from a single object?

I believe this to be a fraud - hired, then asked to cash check and send cash as Bitcoin

What happened in Rome, when the western empire "fell"?

Would a galaxy be visible from outside, but nearby?

What does "Its cash flow is deeply negative" mean?

Is there a way to save my career from absolute disaster?

Inappropriate reference requests from Journal reviewers

What flight has the highest ratio of time difference to flight time?

sp_blitzCache results Memory grants

Why don't programming languages automatically manage the synchronous/asynchronous problem?

Is it professional to write unrelated content in an almost-empty email?

Is there a difference between "Fahrstuhl" and "Aufzug"

Would this house-rule that treats advantage as a +1 to the roll instead (and disadvantage as -1) and allows them to stack be balanced?

Does it take more energy to get to Venus or to Mars?

Which kind of appliances can one connect to electric sockets located in a airplane's toilet?

What does convergence in distribution "in the Gromov–Hausdorff" sense mean?

Won the lottery - how do I keep the money?

To not tell, not take, and not want

Multiple labels for a single equation

Is 'diverse range' a pleonastic phrase?

Written every which way

Can I equip Skullclamp on a creature I am sacrificing?



How does the Z80 determine which peripheral sent an interrupt?



The Next CEO of Stack OverflowWhy does the Z80 have a half-carry bit?How fast is memcpy on the Z80?How can a C64 interrupt let the KERNAL keep operating?Which Z80 opcodes can I use without a stack?Why does the Z80 include the RLD and RRD instructions?Intel 8080 and Altair 8800. 256 I/0 ports, but only 7 free RST (interrupt subroutine) - how it works?Is it possible to switch the interrupt source of the C64 to VIC without changing the IRQ routine?Why do we need to acknowledge the interrupt from VIC-II?How do I Interface a PS/2 Keyboard without Modern Techniques?Where does the Z80 processor start executing from?










2















My understanding of how interrupts (and more specifically, interrupt daisy-chaining) works in the Z80 is limited, to say the least, so if I get anything wrong please correct me.



Anyway, let's say I have 2 PIO chips to control 2 different peripherals (lets say, a character LCD display, and some switches, but I'm sure that's not very relevant). I've connected the IEO pin of one PIO to the CPU's INT pin, and it's IEI pin to the other PIO's IEO. I then connected that PIO's IEI pin to a 5V rail. I got this information from this image: (but instead of the three different peripheral chips they use, I just have two PIO chips.)



daisy
[from here]



Anyway, my understanding is that this kind of configuration means that if the second PIO (the one directly connected to the 5V rail) pulls its IEO pin low, the other PIO will not be able to send an interrupt. Correct?



My issue is this: How would I cause a PIO chip's IEO pin to go low? And how can I actually send an interrupt from one of these peripherals? My initial thought would be that I'd just pull the CPU's INT pin low, but that doesn't make sense the more I think about it.



(On a side note, any idea what the INTACK pin is on that diagram?)










share|improve this question









New contributor




Jacob Garby is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
























    2















    My understanding of how interrupts (and more specifically, interrupt daisy-chaining) works in the Z80 is limited, to say the least, so if I get anything wrong please correct me.



    Anyway, let's say I have 2 PIO chips to control 2 different peripherals (lets say, a character LCD display, and some switches, but I'm sure that's not very relevant). I've connected the IEO pin of one PIO to the CPU's INT pin, and it's IEI pin to the other PIO's IEO. I then connected that PIO's IEI pin to a 5V rail. I got this information from this image: (but instead of the three different peripheral chips they use, I just have two PIO chips.)



    daisy
    [from here]



    Anyway, my understanding is that this kind of configuration means that if the second PIO (the one directly connected to the 5V rail) pulls its IEO pin low, the other PIO will not be able to send an interrupt. Correct?



    My issue is this: How would I cause a PIO chip's IEO pin to go low? And how can I actually send an interrupt from one of these peripherals? My initial thought would be that I'd just pull the CPU's INT pin low, but that doesn't make sense the more I think about it.



    (On a side note, any idea what the INTACK pin is on that diagram?)










    share|improve this question









    New contributor




    Jacob Garby is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.






















      2












      2








      2








      My understanding of how interrupts (and more specifically, interrupt daisy-chaining) works in the Z80 is limited, to say the least, so if I get anything wrong please correct me.



      Anyway, let's say I have 2 PIO chips to control 2 different peripherals (lets say, a character LCD display, and some switches, but I'm sure that's not very relevant). I've connected the IEO pin of one PIO to the CPU's INT pin, and it's IEI pin to the other PIO's IEO. I then connected that PIO's IEI pin to a 5V rail. I got this information from this image: (but instead of the three different peripheral chips they use, I just have two PIO chips.)



      daisy
      [from here]



      Anyway, my understanding is that this kind of configuration means that if the second PIO (the one directly connected to the 5V rail) pulls its IEO pin low, the other PIO will not be able to send an interrupt. Correct?



      My issue is this: How would I cause a PIO chip's IEO pin to go low? And how can I actually send an interrupt from one of these peripherals? My initial thought would be that I'd just pull the CPU's INT pin low, but that doesn't make sense the more I think about it.



      (On a side note, any idea what the INTACK pin is on that diagram?)










      share|improve this question









      New contributor




      Jacob Garby is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.












      My understanding of how interrupts (and more specifically, interrupt daisy-chaining) works in the Z80 is limited, to say the least, so if I get anything wrong please correct me.



      Anyway, let's say I have 2 PIO chips to control 2 different peripherals (lets say, a character LCD display, and some switches, but I'm sure that's not very relevant). I've connected the IEO pin of one PIO to the CPU's INT pin, and it's IEI pin to the other PIO's IEO. I then connected that PIO's IEI pin to a 5V rail. I got this information from this image: (but instead of the three different peripheral chips they use, I just have two PIO chips.)



      daisy
      [from here]



      Anyway, my understanding is that this kind of configuration means that if the second PIO (the one directly connected to the 5V rail) pulls its IEO pin low, the other PIO will not be able to send an interrupt. Correct?



      My issue is this: How would I cause a PIO chip's IEO pin to go low? And how can I actually send an interrupt from one of these peripherals? My initial thought would be that I'd just pull the CPU's INT pin low, but that doesn't make sense the more I think about it.



      (On a side note, any idea what the INTACK pin is on that diagram?)







      z80 interrupt






      share|improve this question









      New contributor




      Jacob Garby is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.











      share|improve this question









      New contributor




      Jacob Garby is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      share|improve this question




      share|improve this question








      edited 5 hours ago







      Jacob Garby













      New contributor




      Jacob Garby is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      asked 5 hours ago









      Jacob GarbyJacob Garby

      2206




      2206




      New contributor




      Jacob Garby is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.





      New contributor





      Jacob Garby is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






      Jacob Garby is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.




















          1 Answer
          1






          active

          oldest

          votes


















          3














          You might want to consult the chapter for 'Interrupt Response' of the CPU manual (Chapter 8 on p.55 of the 1976 issue) and 'Interrupt Servicing' from the PIO manual (Chapter 6 on p.15 of the 1977 issue).



          In general the Z80 supports 3 different interrupt modes:



          • Mode 0 - like 8080, here the interrupting device must place an instrution on the bus - usually done by a 8259 interrupt controller.


          • Mode 1 - All interrupts will jump to 38h (restart) and execute from there. Much like NMI


          • Mode 2 - Peripherals put an interrupt service number on the bus during interrupt response, the CPU uses for an indirect call thru a table of pointers in a 256 byte page pointed to by the I register.


          The picture inserted hints that you intend to use Z80s Mode 2. To make it work:



          • Write some service routine for your interrupt, ending in an RETI

          • Disable interrupts

          • Setup a vector table in a memory page (256 byte boundry)

          • Pick any vector number you like (lets say 3)

          • Put the address of your service routing to that vector (xx06/xx07)

          • Put the vector number into the PIO channels vector register (control word with 2^0 set)

          • Set the Interrupt control word (x7) for the port to define which bits and under wich configuration will trigger an interrupt. For example 97h FFh sent to Port A will make all inputs issue interrupts as soon as they go high.

          • Set interrupt Mmode 2 of the CPU

          • Enable interrupts

          • Enjoy whatever happens :))

          A Z80 in Mode 2 is perfect suited for an interrupt driven system.




          How would I cause a PIO chip's IEO pin to go low?




          Err ... by waiting for an interrupt to occur, then serving it?



          (Maybe I do not really understand what part of information is missing).






          share|improve this answer























          • Okay, thanks! That cleared a lot of things up for me. I don't know if I'm being stupid, but one thing I don't understand is exactly how I would create an interrupt from the PIO -- I mean, how can I interrupt the CPU when a button is pressed, for example?

            – Jacob Garby
            4 hours ago











          Your Answer








          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "648"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          noCode: true, onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );






          Jacob Garby is a new contributor. Be nice, and check out our Code of Conduct.









          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fretrocomputing.stackexchange.com%2fquestions%2f9475%2fhow-does-the-z80-determine-which-peripheral-sent-an-interrupt%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          3














          You might want to consult the chapter for 'Interrupt Response' of the CPU manual (Chapter 8 on p.55 of the 1976 issue) and 'Interrupt Servicing' from the PIO manual (Chapter 6 on p.15 of the 1977 issue).



          In general the Z80 supports 3 different interrupt modes:



          • Mode 0 - like 8080, here the interrupting device must place an instrution on the bus - usually done by a 8259 interrupt controller.


          • Mode 1 - All interrupts will jump to 38h (restart) and execute from there. Much like NMI


          • Mode 2 - Peripherals put an interrupt service number on the bus during interrupt response, the CPU uses for an indirect call thru a table of pointers in a 256 byte page pointed to by the I register.


          The picture inserted hints that you intend to use Z80s Mode 2. To make it work:



          • Write some service routine for your interrupt, ending in an RETI

          • Disable interrupts

          • Setup a vector table in a memory page (256 byte boundry)

          • Pick any vector number you like (lets say 3)

          • Put the address of your service routing to that vector (xx06/xx07)

          • Put the vector number into the PIO channels vector register (control word with 2^0 set)

          • Set the Interrupt control word (x7) for the port to define which bits and under wich configuration will trigger an interrupt. For example 97h FFh sent to Port A will make all inputs issue interrupts as soon as they go high.

          • Set interrupt Mmode 2 of the CPU

          • Enable interrupts

          • Enjoy whatever happens :))

          A Z80 in Mode 2 is perfect suited for an interrupt driven system.




          How would I cause a PIO chip's IEO pin to go low?




          Err ... by waiting for an interrupt to occur, then serving it?



          (Maybe I do not really understand what part of information is missing).






          share|improve this answer























          • Okay, thanks! That cleared a lot of things up for me. I don't know if I'm being stupid, but one thing I don't understand is exactly how I would create an interrupt from the PIO -- I mean, how can I interrupt the CPU when a button is pressed, for example?

            – Jacob Garby
            4 hours ago















          3














          You might want to consult the chapter for 'Interrupt Response' of the CPU manual (Chapter 8 on p.55 of the 1976 issue) and 'Interrupt Servicing' from the PIO manual (Chapter 6 on p.15 of the 1977 issue).



          In general the Z80 supports 3 different interrupt modes:



          • Mode 0 - like 8080, here the interrupting device must place an instrution on the bus - usually done by a 8259 interrupt controller.


          • Mode 1 - All interrupts will jump to 38h (restart) and execute from there. Much like NMI


          • Mode 2 - Peripherals put an interrupt service number on the bus during interrupt response, the CPU uses for an indirect call thru a table of pointers in a 256 byte page pointed to by the I register.


          The picture inserted hints that you intend to use Z80s Mode 2. To make it work:



          • Write some service routine for your interrupt, ending in an RETI

          • Disable interrupts

          • Setup a vector table in a memory page (256 byte boundry)

          • Pick any vector number you like (lets say 3)

          • Put the address of your service routing to that vector (xx06/xx07)

          • Put the vector number into the PIO channels vector register (control word with 2^0 set)

          • Set the Interrupt control word (x7) for the port to define which bits and under wich configuration will trigger an interrupt. For example 97h FFh sent to Port A will make all inputs issue interrupts as soon as they go high.

          • Set interrupt Mmode 2 of the CPU

          • Enable interrupts

          • Enjoy whatever happens :))

          A Z80 in Mode 2 is perfect suited for an interrupt driven system.




          How would I cause a PIO chip's IEO pin to go low?




          Err ... by waiting for an interrupt to occur, then serving it?



          (Maybe I do not really understand what part of information is missing).






          share|improve this answer























          • Okay, thanks! That cleared a lot of things up for me. I don't know if I'm being stupid, but one thing I don't understand is exactly how I would create an interrupt from the PIO -- I mean, how can I interrupt the CPU when a button is pressed, for example?

            – Jacob Garby
            4 hours ago













          3












          3








          3







          You might want to consult the chapter for 'Interrupt Response' of the CPU manual (Chapter 8 on p.55 of the 1976 issue) and 'Interrupt Servicing' from the PIO manual (Chapter 6 on p.15 of the 1977 issue).



          In general the Z80 supports 3 different interrupt modes:



          • Mode 0 - like 8080, here the interrupting device must place an instrution on the bus - usually done by a 8259 interrupt controller.


          • Mode 1 - All interrupts will jump to 38h (restart) and execute from there. Much like NMI


          • Mode 2 - Peripherals put an interrupt service number on the bus during interrupt response, the CPU uses for an indirect call thru a table of pointers in a 256 byte page pointed to by the I register.


          The picture inserted hints that you intend to use Z80s Mode 2. To make it work:



          • Write some service routine for your interrupt, ending in an RETI

          • Disable interrupts

          • Setup a vector table in a memory page (256 byte boundry)

          • Pick any vector number you like (lets say 3)

          • Put the address of your service routing to that vector (xx06/xx07)

          • Put the vector number into the PIO channels vector register (control word with 2^0 set)

          • Set the Interrupt control word (x7) for the port to define which bits and under wich configuration will trigger an interrupt. For example 97h FFh sent to Port A will make all inputs issue interrupts as soon as they go high.

          • Set interrupt Mmode 2 of the CPU

          • Enable interrupts

          • Enjoy whatever happens :))

          A Z80 in Mode 2 is perfect suited for an interrupt driven system.




          How would I cause a PIO chip's IEO pin to go low?




          Err ... by waiting for an interrupt to occur, then serving it?



          (Maybe I do not really understand what part of information is missing).






          share|improve this answer













          You might want to consult the chapter for 'Interrupt Response' of the CPU manual (Chapter 8 on p.55 of the 1976 issue) and 'Interrupt Servicing' from the PIO manual (Chapter 6 on p.15 of the 1977 issue).



          In general the Z80 supports 3 different interrupt modes:



          • Mode 0 - like 8080, here the interrupting device must place an instrution on the bus - usually done by a 8259 interrupt controller.


          • Mode 1 - All interrupts will jump to 38h (restart) and execute from there. Much like NMI


          • Mode 2 - Peripherals put an interrupt service number on the bus during interrupt response, the CPU uses for an indirect call thru a table of pointers in a 256 byte page pointed to by the I register.


          The picture inserted hints that you intend to use Z80s Mode 2. To make it work:



          • Write some service routine for your interrupt, ending in an RETI

          • Disable interrupts

          • Setup a vector table in a memory page (256 byte boundry)

          • Pick any vector number you like (lets say 3)

          • Put the address of your service routing to that vector (xx06/xx07)

          • Put the vector number into the PIO channels vector register (control word with 2^0 set)

          • Set the Interrupt control word (x7) for the port to define which bits and under wich configuration will trigger an interrupt. For example 97h FFh sent to Port A will make all inputs issue interrupts as soon as they go high.

          • Set interrupt Mmode 2 of the CPU

          • Enable interrupts

          • Enjoy whatever happens :))

          A Z80 in Mode 2 is perfect suited for an interrupt driven system.




          How would I cause a PIO chip's IEO pin to go low?




          Err ... by waiting for an interrupt to occur, then serving it?



          (Maybe I do not really understand what part of information is missing).







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered 4 hours ago









          RaffzahnRaffzahn

          54.4k6133219




          54.4k6133219












          • Okay, thanks! That cleared a lot of things up for me. I don't know if I'm being stupid, but one thing I don't understand is exactly how I would create an interrupt from the PIO -- I mean, how can I interrupt the CPU when a button is pressed, for example?

            – Jacob Garby
            4 hours ago

















          • Okay, thanks! That cleared a lot of things up for me. I don't know if I'm being stupid, but one thing I don't understand is exactly how I would create an interrupt from the PIO -- I mean, how can I interrupt the CPU when a button is pressed, for example?

            – Jacob Garby
            4 hours ago
















          Okay, thanks! That cleared a lot of things up for me. I don't know if I'm being stupid, but one thing I don't understand is exactly how I would create an interrupt from the PIO -- I mean, how can I interrupt the CPU when a button is pressed, for example?

          – Jacob Garby
          4 hours ago





          Okay, thanks! That cleared a lot of things up for me. I don't know if I'm being stupid, but one thing I don't understand is exactly how I would create an interrupt from the PIO -- I mean, how can I interrupt the CPU when a button is pressed, for example?

          – Jacob Garby
          4 hours ago










          Jacob Garby is a new contributor. Be nice, and check out our Code of Conduct.









          draft saved

          draft discarded


















          Jacob Garby is a new contributor. Be nice, and check out our Code of Conduct.












          Jacob Garby is a new contributor. Be nice, and check out our Code of Conduct.











          Jacob Garby is a new contributor. Be nice, and check out our Code of Conduct.














          Thanks for contributing an answer to Retrocomputing Stack Exchange!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fretrocomputing.stackexchange.com%2fquestions%2f9475%2fhow-does-the-z80-determine-which-peripheral-sent-an-interrupt%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          名間水力發電廠 目录 沿革 設施 鄰近設施 註釋 外部連結 导航菜单23°50′10″N 120°42′41″E / 23.83611°N 120.71139°E / 23.83611; 120.7113923°50′10″N 120°42′41″E / 23.83611°N 120.71139°E / 23.83611; 120.71139計畫概要原始内容臺灣第一座BOT 模式開發的水力發電廠-名間水力電廠名間水力發電廠 水利署首件BOT案原始内容《小檔案》名間電廠 首座BOT水力發電廠原始内容名間電廠BOT - 經濟部水利署中區水資源局

          Prove that NP is closed under karp reduction?Space(n) not closed under Karp reductions - what about NTime(n)?Class P is closed under rotation?Prove or disprove that $NL$ is closed under polynomial many-one reductions$mathbfNC_2$ is closed under log-space reductionOn Karp reductionwhen can I know if a class (complexity) is closed under reduction (cook/karp)Check if class $PSPACE$ is closed under polyonomially space reductionIs NPSPACE also closed under polynomial-time reduction and under log-space reduction?Prove PSPACE is closed under complement?Prove PSPACE is closed under union?

          Is my guitar’s action too high? Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern)Strings too stiff on a recently purchased acoustic guitar | Cort AD880CEIs the action of my guitar really high?Μy little finger is too weak to play guitarWith guitar, how long should I give my fingers to strengthen / callous?When playing a fret the guitar sounds mutedPlaying (Barre) chords up the guitar neckI think my guitar strings are wound too tight and I can't play barre chordsF barre chord on an SG guitarHow to find to the right strings of a barre chord by feel?High action on higher fret on my steel acoustic guitar