[TUHS] Using printf from Assembly Language in V6, and db.

Paul Riley paul at rileyriot.com
Tue Jun 29 22:18:26 AEST 2021


Thanks Noel, Clem for your always generous and highly informative answers.
I'll digest that and enjoy using C routines in my assembly programs!

Paul

*Paul Riley*

Email: paul at rileyriot.com




On Tue, 29 Jun 2021 at 06:37, Noel Chiappa <jnc at mercury.lcs.mit.edu> wrote:

>     > From: Paul Riley <paul at rileyriot.com>
>
>     >> (I wrote a note, BITD, explaining how all this worked; I'll upload
> it
>     >> to the CHWiki when I get a chance.)
>
> Now here:
>
>   https://gunkies.org/wiki/PDP-11_C_stack_operation
>
> along with simple examples of args and auto variables, which are both
> referenced via the FP.
>
>
>     > As a non-C consumer of printf, should I point R5 at some space for a
>     > stack and call printf in the same manner as the C example I cited?
>
> Not necessary to do anything with R5 (you can leave it blank); the only
> things
> a PDP-11 C routine needs are:
>
> - a good stack
> - the arguments, and return point, on the top of the stack
>
> csv will set up the frame pointer, making no assumptions about the old
> contents of R5 - see the source:
>
>   http://ana-3.lcs.mit.edu/~jnc/tech/unix/lib/csv.s
>
> although it does save the old R5 contents, and restore them on exit.
>
>          Noel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://minnie.tuhs.org/pipermail/tuhs/attachments/20210629/f6cfb8db/attachment.htm>


More information about the TUHS mailing list