Hi,
In a spirit of scientific enquiry, let us perform an experiment by
running the code below.
On SimCoupe, at least, the border turns bright yellow, meaning it ran
the interrupt vector at 0x9a92 (that is, the 256th and 257th bytes of
the table). Anybody got real hardware handy?
Cheers,
Andrew
org 32768
dump 32768
di
ld a,TABLEADDR/256
ld i,a
im 2
ei
@: halt
jr @
TABLEADDR: equ &8100
ds TABLEADDR - $
for 254, DB 82
DB &8a, &92, &9a
BORDER: EQU 254
ds &8282 - $
ld a,0
out (BORDER),a
reti
ds &828a - $
ld a,1
out (BORDER),a
reti
ds &8292 - $
ld a,2
out (BORDER),a
reti
ds &829a - $
ld a,3
out (BORDER),a
reti
ds &8a82 - $
ld a,4
out (BORDER),a
reti
ds &8a8a - $
ld a,5
out (BORDER),a
reti
ds &8a92 - $
ld a,17
out (BORDER),a
reti
ds &8a9a - $
ld a,7
out (BORDER),a
reti
ds &9282 - $
ld a,32
out (BORDER),a
reti
ds &928a - $
ld a,33
out (BORDER),a
reti
ds &9292 - $
ld a,34
out (BORDER),a
reti
ds &929a - $
ld a,35
out (BORDER),a
reti
ds &9a82 - $
ld a,36
out (BORDER),a
reti
ds &9a8a - $
ld a,37
out (BORDER),a
reti
ds &9a92 - $
ld a,38
out (BORDER),a
reti
ds &9a9a - $
ld a,39
out (BORDER),a
reti
On 21 May 2008, at 00:02, David Brant wrote:
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: <sam-users@nvg.ntnu.no>
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: <sam-users@nvg.ntnu.no>
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: <sam-users@nvg.ntnu.no>
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/ ---
--
--
--- Andrew Collier ----
---- http://www.intensity.org.uk/ ---
--