
The MACRO class was much more interesting. MACRO is a computer language of sorts. In languages like FORTRAN and BASIC, you have commands like PRINT or LET, each of which causes a series of machine instructions to be executed. The PRINT command, for example, causes several hundred to several thousand instructions to be executed.
In MACRO, you code each machine instruction individually. So to PRINT something, you have to write hundreds of commands. Fortunately, you can create libraries of these sets of instructions, so you don’t have to rewrite those lines of code each time you want to print something.
You can do just about anything in MACRO, which is one of the things that appealed to me. Also, because MACRO is much closer to the machine, I learned quite a bit more about programming and hardware concepts than I did with FORTRAN or BASIC.
Rick was my MACRO teacher. He is a very imposing man … in stocking feet Rick stood six feet, eleven inches tall. He towered over everyone, and his booming, cheerful voice could be easy heard throughout the class.
Rick was a fascinating teacher. He basically taught one class a week in order to make some extra money while he was starting a new company. At the time, he called this company Systems Associates - he later renamed it to Software Techniques.
Before he was a teacher, Rick worked for Digital Equipment Corporation as a service representative. This meant when a customer had a program with a DEC machine, Rick was called to help them out. He was considered one of the best people in the department by just about everyone, including his direct supervisor, a man named Mike M.
Apparently Rick felt stifled at DEC, and decided to leave the company. He was well prepared - he walked out with a dozen or so customers. These customers were loyal to him, not DEC, not only because he was a good programmer, but because he could talk anyone into anything.
Rick’s lectures were great - he absolutely loved to talk. He could talk for hours and hours about practically anything, especially himself. He was very good at spicing up a dull lecture with personal anecdotes and remembrances.
The small program below is the first MACRO program that I wrote. All it does is load some numbers into memory and die with an error. The error just happens to print out the values previously placed in the memory locations.
.TITLE RICHARD LOWE, JR. .LIST TTM START: MOV #3, R0 MOV #4, R1 ADD R0, R1 HALT .END START
This is the second MACRO program that I wrote. It is similar to the first, except that it adds a bunch of numbers together. After that, it dies, printing the numbers out.
.TITLE RGL02 RICHARD G. LOWE, JR. .PSECT RGL02 .LIST TTM START: MOV #TABLE,R0 CLR R1 ;INITIALIZE R1 AGAIN: ADD (R0)+,R1 TST (R0) BNE AGAIN CALL REGDMP EMT 46 TABLE: .WORD 10. .WORD 17. .WORD 5 .WORD 0 .END START
.TITLE RGLO3 MACHINE CODES FOR 41 .=. + 500 MOV R0,R1 MOV (R0)+,R1 MOV -(R0),R1 MOV 100(R0),R1 MOV #100,R1 MOV 100,R1 MOV (R0),R1 MOV @(R0)+,R1 MOV @-(R0),R1 MOV @100(R0),R1 MOV @#100,R1
.TITLE RGL04 MULTIECHO .PSECT RGL04 ; ; THIS PROGRAM WAS COPY-TYPED FROM THE BOOK. ; IT WILL ECHO EACH TYPED IN CHARACTER N TIMES. USE CIRCULAR ; BUFFER OF 64 (DECIIMAL) BYTES FOR STORING AWAITING CHARACTERS. ; LC=. .=4+LC .WORD 6,0,12,0 .=500+LC START: MOV PC,SP ; TST -(SP) ; INITIALIZE SP TO START ; KBSTAT=177560 KBDATA=177562 PRSTAT=177564 PRDATA=177566 ; CLR R0 ; INITIALIZE BUFFER INPUT POINTER CLR R1 ; INITIALIZE BUFFER OUTPUT POINTER CLR R2 ; INITIALIZE REPITITION COUNT LOOP: TSTB KBSTAT ; CHARACTER ENTERED? BPL ECHO MOVB KBDATA,BUFFER(R0) ; IF NOT, KEEP ECHOING INC R0 BIC #177700,R0 ; ZERO R0 IF > 77 ECHO: TST R2 ; IF MULTIPLE ECHO TERMINATES, BEQ NEXT ; PREPARE FOR NEXT OUTPUT CHARACTER TSTB PRSTAT ; OTHERWISE PRINTER IS READY. BPL LOOP ; IF NOT, ACCEPT NEXT CHARACTER. MOVB BUFFER(R1),PRDATA ; IF SO, ECHO NEXT CHARACTER. DEC R2 ; (R2) = (R2) - 1 BNE LOOP ; IF (R2) <> 0, ACCEPT NEXT CHARACTER. INC R1 ; ELSE, (R1) = (R1) + 1 BIC #177700,R1 ; ZERO R1 IF > 77 NEXT: CMP R0,R1 ; IF (R0) = (R1) (BUFFER EMPTY), BEQ LOOP ; ACCEPT NEXT CHARACTER MOV N,R2 ; (R2) = (N) (REPITITION COUNTER) BR LOOP ; ACCEPT NEXT CHARACTER N: .WORD 5 BUFFER: .BLKB 64. .END START EMT 46
.Title Error -- Error Handler Routines. .Psect Error .Ident "X001AM" .Enabl Lc .Dsabl Gbl .Globl Clrfqb .Globl Regdmp .Globl Print ; ; ; E R R O R ; ; ; Version X001AM ; ; Written By: Richard Gerald Lowe, Jr. ; Start Date: January 23, 1980 ; ; This module contains all of the subroutines to handle any ; recoverable errors. ; ; ; Error:: .Sbttl Routine -- Print error text from system default error file. ; ; ; Routine to print message from default error message file. ; ; This routine is entered if no errors have been trapped so far. They ; are all fatal, and the program exits to the default Run-Time system. ; ; Giveup: Movb Firqb,Temp ; Push error code onto stack. Jsr Pc, Clrfqb ; Clear out the firqb. Movb #Errfq, Firqb + Fqfun ; Error message function number Movb Temp, Firqb + Fqerno ; Put Error code into Firqb. Calfip ; Call the file Processor. Mov #Firqb+Fqerno, R0 ; Point R0 to beginning of text. Mov #14., R1 ; Set R1 for a maximum of 28. char. Mov #Buff, R3 ; Point R3 to buff. Clr R2 ; Set byte count to zero. 1$: Tst (R0) ; See if a character is here. Beq 2$ ; No more characters, than we are at end ; of error message text. Mov (R0)+,(R3)+ ; Put Word of text into buff. Inc (R2)+ ; Increment text counter for another word. Sob R1, 1$ ; Get next Character. 2$: Jsr R5, Print ; Well, lets write out error message text. .Word Buff ; Buffer position is in Firqb. .Byte 0 ; Channel 0 .Byte 0 ; Dummy variable. Mov #14., R2 ; Put length of fatal into R2 Jsr R5, Print ; Now, add the FATAL end of text. .Word Fatal ; Position of buffer .Byte 0 ; Channel is 0 .Byte 0 ; Dummy .Exit ; And, if we get here we cannot recover. Buff: .Blkb 30. ; Error message text is put here. Fatal: .Ascii " -- FATAL" <13.><10.><7.><13.><10.> Temp: .Blkb 1. ; Temporary holding box. .Even .end
; ; Routine to Input a string from KB: ; ; Written By: Richard G. Lowe ; ; This routine merely inputs a one line string from the terminal. ; .TITLE INPUT Input .PSECT INPUT Jsr PC,SETXRB ;Jump to routine to clear XRB Mov IBSIZ,(R0)+ ;put buffer size in XRB Tst (R0)+ ;Skip the byte count Mov #INBUF,(R0)+ ;Pointer to I/O Buffer .Read Rts Pc ;Return to calling program
Unless otherwise noted, all photos and text is Copyright © Richard G Lowe, Jr.