ITS: fetch command line parameters in MIDAS assembler

62 views
Skip to first unread message

Jali

unread,
Aug 4, 2025, 9:59:53 AMAug 4
to PiDP-10
Hello,
I have recently started familiarising myself with the PDP-10 assembler language and the MIDAS assembler. So far, I have only been experimenting with different IOT operations, such as writing on the terminal and reading from/writing to files. Now I was wondering (and this is maybe a noob question): Some programs, such as MIDAS itself, can take parameters from the command line. Just like in UNIX-like operating systems, I would like to pass the name of the file, I want to open, to my program as a parameter, and then read that parameter in my code, and use it. Sadly, I have not found out yet, how to accomplish this. While asking for a file name as input works fine, I don't know how to access the command line. Can anyone here nudge me into the right direction please?

Kind regards,
Alexander

Eric Swenson

unread,
Aug 4, 2025, 10:43:00 AMAug 4
to Jali, PiDP-10
You access the command line (called JCL in ITS parlance) by having your program execute a

 .BREAK 12,[..RJCL,,<loc>]

Instruction.  .BREAK is a UUO that is handled by DDT.  The 12 in the AC position of the instruction tells DDT that the caller wants an “information transfer”.  

The ..RJCL in the word referenced by the address portion of the instruction tells DDT that the information you want to transfer is the JCL. Finally, the <loc> value tells DDT where in your program’s address space you want DDT to copy the JCL.

The best way to learn about how to process the JCL copied into your job’s memory is to look at some code.  

Here is a sample program (LARS; UTNAM 20):

        title utnam - set microtape name

a=1
b=2
c=3
d=4

go:     movei a,0
        .break 12,[..rjcl,,jcl]         ;get jcl
        move b,[440700,,jcl]
        move c,[440600,,a]
repeat 3,[                              ;convert three characters
        ildb d,b                        ;from ascii to sixbit
        cail d,140
         subi d,40
        subi d,40
        idpb d,c
]
        .break 12,[..rpfi,,def]         ;get ddt :print defaults
        hlr a,def                       ;get device
        trz a,777770                    ;mask to unit number
        .utnam a,
         .lose %lssys
        .logout 1,

def:    block 4
jcl:    block 100

end go

The "  .break 12,[..rjcl,,jcl]” instruction copies the JCL into a buffer at address JCL. You’ll see the space reserved for it at the label JCL.

The "move b,[440700,,jcl]” instruction gets an ascii “byte pointer” to the first ascii character of JCL.

The "  ildb d,b“ instruction loads the first character (from the byte pointed to by B) into D.  That character will be in 7-bit ASCII.

This program just reads three characters, but you can have more sophisticated logic that loops until a <space> or end of buffer is found.  Look around in the source tree for other uses of “.break 12”.

— Eric


--
You received this message because you are subscribed to the Google Groups "PiDP-10" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pidp-10+u...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/pidp-10/1792f8b5-830d-4e1c-a828-9fe709a10181n%40googlegroups.com.

Message has been deleted

Jali

unread,
Aug 5, 2025, 9:37:28 AMAug 5
to PiDP-10
Hi Eric,

this worked like a charm. Thanks to your explanation, I could transfer the example to my scenario and it worked first time. 
Thank you so much for your help!

-- Alexander

Eric Swenson

unread,
Aug 5, 2025, 10:07:41 AMAug 5
to Jali, PiDP-10
You’re very welcome!

On Aug 5, 2025, at 06:37, Jali <jali...@gmail.com> wrote:

Hi Eric,
Reply all
Reply to author
Forward
0 new messages