All Topics  
Zero page

 

   Email Print
   Bookmark   Link






 

Zero page



 
 
The zero page is the series of memory address
Memory address

In computer science, a memory address is an identifier for a computer memory location, at which a computer program or a hardware device can store a piece of data and later retrieve it....
es at the absolute beginning of a computer
Computer

A computer is a machine that manipulates Data according to a list of Code .The first devices that resemble modern computers date to the mid-20th century , although the computer concept and various machines similar to computers existed earlier....
's address space
Address space

In computing, an address space defines a range of discrete addresses, each of which may correspond to a physical or virtual memory register, a Node , peripheral device, disk sector or other logical or physical entity....
; 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 MOS Technology 6502 processor treats the first 256 byte
Byte

A byte is a basic unit of measurement of Computer storage in computer science. In many computer architectures it is a Byte addressing memory address space....
s of memory specially, whereas many other processors do not.

The actual size of zero page in bytes is determined by the microprocessor
Microprocessor

A microprocessor incorporates most or all of the functions of a central processing unit on a single integrated circuit . The first microprocessors emerged in the early 1970s and were used for electronic calculators, using Binary-coded decimal arithmetic on 4-bit Word ....
 design and in older designs, is often equal to the largest value that can be referenced by the processor's indexing registers.






Discussion
Ask a question about 'Zero page'
Start a new discussion about 'Zero page'
Answer questions from other users
Full Discussion Forum



Encyclopedia


The zero page is the series of memory address
Memory address

In computer science, a memory address is an identifier for a computer memory location, at which a computer program or a hardware device can store a piece of data and later retrieve it....
es at the absolute beginning of a computer
Computer

A computer is a machine that manipulates Data according to a list of Code .The first devices that resemble modern computers date to the mid-20th century , although the computer concept and various machines similar to computers existed earlier....
's address space
Address space

In computing, an address space defines a range of discrete addresses, each of which may correspond to a physical or virtual memory register, a Node , peripheral device, disk sector or other logical or physical entity....
; 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 MOS Technology 6502 processor treats the first 256 byte
Byte

A byte is a basic unit of measurement of Computer storage in computer science. In many computer architectures it is a Byte addressing memory address space....
s of memory specially, whereas many other processors do not.

The actual size of zero page in bytes is determined by the microprocessor
Microprocessor

A microprocessor incorporates most or all of the functions of a central processing unit on a single integrated circuit . The first microprocessors emerged in the early 1970s and were used for electronic calculators, using Binary-coded decimal arithmetic on 4-bit Word ....
 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 6502
MOS Technology 6502

The MOS Technology 6502 is an 8-bit microprocessor that was designed by Chuck Peddle and Bill Mensch for MOS Technology in 1975. When it was introduced, it was the least expensive full-featured central processing unit on the market by a considerable margin, costing less than one-sixth the price of competing designs from larger companies such...
's index registers' size is 8 bits and the page size is 256 bytes. Therefore, zero page extends from address 0 to address 255.

In early computers, including the PDP-8
PDP-8

The PDP-8 was the first successful commercial minicomputer, produced by Digital Equipment Corporation in the 1960s. DEC introduced it on 22 March 1965, and sold more than 50,000 systems, the most of any computer up to that date....
, the zero page had a special fast addressing mode
Addressing mode

Addressing modes are an aspect of the instruction set architecture in most central processing unit designs. The various addressing modes that are defined in a given instruction set architecture define how Machine code Instruction in that architecture identify the operand of each instruction....
, which facilitated its use for temporary storage of data
Computer storage

Computer data storage, often called storage or memory, refers to computer components, devices, and recording medium that retain digital data used for computing for some interval of time....
 and compensated for the relative shortage of CPU
Central processing unit

A central processing unit is an electronic circuit that can execute computer programs. This broad definition can easily be applied to many early computers that existed long before the term "CPU" ever came into widespread usage....
 register
Processor register

In computer architecture, a processor register is a small amount of Computer storage available on the CPU whose contents can be accessed more quickly than storage available elsewhere....
s. The PDP-8 had only one register, so zero page addressing was essential.

Possibly unimaginable by computer users after the 1980s, computer RAM used to be faster than or as fast as the CPU during the 1970s. Thus it made sense to have few registers and use the main memory as an extended pool of extra registers. Since each memory location within the zero page of a 16-bit
16-bit

16-bit architectureThe HP 2100#Descendants and variants , introduced in 1975, was the world's first 16-bit microprocessor.Prominent 16-bit processors include the PDP-11, Intel 8086, Intel 80286 and the WDC 65C816....
 address bus
Address bus

An address bus is a computer bus that is used to specify a memory address. When a central processing unit or direct memory access-enabled device needs to read or write to a memory location, it specifies that memory location on the address bus ....
 computer may be addressed by a single byte
Byte

A byte is a basic unit of measurement of Computer storage in computer science. In many computer architectures it is a Byte addressing memory address space....
, it was faster, in 8-bit
8-bit

Eight-bit CPUs normally use an 8-bit data bus and a 16-bit address bus which means that their address space is limited to 64 KBs. This is not a "natural law", however, so there are exceptions....
 data bus machines, to access such a location rather than a non-zero page location.

For example, the MOS Technology 6502
MOS Technology 6502

The MOS Technology 6502 is an 8-bit microprocessor that was designed by Chuck Peddle and Bill Mensch for MOS Technology in 1975. When it was introduced, it was the least expensive full-featured central processing unit on the market by a considerable margin, costing less than one-sixth the price of competing designs from larger companies such...
 has only one general purpose register (the accumulator). As a result, it used the zero page extensively. Many instruction
Instruction set

An instruction set is a list of all the instruction , and all their variations, that a processor can execute.Instructions include:* Arithmetic such as add and subtract...
s are coded differently for zero page and non-zero page addresses:

LDA $00 ; zero page LDA $0000 ; non-zero page

The above two instructions both accomplish the same thing: they load the value of memory location $00 into the .A register (accumulator). 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. Obviously, the difference in execution time could significantly improve performance in repetitive code.

Zero page addressing now has mostly historical significance, since the developments in integrated circuit
Integrated circuit

In electronics, an integrated circuit is a miniaturized electronic circuit that has been manufactured in the surface of a thin Wafer of semiconductor material....
 technology
Technology

Technology is a broad concept that deals with an animal species' usage and knowledge of tools and crafts, and how it affects an animal species' ability to control and adapt to its Natural environment....
 have made adding more registers to a CPU less expensive, and have made CPU operations much faster than RAM accesses. Some computer architectures still reserve the beginning of address space for other purposes, though; for instance, the Intel x86 systems reserve the first 512 words of address space for the interrupt
Interrupt

In computing, an interrupt is an asynchronous communication signal from hardware indicating the need for attention or a synchronous event in software indicating the need for a change in execution....
 table if it runs in realmode. A similar technique of using zero page for hardware related vectors was employed in the ARM architecure, leading in some badly written programs to the infamous "ofla" behaviour.

In fact, quite contrary to the zero page's original preferential use, some modern operating systems such as Linux
Linux

Linux is a generic term referring to Unix-like computer operating systems based on the Linux kernel. Their development is one of the most prominent examples of free and open source software collaboration; typically all the underlying source code can be used, freely modified, and redistributed by anyone under the terms of the GNU GPL license...
 and Microsoft Windows
Microsoft Windows

Microsoft Windows is a series of software operating systems and graphical user interfaces produced by Microsoft. Microsoft first introduced an operating environment named Windows in November 1985 as an add-on to MS-DOS in response to the growing interest in graphical user interfaces ....
 actually make the zero page inaccessible to trap uses of NULL pointers. This is useful, as NULL pointers are the method used to represent the value of a reference that points to nothing. Since code operating on a reference will be written assuming it that the reference actually refers to some valid structure or value, catching the case where the reference points to nothing is of use since it is a sure sign of a bug.

CP/M


In 8-bit CP/M
CP/M

CP/M is an operating system originally created for Intel 8080/Intel 8085 based microcomputers by Gary Kildall of Digital Research. Initially confined to single tasking on 8-bit processors and no more than 64 kilobytes of memory, later versions of CP/M added multi-user variations, and were migrated to 16-bit processors....
, the zero page is used for communication between the running program and the operating system. See Zero page (CP/M)
Zero page (CP/M)

The Zero Page is a data structure used in CP/M systems for programs to communicate with the operating system. In 8-bit CP/M versions it is located in the zero page, hence its name....
 for more information.