l GetSinCos
mov [Zsin],ax
mov [Zcos],bx
ret
ENDP SetRotation
PROC RotatePoint ; Rotates the point around x,y,z
; Gets original x,y,z values
; This can be done elsewhere
movsx ax,[Cube+si] ; si = X (movsx coz of byte)
mov [X],ax
movsx ax,[Cube+si+1] ; si+1 = Y
mov [Y],ax
movsx ax,[Cube+si+2] ; si+2 = Z
mov [Z],ax
; Rotate around x-axis
; YT = Y * COS(xang) - Z * SIN(xang) / 256
; ZT = Y * SIN(xang) + Z * COS(xang) / 256
; Y = YT
; Z = ZT
mov ax,[Y]
mov bx,[XCos]
imul bx ; ax = Y * Cos(xang)
mov bp,ax
mov ax,[Z]
mov bx,[XSin]
imul bx ; ax = Z * Sin(xang)
sub bp,ax ; bp = Y * Cos(xang) - Z * Sin(xang)
sar bp,8 ; bp = Y * Cos(xang) - Z * Sin(xang) / 256
mov [Yt],bp
mov ax,[Y]
mov bx,[XSin]
imul bx ; ax = Y * Sin(xang)
mov bp,ax
mov ax,[Z]
mov bx,[XCos]
imul bx ; ax = Z * Cos(xang)
add bp,ax ; bp = Y * SIN(xang) + Z * COS(xang)
sar bp,8 &n