Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

Your own mileage may vary.


computers / alt.sys.pdp11 / BSD 2.11 Unix

SubjectAuthor
* BSD 2.11 UnixJonathan Harston
+* Re: BSD 2.11 UnixPaul Rubin
|`- Re: BSD 2.11 UnixJonathan Harston
+* Re: BSD 2.11 UnixIan Hammond
|`* Re: BSD 2.11 UnixJonathan Harston
| `- Re: BSD 2.11 UnixIan Hammond
+* Re: BSD 2.11 UnixBob Eager
|`- Re: BSD 2.11 UnixJonathan Harston
`* Re: BSD 2.11 UnixScott Lurndal
 `* Re: BSD 2.11 UnixScott Lurndal
  `* Re: BSD 2.11 UnixJonathan Harston
   `* Re: BSD 2.11 UnixJonathan Harston
    +- Re: BSD 2.11 UnixJonathan Harston
    `- Re: BSD 2.11 UnixIan Hammond

1
BSD 2.11 Unix

<0a390720-a910-48c9-86ea-1a073ca01c85n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/computers/article-flat.php?id=354&group=alt.sys.pdp11#354

  copy link   Newsgroups: alt.sys.pdp11
X-Received: by 2002:ac8:64c:: with SMTP id e12mr10523486qth.144.1626052220676;
Sun, 11 Jul 2021 18:10:20 -0700 (PDT)
X-Received: by 2002:a0c:fb03:: with SMTP id c3mr32731416qvp.19.1626052220454;
Sun, 11 Jul 2021 18:10:20 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: alt.sys.pdp11
Date: Sun, 11 Jul 2021 18:10:20 -0700 (PDT)
Injection-Info: google-groups.googlegroups.com; posting-host=86.8.202.163; posting-account=jgPW4gkAAACE_VxPxIZ8VykZc96-9sT_
NNTP-Posting-Host: 86.8.202.163
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <0a390720-a910-48c9-86ea-1a073ca01c85n@googlegroups.com>
Subject: BSD 2.11 Unix
From: jgh@mdfs.net (Jonathan Harston)
Injection-Date: Mon, 12 Jul 2021 01:10:20 +0000
Content-Type: text/plain; charset="UTF-8"
 by: Jonathan Harston - Mon, 12 Jul 2021 01:10 UTC

I've been experimenting with BSD 2.11 Unix. I'm having problems
getting assembly code to execute and do anything. I stripped
down to a minimal example:

ORG 0 ; position independant code
EQUW &0107 ; magic number, also branch to Startup
EQUW _DATA%-_TEXT% ; size of text
EQUW _BSS%-_DATA% ; size of initialised data
EQUW _END%-_BSS% ; size of uninitialised data
EQUW &0000 ; size of symbol data
EQUW _ENTRY%-_TEXT% ; entry point
EQUW &0000 ; not used
EQUW &0001 ; no relocation info
ORG 0 ; position independant code
.._TEXT%
;

.._ENTRY%
mov #1,r0 ; r0=STDOUT
trap 4 ; write()
equw msg_hello ; Start of data
equw end_hello-msg_hello ; Length of data
; trap 1 ; exit()
halt ; drop to monitor
;

.._DATA%
..msg_hello
equs "Hello world!",10,13
..end_hello
align
;

.._BSS%
.._END%

Running it just returns to the command prompt with no output.
Examining the binary with adb shows the expected code and
data, and single-stepping through it successfully sets R0, then
at the sys write() it makes the call, outputs nothing, and ends
at the exit().

If I can't even get any output so I can display debug messages,
I'm stumped!

Aside, I've written the same code in C and compiled it, and it
works fine, so my next direction of attack is to disassemble
the generated code and see what it's doing that my assembly
code isn't.

jgh

Re: BSD 2.11 Unix

<87wnpwb9tw.fsf@nightsong.com>

  copy mid

https://www.rocksolidbbs.com/computers/article-flat.php?id=355&group=alt.sys.pdp11#355

  copy link   Newsgroups: alt.sys.pdp11
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: no.email@nospam.invalid (Paul Rubin)
Newsgroups: alt.sys.pdp11
Subject: Re: BSD 2.11 Unix
Date: Sun, 11 Jul 2021 18:27:23 -0700
Organization: A noiseless patient Spider
Lines: 7
Message-ID: <87wnpwb9tw.fsf@nightsong.com>
References: <0a390720-a910-48c9-86ea-1a073ca01c85n@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain
Injection-Info: reader02.eternal-september.org; posting-host="d795330fbdde19ce534ba4db1502b999";
logging-data="29349"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/PH2ncMDnE5STCuFomNDuP"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux)
Cancel-Lock: sha1:UhVLbJeRt1YVe+BIZR0yqsV5Z8o=
sha1:MGrct4ii/LBmEInmhEi4K+WK3cI=
 by: Paul Rubin - Mon, 12 Jul 2021 01:27 UTC

Jonathan Harston <jgh@mdfs.net> writes:
> ._ENTRY%
> mov #1,r0 ; r0=STDOUT
> trap 4 ; write()

Are you sure you are supposed to put the fd in r0? That doesn't look
right to me, but it's been a while.

Re: BSD 2.11 Unix

<e5af9857-1194-4a3c-8ad0-65a4831b5c79n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/computers/article-flat.php?id=356&group=alt.sys.pdp11#356

  copy link   Newsgroups: alt.sys.pdp11
X-Received: by 2002:a05:620a:101a:: with SMTP id z26mr4076036qkj.261.1626063773630; Sun, 11 Jul 2021 21:22:53 -0700 (PDT)
X-Received: by 2002:a05:620a:13fc:: with SMTP id h28mr26086272qkl.188.1626063773420; Sun, 11 Jul 2021 21:22:53 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.goja.nl.eu.org!2.eu.feeder.erje.net!feeder.erje.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed9.news.xs4all.nl!tr2.eu1.usenetexpress.com!feeder.usenetexpress.com!tr2.iad1.usenetexpress.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: alt.sys.pdp11
Date: Sun, 11 Jul 2021 21:22:53 -0700 (PDT)
In-Reply-To: <0a390720-a910-48c9-86ea-1a073ca01c85n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=49.199.136.63; posting-account=iRacWwoAAABNBg7xAp9DBnfmGfuf1vDI
NNTP-Posting-Host: 49.199.136.63
References: <0a390720-a910-48c9-86ea-1a073ca01c85n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <e5af9857-1194-4a3c-8ad0-65a4831b5c79n@googlegroups.com>
Subject: Re: BSD 2.11 Unix
From: paramucho@gmail.com (Ian Hammond)
Injection-Date: Mon, 12 Jul 2021 04:22:53 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 12
 by: Ian Hammond - Mon, 12 Jul 2021 04:22 UTC

On Monday, July 12, 2021 at 11:10:21 AM UTC+10, j...@mdfs.net wrote:
> I've been experimenting with BSD 2.11 Unix. I'm having problems
> getting assembly code to execute and do anything. I stripped
> down to a minimal example:
>
> ORG 0 ; position independant code
> EQUW &0107 ; magic number, also branch to Startup

I'm not familiar with BSD, but in the earlier versions the magic number was 407
(which in fact is the PDP-11 branch instruction to skip past the header).

Re: BSD 2.11 Unix

<il2kd4Ftr38U1@mid.individual.net>

  copy mid

https://www.rocksolidbbs.com/computers/article-flat.php?id=357&group=alt.sys.pdp11#357

  copy link   Newsgroups: alt.sys.pdp11
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!lilly.ping.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: news0009@eager.cx (Bob Eager)
Newsgroups: alt.sys.pdp11
Subject: Re: BSD 2.11 Unix
Date: 12 Jul 2021 10:38:28 GMT
Lines: 17
Message-ID: <il2kd4Ftr38U1@mid.individual.net>
References: <0a390720-a910-48c9-86ea-1a073ca01c85n@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Trace: individual.net RFnpm9jBF5RsX9vZBGIOVgSyReEwKq2AtIBayde+vgTAqBpiA7
Cancel-Lock: sha1:giTjiQVivkBRHMZx2vZPSfC+kpg=
User-Agent: Pan/0.145 (Duplicitous mercenary valetism; d7e168a
git.gnome.org/pan2)
 by: Bob Eager - Mon, 12 Jul 2021 10:38 UTC

On Sun, 11 Jul 2021 18:10:20 -0700, Jonathan Harston wrote:

> Aside, I've written the same code in C and compiled it, and it works
> fine,
> so my next direction of attack is to disassemble the generated code and
> see what it's doing that my assembly code isn't.

Why would you want to disassemble it, when you can just tell the compiler
to retain the .s file?

--
Using UNIX since v6 (1975)...

Use the BIG mirror service in the UK:
http://www.mirrorservice.org

Re: BSD 2.11 Unix

<44828480-d141-4e1d-b6ad-3e5857c93b79n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/computers/article-flat.php?id=358&group=alt.sys.pdp11#358

  copy link   Newsgroups: alt.sys.pdp11
X-Received: by 2002:a37:7e46:: with SMTP id z67mr17171539qkc.417.1626088927257;
Mon, 12 Jul 2021 04:22:07 -0700 (PDT)
X-Received: by 2002:ad4:52ea:: with SMTP id p10mr50503391qvu.45.1626088927120;
Mon, 12 Jul 2021 04:22:07 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: alt.sys.pdp11
Date: Mon, 12 Jul 2021 04:22:06 -0700 (PDT)
In-Reply-To: <87wnpwb9tw.fsf@nightsong.com>
Injection-Info: google-groups.googlegroups.com; posting-host=86.8.202.163; posting-account=jgPW4gkAAACE_VxPxIZ8VykZc96-9sT_
NNTP-Posting-Host: 86.8.202.163
References: <0a390720-a910-48c9-86ea-1a073ca01c85n@googlegroups.com> <87wnpwb9tw.fsf@nightsong.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <44828480-d141-4e1d-b6ad-3e5857c93b79n@googlegroups.com>
Subject: Re: BSD 2.11 Unix
From: jgh@mdfs.net (Jonathan Harston)
Injection-Date: Mon, 12 Jul 2021 11:22:07 +0000
Content-Type: text/plain; charset="UTF-8"
 by: Jonathan Harston - Mon, 12 Jul 2021 11:22 UTC

On Monday, 12 July 2021 at 02:27:26 UTC+1, Paul Rubin wrote:
> Jonathan Harston <j...@mdfs.net> writes:
> > ._ENTRY%
> > mov #1,r0 ; r0=STDOUT
> > trap 4 ; write()
> Are you sure you are supposed to put the fd in r0? That doesn't look
> right to me, but it's been a while.

That's correct for v1, v2, v3, v4, v5, v5, v6, v7 Unix. The above program
works on v5, v6, v7 Unix (I haven't had access to v1-v4).

Re: BSD 2.11 Unix

<24e2aaa2-e79d-4245-bc7d-f7ab880d45d4n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/computers/article-flat.php?id=359&group=alt.sys.pdp11#359

  copy link   Newsgroups: alt.sys.pdp11
X-Received: by 2002:a0c:9ac7:: with SMTP id k7mr51815149qvf.49.1626088972334;
Mon, 12 Jul 2021 04:22:52 -0700 (PDT)
X-Received: by 2002:a05:620a:2145:: with SMTP id m5mr27756288qkm.301.1626088972216;
Mon, 12 Jul 2021 04:22:52 -0700 (PDT)
Path: i2pn2.org!i2pn.org!paganini.bofh.team!news.dns-netz.com!news.freedyn.net!newsreader4.netcologne.de!news.netcologne.de!peer01.ams1!peer.ams1.xlned.com!news.xlned.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: alt.sys.pdp11
Date: Mon, 12 Jul 2021 04:22:51 -0700 (PDT)
In-Reply-To: <il2kd4Ftr38U1@mid.individual.net>
Injection-Info: google-groups.googlegroups.com; posting-host=86.8.202.163; posting-account=jgPW4gkAAACE_VxPxIZ8VykZc96-9sT_
NNTP-Posting-Host: 86.8.202.163
References: <0a390720-a910-48c9-86ea-1a073ca01c85n@googlegroups.com> <il2kd4Ftr38U1@mid.individual.net>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <24e2aaa2-e79d-4245-bc7d-f7ab880d45d4n@googlegroups.com>
Subject: Re: BSD 2.11 Unix
From: jgh@mdfs.net (Jonathan Harston)
Injection-Date: Mon, 12 Jul 2021 11:22:52 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 1595
 by: Jonathan Harston - Mon, 12 Jul 2021 11:22 UTC

On Monday, 12 July 2021 at 11:38:31 UTC+1, Bob Eager wrote:
> On Sun, 11 Jul 2021 18:10:20 -0700, Jonathan Harston wrote:
>
> > Aside, I've written the same code in C and compiled it, and it works
> > fine,
> > so my next direction of attack is to disassemble the generated code and
> > see what it's doing that my assembly code isn't.
> Why would you want to disassemble it, when you can just tell the compiler
> to retain the .s file?

Brain fart, that's what I meant. ;)

Re: BSD 2.11 Unix

<a0439ced-cedb-4148-969f-e9874cf4bd1an@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/computers/article-flat.php?id=360&group=alt.sys.pdp11#360

  copy link   Newsgroups: alt.sys.pdp11
X-Received: by 2002:ac8:5d09:: with SMTP id f9mr30481927qtx.91.1626089055419;
Mon, 12 Jul 2021 04:24:15 -0700 (PDT)
X-Received: by 2002:a37:a9d3:: with SMTP id s202mr9832672qke.422.1626089055304;
Mon, 12 Jul 2021 04:24:15 -0700 (PDT)
Path: i2pn2.org!rocksolid2!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: alt.sys.pdp11
Date: Mon, 12 Jul 2021 04:24:15 -0700 (PDT)
In-Reply-To: <e5af9857-1194-4a3c-8ad0-65a4831b5c79n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=86.8.202.163; posting-account=jgPW4gkAAACE_VxPxIZ8VykZc96-9sT_
NNTP-Posting-Host: 86.8.202.163
References: <0a390720-a910-48c9-86ea-1a073ca01c85n@googlegroups.com> <e5af9857-1194-4a3c-8ad0-65a4831b5c79n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <a0439ced-cedb-4148-969f-e9874cf4bd1an@googlegroups.com>
Subject: Re: BSD 2.11 Unix
From: jgh@mdfs.net (Jonathan Harston)
Injection-Date: Mon, 12 Jul 2021 11:24:15 +0000
Content-Type: text/plain; charset="UTF-8"
 by: Jonathan Harston - Mon, 12 Jul 2021 11:24 UTC

On Monday, 12 July 2021 at 05:22:53 UTC+1, Ian Hammond wrote:
> On Monday, July 12, 2021 at 11:10:21 AM UTC+10, j...@mdfs.net wrote:
> > I've been experimenting with BSD 2.11 Unix. I'm having problems
> > getting assembly code to execute and do anything. I stripped
> > down to a minimal example:
> >
> > ORG 0 ; position independant code
> > EQUW &0107 ; magic number, also branch to Startup
> I'm not familiar with BSD, but in the earlier versions the magic number was 407
> (which in fact is the PDP-11 branch instruction to skip past the header).

Hex 107 is Oct 407. A binary dump of working code shows the same header and
magic numbers.

Re: BSD 2.11 Unix

<053f7d01-966f-4867-9811-b291fc457a7en@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/computers/article-flat.php?id=361&group=alt.sys.pdp11#361

  copy link   Newsgroups: alt.sys.pdp11
X-Received: by 2002:a0c:ff01:: with SMTP id w1mr21483910qvt.28.1626103504410;
Mon, 12 Jul 2021 08:25:04 -0700 (PDT)
X-Received: by 2002:a37:5d7:: with SMTP id 206mr2463968qkf.170.1626103504229;
Mon, 12 Jul 2021 08:25:04 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: alt.sys.pdp11
Date: Mon, 12 Jul 2021 08:25:04 -0700 (PDT)
In-Reply-To: <a0439ced-cedb-4148-969f-e9874cf4bd1an@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=49.199.136.63; posting-account=iRacWwoAAABNBg7xAp9DBnfmGfuf1vDI
NNTP-Posting-Host: 49.199.136.63
References: <0a390720-a910-48c9-86ea-1a073ca01c85n@googlegroups.com>
<e5af9857-1194-4a3c-8ad0-65a4831b5c79n@googlegroups.com> <a0439ced-cedb-4148-969f-e9874cf4bd1an@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <053f7d01-966f-4867-9811-b291fc457a7en@googlegroups.com>
Subject: Re: BSD 2.11 Unix
From: paramucho@gmail.com (Ian Hammond)
Injection-Date: Mon, 12 Jul 2021 15:25:04 +0000
Content-Type: text/plain; charset="UTF-8"
 by: Ian Hammond - Mon, 12 Jul 2021 15:25 UTC

On Monday, July 12, 2021 at 9:24:15 PM UTC+10, j...@mdfs.net wrote:
> On Monday, 12 July 2021 at 05:22:53 UTC+1, Ian Hammond wrote:
> > On Monday, July 12, 2021 at 11:10:21 AM UTC+10, j...@mdfs.net wrote:
> > > I've been experimenting with BSD 2.11 Unix. I'm having problems
> > > getting assembly code to execute and do anything. I stripped
> > > down to a minimal example:
> > >
> > > ORG 0 ; position independant code
> > > EQUW &0107 ; magic number, also branch to Startup
> > I'm not familiar with BSD, but in the earlier versions the magic number was 407
> > (which in fact is the PDP-11 branch instruction to skip past the header).
> Hex 107 is Oct 407. A binary dump of working code shows the same header and
> magic numbers.

My eyes are octal, I cannot see
I have not brought my hex with me

Re: BSD 2.11 Unix

<ahZGI.14506$dp5.2021@fx48.iad>

  copy mid

https://www.rocksolidbbs.com/computers/article-flat.php?id=362&group=alt.sys.pdp11#362

  copy link   Newsgroups: alt.sys.pdp11
Path: i2pn2.org!i2pn.org!aioe.org!news.dns-netz.com!news.freedyn.net!newsreader4.netcologne.de!news.netcologne.de!peer03.ams1!peer.ams1.xlned.com!news.xlned.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx48.iad.POSTED!not-for-mail
X-newsreader: xrn 9.03-beta-14-64bit
Sender: scott@dragon.sl.home (Scott Lurndal)
From: scott@slp53.sl.home (Scott Lurndal)
Reply-To: slp53@pacbell.net
Subject: Re: BSD 2.11 Unix
Newsgroups: alt.sys.pdp11
References: <0a390720-a910-48c9-86ea-1a073ca01c85n@googlegroups.com>
Lines: 56
Message-ID: <ahZGI.14506$dp5.2021@fx48.iad>
X-Complaints-To: abuse@usenetserver.com
NNTP-Posting-Date: Mon, 12 Jul 2021 15:33:26 UTC
Organization: UsenetServer - www.usenetserver.com
Date: Mon, 12 Jul 2021 15:33:26 GMT
X-Received-Bytes: 2276
 by: Scott Lurndal - Mon, 12 Jul 2021 15:33 UTC

Jonathan Harston <jgh@mdfs.net> writes:
>I've been experimenting with BSD 2.11 Unix. I'm having problems
>getting assembly code to execute and do anything. I stripped
>down to a minimal example:
>
>ORG 0 ; position independant code
>EQUW &0107 ; magic number, also branch to Startup
>EQUW _DATA%-_TEXT% ; size of text
>EQUW _BSS%-_DATA% ; size of initialised data
>EQUW _END%-_BSS% ; size of uninitialised data
>EQUW &0000 ; size of symbol data
>EQUW _ENTRY%-_TEXT% ; entry point
>EQUW &0000 ; not used
>EQUW &0001 ; no relocation info
>ORG 0 ; position independant code
>._TEXT%
>;
>
>._ENTRY%
>mov #1,r0 ; r0=STDOUT
>trap 4 ; write()
>equw msg_hello ; Start of data
>equw end_hello-msg_hello ; Length of data
>;
>trap 1 ; exit()
>halt ; drop to monitor
>;
>
>._DATA%
>.msg_hello
>equs "Hello world!",10,13
>.end_hello
>align
>;
>
>._BSS%
>._END%
>
>Running it just returns to the command prompt with no output.
>Examining the binary with adb shows the expected code and
>data, and single-stepping through it successfully sets R0, then
>at the sys write() it makes the call, outputs nothing, and ends
>at the exit().
>
>If I can't even get any output so I can display debug messages,
>I'm stumped!
>
>Aside, I've written the same code in C and compiled it, and it
>works fine, so my next direction of attack is to disassemble
>the generated code and see what it's doing that my assembly
>code isn't.

Standard code relies on exit() to flush the stream, which (stdout)
will be fully buffered.

Does your 'halt' call call exit()?

Re: BSD 2.11 Unix

<yiZGI.14507$dp5.3178@fx48.iad>

  copy mid

https://www.rocksolidbbs.com/computers/article-flat.php?id=363&group=alt.sys.pdp11#363

  copy link   Newsgroups: alt.sys.pdp11
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!4.us.feeder.erje.net!feeder.erje.net!news2.arglkargh.de!news.mixmin.net!newsreader4.netcologne.de!news.netcologne.de!peer03.ams1!peer.ams1.xlned.com!news.xlned.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx48.iad.POSTED!not-for-mail
X-newsreader: xrn 9.03-beta-14-64bit
Sender: scott@dragon.sl.home (Scott Lurndal)
From: scott@slp53.sl.home (Scott Lurndal)
Reply-To: slp53@pacbell.net
Subject: Re: BSD 2.11 Unix
Newsgroups: alt.sys.pdp11
References: <0a390720-a910-48c9-86ea-1a073ca01c85n@googlegroups.com> <ahZGI.14506$dp5.2021@fx48.iad>
Lines: 14
Message-ID: <yiZGI.14507$dp5.3178@fx48.iad>
X-Complaints-To: abuse@usenetserver.com
NNTP-Posting-Date: Mon, 12 Jul 2021 15:34:54 UTC
Organization: UsenetServer - www.usenetserver.com
Date: Mon, 12 Jul 2021 15:34:54 GMT
X-Received-Bytes: 1205
 by: Scott Lurndal - Mon, 12 Jul 2021 15:34 UTC

scott@slp53.sl.home (Scott Lurndal) writes:
>Jonathan Harston <jgh@mdfs.net> writes:
>>I've been experimenting with BSD 2.11 Unix. I'm having problems
>
>>Aside, I've written the same code in C and compiled it, and it
>>works fine, so my next direction of attack is to disassemble
>>the generated code and see what it's doing that my assembly
>>code isn't.
>
>Standard code relies on exit() to flush the stream, which (stdout)
>will be fully buffered.

Never mind, I see you're using write directly.

Re: BSD 2.11 Unix

<365b86b7-42f3-4e39-9eb4-75946805ddf3n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/computers/article-flat.php?id=364&group=alt.sys.pdp11#364

  copy link   Newsgroups: alt.sys.pdp11
X-Received: by 2002:a05:620a:1728:: with SMTP id az40mr6585678qkb.366.1626105120799;
Mon, 12 Jul 2021 08:52:00 -0700 (PDT)
X-Received: by 2002:ad4:5426:: with SMTP id g6mr52432299qvt.47.1626105120653;
Mon, 12 Jul 2021 08:52:00 -0700 (PDT)
Path: i2pn2.org!i2pn.org!aioe.org!feeder1.feed.usenet.farm!feed.usenet.farm!news-out.netnews.com!news.alt.net!fdc3.netnews.com!peer01.ams1!peer.ams1.xlned.com!news.xlned.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: alt.sys.pdp11
Date: Mon, 12 Jul 2021 08:52:00 -0700 (PDT)
In-Reply-To: <yiZGI.14507$dp5.3178@fx48.iad>
Injection-Info: google-groups.googlegroups.com; posting-host=80.2.23.243; posting-account=jgPW4gkAAACE_VxPxIZ8VykZc96-9sT_
NNTP-Posting-Host: 80.2.23.243
References: <0a390720-a910-48c9-86ea-1a073ca01c85n@googlegroups.com>
<ahZGI.14506$dp5.2021@fx48.iad> <yiZGI.14507$dp5.3178@fx48.iad>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <365b86b7-42f3-4e39-9eb4-75946805ddf3n@googlegroups.com>
Subject: Re: BSD 2.11 Unix
From: jgh@mdfs.net (Jonathan Harston)
Injection-Date: Mon, 12 Jul 2021 15:52:00 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 2207
 by: Jonathan Harston - Mon, 12 Jul 2021 15:52 UTC

This is what I'm getting:

2.11 BSD UNIX (vixen.2bsd.com) (console)
login: root
erase, kill ^U, intr ^C
# cd usr/jgh
# ./fdump hello
0000 07 01 0E 00 0E 00 00 00 00 00 00 00 00 00 01 00 ................
0010 C0 15 01 00 04 89 0E 00 0E 00 01 89 00 00 48 65 @.............He
0020 6C 6C 6F 20 77 6F 72 6C 64 21 0A 0D ** ** ** ** llo world!..
# ./hello
#

(Unix v7)
Restricted rights: Use, duplication, or disclosure
is subject to restrictions stated in your contract with
Western Electric Company, Inc.
Thu Sep 22 07:13:20 EDT 1988

login: root
Password:
You have mail.
# cd usr/jgh
# ./fdump hello
0000 07 01 0E 00 0E 00 00 00 00 00 00 00 00 00 01 00 ................
0010 C0 15 01 00 04 89 0E 00 0E 00 01 89 00 00 48 65 @.............He
0020 6C 6C 6F 20 77 6F 72 6C 64 21 0A 0D ** ** ** ** llo world!..
# ./hello
Hello world!
#

The content being identical (header removed):
mov #1,r0
trap 4 ; write("Hello world!\n")
equw msg_hello
equw end_hello-msg_hello
trap 1 ; exit()
halt
..msg_hello
equs "Hello world!",10,13
..end_hello

Re: BSD 2.11 Unix

<5d053733-63fd-4f9e-8ac5-2e80f7cab5b4n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/computers/article-flat.php?id=365&group=alt.sys.pdp11#365

  copy link   Newsgroups: alt.sys.pdp11
X-Received: by 2002:ac8:13c4:: with SMTP id i4mr1023674qtj.136.1626127204304;
Mon, 12 Jul 2021 15:00:04 -0700 (PDT)
X-Received: by 2002:a05:620a:4487:: with SMTP id x7mr868874qkp.211.1626127204134;
Mon, 12 Jul 2021 15:00:04 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.goja.nl.eu.org!3.eu.feeder.erje.net!feeder.erje.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: alt.sys.pdp11
Date: Mon, 12 Jul 2021 15:00:03 -0700 (PDT)
In-Reply-To: <365b86b7-42f3-4e39-9eb4-75946805ddf3n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=80.2.20.208; posting-account=jgPW4gkAAACE_VxPxIZ8VykZc96-9sT_
NNTP-Posting-Host: 80.2.20.208
References: <0a390720-a910-48c9-86ea-1a073ca01c85n@googlegroups.com>
<ahZGI.14506$dp5.2021@fx48.iad> <yiZGI.14507$dp5.3178@fx48.iad> <365b86b7-42f3-4e39-9eb4-75946805ddf3n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <5d053733-63fd-4f9e-8ac5-2e80f7cab5b4n@googlegroups.com>
Subject: Re: BSD 2.11 Unix
From: jgh@mdfs.net (Jonathan Harston)
Injection-Date: Mon, 12 Jul 2021 22:00:04 +0000
Content-Type: text/plain; charset="UTF-8"
 by: Jonathan Harston - Mon, 12 Jul 2021 22:00 UTC

I've worked out what it is.

In Bell Labs PDP11 Unix, sys calls are:
TRAP n
DW parameter
DW parameter
etc.
code continues

In BSD PDP11 Unix, sys calls are:
mov parameter,-(sp)
mov parameter,-(sp)
etc
TRAP n
code continues.

In the Hello world example:
MOV #1,r0
TRAP 4
DW msgHello
DW lenHello
code continues

vs
MOV lenHello,-(sp)
MOV msgHello,-(sp)
MOV #1,-(sp)
TRAP 4
code continues

ubggre. That means the same binary won't run. My first thought is
to use TRAP 0 ; indirect but I bet that also uses the stack.

Anyway, knowing the issue, I know how to build a target-specific
binary by rebuilding the platform-specific code.

jgh

Re: BSD 2.11 Unix

<512b0087-fa13-44b0-a2d5-03812b1b69ban@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/computers/article-flat.php?id=366&group=alt.sys.pdp11#366

  copy link   Newsgroups: alt.sys.pdp11
X-Received: by 2002:ac8:5d09:: with SMTP id f9mr1157691qtx.91.1626130391809; Mon, 12 Jul 2021 15:53:11 -0700 (PDT)
X-Received: by 2002:ac8:5751:: with SMTP id 17mr1175531qtx.83.1626130391595; Mon, 12 Jul 2021 15:53:11 -0700 (PDT)
Path: i2pn2.org!i2pn.org!aioe.org!news.dns-netz.com!news.freedyn.net!newsfeed.xs4all.nl!newsfeed8.news.xs4all.nl!tr3.eu1.usenetexpress.com!feeder.usenetexpress.com!tr1.iad1.usenetexpress.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: alt.sys.pdp11
Date: Mon, 12 Jul 2021 15:53:11 -0700 (PDT)
In-Reply-To: <5d053733-63fd-4f9e-8ac5-2e80f7cab5b4n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=80.2.20.208; posting-account=jgPW4gkAAACE_VxPxIZ8VykZc96-9sT_
NNTP-Posting-Host: 80.2.20.208
References: <0a390720-a910-48c9-86ea-1a073ca01c85n@googlegroups.com> <ahZGI.14506$dp5.2021@fx48.iad> <yiZGI.14507$dp5.3178@fx48.iad> <365b86b7-42f3-4e39-9eb4-75946805ddf3n@googlegroups.com> <5d053733-63fd-4f9e-8ac5-2e80f7cab5b4n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <512b0087-fa13-44b0-a2d5-03812b1b69ban@googlegroups.com>
Subject: Re: BSD 2.11 Unix
From: jgh@mdfs.net (Jonathan Harston)
Injection-Date: Mon, 12 Jul 2021 22:53:11 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 32
 by: Jonathan Harston - Mon, 12 Jul 2021 22:53 UTC

Changing my I/O code to...

..CHAROUT
mov r0,-(sp) ; Push r0
mov sp,r0 ; r0=>data on stack
mov #1,-(sp) ; length
mov r0,-(sp) ; =>data
mov #1,-(sp) ; STDOUT=1
clr -(sp) ; padding for return address
trap 4 ; write()
add #8,sp ; drop parameters
mov (sp)+,r0 ; restore r0
rts pc

(called by
mov #hello,r1
..loop
movb (r1)+,r0 ; get byte from r1, inc r1
beq end ; exit if final byte
jsr pc,CHAROUT ; send character to output
br loop ; loop back
..end
jsr pc,QUIT ; quit to caller
halt
)

#./testfile
Hello world!

YAYYYY!!!!

<rolls up sleeves....>

Re: BSD 2.11 Unix

<1eb3257c-5486-4639-8f47-51a00b0d8140n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/computers/article-flat.php?id=367&group=alt.sys.pdp11#367

  copy link   Newsgroups: alt.sys.pdp11
X-Received: by 2002:ad4:4bca:: with SMTP id l10mr5113522qvw.50.1626186532607;
Tue, 13 Jul 2021 07:28:52 -0700 (PDT)
X-Received: by 2002:ae9:e886:: with SMTP id a128mr4536361qkg.218.1626186532392;
Tue, 13 Jul 2021 07:28:52 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: alt.sys.pdp11
Date: Tue, 13 Jul 2021 07:28:52 -0700 (PDT)
In-Reply-To: <5d053733-63fd-4f9e-8ac5-2e80f7cab5b4n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=49.183.3.109; posting-account=iRacWwoAAABNBg7xAp9DBnfmGfuf1vDI
NNTP-Posting-Host: 49.183.3.109
References: <0a390720-a910-48c9-86ea-1a073ca01c85n@googlegroups.com>
<ahZGI.14506$dp5.2021@fx48.iad> <yiZGI.14507$dp5.3178@fx48.iad>
<365b86b7-42f3-4e39-9eb4-75946805ddf3n@googlegroups.com> <5d053733-63fd-4f9e-8ac5-2e80f7cab5b4n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <1eb3257c-5486-4639-8f47-51a00b0d8140n@googlegroups.com>
Subject: Re: BSD 2.11 Unix
From: paramucho@gmail.com (Ian Hammond)
Injection-Date: Tue, 13 Jul 2021 14:28:52 +0000
Content-Type: text/plain; charset="UTF-8"
 by: Ian Hammond - Tue, 13 Jul 2021 14:28 UTC

On Tuesday, July 13, 2021 at 8:00:04 AM UTC+10, j...@mdfs.net wrote:
> ubggre. That means the same binary won't run. My first thought is
> to use TRAP 0 ; indirect but I bet that also uses the stack.

Looking at the 2.11 source code I see that BSD deprecated indirect calls
(which makes sense since its (much more sensible) stack interface is
itself "indirect").

TRAP.C:
...
if (code >= nsysent)
callp = &sysent[0]; /* indir (illegal) */
else
callp = &sysent[code];

INIT_SYSENT.C:
struct sysent sysent[] = {
1, nosys, /* 0 = indir or out-of-range */
1, rexit, /* 1 = exit */
0, fork, /* 2 = fork */
3, read, /* 3 = read */
3, write, /* 4 = write */
...

1
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor