From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, MAILING_LIST_MULTI,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 19270 invoked from network); 12 Jul 2023 18:10:13 -0000 Received: from minnie.tuhs.org (50.116.15.146) by inbox.vuxu.org with ESMTPUTF8; 12 Jul 2023 18:10:13 -0000 Received: from minnie.tuhs.org (localhost [IPv6:::1]) by minnie.tuhs.org (Postfix) with ESMTP id F0E7442A40; Thu, 13 Jul 2023 04:10:06 +1000 (AEST) Received: from out3-smtp.messagingengine.com (out3-smtp.messagingengine.com [66.111.4.27]) by minnie.tuhs.org (Postfix) with ESMTPS id AD0EF42A1F for ; Thu, 13 Jul 2023 04:09:50 +1000 (AEST) Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id 958E95C0181 for ; Wed, 12 Jul 2023 14:09:49 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Wed, 12 Jul 2023 14:09:49 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=papnet.eu; h=cc :content-type:content-type:date:date:from:from:in-reply-to :message-id:mime-version:reply-to:sender:subject:subject:to:to; s=fm2; t=1689185389; x=1689271789; bh=YTjrN+YNbCJz/eaOnnOeOTX95 xZ1CQ8QU32M+1KiO8o=; b=TstemAceHNHX3Bixs/Ponhn/VHDCuoLuHk3/uxU46 2BO+3+bTw6nvHmqS09yWLThEx2zbmD4e3alnkWsLD7qD77O+6uzQNgH8kzLGrqEN NRyeLjJxZwCFhHq+/1Mm+KbUjkLHk5Q5/fEwKx8A7UZIjgX8KvEkdCuGoIlpPZzD RYhM3p1ytERwAKNuI0qLsOs5wuVl3F44jvbks1C+O+FKLkaLVhY0yQNO5uM8UXt7 bLJJf1DB0hnJ+wfNkRl+jn+GlX4t+e7no0KAGD9X1X2As56x3tMXiGkAzIO5f1bS m94C1UPIOXKxl0MHq/dTsrWcW4035bFOePmV27BSLPmNw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:message-id :mime-version:reply-to:sender:subject:subject:to:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t= 1689185389; x=1689271789; bh=YTjrN+YNbCJz/eaOnnOeOTX95xZ1CQ8QU32 M+1KiO8o=; b=YowoYpxgCgl+d0uopKrAlLAHyLM+aEpq2qEdzavQOjvJYbXfpES 3Gp3YdFqKS2yKpgF7/LHvSZXf7OUcQ9wCkJsZOjM0jp4eYC+UAVaiqgby2+wyv9k j8yxNTbce+xdtrELA2VedOfHKVuBczhi8x9GyRUt5LtVXak8LCtS9+8mkPjj5RUT 6wmzkVp4LjWdYlE1b5Fa/VVvOXtaCqrHZnKtFTujNjeD8ltSojk9BVnix7kM1UCH XhzFixAQsCHvQQSumf58BugAarjEZiEE+zfMGxnWFWjZEfw6TNGgk4xVezT0fnS8 puixq1wLtveQeU+0/JFUlrG8Fl9pRnNchbg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedviedrfedvgdduvddvucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpeffhffvuffkgggtugesthdtredttd dtvdenucfhrhhomheptehnghgvlhhoucfrrghpvghnhhhofhhfuceorggrphesphgrphhn vghtrdgvuheqnecuggftrfgrthhtvghrnhepkeefledvudejjeeuuefhtdehgeefledvge fhgeduvddtgfejleelffdvjeeltdetnecuffhomhgrihhnpehgihhthhhusgdrtghomhdp shhquhhoiigvrdhnvghtnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrg hilhhfrhhomheprggrphesphgrphhnvghtrdgvuh X-ME-Proxy: Feedback-ID: i47c14439:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA for ; Wed, 12 Jul 2023 14:09:48 -0400 (EDT) Date: Wed, 12 Jul 2023 20:09:46 +0200 From: Angelo Papenhoff To: tuhs@tuhs.org Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Message-ID-Hash: 42YDKFP33LTEZIKV64L3VK63ZN5PKYQI X-Message-ID-Hash: 42YDKFP33LTEZIKV64L3VK63ZN5PKYQI X-MailFrom: aap@papnet.eu X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.6b1 Precedence: list Subject: [TUHS] B compiler restored List-Id: The Unix Heritage Society mailing list Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: So there's been quite a bit of talk about B recently (mostly from my side) and right now I feel that I've reach an interesting enough milestone to warrant a separate thread for this here. First of all, I want to stress that this is still WIP, but everything can be found here now: https://github.com/aap/b/tree/master/unix1_bdir In this repo you will find the following: - bc and ba that can build themselves (I've included .s files so everything can be bootstrapped easily). - libb and bilib in source form from object/library and binary files of the s2 tape - brt1 and brt2 restored from binary files of the s2 tape - olibb, obilib and obrt1, older versions of the above - a version of ba that does not generate threaded code but an interpreted code more like the pdp-7 code. ken told me such a thing existed at one point and indeed it is the only way to fit the compiler into 8kb/4kw - an implementation of this interpreted code. With this bc and ba fit into 8kb Note I have only tested this under apout so far. The version I used [1] needed two tweaks, but see my README. With this I was able to build the recently reversed B programs [2] and produce exact matches to the originals (modulo assembler differences). In that process I found a few mistakes I made, now the programs are exact. I want to thank everyone who was of help in this endeavour in one way or another: Ken Thompson, Phil Budne, Robert Swierczek, Steve Johnson, Warren Toomey What's left to do now is to actually run this under UNIX v1 proper, preferably even on a real machine. I've been too lazy for that so far. Also there are inaccuracies and unknowns in the compiler and assembler. Right now the intermediate code is a binary code that's easy to generate and to parse, but if I understood ken correctly the intermediate code was more like something the PDP-7 assembler could deal with. I'm also rather unsure how to handle the conditional ?: operator. The printf.o file shows that it produces labels that are in line with all the other labels. Now the C compiler uses labels starting at L10000 for the ones generated in the second pass. So it *feels* like the conditional should be generated by bc directly and not by ba but this leads to other problems, which I won't go into detail now. Finally the code should probably be a bit closer to the C compiler than it currently is. Cheers, Angelo [1] https://github.com/philbudne/pdp11-B/tree/pb/tools/apout [2] http://squoze.net/B/programs/