Autor
| How do you make use of INTs?
|
jltursan msx professional Mensajes: 887 | Publicado: Julio 14 2006, 09:53   |
About IM2 mode, from the Thomas Scherrer Z80 FAQ :
Quote:
| Mode 2: Is the most powerful, in that it allows for an indirect call to
any location in memory. With this mode the CPU forms a 16-bit memory address
where the upper 8-bits are the content of register I and the lower 8-bits
are supplied by the interrupting device. This address points to the first of
two sequential bytes in a table where the address of the service routine is
located. The CPU automatically obtains the starting address and performs a
CALL to this address. The RETI is also used to return to the main programm.
|
The ugly thing is that in common Z80 machines, the LSB (the one that comes from the device) never has a constant value; so you can't predict the value of the built jumping address (256 different addresses). The only solution is to set up a vector table whith 257 identical values, say $C1 for example, and then you'll be sure that when we get the interrupt address, it will be always $C1C1.
As you can see it's only a bit more work (and 257 bytes free less). The advantage is the total control of the CPU. |
|
tokumaru msx lover Mensajes: 83 | Publicado: Julio 14 2006, 16:17   |
Oh I get it now. So register I combined with a the lower byte from the device points to the address of the interrupt routine... This must be specially useful on machines with more than 1 interrupt!
For some reason I just assumed that the MSX didn't have a IM2 mode (just as it doesn't use NMI's), but it turns out you just have to waste a bunch of memory to make sure it'll jump to the correct place. Thanks a bunch jltursan!
|
|
NYYRIKKI msx master Mensajes: 1533 | Publicado: Julio 14 2006, 22:00   |
|
|
Alex msx lover Mensajes: 102 | Publicado: Julio 15 2006, 14:44   |
Quote:
| Oh I get it now. So register I combined with a the lower byte from the device points to the address of the interrupt routine... This must be specially useful on machines with more than 1 interrupt!
For some reason I just assumed that the MSX didn't have a IM2 mode (just as it doesn't use NMI's), but it turns out you just have to waste a bunch of memory to make sure it'll jump to the correct place. Thanks a bunch jltursan!
|
As far as I know, MSX always contains pull-up resistors on the data bus. It means that the Z80 will read the value 0xFF for the high-part of the pointer as there is no device to put any other value on the bus.
|
|
tokumaru msx lover Mensajes: 83 | Publicado: Julio 15 2006, 18:33   |
In the thread that NYYRIKKI posted above, some MSX models will have random values. Or didn't I get what you just said? =)
|
|
|
|
|