     1 000000           ; > MemSize works out memory size, then prints result in octal
     2 000000           ;   Fills memory with zeros until it hits non-existent memory
     3 000000           ;   Prints result on console.  Works on KF-11, KDF-11, KDJ-11 systems.
     4 000000           ;
     5 000000                   ORG     O1000
     6 001000 012706            MOV     #O1000,R6       ; init stack
     6 001002 001000    
     7 001004 012737            MOV     #VEC,@#4        ; set bus timeout trap vector at loc'n 4
     7 001006 001030    
     7 001010 000004    
     8 001012 005037            CLR     @#6             ; set new PSW for use in trap routine
     8 001014 000006    
     9 001016 012705            MOV     #O2000,R5       ; start at 1st 1K boundary
     9 001020 002000    
    10 001022 005115    LOOP:   COM     (R5)            ; read/modify/write location
    11 001024 005125            COM     (R5)+           ; restore original
    12 001026 000775            BR      LOOP            ; only break out on bus time-out
    13 001030 005305    VEC:    DEC     R5              ; point down to true top
    14 001032 005305            DEC     R5
    15 001034 004537            JSR     R5,@#PRTA       ; print following text
    15 001036 001160    
    16 001040 000015            DEF     13              ; <CR>
    17 001042 100012            DEF     10 OR &8000     ; <LF> with top bit set to mark endoftext
    18 001044 012704            MOV     #O30,R4         ; R4 will be 6x after shifts
    18 001046 000030    
    19 001050 006105            ROL     R5              ; rotate 1 bit from R5 to R4
    20 001052 006104            ROL     R4
    21 001054 004737            JSR     R7,@#PRTN       ; print - as ASCII since it's 6x
    21 001056 001144    
    22 001060 012700            MOV     #5,R0           ; set to do five octets
    22 001062 000005    
    23 001064 012704    CLOOP:  MOV     #6,R4           ; shifted 3 times, becomes octal 60, ie "0"
    23 001066 000006    
    24 001070 006105            ROL     R5              ; rotate R5>R4: 3 bits of octal number
    25 001072 006104            ROL     R4              ; could use ASHC R4,#3 if we have EIS
    26 001074 006105            ROL     R5
    27 001076 006104            ROL     R4
    28 001100 006105            ROL     R5
    29 001102 006104            ROL     R4
    30 001104 004737            JSR     R7,@#PRTN       ; print a digit
    30 001106 001144    
    31 001110 005300            DEC     R0              ; one less digit to do
    32 001112 001364            BNE     CLOOP
    33 001114 000000    HALT:   HALT                    ; stop when done
    34 001116 004537            JSR     R5,@#PRTA       ; if restarting, say "Can't"
    34 001120 001160    
    35 001122 000040            DEF     32              ; ASCII space
    36 001124 000103            DEF     ASC("C")
    37 001126 000141            DEF     ASC("a")
    38 001130 000156            DEF     ASC("n")
    39 001132 000047            DEF     ASC("'")
    40 001134 000164            DEF     ASC("t")
    41 001136 000015            DEF     13
    42 001140 100012            DEF     &800A           ; finish with <CR><LF>
    43 001142 000764            BR      HALT
    44 001144 105737    PRTN:   TSTB    @#O177564       ; look for RDY bit in CSR
    44 001146 177564    
    45 001150 100375            BPL     PRTN
    46 001152 010437            MOV     R4,@#O177566    ; send char to TX buffer
    46 001154 177566    
    47 001156 000207            RTS     R7
    48 001160 011504    PRTA:   MOV     (R5),R4         ; get char just past where we were
    49 001162 004737            JSR     R7,@#PRTN       ; print it
    49 001164 001144    
    50 001166 005725            TST     (R5)+           ; see if it was last, and point to next
    51 001170 100373            BPL     PRTA            ; top bit set = finished
    52 001172 000205            RTS     R5
