Mode 2 interupts - CP/M

This is a discussion on Mode 2 interupts - CP/M ; >Message-ID: Allisonnospam@nouce.bellatlantic.net wrote: > The logic to do this is a trivial combination of IORQ/ and M1/ > (signifies an interrupt response) and a 8bit tristate device > (or gates) like a LS244 to gate a 7bit value to the ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: Mode 2 interupts

  1. Mode 2 interupts

    >Message-ID:

    Allisonnospam@nouce.bellatlantic.net wrote:
    > The logic to do this is a trivial combination of IORQ/ and M1/
    > (signifies an interrupt response) and a 8bit tristate device
    > (or gates) like a LS244 to gate a 7bit value to the data bus
    > with bit 0=0. The value can be an encoded number from


    Is bit zero actually forced to zero by the Z80 during an IM2 or
    not? If I=&FF and the data bus is &FF, is the vector fetched from
    &FFFE/&FFFF (ie, bit zero forced to 0) or from &FFFF/&0000 ? I
    have seen documentation, programs and (importantly!) emulators
    written declaring both to be true.

    Zaks says bit 0 is forced to zero (p504). Leventhal says bit 0 is
    forced to zero (p12-5). Penfold says "bit 0 is always 0" without
    saying if it is forced to zero (p34), or the hardware should
    always *supply* a zero. Zilog is silent (p145). [1]

    With different emulators I have found some force bit 0 to zero,
    some do not.

    In one bit of code I wrote, I is set to &FF, the data bus holds
    &FF on IRQs and &FFFE/FFFF is externally defined as the address of
    the IM2 routine. On some emulators, the IM2 vectored via
    &FFFF/&0000. I ended up having to write the following code to get
    around this, and still use &FFFE/&FFFF as the vector:

    ..IRQFix ; I needs to be set to &FD
    FDF7 E5 PUSH HL
    FDF8 2A FE FF LD HL,(&FFFE) ; Save HL and get IRQV
    FDFB E3 EX (SP),HL ; Restore HL and jump to IRQV
    FDFC C9 RET
    FDFD C3 F7 FD JP &FDF7
    FE00 FD DEFB &FD
    ; If IM2 gives 256*I+255, then
    ; vectors via &FDFF/&FE00, which
    ; jumps to &FDFD, which jumps via
    ; the JP to IRQFix at &FDF7

    ; If IM2 gives 256*I+254, then
    ; vectors via &FDFE/&FDFF, which
    ; jumps direct to IRQFix at &FDF7.

    ; In both cases, IRQFix fetches the
    ; true IRQV address and jumps to it.

    Of course, the obvious thing to do is to test some real hardware,
    but my suitable hardware for this sort of test is a bit
    inaccessible at the moment.

    [1] References:
    Zaks, Programming the Z80, 1982
    Leventhal, Z80 Assembly Language Programming, 1979
    Penfold, An Introduction to Z80 Machine Code, 1984
    Zilog, Z80-Assembly Language Programming Manual, 1977

    --
    J.G.Harston - jgh@arcade.demon.co.uk - mdfs.net/User/JGH
    There are three food groups: brown, green and ice cream.


  2. Re: Mode 2 interupts

    On 14 Jun 06 22:26:28 GMT, jgh@arcade.demon.co.uk (Jonathan Graham
    Harston) wrote:

    >>Message-ID:

    >
    >Allisonnospam@nouce.bellatlantic.net wrote:
    >> The logic to do this is a trivial combination of IORQ/ and M1/
    >> (signifies an interrupt response) and a 8bit tristate device
    >> (or gates) like a LS244 to gate a 7bit value to the data bus
    >> with bit 0=0. The value can be an encoded number from

    >
    >Is bit zero actually forced to zero by the Z80 during an IM2 or
    >not? If I=&FF and the data bus is &FF, is the vector fetched from
    >&FFFE/&FFFF (ie, bit zero forced to 0) or from &FFFF/&0000 ? I
    >have seen documentation, programs and (importantly!) emulators
    >written declaring both to be true.
    >
    >Zaks says bit 0 is forced to zero (p504). Leventhal says bit 0 is
    >forced to zero (p12-5). Penfold says "bit 0 is always 0" without
    >saying if it is forced to zero (p34), or the hardware should
    >always *supply* a zero. Zilog is silent (p145). [1]
    >
    >With different emulators I have found some force bit 0 to zero,
    >some do not.
    >
    >In one bit of code I wrote, I is set to &FF, the data bus holds
    >&FF on IRQs and &FFFE/FFFF is externally defined as the address of
    >the IM2 routine. On some emulators, the IM2 vectored via
    >&FFFF/&0000. I ended up having to write the following code to get
    >around this, and still use &FFFE/&FFFF as the vector:
    >
    >.IRQFix ; I needs to be set to &FD
    >FDF7 E5 PUSH HL
    >FDF8 2A FE FF LD HL,(&FFFE) ; Save HL and get IRQV
    >FDFB E3 EX (SP),HL ; Restore HL and jump to IRQV
    >FDFC C9 RET
    >FDFD C3 F7 FD JP &FDF7
    >FE00 FD DEFB &FD
    > ; If IM2 gives 256*I+255, then
    > ; vectors via &FDFF/&FE00, which
    > ; jumps to &FDFD, which jumps via
    > ; the JP to IRQFix at &FDF7
    >
    > ; If IM2 gives 256*I+254, then
    > ; vectors via &FDFE/&FDFF, which
    > ; jumps direct to IRQFix at &FDF7.
    >
    > ; In both cases, IRQFix fetches the
    > ; true IRQV address and jumps to it.
    >
    >Of course, the obvious thing to do is to test some real hardware,
    >but my suitable hardware for this sort of test is a bit
    >inaccessible at the moment.
    >
    >[1] References:
    >Zaks, Programming the Z80, 1982
    >Leventhal, Z80 Assembly Language Programming, 1979
    >Penfold, An Introduction to Z80 Machine Code, 1984
    >Zilog, Z80-Assembly Language Programming Manual, 1977
    >


    bit 0-0 internally and the hardware I use also forces that.

    Allison


+ Reply to Thread