home *** CD-ROM | disk | FTP | other *** search
- PEEK/POKE/SYS -- Part I
- ==== ==== === ==== =
-
- by: Joel Ellis Rea
-
-
- This series is designed for people
-
- who are familiar with BASIC program-
-
- ming, and would like to learn more a-
-
- bout the memory locations that can be
-
- used with the PEEK function, and the
-
- POKE and SYS statements.
-
- Beginners, listen up...
-
- A PEEK works like this:
-
- 'LET W = PEEK(1024)' sets the variable
-
- W equal to the contents of memory
-
- location 1024.
-
- A POKE works like this:
-
- 'POKE 1025,W' sets memory location
-
- 1025 equal to the value of the
-
- variable W, which must be within the
-
- range 0 to 255.
-
- A SYS works like this:
-
- 'SYS 49152' attempts to execute
-
- machine language code starting at
-
- memory location 49152.
-
- ------
-
- Well, that's all the easy stuff. What
-
- follows is usually very technical, so
-
- pay close attention.
-
- ------
-
- The 64's memory consists of 65,536
-
- bytes (1K = 1,024; 64K = 64 * 1,024 =
-
- 65,536), some of which is ROM (Read-
-
- Only Memory) which cannot be changed,
-
- some is I/O (Input/Output) Chip Regis-
-
- ters which control hardware functions
-
- of the machine, and most is RAM (Ran-
-
- dom-Access Memory), which can be writ-
-
- ten to, and which "forgets" its con-
-
- tents when the power is turned off.
-
-
- The PEEK function can read RAM, ROM
-
- and most I/O. The POKE statement can
-
- write to RAM and many I/O locations.
-
- The SYS statement transfers control to
-
- a machine-language subroutine located
-
- in ROM or RAM.
-
-
- This month, we will cover five of
-
- the most important locations in the
-
- whole 64, locations 0 - 4.
-
-
- --------------------------------------
- Location: 0 Hexadecimal: $0000
-
- Official Label: D6510 Type: I/O
-
- Useful BASIC commands: None
-
-
- This byte MUST be kept at its nor-
-
- mal value (such that PRINT PEEK(0) AND
-
- 63 prints 47) in order for the 64 to
-
- be able to function correctly. It is
-
- the Data Direction Register for the
-
- 6510 processor's On Board Bi-direc-
-
- tional I/O port (Location 1). Its
-
- bits determine which of the 6 I/O port
-
- lines are input and which are output.
-
- The normal value means that bits 0-3
-
- and 5 are output (1) and bit 4 is in-
-
- put (0).
-
- --------<continued in part 2>---------
- <x to exit>
-