13.07.2015 Views

apple-pascal-1.3-manual

apple-pascal-1.3-manual

apple-pascal-1.3-manual

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

The previous chapter discussed the static structure of program codefiles ondisk and in memory. This chapter discusses the dynamic structure ofprogram code as it is being executed in memory.The Apple Pascal pseudomachine or P-machine, a version of the UCSDPascal P-machine, is the software-generated device that executes P-code asits machine language. Every computer operating under a form of UCSDPascal has been programmed to "look like" this common P-machine, or arelated variant, from the viewpoint of a program being executed. TheP-machine has an evaluation stack, several registers, and a usermemory. The user memory contains the program stack and the heap.These memory structures are described in Chapter 1. They are discussed indetail below.The P-machine supportso Variable addressing, including strings, byte arrays, packed fields, anddynamic variables;o Logical, integer, real, set, array, and string, top-of-stack arithmetic andcomparisons;o Multi-element structure comparisons;o Branches;o Procedure and function calls and returns, including overlayableprocedures;o Miscellaneous procedures used by system and user programs.The P-machine uses 16-bit words, with two 8-bit bytes per word. Wordsconsist of two bytes, of which the lower, even-address byte is leastsignificant. See Figure 3-1. The least significant bit of a word is bit 0, themost significant is bit 15.Figure 3-1. Relationship of Words and Byteshigher, odd addresseslower, even addressesbit: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 0one wordIV-46Chapter 3: The P-Machine

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!