Skip to content

Commit

Permalink
Fix uvmap registers save/restore (backported from be7b858)
Browse files Browse the repository at this point in the history
  • Loading branch information
cahirwpz committed Dec 16, 2023
1 parent 272beee commit a464886
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
4 changes: 2 additions & 2 deletions effects/uvmap/mainloop.asm
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ group macro ; cpu/bus cycles
or.b $4444(a2),\1 ; 12/3
endm

movem.w d2-d7,-(sp)
movem.l d2-d7,-(sp)

group d0
group d1
Expand All @@ -20,4 +20,4 @@ group macro ; cpu/bus cycles
movem.w d0-d7,-(a0) ; 8+4*8/8
; 13.25/3.25 per pixel

movem.w (sp)+,d2-d7
movem.l (sp)+,d2-d7
4 changes: 2 additions & 2 deletions effects/uvmap/uvmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ static void MakeUVMapRenderCode(void) {
* [a b c d e f g h] => [a b e f c d g h] */
short n = WIDTH * HEIGHT / 32;

*code++ = 0x48a7; *code++ = 0x3f00; /* movem.w d2-d7,-(sp) */
*code++ = 0x48e7; *code++ = 0x3f00; /* movem.l d2-d7,-(sp) */

while (n--) {
short m;
Expand All @@ -87,7 +87,7 @@ static void MakeUVMapRenderCode(void) {
*code++ = 0x48a0; *code++ = 0xff00; /* d0-d7,-(a0) */
}

*code++ = 0x4c9f; *code++ = 0x00fc; /* movem.w (sp)+,d2-d7 */
*code++ = 0x4cdf; *code++ = 0x00fc; /* movem.l (sp)+,d2-d7 */
*code++ = 0x4e75; /* rts */
}

Expand Down
7 changes: 4 additions & 3 deletions tools/pylib/uvmap.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,11 @@ def save(self, name, fn=None, scale=256):
print(' %s,' % ', '.join(row))
print('};')

def save_uv(self, name):
def save_uv(self, name, scale=256):
size = self.texsize
im = Image.new('L', (self.width, self.height))
im.putdata([frpart(u) * 256 for u in self.umap])
im.putdata([int(frpart(u) * scale) % size for u in self.umap])
im.save(name + '-u.png', 'PNG')
im = Image.new('L', (self.width, self.height))
im.putdata([frpart(v) * 256 for v in self.vmap])
im.putdata([int(frpart(v) * scale) % size for v in self.vmap])
im.save(name + '-v.png', 'PNG')

0 comments on commit a464886

Please sign in to comment.