I thought the idea of mode2 was you could have different vectors for
different devices connected well this throws a spanner in the works. But
then again is there any hardware for the SAM that uses them? I think it must
have been an old spectrum book that said this about swapping high,low bytes.
After a little test and using old brain this is wrong.
Dave
----- Original Message -----
From: "Edwin Blink" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Wednesday, May 21, 2008 5:34 AM
Subject: Re: Short, short questions
All 8 bits are used for LSB of the vector. The part where bit 0 always is
zero is when one of the Z80's IO chips is connected (PIO,SIO,CTC etc) is
connected.
Edwin
----- Original Message -----
From: "David Brant" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Wednesday, May 21, 2008 1:02 AM
Subject: Re: Short, short questions
I've just been looking at my books. Although I can't find the bit that
said about swapping to high,low but I'm sure that I did read it
somewhere. It does say that the device only gives the bits 1-7 and bit 0
is always 0 giving 128 possible addresses.
Dave
----- Original Message -----
From: "David Brant" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Tuesday, May 20, 2008 10:49 PM
Subject: Re: Short, short questions
This was based on info from a book called z-80 Workshop manual by E.A
Parr. The I register gives the high part of the table and the hardware
gives the low part to the table then takes that word for the service
routine. So if you start from one byte before the table and use the same
address for all entries and over run it by one it will work. My demo of
a full scrolling football pitch used this system, which I believe you
saw many years a go.
Dave
----- Original Message -----
From: "Andrew Collier" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Tuesday, May 20, 2008 9:50 PM
Subject: Re: Short, short questions
Hi,
I'm sceptical about this claim. I've never heard anybody say that the
vector formed is big-endian - it's just you don't know the byte offset
from which the interrupt vector will be fetched. (As Edwin says, it is
usually 255 - which is odd so your 1-aligned table will usually work -
but I don't know that Sam's hardware guarantees this).
So the high byte comes from I, the low byte from the data bus; this
forms a 16 bit address which will be incremented once (which is why
the table needs 257 bytes, not 256). You could, at least in theory,
read the vector address from even or odd overlapping entries, which is
why the usual strategy is to pick a vector address whose low and high
bytes are the same.
The last IM2 interrupt routine I wrote looked something like this:
ds ALIGN 256
IM2TABLE: equ $
IM2BYTE: equ im2table/256
IM2TARGETBYTE: equ IM2BYTE+1
for 257, DB IM2TARGETBYTE
IM2TARGET: equ 257*IM2TARGETBYTE
ds IM2TARGET-$
EX AF,AF'
...
Andrew
On 20 May 2008, at 21:16, David Brant wrote:
Mode 2 uses a table with 128 word address but as byte high,byte low
not the normal low, high bytes
So if you set your org/dump address to &??FF (i.e. &??00-1)
and then do
DEFW mode2.i,mode2.i
so you have 129 words.
mode2.i:
di
push af
in a,(status.int)
.....
.....
ei
ret
----- Original Message ----- From: "Andrew Collier"
<[EMAIL PROTECTED]
>
To: <[email protected]>
Sent: Tuesday, May 20, 2008 3:22 PM
Subject: Re: Short, short questions
The usual strategies are to use mode 1, or to use mode 2 with a 257-
byte table all
containing the same byte.
--
--- Andrew Collier ----
---- http://www.intensity.org.uk/ ---
--