.include "demo.equ" /*---------------------------------------------------------- * vmap: Vertical texture map * * void vmap(*struct) *---------------------------------------------------------- * Int16 sx, // x position on screen * Int16 sy, // y position on screen * Int16 count, // pixels to write in column * Uint32 *colormap, // colormap address * Uint32 *source, // offset in source * Fixed32 frac, // pointer to source bitmap * Fixed32 fracStep, // step to next pixel in source * * Register Usage: * -------------- * r0: source * r1: dest * r2: frac * r3: frac (integer) * r4: mask * r5: fracStep * r6: count * r7: SCREEN_WIDTH * r8: colormap *---------------------------------------------------------*/ .align 4 .globl _vmap _vmap: mov.l r8, @-r15 ! save registers mov.w @r4+, r5 ! sx mov.w @r4+, r6 ! sy mov.w @(l_SCREEN_WIDTH, pc), r7 mul.l r6, r7 ! (sy * SCREEN_WIDTH) sts macl, r1 add r5, r1 ! (sy * SCREEN_WIDTH) + sx mov.w @r4+, r6 ! count mov.l @r4+, r8 ! colormap mov.l @r4+, r0 ! source mov.l @r4+, r2 ! frac mov.l @r4+, r5 ! fracStep mov #127, r4 ! mask for texture wrap _VM1: mov r2, r3 ! frac shlr16 r3 ! Fixed to Int and r4, r3 ! Texture wraps on 128 mov.l @(r0, r3), r3 ! source[i] add r8, r3 mov.b @r3, r3 ! colormap[ source[i] ] add r5, r2 ! add step mov.b r3, @r1 ! write Pixel dt r6 ! count-- bf.s _VM1 add r7, r1 ! add SCREEN_WIDTH mov.l @r15+, r8 ! restore registers rts nop /*---------------------------------------------------------- * hmap: Horizontal texture map * * void hmap(*struct) *---------------------------------------------------------- * Int16 sx, // x position on screen * Int16 sy, // y position on screen * Int16 count, // pixels to write in column * Uint32 *colormap, // colormap address * Uint32 *source, // offset in source * Fixed32 xfrac, // pointer to source bitmap * Fixed32 xfracStep, // step to next pixel in source * Fixed32 yfrac, // pointer to source bitmap * Fixed32 yfracStep, // step to next pixel in source * * Register Usage: * -------------- * r0: source * r1: dest * r2: xfrac * r3: xfrac (integer) * r4: mask * r5: xfracStep * r6: count * r7: SCREEN_WIDTH * r8: colormap * r9: yfrac * r10: yfrac (integer) * r11: yfracStep *---------------------------------------------------------*/ .align 4 .globl _hmap _hmap: mov.l r8, @-r15 ! save registers mov.l r9, @-r15 mov.l r10, @-r15 mov.l r11, @-r15 mov.w @r4+, r5 ! sx mov.w @r4+, r6 ! sy mov.w @(l_SCREEN_WIDTH, pc), r7 mul.l r6, r7 ! (sy * SCREEN_WIDTH) sts macl, r1 add r5, r1 ! (sy * SCREEN_WIDTH) + sx mov.w @r4+, r6 ! count mov.l @r4+, r8 ! colormap mov.l @r4+, r0 ! source mov.l @r4+, r2 ! xfrac mov.l @r4+, r5 ! xfracStep mov.l @r4+, r9 ! yfrac mov.l @r4+, r11 ! yfracStep mov.w @(l_mask,pc),r4 ! mask for texture wrap _HM1: mov r2, r3 ! xfrac mov r9, r10 ! yfrac shlr8 r10 shlr2 r10 and r4, r10 shlr16 r3 ! Fixed to Int add r10, r3 ! add r5, r2 ! add xstep mov.l @(r0, r3), r3 ! source[i] add r8, r3 ! colormap[ source[i] ] mov.b @r3, r3 add r11, r10 ! add ystep mov.b r3, @r1 ! write Pixel dt r6 ! count-- bf.s _HM1 add r7, r1 ! add SCREEN_WIDTH mov.l @r15+, r11 ! restore registers mov.l @r15+, r10 mov.l @r15+, r9 mov.l @r15+, r8 .align 4 l_SCREEN_WIDTH: .word SCREEN_WIDTH l_mask: .word (63*64)