Xref: utzoo comp.lang.c++:2207 comp.lang.c:14574 comp.lang.forth:728 comp.lang.fortran:1600 comp.lang.misc:2307
Path: utzoo!utgpu!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!mailrus!ames!pasteur!agate!labrea!decwrl!sun!pitstop!sundc!seismo!uunet!mcvax!cernvax!ethz!pasche
From: pasche@ethz.UUCP (Stephan Pasche)
Newsgroups: comp.lang.c++,comp.lang.c,comp.lang.forth,comp.lang.fortran,comp.lang.misc
Subject: Re: Assembly or ....
Message-ID: <707@ethz.UUCP>
Date: 5 Dec 88 19:15:08 GMT
References: <1388@aucs.UUCP>
Reply-To: pasche@bernina.UUCP (Stephan Paschedag)
Organization: ETH Zuerich, Switzerland
Lines: 32

In article <1388@aucs.UUCP> 861087p@aucs.UUCP (A N D R E A S) writes:
>
>I've been told also that there are some low-level operations
>that you just can't do in C or any other high level language.

for example : I don't know a high-level language where you have control of
	      the CPU status flags. These can be very useful for some 
	      applications. One example is an operation you need for a
	      fft program. There you have to reverse the bitorder of a word.
	      In assembly language there's a very elegant and fast solution :
	      You can shift the source operand via the carry bit into the
	      destination operand. For a 680xx CPU :

		Entry: move.l Source,d0  get source operand
		       moveq #31,d2	 init bit counter for a longword
		Loop:  lsr.l #1,d0	 shift source, one bit goes into x-bit 
		       roxl.l #1,d1      shift bit from x-bit into destination
		       dbra d2,Loop	 loop until last bit is shifted
		       move.l d1,Dest    save result (reverse bit-order) 

	      The x-bit of the 680xx has in this example about the same
	      function as the carry bit of other CPUs.
	      If you want to write the same program in a high-level language
	      you have to work with bit-masks and test operations, which
	      is (compared to the program above) very slow and complicated.

==============================================================================
OS/2 & PS/2 : half an operating system for half a computer
 
Stephan Paschedag           pachedag@strati.ethz.ch  or  pasche@bernina.UUCP
Federal Institute Of Technology Zurich
______________________________________________________________________________