The Unix Heritage Society mailing list
 help / color / mirror / Atom feed
* [TUHS] pdp-11 assembly as a hll?
@ 2018-02-14  1:08 Warner Losh
  2018-02-14  3:18 ` Dave Horsfall
  2018-02-14 16:03 ` Paul Winalski
  0 siblings, 2 replies; 10+ messages in thread
From: Warner Losh @ 2018-02-14  1:08 UTC (permalink / raw)


I don't suppose anybody has written a pdp-11 assembler to C translator...
My google fu is insufficient for the day.

Warner
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://minnie.tuhs.org/pipermail/tuhs/attachments/20180213/594d49ba/attachment.html>


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [TUHS] pdp-11 assembly as a hll?
  2018-02-14  1:08 [TUHS] pdp-11 assembly as a hll? Warner Losh
@ 2018-02-14  3:18 ` Dave Horsfall
  2018-02-14  5:12   ` Warner Losh
  2018-02-14  7:28   ` Ian Zimmerman
  2018-02-14 16:03 ` Paul Winalski
  1 sibling, 2 replies; 10+ messages in thread
From: Dave Horsfall @ 2018-02-14  3:18 UTC (permalink / raw)


On Tue, 13 Feb 2018, Warner Losh wrote:

> I don't suppose anybody has written a pdp-11 assembler to C 
> translator... My google fu is insufficient for the day.

I'd like to see it handle "JSR PC,@(SP)+"...  Are you reverse-engineering 
something, writing a PDP-11 simulator, or what?

-- 
Dave Horsfall DTM (VK2KFU)  "Those who don't understand security will suffer."


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [TUHS] pdp-11 assembly as a hll?
  2018-02-14  3:18 ` Dave Horsfall
@ 2018-02-14  5:12   ` Warner Losh
  2018-02-14  6:43     ` Dave Horsfall
  2018-02-14  7:27     ` Bakul Shah
  2018-02-14  7:28   ` Ian Zimmerman
  1 sibling, 2 replies; 10+ messages in thread
From: Warner Losh @ 2018-02-14  5:12 UTC (permalink / raw)


On Tue, Feb 13, 2018 at 8:18 PM, Dave Horsfall <dave at horsfall.org> wrote:

> On Tue, 13 Feb 2018, Warner Losh wrote:
>
> I don't suppose anybody has written a pdp-11 assembler to C translator...
>> My google fu is insufficient for the day.
>>
>
> I'd like to see it handle "JSR PC,@(SP)+"...  Are you reverse-engineering
> something, writing a PDP-11 simulator, or what?


I was wondering what it would take to convert the v6/v7 basic program into
something that can be run today.

http://www.tuhs.org/cgi-bin/utree.pl?file=V6/usr/source/s1/bas.s
or
http://www.tuhs.org/cgi-bin/utree.pl?file=V7/usr/src/cmd/bas/bas.s

Its 2128 lines. It doesn't have that fun instruction in it :)

Warner
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://minnie.tuhs.org/pipermail/tuhs/attachments/20180213/6ba627f7/attachment.html>


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [TUHS] pdp-11 assembly as a hll?
  2018-02-14  5:12   ` Warner Losh
@ 2018-02-14  6:43     ` Dave Horsfall
  2018-02-14  7:27     ` Bakul Shah
  1 sibling, 0 replies; 10+ messages in thread
From: Dave Horsfall @ 2018-02-14  6:43 UTC (permalink / raw)


On Tue, 13 Feb 2018, Warner Losh wrote:

> I was wondering what it would take to convert the v6/v7 basic program 
> into something that can be run today.

Hmmm...  If it were C-generated then it would be (somewhat) easy, but it's 
hand-written and hand-optimised...  You'd have to do some functional 
analysis on it e.g. what does this routine do, etc.

> Its 2128 lines. It doesn't have that fun instruction in it :)

I know!  Say ~2,000 lines, say ~100 people on this list, distributed 
computing to the rescue!  That's only 20 lines each, so it ought to be a 
piece of cake :-)

-- 
Dave Horsfall DTM (VK2KFU)  "Those who don't understand security will suffer."


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [TUHS] pdp-11 assembly as a hll?
  2018-02-14  5:12   ` Warner Losh
  2018-02-14  6:43     ` Dave Horsfall
@ 2018-02-14  7:27     ` Bakul Shah
  1 sibling, 0 replies; 10+ messages in thread
From: Bakul Shah @ 2018-02-14  7:27 UTC (permalink / raw)


On Tue, 13 Feb 2018 22:12:50 -0700 Warner Losh <imp at bsdimp.com> wrote:
> 
> On Tue, Feb 13, 2018 at 8:18 PM, Dave Horsfall <dave at horsfall.org> wrote:
> 
> > On Tue, 13 Feb 2018, Warner Losh wrote:
> >
> > I don't suppose anybody has written a pdp-11 assembler to C translator...
> >> My google fu is insufficient for the day.
> >>
> >
> > I'd like to see it handle "JSR PC,@(SP)+"...  Are you reverse-engineering
> > something, writing a PDP-11 simulator, or what?
> 
> 
> I was wondering what it would take to convert the v6/v7 basic program into
> something that can be run today.
> 
> http://www.tuhs.org/cgi-bin/utree.pl?file=V6/usr/source/s1/bas.s
> or
> http://www.tuhs.org/cgi-bin/utree.pl?file=V7/usr/src/cmd/bas/bas.s
> 
> Its 2128 lines. It doesn't have that fun instruction in it :)

May be it just needs a perl script to generate C code?

Example:
2:				label(lab0);
	cmp	r0,(r3)		cmp(r0,deref(r3));
	beq	2f		beq(lab1);
	tst	(r3)	  =>	tst(deref(r3));
	beq	2f		beq(lab1);
	add	$6,r3		add(6,r3);
	br	2b		br(lab0);
2:				label(lab1);

C calls are to macros or inline functions.


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [TUHS] pdp-11 assembly as a hll?
  2018-02-14  3:18 ` Dave Horsfall
  2018-02-14  5:12   ` Warner Losh
@ 2018-02-14  7:28   ` Ian Zimmerman
  1 sibling, 0 replies; 10+ messages in thread
From: Ian Zimmerman @ 2018-02-14  7:28 UTC (permalink / raw)


On 2018-02-14 14:18, Dave Horsfall wrote:

> I'd like to see it handle "JSR PC,@(SP)+"...  

BTW, isn't that precisely the "retpoline" that we've seen in the news
recently ?

-- 
Please don't Cc: me privately on mailing lists and Usenet,
if you also post the followup to the list or newsgroup.
To reply privately _only_ on Usenet and on broken lists
which rewrite From, fetch the TXT record for no-use.mooo.com.


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [TUHS] pdp-11 assembly as a hll?
  2018-02-14  1:08 [TUHS] pdp-11 assembly as a hll? Warner Losh
  2018-02-14  3:18 ` Dave Horsfall
@ 2018-02-14 16:03 ` Paul Winalski
  2018-02-14 16:56   ` Warner Losh
  1 sibling, 1 reply; 10+ messages in thread
From: Paul Winalski @ 2018-02-14 16:03 UTC (permalink / raw)


On 2/13/18, Warner Losh <imp at bsdimp.com> wrote:
> I don't suppose anybody has written a pdp-11 assembler to C translator...
> My google fu is insufficient for the day.
>
Or you could write a compiler that translates PDP-11 assembler to LLVM
intermediate language.  That was the technique used to port VMS to the
DEC Alpha and Intel Itanium.  A lot of VMS was in VAX assembler, so
DEC's compiler group wrote a compiler that took in VAX assembler and
generated IL for the GEM back end used by all of DEC's Alpha and
Itanium compilers.

-Paul W.


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [TUHS] pdp-11 assembly as a hll?
  2018-02-14 16:03 ` Paul Winalski
@ 2018-02-14 16:56   ` Warner Losh
  0 siblings, 0 replies; 10+ messages in thread
From: Warner Losh @ 2018-02-14 16:56 UTC (permalink / raw)


On Wed, Feb 14, 2018 at 9:03 AM, Paul Winalski <paul.winalski at gmail.com>
wrote:

> On 2/13/18, Warner Losh <imp at bsdimp.com> wrote:
> > I don't suppose anybody has written a pdp-11 assembler to C translator...
> > My google fu is insufficient for the day.
> >
> Or you could write a compiler that translates PDP-11 assembler to LLVM
> intermediate language.  That was the technique used to port VMS to the
> DEC Alpha and Intel Itanium.  A lot of VMS was in VAX assembler, so
> DEC's compiler group wrote a compiler that took in VAX assembler and
> generated IL for the GEM back end used by all of DEC's Alpha and
> Itanium compilers.
>

Yea, I was kinda hoping someone else had already done the translation for
basic. But it actually looks to be from v5, using the v5 calling
conventions and library routines now that I have had a chance to study it.

Warner
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://minnie.tuhs.org/pipermail/tuhs/attachments/20180214/c8463928/attachment.html>


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [TUHS] pdp-11 assembly as a hll?
@ 2018-02-14 13:15 Noel Chiappa
  0 siblings, 0 replies; 10+ messages in thread
From: Noel Chiappa @ 2018-02-14 13:15 UTC (permalink / raw)


    > From: Dave Horsfall <dave at horsfall.org>

    > I'd like to see it handle "JSR PC,@(SP)+"...

Heh!

But that does point out that the general concept is kind of confused - at
least, if you hope to get a fully working program out the far end. The only
way to do that is build (effectively) a simulator, one that _exactly_
re-creates the effects on the memory and registers of the original program.
Only instead of reading binary machine code, this one's going to read in the
machine language source, and produce a custom simulator, one that can run only
one program - the one fed into it.

Think of it as a 'simulator compiler'! :-)

      Noel


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [TUHS] pdp-11 assembly as a hll?
@ 2018-02-14  8:41 Paul Ruizendaal
  0 siblings, 0 replies; 10+ messages in thread
From: Paul Ruizendaal @ 2018-02-14  8:41 UTC (permalink / raw)



>> I was wondering what it would take to convert the v6/v7 basic program 
>> into something that can be run today.
> 
> Hmmm...  If it were C-generated then it would be (somewhat) easy, but it's 
> hand-written and hand-optimised...  You'd have to do some functional 
> analysis on it e.g. what does this routine do, etc.
> 
>> Its 2128 lines. It doesn't have that fun instruction in it :)
> 
> I know!  Say ~2,000 lines, say ~100 people on this list, distributed 
> computing to the rescue!  That's only 20 lines each, so it ought to be a 
> piece of cake :-)

I'm up for that! However, only if the resulting C program can be compiled/run
on a V6/PDP11 again.

Let's assume that reverse engineering a subroutine of 20 lines takes
an hour. That then makes for 100 hours. If 10 people participate and
contribute one hour/routine per week, it will be done by May.

However, the initial analysis of the code architecture is a (time) hurdle.

Paul

PS: the Fortran66 of V6 is also assembler only...



^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2018-02-14 16:56 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-14  1:08 [TUHS] pdp-11 assembly as a hll? Warner Losh
2018-02-14  3:18 ` Dave Horsfall
2018-02-14  5:12   ` Warner Losh
2018-02-14  6:43     ` Dave Horsfall
2018-02-14  7:27     ` Bakul Shah
2018-02-14  7:28   ` Ian Zimmerman
2018-02-14 16:03 ` Paul Winalski
2018-02-14 16:56   ` Warner Losh
2018-02-14  8:41 Paul Ruizendaal
2018-02-14 13:15 Noel Chiappa

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).