Skip to content

Instantly share code, notes, and snippets.

@emoon
Created July 31, 2014 12:36
Show Gist options
  • Save emoon/cd70dbaceef304c2229e to your computer and use it in GitHub Desktop.
Save emoon/cd70dbaceef304c2229e to your computer and use it in GitHub Desktop.
(defun-68k integer-rotate-verts (input :reg a0
output :reg a1
matrix :reg a2 as MatrixInt
count :reg d7)
(loop dec count
(move.w (++ input) x)
(move.w (++ input) y)
(move.w (++ input) z)
(move.l x temp_x)
(move.l y temp_y)
(move.l z temp_z)
; Rotate Z
(muls.w (matrix :row2-x) x)
(muls.w (matrix :row2-y) y)
(muls.w (matrix :row2-z) z)
(add.l x z)
(add.l y z)
(add.w (matrix :trans-z) z)
(move.l z rot_z)
; Rotate Y
(move.l temp_x x)
(move.l temp_y y)
(move.l temp_y z)
(muls.w (matrix :row1-x) x)
(muls.w (matrix :row1-y) y)
(muls.w (matrix :row1-z) z)
(add.l x y)
(add.l z y)
(add.w (matrix :trans-y) y)
(move.l y temp_y)
; Rotate X
(move.l temp_x x)
(move.l temp_y y)
(move.l temp_y z)
(muls.w (matrix :row0-x) x)
(muls.w (matrix :row0-y) y)
(muls.w (matrix :row0-z) z)
(add.l z x)
(add.l y x)
(add.w (matrix :trans-x) x)
(move.l x temp_x)
(divs.l rot_z temp_x)
(divs.l rot_z temp_y)
(add.l 160 temp_x)
(add.l 100 temp_y)
(move.w temp_y (++ output))
(move.w temp_z (++ output)))
(rts))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment