Karoshi MSX Community
05 de Julio de 2021, 10:46:54 am *
Bienvenido(a), Visitante. Por favor, ingresa o regístrate.

Ingresar con nombre de usuario, contraseña y duración de la sesión
Noticias:
 
   Inicio   Ayuda Buscar Ingresar Registrarse  
Páginas: [1]
  Imprimir  
Autor Tema: IM2  (Leído 9760 veces)
0 Usuarios y 1 Visitante están viendo este tema.
Dioniso
Visitante
IM2
« : 20 de Enero de 2009, 06:34:58 pm »

   Hi!

   I have been doing some testing with the IM2 mode, which is something completely new to me.

   The setting up I have goes like this:

Código:
di
ld hl,TABLE257
ld bc,MAIN
ld (hl),b
inc hl
ld (hl),c
ld e,l
ld d,h
inc de
dec hl
ld bc,$ff
ldir
ld a,$d0
ld i,a
im 2

Where TABLE257 is a space in RAM to store the higher byte of the routine MAIN. The space is stored at $D000.

Since this is unknown to me, I have some questions for the experts in IM2:

-Is that routine above correct?
-Is the frame rate still 50/60hz or it depends on the use of HALT?
-After every HALT is the routine MAIN called automatically?

I think the routine above is not completely right...

I already had a look at the one in the SNIPPETS, by jltursan, but there are some things I still don't understand quite well...

I am doing the testings on BlueMSX.
En línea
SapphiRe_MSX
Visitante
« Respuesta #1 : 20 de Enero de 2009, 07:05:34 pm »

The main problem with IM2 mode is that the routine you want to jump in should have the same upper and lower byte. So there's only 256 possible locations for this routine. When an interrupt occurs:

-Register I contains the upper byte of the address with the direction of the routine (you can control this)
-Data on the bus contains the lower byte of the address with the direction of the routine (you can't control this)
-CPU looks on the direction and jumps to this address

That's why you need to put the routine in an address with the same upper and lower byte.

Citar
-Is that routine above correct?

No. First you have to place your routine in a valid address and fill the table with that byte.

Citar
-Is the frame rate still 50/60hz or it depends on the use of HALT?

Is independent and controlled by the VDP, as usual.

Citar
-After every HALT is the routine MAIN called automatically?

If you put the routine in a valid address, init the I register with the upper byte of the 257 byte table and fill the table with the correct value: yes.

Regards
--
Sph.
En línea
Dioniso
Visitante
« Respuesta #2 : 20 de Enero de 2009, 07:10:35 pm »

The main problem with IM2 mode is that the routine you want to jump in should have the same upper and lower byte. So there's only 256 possible locations for this routine.

Mmm... I thought we could control the higher byte, not the lower, that's why we have to fill the 256 possibilities, just for the lower byte...

So I'll try what you say, SapphiRe. Thanks again!  Wink
En línea
SapphiRe_MSX
Visitante
« Respuesta #3 : 20 de Enero de 2009, 07:30:26 pm »

Mmm... I thought we could control the higher byte, not the lower, that's why we have to fill the 256 possibilities, just for the lower byte...

Yes, you can control the higher byte of the address of the table, not the lower. So, for instance, if the table is located on $D000, register I should be initialized to $D0 and:

a) If bus has $88, the address of the interrupt routine is located at $D088
b) If bus has $89, the address of the interrupt routine is located at $D089

As you want to jump to the same routine, $D088 and $D089 must have the same byte (lower byte of the address). That's why the interrupt routine must be placed on an address with the same upper and lower byte.
En línea
Dioniso
Visitante
« Respuesta #4 : 20 de Enero de 2009, 09:00:23 pm »

I surrender. Bye.
En línea
Dioniso
Visitante
« Respuesta #5 : 21 de Enero de 2009, 07:32:19 pm »

Thanks again, SapphiRe, for your help. Your private messages helped me to understand how IM2 works  Cheesy
En línea
k0ga
Karoshi Fan
**
Mensajes: 85


Email
« Respuesta #6 : 13 de Febrero de 2009, 09:52:07 am »

The main problem with IM2 mode is that the routine you want to jump in should have the same upper and lower byte. So there's only 256 possible locations for this routine. When an interrupt occurs:

-Register I contains the upper byte of the address with the direction of the routine (you can control this)
-Data on the bus contains the lower byte of the address with the direction of the routine (you can't control this)
-CPU looks on the direction and jumps to this address

That's why you need to put the routine in an address with the same upper and lower byte.


How in MSX wasn't fixed address read in the bus, in theory you could read any value, but in real life I can sure you that you will read always a FF, because is a hardware basic design rule (put pullup resistor in the bus to avoid fluctuations which can cause problems).
En línea
Dioniso
Visitante
« Respuesta #7 : 13 de Febrero de 2009, 01:52:10 pm »

I read somewhere some computers doesn't read $ff. I think it was a Brazilian computer.
En línea
Páginas: [1]
  Imprimir  
 
Ir a:  

Impulsado por MySQL Impulsado por PHP Powered by SMF 1.1.21 | SMF © 2013, Simple Machines XHTML 1.0 válido! CSS válido!