ArticleslgStudy

science

Zero page

Zero page is a science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Zero page rather than just read about it. In short: The zero page or base page is the block of memory at the very beginning of a computer's address space; that is, the page whose starting address is zero. The size of a page depends on the context, and the significance of zero page memory versus higher addressed memory is highly dependent on machine architecture.

Key takeaways

  • Zero page belongs to science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Zero page to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Zero page from memory before moving on to harder problems.

Reference excerpt

The zero page or base page is the block of memory at the very beginning of a computer's address space; that is, the page whose starting address is zero. The size of a page depends on the context, and the significance of zero page memory versus higher addressed memory is highly dependent on machine architecture. For example, the Motorola 6800 and MOS Technology 6502 processor families treat the first 256 bytes of memory specially, whereas many other processors do not. Unlike more modern hardware, in the 1970s computer RAM speed was similar to that of CPUs. Thus it made sense to have few registers and use the main memory as an extended pool of extra registers. In machines with a relatively wide 16-bit address bus and comparatively narrow 8-bit data bus, calculating an address in memory could take several cycles. The zero page's one-byte address was smaller and therefore faster to read and calculate than other locations, making the zero page useful for high-performance code. Zero page addressing now has mostly historical significance, since the developments in integrated circuit technology have made adding more registers to a CPU less expensive and CPU operations much faster than RAM accesses.

Size The actual size of the zero page in bytes is determined by the microprocessor design and in older designs, is often equal to the largest value that can be referenced by the processor's indexing registers. For example, the aforementioned 8-bit processors have 8-bit index registers and a page size of 256 bytes. Therefore, their zero page extends from address 0 to address 255.

Computers with few CPU registers In early computers, such as the PDP-8, the zero page had a special fast addressing mode, which facilitated its use for temporary storage of data and compensated for the paucity of CPU registers. The PDP-8 had only one register, so zero page addressing was essential. In the original PDP-10 KA-10 models, the available registers are simply the first 16 words, 36-bits long, of main memory. Those locations can be accessed as both registers and memory locations. Unlike more modern hardware, 1970s-era computer RAM was as fast as the CPU. Thus, it made sense to have few registers and use the main memory as an extended pool of extra registers. In machines with a 16-bit address bus and 8-bit data bus, accessing zero page locations could be faster than accessing other locations. Since zero page locations could be addressed by a single byte, the instructions accessing them could be shorter and hence faster-loading. For example, the MOS Technology 6502 family has only one general purpose register: the accumulator. To offset this limitation and gain a performance advantage, the 6502 is designed to make special use of the zero page, providing instructions whose operands are eight bits, instead of 16, thus requiring fewer memory fetch cycles. Many instructions are coded differently for zero page and non-zero page addresses; this is called zero-page addressing in 6502 terminology (it is called direct addressing in Motorola 6800 terminology; the Western Design Center 65C816 also refers to zero page addressing as direct page addressing):

In 6502 assembly language, the above two instructions both accomplish the same thing: they load the value of memory location $12 into the .A (accumulator) register ($ is Motorola/MOS Technology assembly language notation for a hexadecimal number). However, the first instruction is only two bytes long and requires three clock cycles to complete. The second instruction is three bytes in length and requires four clock cycles to execute. This difference in execution time could become significant in repetitive code. Some processors, such as the Motorola 6809 and the aforementioned WDC 65C816, implement a “direct page register” (DP) that tells the processor the starting address in RAM of what is considered to be zero page. In this context, zero page addressing is notional; the actual access would not be to the physical zero page if DP is loaded with some address other than $00 (or $0000 in the case of the 65C816).

Interrupt vectors Some computer architectures still reserve the beginning of address space for other purposes, though; for instance, Intel x86 systems reserve the first 256 double-words of address space for the interrupt vector table (IVT) if they run in real mode. A similar technique of using the zero page for hardware related vectors was employed in the ARM architecture. In badly written programs this could lead to "ofla" behaviour, where a program tries to read information from an unintended memory area, and treats executable code as data or vice versa. This is especially problematic if the zero page area is used to store system jump vectors and the firmware is tricked into overwriting them.

CP/M

In 8-bit CP/M, the zero page is used for communication between the running program and the operating system.

Page addressing In some processor architectures, like that of the Intel 4004 4-bit processor, memory was divided into (256 byte) pages and special precautions had to be taken when the control flow crossed page boundaries, as some machine instructions exhibited different behaviour if located in the last few instructions of a page, so that only few instructions were recommended to jump between pages.

Null pointers Contrary to the zero page's original preferential use, some modern operating systems such as FreeBSD, Linux, Solaris, macOS, and Microsoft Windows actually make the zero page inaccessible to trap uses of null pointers. Such pointer values may legitimately indicate uninitialized values or sentinel nodes, but they do not point to valid objects. Buggy code may try to access an object via a null pointer, and this can be trapped at the operating system level as a memory access violation. By making invalid the whole page, instead of just the singular zero-valued null pointer, the Operating System can trap on code that, for example, has a null pointer pointing to a structure, and accesses a member of the structure at an offset from the null pointer.

See also Low memory – the first 64 KB of memory (segment 0) in DOS Page boundary relocation

References

… excerpt ends here. Continue reading the full article.

Worked examples

Example 1 — a first encounter with Zero page

Start with the simplest possible case. Write down what Zero page claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Zero page before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Zero page ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Zero page

In research
Zero page appears in science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Zero page in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Zero page is common in secondary-school and first-year university syllabi. It links to neighbouring topics Memory management, so understanding it makes those chapters shorter.
In everyday life
Look for Zero page outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Zero page” →

How to study Zero page in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Zero page means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Zero page out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Zero page in simple terms?

The zero page or base page is the block of memory at the very beginning of a computer's address space; that is, the page whose starting address is zero. The size of a page depends on the context, and the significance of zero page memory versus higher addressed memory is highly dependent on machine…

Why does Zero page matter?

Because it connects several science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Zero page?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Zero page.

Tags

  • Memory management

Keep exploring