Classic Computer Magazine Archive COMPUTE! ISSUE 9 / FEBRUARY 1981 / PAGE 116

Machine Language Printer Command

Zoltan Szepesi
Pittsburgh, PA

While working on a Machine Language program, it could be advantageous to be able to give a command to the printer in ML instead of going back to BASIC and returning to the Monitor or to some other ML program.

The program, which follows, substitutes the BASIC command:

OPEN4, 4 : CMD4

and at the end:

PRINT #4 : CLOSE 4

The program can be loaded anywhere there are 20 bytes free address. Starting at $XXXX:

xxxx
START      A9 04 LDA -$04 File and device number
           85 B0 STA z$B0 The output to CMD is in $B0
           85 D4 STA z$D4 The device number is in $D4
           20 BA
           F0    JSR OPEN IEEE
           20 2D
           F1    JSR TEST IEEE
           20 D2
           FF    JSR WRT
           00    BRK
XX(X + 1)X 4C CC
           FF    JMP RESTORE I/O
           00    BRK

When we want to start the printer, we have to type: .G XXXX (or working with some other program, e.g. Moser's Assembler, print: RUN $XXXX), and to close the printer we have to type: .G XX(X + 1)X.

The screen does not show what the printer prints, but we can give the necessary commands through the keyboard as if the printed text would be on the screen. This way we can continually print out the dumping of a complete ML program or the Assmelbe List.