Motorola M68000 Betriebsanweisung Seite 63

  • Herunterladen
  • Zu meinen Handbüchern hinzufügen
  • Drucken
  • Seite
    / 256
  • Inhaltsverzeichnis
  • LESEZEICHEN
  • Bewertet. / 5. Basierend auf Kundenbewertungen
Seitenansicht 62
Getting Started 49
5. PUTCOutput a single character to the screen. The character is
taken from the low-order eight bits of register DO.
In order to use these procedures within your program, a special in
struction, JSR (jump to subroutine) is provided in the 68000 instruction
set. The exact operation of this instruction, and of subroutines in gen
eral, will be discussed in Chapter 8. The mnemonic JSR is followed by
the symbol representing the subroutines name. For now, assume that
when you use the JSR instruction, the program performs the operations
specified by the subroutine that is called, and then continues on to the
next instruction. The following program excerpt will obtain two num
bers from your keyboard, add them together, and then output the result
to your screen:
JSR
INDEC
JSR
NEWLINE
MOVE.L D0,D1
JSR
INDEC
JSR
NEWLINE
ADD.L
D1,D0
JSR OUTDEC
JSR NEWLINE
Notice that the third instruction is used to save the contents of the DO
register so that the second JSR instruction to INDEC does not destroy
the first number to be added. Other than the DO register that is used with
the INDEC procedure, the input/output procedures given above do not
destroy the contents of any of the 68000 registers. The JSR to NEWLINE
ensures the advance to the beginning of a new line after each number
is input and after the result is output. A call to NEWLINE is required
even if you terminate the number you enter with a carriage return. A line
feed must be output to advance to the beginning of the next” line. The
carriage return only positions you at the beginning of the current” line.
The Program Shell
For the writing of a complete program, certain assembler directives
and standard code sequences are needed for each different assembler
and operating system. This program shell will enclose each program. So
that we dont have to depend on one particular assembler or operating
system, we will not include this program code for each program pre
sented. Appendix B shows an appropriate program shell for the Atari ST,
Commodore Amiga, and Apple Macintosh.
Note that the shell is terminated by an appropriate mechanism to re
turn control to the operating system. The 68000 does have a halt instruc
Seitenansicht 62
1 2 ... 58 59 60 61 62 63 64 65 66 67 68 ... 255 256

Kommentare zu diesen Handbüchern

Keine Kommentare