How safe is to use undocumented Z80 instructions? (Development Foros MSX)MSX Resource Center            
                       
English Nederlands Espa�ol Portugu�s Russian                  
 Noticias
   Página principal
  Almacén de noticias
  Temas de noticias

 Recursos
   Foros MSX
  Artículos
  Analisis
  Informe de ferias/RUs
  Álbum de fotos
  Ferias y encuentros
  Encuestas
  Enlaces
  Buscar

 Software
   Descargas
  Tienda Online

 MRC
   Quiénes somos
  Únete a nuestro equipo
  Donar
  Políticas
  Contacta con nosotros
  Enlázanos
  Estadísticas

 Buscar
 
  

  

 Login
 

Login

Contraseña




¿Aún no tienes una cuenta? ¡Conviértete en miembro del MSX Resource Center! ¡Únete a nosotros!.


 Estadísticas
 

Hay 48 invitados y 5 miembros en línea

Eres un usuario anónimo.
 

Foros MSX


Foros MSX

Development - How safe is to use undocumented Z80 instructions?

Ir a la página ( Página anterior 1 | 2 )
Autor

How safe is to use undocumented Z80 instructions?

PingPong
msx master
Mensajes: 1069
Publicado: Abril 22 2007, 16:32   
Quote:

In my experience, exx is rarely a solution for the problem because you lose the current values of bc, de, hl as well. Which you don't really want because you were out of registers for a reason. In that case it's a very good solution to use ixl, ixh, iyl and iyh for storage of 8 bit values or counters. In many cases it's the faster solution. I use them quite a lot myself. Much more than exx. I haven't heard of any compatibility issue with any msx machine.



I agree: most people under-estimate the index registers claiming that they are slow, but exchanging register bank could be even slow or more slow, especially if you need to have on-line all the register values (normal+switched). this usually need a lot of EXX where storing values in ix (H/L) and iy (H/L) does not need anything.

the trick is to use ix/iy for rare-changing values...


Of course, always depends to the use you need to do.

Chardson
msx lover
Mensajes: 93
Publicado: Abril 22 2007, 22:34   
Quote:

Quote:

Yeah, I could use them, but this routine belongs to a lib I am doing while I work on the main program. And I don't think it is good for a "general" routine to use exx. If so, every "general" routine should use them and main programs should never.

Documentation is the key here. You're also using the normal registers - all of them, apparently. Does that imply that main programs should never do that? No, it means that if the main program uses the registers, it has the responsibility to save their values somewhere - e.g. on the stack - before calling your lib function, and restore them afterwards. The same holds for the alternative register set: if the main program uses it, it will have the responsibility to save the contents.
Your lib documentation will just note that this particular routine uses the alternative registers and you're done



But, IMHO, saving all registers and the alternate ones would need so many push'es and pop's that it is not worth it. I prefer to save exx registers to routines that have any sort of (semi-)parallel processing.

Also, I couldn't agree more with Edwin. This routine mine, I can't switch actual bc, de and hl values, because they all need to be used. It would be very tricky to use exx all the time and correctly.

Quote:

But that's just my 2cts... (Plus: who else is going to use that lib and which other program than the one you're currently working on uses this lib? )



Probably, none after me is going to use it. But when it is done, I will share it on internet . And no other program uses it, but the intention is that my next projects will rely on them.
AuroraMSX

msx master
Mensajes: 1277
Publicado: Abril 23 2007, 22:13   
Quote:

In my experience, exx is rarely a solution for the problem because you lose the current values of bc, de, hl as well. Which you don't really want because you were out of registers for a reason.

Good point. On the other hand, if you just want some register space for an extra loop counter, exx may still be an option. It's probably just me, but using undocumented instructions grates my nerves a bit

wolf_

msx legend
Mensajes: 4827
Publicado: Abril 23 2007, 22:22   
short message of unimportance: Chardson's post was a quote-mess.. Plz do read what you post within the edit-time. Now and then some oddness flips through that wouldn't have been there if we all check what we post. Tnx!
AuroraMSX

msx master
Mensajes: 1277
Publicado: Abril 23 2007, 22:29   
Quote:

short message of unimportance: Chardson's post is a quote-mess..

but now it's all correct-mess eh... correctness, thanx to wolfness
 
Ir a la página ( Página anterior 1 | 2 )
 







(c) 1994 - 2009 Fundación MSX Resource Center. MSX es una marca registrada de MSX Licensing Corporation