home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Loadstar 3
/
003.d81
/
p_p_s#5
< prev
next >
Wrap
Text File
|
2022-08-26
|
3KB
|
169 lines
PEEK/POKE/SYS - PART 5
==========================
by: Joel Ellis Rea
This series was introduced last
issue. Last issue we document-ed
Locations 0-4. Now let's take up
where we left off . . .
--------------------------------------
Location: 5&6 Hexadecimal: $0005
Official Label: ADRAY2 Type: RAM
Useful BASIC commands: PEEK, POKE
Like ADRAY1, ADRAY2 is a two-byte
Jump Vector. (See the description of
ADRAY1 Locations 3 & 4 last issue for
a description of Jump Vectors.) This
one is the address of the routine that
BASIC calls to convert an integer into
an equivilant floating-point, or real,
number. The integer is loaded into
the 6510's .A and .Y registers (with
.Y as the low byte), and the routine
specified in this address is called.
The real result is placed into the
Floating-point ACumulator (FAC). The
actual routine is at 45969 ($B391).
--------------------------------------
Location: 7 Hexadecimal: $0007
Official Label: CHARAC Type: RAM
Useful BASIC commands: PEEK, POKE
CHARAC is a Zero-Page Parameter.
The 65xx-series of processors (inclu-
ding the 6510) divide memory into 256
'pages' each containing 256 bytes.
The first of these is called the Zero
Page. Due to the architecture of the
65xx-series, locations in Zero Page
can be referenced faster than loca-
tions in other parts of memory. So
many parameters to special routines
that are used frequently are kept in
Zero Page. CHARAC is one of these.
The ASCII code of a character is put
here, as one of two characters for a
string search to end on. For example,
if you use a statement like:
150 A$="THIS IS A TEST":GOSUB 900
when BASIC executes it, it will want
to know where the end of the string
is. So a 34 ($22) is placed in CHARAC
since the ASCII code for a quote is
34. Now the routine BASIC uses to
search through strings will know where
to quit!
--------------------------------------
Location: 8 Hexadecimal: $0008
Official Label: ENDCHR Type: RAM
Useful BASIC Commands: PEEK, POKE
ENDCHR is identical to CHARAC. But
ENDCHR is used if there are 2 differ-
ent characters that a string might
terminate with. An example is the IN-
PUT statement. If this:
160 INPUT "X & Y";X,Y
is executed, the screen displays:
X & Y?
as it waits for the user's response.
If the user types:
X & Y? 23,56
then when the BASIC INPUT handler
wants to separate the two numbers for
assignment to X and Y, it needs to be
able to find out where they end. A
number in INPUT could end with a comma
or the NUL (ASCII 0) that is placed at
the end of the line. So CHARAC is
loaded with 0, and ENDCHR is loaded
with 44, the ASCII code for a comma.
For regular string searching, both
CHARAC and ENDCHR will contain 34 for
a double-quote character.
------- continued in part 6 ----------
<X> to exit