Print the word size and endianness of the host machine.

See also: Variable size/Get

 
title  Host Introspection
subttl PDP-10 assembly (MACRO-10 on TOPS-20). KJX 2022.
search monsym,macsym
 
comment \
        The wordsize is detected by putting 1 into a re-
        gister, counting the leading zeros (resulting in
        wordsize-1) and adding 1 to the result.
 
        Endianness doesn't really apply, as the PDP-10 is
        a 36bit word-adressable computer, and the handling
        of characters is peculiar enough that it would get
        out of hand if I'd dive into the details here.
        \
 
a=:1                            ;Define three accumulators.
b=:2
c=:3
 
start:: reset%                  ;Initialize process.
 
        movei a,1               ;Set A to 1.
        jffo a,.+1              ;B = leading zeros of A.
        aos b                   ;Add 1 to B. -> wordsize.
 
        movei a,.priou          ;Print B on standard output
        movei c,^d10            ;in base 10.
        nout%
          jfcl
 
        haltf%                  ;Halt program.
        jrst start              ;Allow continue-command.
 
end start
 