25Fermer27
chickendudeLe 04/02/2013 à 12:57
Voici ma tentative (38 octets) :; INPUT : ; ix:sprite; b:height; c:width/8 ; OUTPUT : ; ix=flipped sprite ; destroys a, de ; uses saferam3 flip_sprite: push bc push ix pop de ld hl,saferam3 flip_sprite_outer: ;de = original sprite ;hl = buffer push bc ;save b (sprite height) ld b,0 ;bc = width in bytes add hl,bc ;go to very right of first sprite and draw leftward push hl ld b,8 flip_sprite_loop: dec hl ;go left in buffer push bc ;c gets overwritten so we need to save it ld a,(de) ;first byte in a rrca ;rotate a to the right and rotate the carry left into c rl c djnz $-3 ld (hl),c ;save flipped byte inc de ;next byte of sprite pop bc ;c = counter (number of bytes to flip) dec c jr nz,flip_sprite_loop pop hl pop bc ;restore b (height) djnz flip_sprite_outer ld ix,saferam3 pop bc retElle est peut-être plus lente mais je crois que ce ne sera pas un problème smile