From: Will Senn <will.senn@gmail.com>
To: TUHS main list <tuhs@minnie.tuhs.org>
Subject: [TUHS] asm helper routines in v7
Date: Tue, 4 Jan 2022 14:37:25 -0600 [thread overview]
Message-ID: <10197622-30fe-7553-2f2d-edc9637ff489@gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 1738 bytes --]
So,
in v6, it was possible to use the mesg function from the system library
with:
ed hello.s
/ hello world using external mesg routine
.globl mesg
mov sp,r5
jsr r5,mesg; <Hello, World!\n\0>; .even
sys exit
as hello.sld -s a.out -l
a.out
Hello, World!
This was because v6 included mesg in the library, in v7, it doesn't look
like mesg is included, so doing the same thing as above requires that
code to write the message out be included and in addition system call
names are not predefined, so exit and write have to be looked up in
/usr/include/sys.s, resulting in the v7 equivalent file:
ed hello2.s
/ hello world using internal mesg routine
mov sp,r5
jsr r5,mesg; <Hello, World!\n\0>; .even
sys 1
mesg:
mov r0,-(sp)
mov r5,r0
mov r5,0f
1:
tstb (r5)+
bne 1b
sub r5,r0
com r0
mov r0,0f+2
mov $1,r0
sys 0; 9f
.data
9:
sys 4; 0:..; ..
.text
inc r5
bic $1,r5
mov (sp)+,r0
rts r5
as hello2.s
a.out
Hello, World!
My questions are:
1. Is mesg or an equivalent available in v7?
2. If not, what was the v7 way of putting strings out?
3. Why aren't the system call names defined?
4. What was the v7 way of naming system calls?
Will
[-- Attachment #2: Type: text/html, Size: 2447 bytes --]
next reply other threads:[~2022-01-04 20:38 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-04 20:37 Will Senn [this message]
2022-01-04 21:12 ` Dan Cross
2022-01-04 21:24 ` Will Senn
2022-01-04 21:28 ` Warner Losh
2022-01-05 17:35 ` Dan Cross
2022-01-04 21:38 ` Clem Cole
2022-01-06 3:26 Douglas McIlroy
2022-01-06 3:37 ` Warner Losh
2022-01-06 16:00 ` Clem Cole
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=10197622-30fe-7553-2f2d-edc9637ff489@gmail.com \
--to=will.senn@gmail.com \
--cc=tuhs@minnie.tuhs.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).