/*---------------------------------------------------------------------- * File Name: mat.s * * Copyright (c) 1994 Sega of America, Inc. All Rights Reserved. * * Author(s): jef * Date: 5-10-94 * Description: Matrix routines * * History: * *---------------------------------------------------------------------*/ /*------------------------------------------------------------------------ * * NAME : coordTrans * * PARAMETERS * param1 - The source coordinate to be transformed * param2 - The result of coordinate transformation * * DESCRIPTION * * | Xn | | M00, M01, M02, M03 | | Xa | | M00Xa+M01Ya+M02Za+M03 | * | Yn | = | M10, M11, M12, M13 |.| Ya | = | M10Xa+M11Ya+M12Za+M13 | * | Zn | | M20, M21, M22, M23 | | Za | | M20Xa+M21Ya+M22Za+M23 | * | 1 | | 0, 0, 0, 1 | | 1 | | 1 | * * void coordTrans(Matrix *ctm, XYZ *src, XYZ *ans) *------------------------------------------------------------------------*/ .align 4 .globl _coordTrans _coordTrans: clrmac mov r5, r3 mac.l @r4+, @r3+ !+ M00 * X mac.l @r4+, @r3+ !+ M01 * Y mac.l @r4+, @r3+ !+ M02 * Z sts macl, r0 sts mach, r1 xtrct r1, r0 mov.l @r4+, r2 add r2, r0 !+ M03 mov.l r0, @r6 != Xn add #4, r6 clrmac mov r5, r3 mac.l @r4+, @r3+ !M10 * X mac.l @r4+, @r3+ !M11 * Y mac.l @r4+, @r3+ !M12 * Z sts macl, r0 sts mach, r1 xtrct r1, r0 mov.l @r4+, r2 add r2, r0 !+ M13 mov.l r0, @r6 != Yn add #4, r6 clrmac mov r5, r3 mac.l @r4+, @r3+ !M20 * X mac.l @r4+, @r3+ !M21 * Y mac.l @r4+, @r3+ !M22 * Z sts macl, r0 sts mach, r1 xtrct r1, r0 mov.l @r4, r2 add r2, r0 !+ M23 rts mov.l r0, @r6 != Zn /*------------------------------------------------------------------------ * * NAME : normalTrans * * PARAMETERS * param1 - The source normal vector to be transformed * param2 - The result of normal vector transformation * * DESCRIPTION * * | Xn | | M00, M01, M02 | | Xa | | M00Xa+M01Ya+M02Za | * | Yn | = | M10, M11, M12 |.| Ya | = | M10Xa+M11Ya+M12Za | * | Zn | | M20, M21, M22 | | Za | | M20Xa+M21Ya+M22Za | * * void normalTrans(Matrix *ctm, XYZ *src, XYZ *ans) *------------------------------------------------------------------------*/ .globl _normalTrans _normalTrans: clrmac mov r5, r3 mac.l @r4+, @r3+ ! + M00 * X mac.l @r4+, @r3+ ! + M01 * Y mac.l @r4+, @r3+ ! + M02 * Z sts macl, r0 sts mach, r1 xtrct r1, r0 add #4, r4 mov.l r0, @r6 != Xn add #4, r6 clrmac mov r5, r3 mac.l @r4+, @r3+ ! M10 * X mac.l @r4+, @r3+ ! M11 * Y mac.l @r4+, @r3+ ! M12 * Z sts macl, r0 sts mach, r1 xtrct r1, r0 add #4, r4 mov.l r0, @r6 != Yn add #4, r6 clrmac mov r5, r3 mac.l @r4+, @r3+ ! M20 * X mac.l @r4+, @r3+ ! M21 * Y mac.l @r4+, @r3+ ! M22 * Z sts macl, r0 sts mach, r1 xtrct r1, r0 rts mov.l r0, @r6 != Zn