On Tue, Apr 28, 2020 at 9:03 AM Ronald Natalie <ron@ronnatalie.com> wrote:
Yes, you aren’t programming 2.11 BSD correctly.
Wow, I'd hoped it was that.  Thank you so much!  I spent way too much time fiddling incorrectly. 
Was an example I'd cobbled together from my college textbook I've been going back through, _Assembly_Language_for_the_PDP-11_RT-RSX-UNIX_ (c)1981 Kapps and Stafford.  We didn't have UNIX for the class so never ran into this.

Your examples are the older UNIX syscalls (your programs work correctly in Version 6 by the way as well).

In 2.11 BSD, all the arguments for the syscalls are inline (i.e., none are passed in registers.   This appears to be the beginnings of making the kernel protable across architectures.
The systent table no longer has separate fields for args in registers and not in registers and the code in sys/pdp/trap.c doesn’t look at the registers anymore.

I wonder if the differences are written up somewhere.  I did try to look for more documentation but came up short.  Must've been quite well-ingrained in programmers' minds in the day.

Proper code now should be:
          sys 4
        sys 1
Note your previous code used to just return 6 from the program (the return value of write).
Ah, so passing exit code as an arg to sys 1.  Cool.  Thanks again!