home *** CD-ROM | disk | FTP | other *** search
/ Loadstar 3 / 003.d81 / p_p_s#5 < prev    next >
Text File  |  2022-08-26  |  3KB  |  169 lines

  1.         PEEK/POKE/SYS - PART 5
  2.       ==========================
  3.  
  4.           by: Joel Ellis Rea
  5.  
  6.  
  7.    This series was introduced last
  8.  
  9. issue. Last issue we document-ed
  10.  
  11. Locations 0-4.  Now let's take up
  12.  
  13. where we left off . . .
  14.  
  15.  
  16. --------------------------------------
  17. Location:  5&6     Hexadecimal:  $0005
  18. Official Label:  ADRAY2      Type: RAM
  19. Useful BASIC commands:  PEEK, POKE
  20.  
  21.  
  22.    Like ADRAY1, ADRAY2 is a two-byte
  23.  
  24. Jump Vector.  (See the description of
  25.  
  26. ADRAY1 Locations 3 & 4 last issue for
  27.  
  28. a description of Jump Vectors.)  This
  29.  
  30. one is the address of the routine that
  31.  
  32. BASIC calls to convert an integer into
  33.  
  34. an equivilant floating-point, or real,
  35.  
  36. number.  The integer is loaded into
  37.  
  38. the 6510's .A and .Y registers (with
  39.  
  40. .Y as the low byte), and the routine
  41.  
  42. specified in this address is called.
  43.  
  44. The real result is placed into the
  45.  
  46. Floating-point ACumulator (FAC).  The
  47.  
  48. actual routine is at 45969 ($B391).
  49.  
  50.  
  51. --------------------------------------
  52. Location:  7       Hexadecimal:  $0007
  53. Official Label:  CHARAC      Type: RAM
  54. Useful BASIC commands:  PEEK, POKE
  55.  
  56.  
  57.    CHARAC is a Zero-Page Parameter.
  58.  
  59. The 65xx-series of processors (inclu-
  60.  
  61. ding the 6510) divide memory into 256
  62.  
  63. 'pages' each containing 256 bytes.
  64.  
  65. The first of these is called the Zero
  66.  
  67. Page.  Due to the architecture of the
  68.  
  69. 65xx-series, locations in Zero Page
  70.  
  71. can be referenced faster than loca-
  72.  
  73. tions in other parts of memory.  So
  74.  
  75. many parameters to special routines
  76.  
  77. that are used frequently are kept in
  78.  
  79. Zero Page.  CHARAC is one of these.
  80.  
  81. The ASCII code of a character is put
  82.  
  83. here, as one of two characters for a
  84.  
  85. string search to end on.  For example,
  86.  
  87. if you use a statement like:
  88.  
  89.  
  90.    150 A$="THIS IS A TEST":GOSUB 900
  91.  
  92.  
  93. when BASIC executes it, it will want
  94.  
  95. to know where the end of the string
  96.  
  97. is.  So a 34 ($22) is placed in CHARAC
  98.  
  99. since the ASCII code for a quote is
  100.  
  101. 34.  Now the routine BASIC uses to
  102.  
  103. search through strings will know where
  104.  
  105. to quit!
  106.  
  107.  
  108. --------------------------------------
  109. Location:  8       Hexadecimal:  $0008
  110. Official Label:  ENDCHR     Type:  RAM
  111. Useful BASIC Commands:  PEEK, POKE
  112.  
  113.  
  114.    ENDCHR is identical to CHARAC.  But
  115.  
  116. ENDCHR is used if there are 2 differ-
  117.  
  118. ent characters that a string might
  119.  
  120. terminate with.  An example is the IN-
  121.  
  122. PUT statement.  If this:
  123.  
  124.  
  125.    160 INPUT "X & Y";X,Y
  126.  
  127.  
  128. is executed, the screen displays:
  129.  
  130.  
  131.    X & Y?
  132.  
  133.  
  134. as it waits for the user's response.
  135.  
  136. If the user types:
  137.  
  138.  
  139.    X & Y? 23,56
  140.  
  141.  
  142. then when the BASIC INPUT handler
  143.  
  144. wants to separate the two numbers for
  145.  
  146. assignment to X and Y, it needs to be
  147.  
  148. able to find out where they end.  A
  149.  
  150. number in INPUT could end with a comma
  151.  
  152. or the NUL (ASCII 0) that is placed at
  153.  
  154. the end of the line.  So CHARAC is
  155.  
  156. loaded with 0, and ENDCHR is loaded
  157.  
  158. with 44, the ASCII code for a comma.
  159.  
  160. For regular string searching, both
  161.  
  162. CHARAC and ENDCHR will contain 34 for
  163.  
  164. a double-quote character.
  165.  
  166.  
  167. ------- continued in part 6 ----------
  168.             <X> to exit
  169.