Task

Produce a sequential count in octal,   starting at zero,   and using an increment of a one for each consecutive number.

Each number should appear on a single line,   and the program should count until terminated,   or until the maximum value of the numeric type in use is reached.



Related task

   Integer sequence   is a similar task without the use of octal numbers.


 
title  OCTAL - Count in octal.
subttl PDP-10 assembly (MACRO-10 on TOPS-20). KJX 2022.
search monsym,macsym
 
comment \
        If you want to see the overflow happening without waiting for
        too long, change "movei b,1" to "move b,[377777,,777770]".
        \
 
a=:1                                            ;Names for accumulators.
b=:2
c=:3
 
define crlf <tmsg <
>>                                              ;Macro to print newline.
 
start:: reset%                                  ;Initialize process.
        movei b,1                               ;B is the counter.
        movei c,^d8                             ;Octal output (nout%).
        do.
           movei a,.priou                       ;Use standard-output (nout%).
           nout%                                ;Print number in B.
              jrst [ tmsg <Output error.>       ;   NOUT can fail, print err-msg
                     jrst endprg ]              ;   and stop in that case.
           crlf                                 ;Print newline.
           aos b                                ;Add one to B.
           jfcl 10,[ tmsg <Arithmetic Overflow (AROV).> ;Handle overflow.
                     jrst endprg ]
           loop.                                ;Do again.
        enddo.
 
endprg: haltf%                                  ;Halt program.
        jrst start                              ;Allow continue-command.
 
end start
 