From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-1.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from minnie.tuhs.org (minnie.tuhs.org [45.79.103.53]) by inbox.vuxu.org (OpenSMTPD) with ESMTP id 0fb38da3 for ; Tue, 23 Apr 2019 23:13:40 +0000 (UTC) Received: by minnie.tuhs.org (Postfix, from userid 112) id EFD1C94916; Wed, 24 Apr 2019 09:13:38 +1000 (AEST) Received: from minnie.tuhs.org (localhost [127.0.0.1]) by minnie.tuhs.org (Postfix) with ESMTP id BDA6C948F0; Wed, 24 Apr 2019 09:13:02 +1000 (AEST) Authentication-Results: minnie.tuhs.org; dkim=pass (2048-bit key; unprotected) header.d=papnet.eu header.i=@papnet.eu header.b="firamuVO"; dkim=pass (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="tWtfMehQ"; dkim-atps=neutral Received: by minnie.tuhs.org (Postfix, from userid 112) id CFDEE948EE; Wed, 24 Apr 2019 09:12:59 +1000 (AEST) Received: from out4-smtp.messagingengine.com (out4-smtp.messagingengine.com [66.111.4.28]) by minnie.tuhs.org (Postfix) with ESMTPS id 0D370948EC for ; Wed, 24 Apr 2019 09:12:59 +1000 (AEST) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 617EA22196; Tue, 23 Apr 2019 19:12:58 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute1.internal (MEProxy); Tue, 23 Apr 2019 19:12:58 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=papnet.eu; h= date:from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; s=fm1; bh=hVL8IbYQMEYKI/jeQ8NOl38ye7I YTUuZpIP2wd5/TKI=; b=firamuVO20VE23juuQlfXcGyW8ca42PrTlY9yn/B2m0 TmA4mQlXb80P0iFuqpVh3rA8dL82vE5aLwr0vNT6y9HfRsMbUi5TWrKqJv9i5wdL gNW0c5LBBFPyfxjwRNPqbLMUq86DqcFtQKn8iajtXnP45c0Od5ptV+EEPwuqxQAk T7xmCKJ4hSVu5Yict+UL7JIR9WgNw4EY/B2bl/SLIcPzyivuV0zMb+DHI4Rq9Uyb Gu1b3WXuEot9zUcje5E229gXKHQJsnyA2hN8lVtdFA71dbI4KfD/U6iMbeHJSrYg edT62Z/WuFBGfJwQDyprbPqDWc3joN4RF6pR9NIqDtQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=hVL8Ib YQMEYKI/jeQ8NOl38ye7IYTUuZpIP2wd5/TKI=; b=tWtfMehQ9aFLWbV0LlTVM2 XDacoxBkLJ4ObtbZNYne3BUPKBCgIh/MV11XmphBc4huoZeKTuSexCPrSnfD6EtB SpnS6sZWg3DNDWFgN031XYx1uphDQSQSCbH0+RcKIQ09WowLmsDlFjlp2265WTg2 4CxOj3fEr6aRV6a/gkKIm1lFhlOHq7Qi9dXWx+UJjrobhZaoOSh8RBbYeAlz1wl0 yo6+O3Ig5oOZdPu2v85BSk9Q11IStZ7qtf/XK6wmDLLYoRb+CPeJ7LtODE2j4vLf fUagkmBHpylhKk1ompYX2ZZKLcrIwfLOyNZZkp4198pf64EBAwf9Y7hXD52XG0MQ == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduuddrgeelgddukecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpeffhffvuffkfhggtggujggfsehttdertddtredvnecuhfhrohhmpeetnhhgvghl ohcurfgrphgvnhhhohhffhcuoegrrghpsehprghpnhgvthdrvghuqeenucffohhmrghinh epghhithhhuhgsrdgtohhmnecukfhppeejjedruddurddujeelrdduiedvnecurfgrrhgr mhepmhgrihhlfhhrohhmpegrrghpsehprghpnhgvthdrvghunecuvehluhhsthgvrhfuih iivgeptd X-ME-Proxy: Received: from indra.papnet.eu (x4d0bb3a2.dyn.telefonica.de [77.11.179.162]) by mail.messagingengine.com (Postfix) with ESMTPA id 5BCFF10316; Tue, 23 Apr 2019 19:12:57 -0400 (EDT) Date: Wed, 24 Apr 2019 01:12:55 +0200 From: Angelo Papenhoff To: Robert Swierczek Message-ID: <20190423231255.GA91890@indra.papnet.eu> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.6.0 (2016-04-01) Subject: Re: [TUHS] New project to recreate the B compiler for the PDP-11 X-BeenThere: tuhs@minnie.tuhs.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: The Unix Heritage Society mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: TUHS main list Errors-To: tuhs-bounces@minnie.tuhs.org Sender: "TUHS" Forgot to mention something on my site but I think I should bring it up on the list anyway because I think it's a very neat hack (by dmr, as scj told me): B expects word addresses but the linker can't generate those on a byte addressed machine. So all addresses have to be patched before calling main at runtime. How can you do that if you link multiple files? You will notice that the disassembled B files printn.s and printf.s start with 'jmp 9f' and end with 'jsr r5,chain; 0' Unfortunately we don't have the chain function but the way this must work is the B runtime falls off into the first B object file, which jumps to the end, calls a function to patch all addresses in the current file, and falls off at the end itself into the next file. The last file in the link has to be a B runtime file as well to end the chain. Note that this doesn't work with printn and printf because they're inside bilib, but they have no addresses that need patching anyway, guess you have to be careful. aap On 23/04/19, Robert Swierczek wrote: > I just started a project to recreate the B compiler for the PDP-11 as > authentically as possible, given the few fragments that remain and > some educated guesswork. It should be fun (for various definitions of > fun). > > Here is the repository https://github.com/rswier/pdp11-B > > I have borrowed some tools from Warren's > https://github.com/DoctorWkt/unix-jun72 > > I have made a good start at reverse engineering the B run time library > in /usr/lib/libb.a. I have tried to make the source match the same > style as the earliest C library found on the last1120c-bits tape. The > remaining functions in libb.a include printf and printn which appear > to be written in B. This should provide more clues needed to create > the compiler. > > I am also tackling the dis-assembly of the threaded code interpreter > /usr/lib/bilib.a (which at the moment is a big mess on my hard-drive) > > Later steps will include creating the B compiler itself by carefully > pruning down the last1120c C compiler. The fun here will be to > boot-strap the B compiler without help from any existing modern > compilers. I think TMG will come into play to make that happen. > > All are welcome to contribute! > > Rob