Assembling and running LIGHT

"Light.mac" is a program to be run in kernel mode, stand-alone and without any monitor support. No TOPS-10 is needed, no disks need be attached. 
LIGHTS shows a moving light pattern on the KI10 console.
We translate it as regular user under TOPS-10. To run it, we use another PDP-10-SimH with KI10 panel and key it in manually.

By the way: here's the MACRO10 manual.

Under TOPS-10 there's a nice "COMPILE"  command, which is "make" and "macro" all in one, and recognizes the programming language semi-automatically.
But we use the interactive mode of the macro assembler.

First prepare for the width listings to follow:
   .set tty width 132
Then:
  .r macro
  *

The "*" is the MACRO command prompt. To exit, press ^C.

Create listings in "instruction" format for the console

To assemble and produce just a listing in "instruction" format, use this command:
* ,tty: = light/L

001000                                  loc     1000
001000                          main:
001000  201 00 0 00 000777         movei    0,777    ; acc0 is shiftedpattern
001001  241 00 0 00 000001         rot        0,1    ; acc0 <<= 1
         .....
        |   |  | |  |            Instructions are shown with separated operand fields:
        |   |  | |  address
        |   |  | index
        |   |  indirection
        |   accumulator
        opcode


The "instruction" format is the default. It is is just right if the program is to be entered over the console panel: there LEDs and buttons are also labled with the instruction fields.

macro10 lights

Listings in "half word" format for SimH

Assemble and produce a listing in "halfword" format:
* ,tty:=light/L/G
001000                          loc     1000
001000                  start:
001000    201000    000777        movei    0,777    ; acc0 is shifted. pattern = 12 bits
001001            nxtbit:
001001    241000    000001        rot        0,1        ; acc0 <<= 1
   ...

This gives the instructions as octal 36bit words, which can be easily converted to SimH "DEPOSIT" commands:
sim> d 1000 201000000777
sim> d 1001 241000000001
...

If you want to save the listing into a file, use
* ,light=light/L/G
This creates a LIGHT.LST file which can be read back with KERMIT.

The full listings are found in the attachements. Start a PDP-10 with attached KI10 panel, convert LIGHT2.LST to "deposit" commands and let it run:

simh light

Or DEPOSIT over the panel, set ADDRESS SWITCHES = 1000 and press START!

pdp10 ki10 lights program

 

Expercise to the reader:

Experiment with different patterns and different speed setting!

 

HELLO

You've waited for it, here it is a "Hello world" program:

    ; "Hello world" program for PDP-10.
    ; by Angelo Papenhoff (http://a.papnet.eu)
    ;
    ; 33 is the location of the character that is to be transmitted
    ;    The lower 7 bits are the ASCII code, bit 8 (400) is the valid-bit


        loc    1000
main:
        movei    1,hello        ; acc1 = string
        movei    2,400        ; acc2 = valid bit
next:   move     0,(1)        ; acc0 = m[acc1]
        jumpe    0,end        ; if (acc0 == 0) goto end // 0 = end of string
        movem    0,33        ; m[33] = acc0    // next ASCII char to be written
        iorm     2,33        ; m[33] |= 400  // make it valid
        ; start transmission (10000 = set flags, 2000 = interrupt flag)
        cono     apr,12000
test:   skipe    0,33        ; if (m[33] == 0) skip next instruction
        jumpa    0,test        ; // loop back until transmission complete
        addi     1,1        ; acc1 += 1 // point to next char
        jumpa    next        ; // transmit next char
end:    halt            ;

    loc    1020
hello:
    110            ; H
    145            ; e
    154            ; l
    154            ; l
    157            ; o
    054            ; ,
    040            ;
    127            ; W
    157            ; o
    162            ; r
    154            ; l
    144            ; d
    041            ; !
    012            ; LF
    015            ; CR
    000

    end

Unlike all "Hello world" programs found for MACRO10, this one does not use any "monitor call" macros to print the text. It runs on "bare metal", without TOPS-10 services.

(Please ask Angelo what the meaning of "m[33]" is !)

Listings are again in the attachement. You convert HELLO2.LST to "deposit" instructions and let it run:

simh hello

Voilà !

 

LIGHT1.LST -- \\\"Running light\\\" program listing in \\\"instruction\\\" format

LIGHT2.LST -- \\\"Running light\\\" program listing in \\\"half word\\\" format

HELLO1.LST -- \\\"Hello world\\\" program listing in \\\"instruction\\\" format

HELLO2.LST -- \\\"Hello world\\\" program listing in \\\"half word\\\" format