🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: rec.games.programmer
Article #411

need help with assembly code, etc.

#411
From: Greg Bonney
Date: Tue, 04 Aug 1992 21:44
23 lines
1375 bytes
M. Abrash's assembly code for doing fixed-point multiplies contains the
following lines:

	mov	eax,[bp+M1]
	imul	dword ptr [bp+M2] ;multiply
	add	eax,8000h	;round by adding 2^(-16)
	adc	edx,0		;whole part of result is in DX
	shr	eax,16		;put the fractional part in AX

Okay, the first line puts the argument M1 into eax (a 32 bit register),
the second line multiplies M2 by what's in eax.  Now, where does the result
of the imul end up?  How does the adc (add with carry) work?  Is the
final result in eax?

Okay, now that we've got that out of the way, I've noticed that the Turbo C++
BASM (built-in assembler) doesn't support 386 instructions, but I don't have
TASM (Turbo Assembler).  I've noticed there are some public-domain assemblers
(one called A86).  Do any of them support 386?  Will any of them link with
Turbo C++?  (I've heard that Borland and Microsoft object files are
incompatible.)

Finally, could this be implemented reasonably in C++ instead of Assembly?
How much speed would you lose?
Technical Details
Message-ID: <1992Aug4.214421.5075@esds.mdc.com>
Path: arc1-ca.pugleaf.net!sparky!uunet!gumby!wupost!esds!bonney

Show Full Headers
Complete Article Headers
Newsgroups: rec.games.programmer
Path: arc1-ca.pugleaf.net!sparky!uunet!gumby!wupost!esds!bonney
From: bonney@esds.mdc.com (Greg Bonney)
Subject: need help with assembly code, etc.
Message-ID: <1992Aug4.214421.5075@esds.mdc.com>
Keywords: assembly, fixed-point, graphics
Organization: Visual Simulation Systems
Date: Tue, 4 Aug 1992 21:44:21 GMT
Lines: 23