Important Notice
The pages on this site contain documentation for very old MS-DOS software,
purely for historical purposes.
If you're looking for up-to-date documentation, particularly for programming,
you should not rely on the information found here, as it will be woefully
out of date.
Mem, MemW, and MemL Arrays
◄System Unit► ◄Contents► ◄Index► ◄Back►
Mem[ segment:offset ]
MemW[ segment:offset ]
MemL[ segment:offset ]
Unit: System (used automatically)
See also: Port, PortW
Description
Three predefined arrays are available for accessing memory directly.
Mem accesses bytes, MemW accesses words, and MemL accesses long
integers. The syntax for these arrays is different from normal
arrays. Specify both a segment and an offset part, separated by a
colon. The arrays can be used either for reading from memory or for
writing to memory. Writing directly to memory is a potentially
dangerous technique that should be used with care.
Some examples are shown below:
{ Turn on CAPSLOCK by setting bit 6 at $40:$17. }
Mem[$40:$17] := Mem[$40:$17] OR $40;
{ Assign clock ticks past midnight to a long integer variable. }
ticks := MemL[$40:$6C];
{ Write attribute $2F, character $01 to color screen buffer. }
MemW[$B800:0] := $2F01;