Fastest possible multiplication routine? (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 47 invitados y 1 miembro en línea

Eres un usuario anónimo.
 

Foros MSX


Foros MSX

Development - Fastest possible multiplication routine?

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

Fastest possible multiplication routine?

dvik
msx master
Mensajes: 1376
Publicado: Mayo 05 2007, 11:15   
I'll send you the version I did earlier. Its not complete but I think I can make it complete based on your version. I started doing a similar routine but didn't finish all cases. I tested numbers 0<L<48 and the routine I made is about 13% faster. Not sure how much bigger the code would be but probably 4-6 times as big or something (I don't do fallthroughs).

But if you want really fast and have a lot of memory you can do a single table lookup. I was actually considering that for the app I was writing.

Would be interesting to know what multiplication routine (if any) alone coder used in his speccy port of wolfenstein.
Prodatron
msx master
Mensajes: 1113
Publicado: Mayo 05 2007, 11:39   
Ok, I am looking forward to it
Regarding the lookup table: Maybe I missunderstood the way, you want to do it, but wouldn't it have a size of 256*65536 bytes?
I use only lookup-tables for the division-part: X will be converted into 1/X, so I can realize formulars like A=X*Y/Z without divisons but two multiplications.
Btw, the bit-shifting instructions may add some optimization. The problem with them is, that you will loose the possibility to have 16bit results. Ok, if you don't need it, it's better to use them... Not easy to have ONE best routine
AuroraMSX

msx master
Mensajes: 1277
Publicado: Mayo 05 2007, 12:23   
Have a look at the MAP
NYYRIKKI
msx master
Mensajes: 1533
Publicado: Mayo 05 2007, 12:37   
Very interesting multiplication routine can be found also here:
http://www.mccw.hetlab.tk/92/Multiplication/en.html

NYYRIKKI
msx master
Mensajes: 1533
Publicado: Mayo 05 2007, 12:53   
Quote:

how much faster the R800 does with its inbuilt MUL-commands?


MULUB takes 14 cycles
MULUW takes 36 cycles

More information: http://www.msxtop.msxall.com/Docs/Z80R800GuideBrochure.pdf
GhostwriterP
msx addict
Mensajes: 320
Publicado: Mayo 05 2007, 12:55   
Not to mention that those add hl,hl's and such are also much faster on r800.
Prodatron
msx master
Mensajes: 1113
Publicado: Mayo 05 2007, 14:13   
Quote:

Very interesting multiplication routine can be found also here:
http://www.mccw.hetlab.tk/92/Multiplication/en.html



Ah, now I got it, what you mean with using lookup tables.
In this case you can also have a look at this:
http://www.cpcwiki.com/index.php/Programming:Integer_Multiplication#Fast_8bit_.2A_8bit_Unsigned_.28using_log_.2F_antilog_tables.29
Works even with bigger numbers, but maybe not always exact.
dvik
msx master
Mensajes: 1376
Publicado: Mayo 06 2007, 00:34   
I think the multiplication algorithm to choose depends on the program using it. The table version NYYRIKKI shown is very nice for small numbers -64 to +63, but for bigger numbers it slows down a bit because the lookup math exceeds 8 bits and of course the table grows. But for many cases especially on an MSX with a low resolution, the range is enough. Prodatrons algorithm has a much bigger range one 8 bit value -128 to 127 multiplied with a 16 bit value and its only about 50% slower than the table version.

Btw, one of my IOCCC entries uses the same hyperbolic functions as the table based multiplication algorithm, but in this case to generate prime numbers.
 
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