 |
|
| |
|
 |
 |
at Global Oneness Community.
Share your dreams and let others help you with the interpretation!
Dream Sharing Forum
|
 |
PDP-8 - Subroutines on the PDP-8 |  | PDP-8 - Subroutines on the PDP-8: Encyclopedia II - PDP-8 - Subroutines on the PDP-8 |  | The PDP-8 did not implement any general-purpose stack so there was no stack upon which to store the PC, AC, or any other context when a subroutine was called or an interrupt occurred. Instead, the updated PC simply replaced the first word of the targeted subroutine. An indirect JMP instruction was then used to exit from the subroutine.
For example, here is "Hello, World!" re-written to use a subroutine:
*200 / Set assembly origin (load address)
HELLO, CLA CLL / Clear the AC and the Link bit ...
See also:PDP-8, PDP-8 - Description, PDP-8 - Versions of the PDP-8, PDP-8 - Input/Output, PDP-8 - Programming facilities, PDP-8 - Instruction set, PDP-8 - Example program, PDP-8 - Subroutines on the PDP-8, PDP-8 - Interrupts |  | | PDP-8, PDP-8 - Description, PDP-8 - Example program, PDP-8 - Input/Output, PDP-8 - Instruction set, PDP-8 - Interrupts, PDP-8 - Programming facilities, PDP-8 - Subroutines on the PDP-8, PDP-8 - Versions of the PDP-8 |  | |
|  |  | PDP-8: Encyclopedia II - PDP-8 - Subroutines on the PDP-8
PDP-8 - Subroutines on the PDP-8
The PDP-8 did not implement any general-purpose stack so there was no stack upon which to store the PC, AC, or any other context when a subroutine was called or an interrupt occurred. Instead, the updated PC simply replaced the first word of the targeted subroutine. An indirect JMP instruction was then used to exit from the subroutine.
For example, here is "Hello, World!" re-written to use a subroutine:
*200 / Set assembly origin (load address)
HELLO, CLA CLL / Clear the AC and the Link bit
TAD (DATA-1) / Point AC just *BEFORE* the data (accounting for later pre-increment behavior)
DCA 10 / Put that into one of ten auto-pre-increment memory locations
LOOP, TAD I 10 / Pre-increment mem location 10, fetch indirect to get the next character of our message
SNA / Skip on non-zero AC
HLT / Else halt at end of message
JMS OUT1 / Write out one character
JMP LOOP / And loop back for more
OUT1, 0 / Will be replaced by caller's updated PC
TSF / Skip if printer ready
JMP .-1 / Wait for flag
TLS / Send the character in the AC
CLA CLL / Clear AC and Link for next pass
JMP I OUT1 / Return to caller
DATA, "H / A well-known message
"e /
"l / NOTE:
"l /
"o / Strings in PAL-8 and PAL-III were "sixbit"
", / To use ASCII, we'll have to spell that out, character by character
" /
"w /
"o /
"r /
"l /
"d /
"! /
015 /
012 /
0 / Mark the end of our .ASCIZ string ('cause .ASCIZ hadn't been invented yet!)
This dedicated storage for the return address made the use of reentrancy and recursion difficult because the programmer would have needed to explicitly store away the return address onto a programmer-maintained stack. It also made it difficult to use ROM with the PDP-8 because read-write return-address storage was commingled with read-only code storage in the address space. Programs intended to be placed into ROMs approached this problem in several ways:
- They avoided the use of subroutines,
- They copied themselves to core memory before execution, or
- They were placed into special ROM cards that provided a few words of read/write memory, accessed indirectly through the use of a thirteenth flag bit in each ROM word.
Other related archives1960s, ALU, BASIC, CMOS, DECUS, DIBOL, DMA, Digital Equipment Corporation (DEC), FOCAL, FORTRAN, FPGA, Hello, world!, I/O, IDE, K, MIPS, MSI, NOP, OR, OS/8, PAL-8, PAL-III, PC, PDP, ROM, RS-232, RTOS, TTL, accumulator, assembled, assembly language, backplane, binary, cache memories, compiler, context, current loop, cycle time, editor, fixed-head disks, floppy disks, instructions, interrupt, kilobytes, machine code, magnetic core memory, magnetic tape, main memory, microprocessors, microseconds, minicomputer, moving-head cartridge disk, operating system, paper-tape, preemptive multitasking, punched card, recursion, reentrancy, registers, source code, stack, subroutine, system on a chip, teletype, terminals, transistor, words
 Adapted from the Wikipedia article "Subroutines on the PDP-8", under the G.N U Free Docmentation License. Please also see http://en.wikipedia.org/wiki |
|
|
More material related to Pdp-8 can be found here:
|
|
« Back
|
Search the Global Oneness web site |
|
|
|
|
 |
Sneak-Peek of Global Oneness Community
Hi friend! The Global Oneness Community, the place for information and sharing about Oneness is not really launched yet (you will see there is still some clean up to do) ...but it is now open for a sneak-peek! And if you wish - please register and become one of the very first members to do so! Jonas
Forum Home,
Articles,
Photo Gallery,
Videos,
News,
Sitemap
...and much more!
|