		.386p
		ASSUME	CS:CODE
		PUBLIC	AL_Draw_RotPoints

SAT_CX			EQU	0
SAT_CY			EQU	4
SAT_MG			EQU	8
SAT_CPZ			EQU	12
SAT_LX			EQU	16
SAT_LY			EQU	20


QROLLF		MACRO	DR
		PUSH	EAX
		PUSH	EBX
		IMUL	DWORD PTR [DR+4]
		XCHG	EBX,EAX
		MOV	ECX,EDX
		IMUL	DWORD PTR [DR]
		SUB	EBX,EAX
		SBB	ECX,EDX
		SHLD	ECX,EBX,16
		POP	EBX
		POP	EAX

		PUSH	ECX
		IMUL	DWORD PTR [DR]
		XCHG	EBX,EAX
		MOV	ECX,EDX
		IMUL	DWORD PTR [DR+4]
		ADD	EBX,EAX
		ADC	ECX,EDX
		SHRD	EBX,ECX,16
		POP	EAX
		ENDM


CODE		SEGMENT
;AL_Draw_RotPoints(p1,ptr,wdr,ofsx,ofsy,ofsz);
		ALIGN	4
AL_Draw_RotPoints	PROC
#OFSZ		EQU	ESP+40
#OFSY		EQU	ESP+36
#OFSX		EQU	ESP+32
#WDR		EQU	ESP+28
#SRC		EQU	ESP+24
#DST		EQU	ESP+20
#RETADR		EQU	ESP+16
#EBP		EQU	ESP+12
#ESI		EQU	ESP+8
#EDI		EQU	ESP+4
#EBX		EQU	ESP
		PUSH	EBP
		PUSH	ESI
		PUSH	EDI
		PUSH	EBX

		MOV	EBP,[#WDR]

		MOV	ESI,[#SRC]
		MOV	EDI,[#DST]
		MOV	EAX,[ESI]
		MOV	[#SRC],EAX
		MOVSD

		AND	EAX,EAX
		JE	#EXIT

#LOOP0:		MOV	EAX,[ESI]
		MOV	EBX,[ESI+4]
		QROLLF	EBP
		ADD	EAX,[#OFSX]
		ADD	EBX,[#OFSZ]
		MOV	[EDI],EAX
		MOV	[EDI+8],EBX
		MOV	EAX,[#OFSY]
		MOV	[EDI+4],EAX
		LEA	ESI,[ESI+8]
		LEA	EDI,[EDI+12]
		DEC	DWORD PTR [#SRC]
		JNE	#LOOP0

#EXIT:		POP	EBX
		POP	EDI
		POP	ESI
		POP	EBP
		RET
AL_Draw_RotPoints	ENDP
CODE		ENDS
		END
