Newsgroups: alt.folklore.computers
Subject: Re: octal to decimal converter?
From: don@zl2tnm.gen.nz (Don Stokes)
Date: 23 Dec 92 09:13:38 GMT
Distribution: world
Organization: The Wolery

lasner@watsun.cc.columbia.edu (Charles Lasner) writes:
> I know, it's really terrible having to use a 16-bit machine; those extra
> bits really hurt you.

But those extra bits are there to make code possible that wouldn't be
on a smaller address space.  You pays your money and you takes your choice.

> 
> >
> >For a general print routine, I think working storage and constants should
> >be included (after all, it does add to total code size).  It's fair to knock 
> >off the text to be printed though.  Constants should definitely be included;
> >the VAX would come out way ahead on some things if you ditch the 32 bit
> >constants....  
> 
> No, the necessary constants are necessary.  The text itself doesn't serve to
> show anything significant, except that for some machines, the use of a
> non-8-bit format can save some space without resorting to some unusual
> encoding with high overhead.
> 
> >The digits do come out in the right order!  I could have saved a goodly
> >number of bytes if it went out backwards.  Sheesh.  
> 
> No, the strings are in reverse order.
> 
> But, the point is that the reverse deflation method lends itself to multiple
> precision since you merely divide by 10 each time, but create the string in
> reverse order to printout.

In real life, the I/O would be done a line at a time, and the digits copied
to an output buffer in reverse order.  It generalises the routine to handling
other bases as well.
 
> 	*200
> 
> 	JMS	MAGIC
> 	TEXT	"^HELLO ^WORLD!%"

Yeah, I used to use that trick a lot on the 6502.
 
> I won't give any more examples, but you wanted *real* code; the optimizations
> I gave are quite real, not contrived.  However, part of the overhead is in the
> contrivance of not having proper input and output routines.  I believe the
> main "guts" of the code is shorter than yours, and I would include in the
> support routine the *real* routines that would have features like:

Real code will have most of the OS interface stuff lurking in one or two
routines.  If I'm writing in MACRO, they'll be within range of a BSW and
quite often a BSB.  So my example isn't completely unreasonable.  HLL code
on the other hand will use CALLS exclusively for subroutine linkage.

I believe the guts of my routine is smaller than yours; the thing that blew 
it out of proportion was the subroutine calls; a MOV R0, (Rx)+ is three
bytes; a JSB xxxxxxxx is six.

> In any case, the point is made:  with all of its complications, it doesn't
> seem that a VAX can create significantly tighter code thana PDP-8 RISC
> machine.  In some cases, specialized instructions will beat it out, calling
> up a lot of hardware to do it, but even then not by much.  And in some cases
> it's still too clumsy to do as well.

You made the assertion that PDP-8 code was significantly smaller; I believe
I've demonstrated that this isn't necessarily the case.  It _is_ fair to 
say that code on a VAX is not bummed in like PDP-8 code, but on a VAX, *you*
*don't* *need* *to*.  There isn't the kind of address space cram on a VAX
or even PDP-11 that there is on an -8.  Again, the tradeoffs of the '1960s
that the PDP-8 represents were not the same as the tradeoffs of the 1970s 
that produced the VAX.

> Considering how much hardware the VAX is, don't you think the problems
> that can be so solved are better served by multiple PDP-8's that amass to
> the same amount of electronics! :-).

Hmmm -- there's a VAX humming away quietly beside my left knee here, and
a PDP-8 (well, a DECmate III+) right behind me, acting as a terminal to the
VAX....

Physically, the DECmate has two serial ports, character mode video, a 20MB
hard disk and 64kwords (96kbytes) of memory.  There are three circuit boards,
a main board, hard disk controller daughtercard and APU (z80 copro) card.

The VAX has 100MB of disk, a TK50 tape drive, 9 serial ports, 16MB of
memory, 768x1024 bitmapped video, keyboard, mouse and ethernet in eight
boards.  Somehow methinks you're not going to get quite the same grunt
out of the equivalent load of PDP-8s, and they're both of similar vintage
(the VAX is a little older).  OK, it's not quite the same as the 1977 
versions....

But then I could argue that DEC or someone should have built a machine out
of a whole bunch of my favourite 1970s microprocessor, the 6502.  The 6502
could go like a scalded cat if you whispered the right sweet nothings in
its ear.  (In fact, it looks a little like a PDP-8, in that it makes 
extensive use of a zero page, and works best within page boundaries.) 
6502 systems at 2 or 3 MHz could outrun the 4.77 MHz 8088 in the IBM PC
easily.

(And no, I'm not a C64 freak.... apple ][s & BBC machines.....)

Of course DEC did build a VAX out of microprocessors -- the 11/730 (and
11/725, which is the same CPU in a smaller box with a built-in (RC25)
disk drive).  Pull the main CPU board out, and you find eight AM2901 
chips in a bunch.....

--
Don Stokes, ZL2TNM (DS555)                        don@zl2tnm.gen.nz (home)
Network Manager, Computing Services Centre            don@vuw.ac.nz (work)
Victoria University of Wellington, New Zealand              +64-4-495-5052
Xref: sparky alt.folklore.computers:18260 sci.math:17339 comp.compression:4213