1,885
edits
Changes
→Peripherals and Memory Map
== Peripherals and Memory Map ==
The entire 64K address space is available and is populated with RAM except for peripherals and a small ROM area.
Visually, the memory map looks like this:
{| border="1" cellpadding="2" cellspacing="0" width="100%"
!Page(s)!!Address Range!!Description!!Subdivided Address Range!!Description
|-
|rowspan="4"|$00||rowspan="4"|$0000-$00FF||rowspan="4"|Zero Page||$0000-$00FD||Fast-access variable storage. Your software can use this region as you see fit.
|-
|$00F5-$00FD||Variables used by the ROM routines -- Do not use this region if you are using the ROM routines.
|-
|$00FE||Random number generator.
|-
|$00FF||Last key pressed on keyboard -- See description below
|-
|$01||$0100-$01FF||Stack|| ||Hardware stack - values are pushed on to the stack by the PHA, JSR, and BRK instructions (plus hardware interrupts), and pulled from the stack by the PLA, RTS, RTI, and PLP instructions. The stack is first-in/last out (FILO) aka last-in, first-out (LIFO), and it descends in memory. After 256 bytes have been pushed on the stack, the stack will overflow back to the beginning and the oldest data will be overwritten. The current stack location is tracked in the Stack Pointer (SP) register.
|-
|$02-$05||$0200-$05FF||Bitmapped Display|| ||32x32 pixel graphics display -- See description below.
|-
|$06-$EF||$0600-$EFFF||Program Memory|| ||RAM available for program use. By default, programs will be assembled starting at memory location $0600. This space is available for software and data. The arrangement and use of this memory is left to the programmer.
|-
|$F0-FC||$F000-$FCFF||Character Display|| ||80 row x 25 line character display for text messages -- See description below.
|-
|$FD||$FD00-$FDFF||Reserved|| ||This memory range is reserved for future ROM expansion.
|-
|rowspan="3"|$FE-$FF||rowspan="3"|$FE00-$FF80||rowspan="3"|ROM||$FE00-FF80||This region is occupied by a small Read-Only Memory (ROM) image that contains input-output routines for the character display and keyboard.
|-
|$FF81-$FFF9||Entry point table - This table consists of 3-byte "entry points" for the ROM routines. To access a particular routine, use the Jump to SubRoutine (JSR) instruction with the corresponding entry point. This arrangement allows the ROM image to be revised without changing the entry point locations. See [[#ROM Routines|ROM Routines]] below for details on the available entry points.
|-
|$FFFA-$FFFF||Hardware vectors - On a hardware 6502 system, three 2-byte pointers (or "vectors") are used to access software routines to handle non-maskable interrupts (NMI) and the BRK instruction (vector $FFFA), CPU reset (vector $FFFC), and hardware interrupt (IRQ) (vector $FFFF). Since this is an emulator, these vectors are not used.
|}
There are four peripherals available: