Je remets le topic au sommet.
Est-ce que ces routines qui marchent avec TIGCC sont les plus rapides possibles, SANS UTILISER DE PRECALCULE ?
// Sensibilité à PortSet.
void FastSetPixPort(short x,short y);
asm("xdef FastSetPixPort
FastSetPixPort:
move.w %d0,-(%sp)
move.w %d1,-(%sp)
pea (%a0)
pea (%a1)
move.w 16(%sp),%d0
move.w 18(%sp),%d1
add.w %d1,%d1
move.w %d1,%a0
lsl.w #4,%d1
sub.w %a0,%d1
move.w %d1,%a0
move.l 0x78C0,%a1
add.l %a1,%a0
move.w %d0,%d1
lsr.w #3,%d0
not.b %d1
bset.b %d1,0(%a0,%d0.w)
move.l (%sp)+,%a1
move.l (%sp)+,%a0
move.w (%sp)+,%d1
move.w (%sp)+,%d0
rts
")
// Plane en tant qu'argument
void FastSetPixPass(void *plane,short x,short y);
asm("xdef FastSetPixPass
FastSetPixPass:
move.w %d0,-(%sp)
move.w %d1,-(%sp)
pea (%a0)
move.w 16(%sp),%d0
move.w 18(%sp),%d1
add.w %d1,%d1
move.w %d1,%a0
lsl.w #4,%d1
sub.w %a0,%d1
move.w %d1,%a0
add.l 12(%sp),%a0
move.w %d0,%d1
lsr.w #3,%d0
not.b %d1
bset.b %d1,0(%a0,%d0.w)
move.l (%sp)+,%a0
move.w (%sp)+,%d1
move.w (%sp)+,%d0
rts
")
// Version grayscale de la routine précédente.
void FastSetGrayPix2B(void *light,void *dark,short x,short y);
asm("xdef FastSetGrayPix2B
FastSetGrayPix2B:
move.w %d0,-(%sp)
move.w %d1,-(%sp)
pea (%a0)
pea (%a1)
pea (%a2)
move.l 20(%sp),%a0
move.l 24(%sp),%a1
move.w 28(%sp),%d0
move.w 30(%sp),%d1
add.w %d1,%d1
move.w %d1,%a2
lsl.w #4,%d1
sub.w %a2,%d1
add.l %d1,%a0
add.l %d1,%a1
move.w %d0,%d1
lsr.w #3,%d0
not.b %d1
bset.b %d1,0(%a0,%d0.w)
move.l (%sp)+,%a2
move.l (%sp)+,%a1
move.l (%sp)+,%a0
move.w (%sp)+,%d1
move.w (%sp)+,%d0
rts
")
Les routines d'inversion, d'effacement et de test de pixel doivent logiquement se déduire de celles-ci en changeant bset en respectivement bchg, bclr et btst.
