0% found this document useful (0 votes)
55 views1 page

A First Example: PUTC

This document describes a simple macro called PUTC that outputs a character to a device. The macro stores the character in a register, loads it, and jumps to a loop that transfers the character to the device register and jumps back until complete. If the assembler supports macros in this format, PUTC can be used like an instruction in programs and expanded by the preprocessor anywhere its op code appears.

Uploaded by

Mohamed Med
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
55 views1 page

A First Example: PUTC

This document describes a simple macro called PUTC that outputs a character to a device. The macro stores the character in a register, loads it, and jumps to a loop that transfers the character to the device register and jumps back until complete. If the assembler supports macros in this format, PUTC can be used like an instruction in programs and expanded by the preprocessor anywhere its op code appears.

Uploaded by

Mohamed Med
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

A First Example: PUTC

Consider the following simple definition of a macro for the output of


a character:

MACRO
&INIT PUTC &CHAR, &DEV
&INIT STA PUTCSAVE
LDCH &CHAR
J PUTCLOOP
PUTCSAVE RESW 1
PUTCLOOP TD &DEV
JEQ PUTCLOOP
WD &DEV
LDA PUTCSAVE
MEND

If our assembler comes with a macro facility for handling this format,
then PUTC can be used in a program in the same manner as an
instruction. In particular, if the definition of PUTC is in the macro
library or included “in-line” in the assembly code, then the
preprocessor will be able to expand any statement whose op code is
PUTC.

You might also like