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

  1. PEEKs, POKEs, and SYSes -- Part 9
  2.  
  3.          by Jimmy Weiler
  4.  
  5. ======================================
  6. Location: 43-44  Hexadecimal: $002B-2C
  7. Official Label: TXTTAB       Type: RAM
  8. Useful BASIC commands: PEEK, POKE
  9.  
  10.  
  11. These two bytes contain the address of
  12.  
  13. the start of the BASIC program in
  14.  
  15. memory.  Their normal value is $0801
  16.  
  17. (that's $08 in 44, and $01 in 43).
  18.  
  19. By messing with TXTTAB you can make
  20.  
  21. your Commodore load BASIC programs
  22.  
  23. anywhere in memory you want them.
  24.  
  25.   Among the tricks you can perform
  26.  
  27. are:  using one program as a
  28.  
  29. subroutine of another;  hiding a
  30.  
  31. tiny program in cassette input buffer;
  32.  
  33. or moving TXTTAB to the middle of your
  34.  
  35. program to make high-numbered routines
  36.  
  37. run faster.
  38.  
  39.   Just use this formula to load a
  40.  
  41. program beyond the end of the program
  42.  
  43. presently in memory:
  44.  
  45. clr:poke43,peek(45):poke44,peek(46):
  46. poke peek(43)+peek(44)*256-1,0
  47.  
  48. Then load the program from disk as
  49.  
  50. usual.  To reconnect to the original
  51.  
  52. program, poke 43,1:poke 44,8.
  53.  
  54.   WARNING!!!  Do NOT save the first
  55.  
  56. program after you restore it.  If you
  57.  
  58. do you will save ALL the programs you
  59.  
  60. had in memory at once.
  61.  
  62.  
  63. ======================================
  64. Location: 45-46  Hexadecimal: $002D-2E
  65. Official Label: VARTAB       Type: RAM
  66. Useful BASIC commands: PEEK, POKE
  67.  
  68.  
  69. VARTAB tells you where in memory you
  70.  
  71. find the variables your program has
  72.  
  73. used.  This is significant, 1: because
  74.  
  75. it just is, and 2: because I say so.
  76.  
  77.   You can use VARTAB indirectly with
  78.  
  79. TXTTAB (43-44) to find the size of
  80.  
  81. the program in memory [size = peek(46)
  82.  
  83. *256+peek(45)-peek(44)*256-peek(43)].
  84.  
  85. You can also use it to directly PEEK,
  86.  
  87. to read, or POKE to modify variables.
  88.  
  89. (This is more commonly done in
  90.  
  91. machine language routines than with
  92.  
  93. BASIC PEEKS and POKES.)
  94.  
  95.  
  96. ======================================
  97. Location:160-2   Hexadecimal: $00A0-A2
  98. Official Label: TIME         Type: RAM
  99. Useful BASIC commands: PEEK, POKE, ti$
  100.  
  101.  
  102. This is the real time jiffy clock.
  103.  
  104. 160 increments every 18 minutes, 8
  105.  
  106. seconds.  161 increments every 4.26
  107.  
  108. seconds.  162 increments 60 times per
  109.  
  110. second.
  111.  
  112.   The reserved variables ti$ and ti
  113.  
  114. are developed from the TIME counter.
  115.  
  116.   You can set the time counter to
  117.  
  118. whatever value you want by setting ti$
  119.  
  120. to the equivalent value (hhmmss), or
  121.  
  122. by POKEing 160-162 with the desired
  123.  
  124. values.
  125.  
  126.   Just remember that 160-162 is the
  127.  
  128. actual count of elapsed jiffies
  129.  
  130. (60th's of a second), and ti$ must
  131.  
  132. be set to a six character string.
  133.  
  134.  (ti$="012500" means time =1:25)
  135.  
  136.  
  137. -------- continued in PART 10 --------
  138.