[Info-vax] iomacs.mlb
George Cornelius
cornelius at eisner.decus.org
Wed Jan 30 18:24:50 EST 2019
In article <q2s3d9$1fqs$1 at gioia.aioe.org>, GC <cornelius at eisner.decus.org.INVALID> writes:
More information:
> .macro print_literal a1,f1,f2,f3,?tmp,?tmpx
> .save_psect
> .psect i__data
> .align quad
> tmp:
> .ascid \a1\
> .restore_psect
> pushal tmp
> calls #1,lib$put_output
> blbs r0,tmpx
> $exit_s
> tmpx:
> .endm
This can be done via the second macro as well but is
an easier example to understand. It has one argument,
a string literal to be printed. f1-3 are placeholders
and aren't for actual arguments. Ditto for the ?x
parameters, which are dummy variables and will be
autoassigned nnn$ variable names unless overidden
by supplying your own names (not suggested).
Example:
print_literal <Begin Program>
> .macro print_fao lit,a1,a2,a3,a4,a5,a6,a7,a8,a9,?tmpa,?tmpb,?tmpw,?tmpx
> .save_psect
> .psect i__data
> .align quad
> tmpa:
> .long p_f_bufsiz
> .address tmpa+8
> ;.blkb p_f_bufsiz
> .align quad
> tmpb:
> .ascid \lit\
> .restore_psect
> subl #p_f_bufsiz,sp
> movl sp,tmpa+4
> movl tmpb,tmpa
> movw #p_f_bufsiz,tmpa
> $fao_s tmpb,tmpa,tmpa,a1,a2,a3,a4,a5,a6,a7,a8,a9
> blbc r0,tmpw
> pushal tmpa
> calls #1,lib$put_output
> blbs r0,tmpx
> tmpw:
> $exit_s
> tmpx:
> addl #p_f_bufsiz,sp
> .endm
This one executes an $fao_s using a literal format
(control) string and up to 9 items to be formatted
per that string. The ?x arguments are as before
and you would want to leave those null.
Example:
.print_fao <!UW !UW>,x,y ; Print words x,y as unsigned decimal
> Sorry, Brian, no variable length strings in this one - stuck
> with what I knew.
print_fao allocates space on the stack for the output
of the fao call, then removes it afterwards. tmpa and
tmpb are output and input descriptors. Note that
initialization of tmpa is present but overwritten later.
It's just there, along with the unused .blkb directive,
to demonstrate how you might do it without having a
stack-based output buffer.
Finally, the low word of tmpa is both an input and
output of the $fao_s directive and, while it has always
worked in the past, might in some future implementation
cause an issue. You could allocate a clone of tmpa for
your final output descriptor if you had reservations.
George
More information about the Info-vax
mailing list