[net.lang] Assembly VS HOL: A

mwm@ucbtopaz.CC.Berkeley.ARPA (05/03/85)

In article <741@mako.UUCP> jans@mako.UUCP (Jan Steinman) writes:
>Here's a short register dump routine. Would others care to demonstrate
>HOL approaches to the problem, preferably in a friendly, non-inflamitory
>manner?

I can't resist :-). The problem is obviously machine-dependent, so here
are solutions for two different architectures, In two different
languages.

First, for DEC mainframes and compatibles, we have a C macro:

#define dump_regs(label) do \
	{static int	*r = (int *) 0; \
	printf("%s\n%8d%8d%8d%8d%8d%8d%8d%8d%8d%8d%8d%8d%8d%8d%8d%8d", \
		 label, r[0], r[1], r[2], r[3], r[4], r[5], r[6], r[7], \
		 	r[010], r[011], r[012], r[013], r[014], r[015], \
		 	r[016], r[017]); \
	} while (0)

Unfortunately, I don't have access to a system to test it on, but it
compiles, and should work.

Now, for any true stack machine, this clu proc will work:

dump_regs = proc (label: string) signals (no_registers)

	signal no_registers
	end dump_regs

And, just to prove that I really am I Unix wizard, I'll note that you
can write a C routine to do exactly what you want on any Unix box, with
"just a small kernel mod" (in C, of course) :-).

The point? You mean I was supposed to have a point? Well, I do. The
entire discussion of HOL vs. asmbumbler is silly. There are problems
that are suited to both. Things that need lots of speed, or need to get
into the nitty-gritty of the hardware should probably be done in
assembler (but may not have to). Things that you want to be portable to
many machines should be done in a HOL.

	Enough,
	<mike