Remote-processing CAMBASIC Instrukcja Użytkownika Strona 171

  • Pobierz
  • Dodaj do moich podręczników
  • Drukuj
  • Strona
    / 208
  • Spis treści
  • BOOKMARKI
  • Oceniono. / 5. Na podstawie oceny klientów
Przeglądanie stron 170
Commands - 138
Strings ar e stored in tw o ways. A literal str ing (e. g., A$ = "string") is stor ed in the program line in
which it appears. Other strings that are formed as a result of string operations (like concatenation)
are stored star ting at the top of RAM and build down towar ds the numeric variables.
On power– up, you have 100 bytes of string space. You can change this with the CL EAR statement.
(Beneath the string area is the stack).
Thus, unused RA M extends from the top of the array space to the bottom of the stack.
EXAM PLE 1: 10 A = 1.1
20 B = VARPTR(A)
30 PRINT B ;
40 FOR X = 0 TO 3
50 PRINT PEEK(B+X) ;
60 NEXT : PRINT
RUN
17487 205 204 12 129
This example is for a simple num eric variable. The first number printed is the addr ess of the first
byte of the floating point representation of the number, or “1. 1”. This is the same as shown on the
previous page.
EXAM PLE 2: 10 H(0) = 1.1
20 Z = VARPTR(H(0))
30 PRINT Z
40 PRINT PEEK(Z) ; PEEK(Z+1) ; PEEK(Z+2) ; PEEK(Z+3)
RUN
17512
205 204 12 129
This routine retur ns the address of the first element of array H. The next e lement, if present, would
be at address 17004, the next at 17008, and so forth.
EXAM PLE 3: Addresses of array variables change each time a simple variable is assigned. For example:
10 T(0) = 0
20 PRINT VARPTR(T(0))
30 W = 0
40 PRINT VARPTR(T(0))
RUN
17484
17490
In this example, the variable W is first used after the array address was printed. Thus the array
address is shifted by the six bytes required for a simple variable.
EXAM PLE 4: 10 A$ = "Tuesday"
20 R = VARPTR(A$)
30 PRINT CHR$(PEEK(R))
T
In this case, new variables are declared after VARPTR returned the address. Unlike the array case,
Przeglądanie stron 170
1 2 ... 166 167 168 169 170 171 172 173 174 175 176 ... 207 208

Komentarze do niniejszej Instrukcji

Brak uwag