Serverless, ReactPHP, and Expanding Frontiers, May 2019

(singke) #1
http://www.phparch.com \ May 2019 \ 35

Memory Abstractions


Internal Apparatus


Adventure pioneered the three-part
structure which became typical:


  1. The prologue is the above-ground
    region of the game, played at ease,
    leading to the sense of foreboding
    and claustrophobia found in the
    upcoming bulk of the game.

  2. The transition is the middle game,
    the passage from the mundane to
    pure fantasy.

  3. The end game or master game pres-
    ents the final puzzle or challenge.
    Skip forward to 1986. The original
    Nintendo Entertainment System^7 was
    just being introduced. The Legend of
    Zelda would appear the following year.
    I’d never heard of Nintendo, but I’d
    played and solved Zork^8 in addition to
    Adventure.


Text games, to be sure, are not as
interesting as video games. They’re
deterministic. You only need to solve
the game once. But it’s 1986, and I’m
in the midst of a text-based adven-
ture, and about to deal with memory
management.
Cray Research was building main-
frame computers. There were so few
in existence that customers sent their
programmers to Cray Research to learn
how to program the thing. There were
no other options. The months-long
training sequence optionally included
the operating system internals.
Figure 2 is a listing of (part of ) the
operating system’s memory allocation
function, and there’s a possible bug in
the code. We can learn something from
that bug, even though the source code
is CRAY-1 assembly language!
Focus on the comments. They begin
with * in the left column.
Note the comment at line A0255.975:

Verify that the requested size is not
larger than the pool

7 Nintendo Entertainment System:
https://phpa.me/wikip-history-nintendo
8 Zork: https://en.wikipedia.org/wiki/Zork

Figure 1

Figure 2. Operating System Listing
Free download pdf