Basics of computer memory

Memory maps


Summary: Memory maps (not to be confused with memory mapped I/O) are diagrams or charts that show how an operating system divides up main memory.

PC-DOS and MS-DOS memory map



high memory
segment
offset
size
contents
0000h
0000h
1024
interrupt vector table

0400h
172
BIOS communication area

04ACh
68
reserved by IBM

04F0h
16
user communication area

0500h
256
DOS communication area

0600h
varies
operating system:
IBMBIO.COM (DOS interface to the BIOS)
IBMDOS.COM (DOS interrupt handlers and interrupt 21h service routines
DOS buffers, control areas, and device drivers
COMMAND.COM (resident portion), interrupt 22h, 23h, and 24h handlers, routine to reload transient portion of COMMAND.COM
memory-resident utilities
transient applications
transient portion of COMMAND.COM
9000h
FFFFh

highest address of user memory
A000h
0000h
128K
reserved area of ROM
A000h
0000h

beginning of area used by EGA and PS/2 video systems
B000h
0000h
4000
monochrome video memory

0800h
16K
color graphics adaptor (CGA) video memory
C000h
0000h
192K
ROM expansion and control area

8000h

ROM for hard disk
D000h


ROM expansion and control area
E000h


ROM expansion and control area
F000h
0000h
16K
reserved ROM

4000h
40K
base system ROM, ROM BASIC

E000h
8K
ROM BIOS
low memory

MS-DOS TSR MEMORY MAP




If a TSR is created in assembly langauge, the programmer has exact control over the use of memory and can omit the heap area and place the initialization code at the end of the segment (where it can be released after initialization).
   
 If a TSR is created in C, the small-memory model must be used. Because of the severe memory limitations, the programmer should not use C allocation functions (such as malloc and calloc), as these add to the heap. A small heap must be assigned because some C library routines (such as fprintf) allocate memory from the heap.
   
 Variables required by MS-DOS interrupt handlers must be placed at the beginning of the code segment. 

Mac Plus memory map



high memory
address
contents
$EFFFFF
end of VIA space
$E80000
beginning of VIA space
$DFFFFF
end of IWM space
$D00000
beginning of IWM space
$BFFFFF
end of SCC write
$B00000
beginning of SCC write
$9FFFFF
end of SCC read
$900000
beginning of SCC read
$5FFFFF
end of SCSI
$580000
beginning of SCSI
$41FFFF
end of ROM
$400000
beginning of ROM
$3FFFFF
end of RAM for 4MB Mac Plus
$27FFFF
end of RAM for 2.5MB Mac Plus
$1FFFFF
end of RAM for 2MB Mac Plus
$0FFFFF
end of RAM for 1MB Mac Plus
varies
sound buffer
varies
System Error Handler area
varies
main screen (ScrnBase)
varies
MacsBugs (optional)
varies
RAM cache (optional)
varies
Jump Table (A5 relative)
varies
application and QuickDraw globals (A5 relative)
varies
stack (A7)
varies
Application Heap (ApplZone)
$001600
beginning of System Heap (SysZone)
$000E00
beginning of Toolbox A-trap table
$000800
additional low-memory global area
$000400
beginning of OS A-trap table
$000100
beginning of low-memory global area
$000000
beginning of RAM
Motorola 680x0 vectors
low memory

Mac Plus video memory locations



system
main screen
alternate screen
Macintosh 128K
$1A700
$12700
Macintosh 512K
$7A700
$72700
Macintosh Plus, 1 Mb
$FA700
$F2700
Macintosh Plus, 2Mb
$1FA700
$1F2700
Macintosh Plus, 2.5Mb
$27A700
$272700
Macintosh Plus, 4 Mb
$3FA700
$3F2700