Skip to content

Commit a464886

Browse files
committed
Fix uvmap registers save/restore (backported from be7b858)
1 parent 272beee commit a464886

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

effects/uvmap/mainloop.asm

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ group macro ; cpu/bus cycles
77
or.b $4444(a2),\1 ; 12/3
88
endm
99

10-
movem.w d2-d7,-(sp)
10+
movem.l d2-d7,-(sp)
1111

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

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

effects/uvmap/uvmap.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ static void MakeUVMapRenderCode(void) {
6767
* [a b c d e f g h] => [a b e f c d g h] */
6868
short n = WIDTH * HEIGHT / 32;
6969

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

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

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

tools/pylib/uvmap.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -121,10 +121,11 @@ def save(self, name, fn=None, scale=256):
121121
print(' %s,' % ', '.join(row))
122122
print('};')
123123

124-
def save_uv(self, name):
124+
def save_uv(self, name, scale=256):
125+
size = self.texsize
125126
im = Image.new('L', (self.width, self.height))
126-
im.putdata([frpart(u) * 256 for u in self.umap])
127+
im.putdata([int(frpart(u) * scale) % size for u in self.umap])
127128
im.save(name + '-u.png', 'PNG')
128129
im = Image.new('L', (self.width, self.height))
129-
im.putdata([frpart(v) * 256 for v in self.vmap])
130+
im.putdata([int(frpart(v) * scale) % size for v in self.vmap])
130131
im.save(name + '-v.png', 'PNG')

0 commit comments

Comments
 (0)