[TUHS] asm helper routines in v7

Will Senn will.senn at gmail.com
Wed Jan 5 06:37:25 AEST 2022


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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://minnie.tuhs.org/pipermail/tuhs/attachments/20220104/f17147c6/attachment.htm>


More information about the TUHS mailing list