Some subroutine calls on PDP-11 machines would be coded with the arguments appearing immediately after JSR
or EMT
instruction, something like this (apologies for not knowing the exact MACRO syntax):
jsr r5,WRITE_STRING
.byte 'This is some string'.'0'
continue:
; do stuff
rts pc
WRITE_STRING:
movb (r5)+,r0
beq done
.PRINT r0
br WRITE_STRING
done:
inc r5
bic #1,r5
jmp (r5)
The jsr
instruction sets r5
to point to the beginning of an ASCIZ string that is located in-line in the code, right after the jsr
. The WRITE_STRING
subroutine then reads the bytes pointed to by r5
and prints them out until the terminating zero is found. r5
is then aligned property, and control is returned to the caller with jmp (r5)
.
There were variants of this calling conventions; for instance the arguments could be indirect, in which case pointers to the actual arguments would be inlined in code, rather than the arguments themselves.
Was there a name for this in-line argument technique?