MACRO-11 - Programming Example

Programming Example

A complete "Hello, world!" program in PDP-11 macro assembler, to run under RT-11:

.TITLE HELLO WORLD .MCALL .TTYOUT,.EXIT HELLO:: MOV #MSG,R1 ;STARTING ADDRESS OF STRING 1$: MOVB (R1)+,R0 ;FETCH NEXT CHARACTER BEQ DONE ;IF ZERO, EXIT LOOP .TTYOUT ;OTHERWISE PRINT IT BR 1$ ;REPEAT LOOP DONE: .EXIT MSG: .ASCIZ /Hello, world!/ .END HELLO

If this file is HELLO.MAC, the RT-11 commands to assemble, link and run (with console output shown) are as follows:

.MACRO HELLO ERRORS DETECTED: 0 .LINK HELLO .R HELLO Hello, world! .

(The RT-11 command prompt is ".")

For a more complicated example of MACRO-11 code, two examples chosen at random are Kevin Murrell's KPUN.MAC, or Farba Research's JULIAN routine. More extensive libraries of PDP-11 code can be found in the Metalab freeware and Trailing Edge archives.

Read more about this topic:  MACRO-11

Famous quotes containing the word programming:

    If there is a price to pay for the privilege of spending the early years of child rearing in the driver’s seat, it is our reluctance, our inability, to tolerate being demoted to the backseat. Spurred by our success in programming our children during the preschool years, we may find it difficult to forgo in later states the level of control that once afforded us so much satisfaction.
    Melinda M. Marshall (20th century)