.TITLE FirstName Find first name and print message ; Program to get and print a name using library I/O subroutines ; ...... Define constant and declare external procedures ...... Blank = ^A" " .EXTERNAL Lib$Get_Input, Lib$Put_Output ; ...... Define a macro ...... .MACRO DynamicStringDesc .BLKW 1 ; Save room for length .BYTE 14 ; Signifies character string .BYTE 2 ; Dynamic, variable length string .BLKL 1 ; Save room for address .ENDM DynamicStringDesc ; ...... Define descriptors ...... Question: .ASCID "Please enter your name, last name first: " Name: DynamicStringDesc ; Descriptor for user's name Response: .ASCID "Hello, xxxxxxxxxxxx" ; ...... Set up argument list for CALLG ...... ArgList: .LONG 1 ; One argument .ADDRESS Response ; Points to argument ; .......... Beginning of executable code .......... .ENTRY NameIO, 0 ; ...... Use Lib$Get_Input to get user's name ...... GetName: PUSHAL Question ; Prompt for name PUSHAL Name ; Input name CALLS #2, G^Lib$Get_Input ; ...... Find the user's first name ...... FindName: SKPC #Blank, Name, @Name+4 ; Find first nonblank LOCC #Blank, R0, (R1) ; Find end of last name SKPC #Blank, R0, (R1) ; Find beginning of first name MOVW R0, R6 ; Save remaining length MOVL R1, R7 ; and address LOCC #Blank, R0, (R1) ; Find end of first name SUBW2 R0, R6 ; Find length of name ; ...... Move and output the user's first name ...... MoveName: MOVC5 R6, (R7), #Blank, #12, Response+15 SayHello: CALLG ArgList, G^Lib$Put_Output ; ...... Terminate run ...... $EXIT_S .END NameIO