bsp; ; bp = Y * SIN(xang) + Z * COS(xang) / 256
mov [Zt],bp
mov ax,[Yt] ; Switch values
mov [Y],ax
mov ax,[Zt]
mov [Z],ax
; Rotate around y-axis
; XT = X * COS(yang) - Z * SIN(yang) / 256
; ZT = X * SIN(yang) + Z * COS(yang) / 256
; X = XT
; Z = ZT
mov ax,[X]
mov bx,[YCos]
imul bx ; ax = X * Cos(yang)
mov bp,ax
mov ax,[Z]
mov bx,[YSin]
imul bx ; ax = Z * Sin(yang)
sub bp,ax ; bp = X * Cos(yang) - Z * Sin(yang)
sar bp,8 ; bp = X * Cos(yang) - Z * Sin(yang) / 256
mov [Xt],bp
mov ax,[X]
mov bx,[YSin]
imul bx ; ax = X * Sin(yang)
mov bp,ax
mov ax,[Z]
mov bx,[YCos]
imul bx ; ax = Z * Cos(yang)
add bp,ax ; bp = X * SIN(yang) + Z * COS(yang)
sar bp,8 ; bp = X * SIN(yang) + Z * COS(yang) / 256
mov [Zt],bp
mov ax,[Xt] ; Switch values
mov [X],ax
mov ax,[Zt]