home *** CD-ROM | disk | FTP | other *** search
/ Loadstar 128 24 / q24.d81 / t.mouse_ctrl80 < prev    next >
Text File  |  2022-08-28  |  7KB  |  153 lines

  1.  
  2.  
  3.                  C O N T R O L   8 0  -  M O U S E    8 0
  4.  
  5.             by Jon Mattson, Maurice Randall and Fender Tucker
  6.  
  7.  
  8.      When we first published Maurice Randall's MOUSE 80 on LS 128 #15 I
  9. planned on making all of my future programs support the mouse, if
  10. applicable.  But I am addicted to Jon Mattson's CONTROL80 (from LS 128
  11. #10) and can't program without it.  So I had to figure out how to get
  12. MOUSE 80 and CONTROL80 to work together.
  13.  
  14.      They both reside at $1300 but since MOUSEMOVER can create a version
  15. of MOUSE80 at any page, there should be no problem, I thought.  But there
  16. was.  When I created a MOUSE80 routine to fit at the end of CONTROL80, the
  17. mouse routine wouldn't work.  Like a fool I figured that there was some
  18. mysterious 128 memory or interrupt conflict that only a master could
  19. solve.  So I let it slide.
  20.  
  21.      As time went by I learned a lot more about memory on the C-128 and I
  22. kept thinking that there's no reason why those two routines shouldn't work
  23. together.  So I tried it again.  This time I discovered that MOUSEMOVER
  24. had a subtle bug.  It will create a working module of MOUSE 80 the first
  25. time you have it make a module; however, any subsequent modules you make
  26. will be assembled with the high bytes wrong.  I had always made several
  27. modules whenever I used MOUSEMOVER and apparently never used the first
  28. one, which was the only good one.
  29.  
  30.      So I created the first module at $1a00 and used that code and for the
  31. first time I had CONTROL80 and MOUSE80 working together flawlessly!  Boy
  32. was I happy.
  33.  
  34.      In the meantime, Jon had produced CONTROL80-C, which is a version of
  35. CONTROL80 that is specially designed for creating card games.  It has a
  36. font built in that has all of the designs for some very nice cards.  See
  37. LS 128 #22 for details on CONTROL80-C.  This font takes up an extra 8
  38. pages of memory so I created another working module of MOUSE80 at $2300
  39. which is right after the end of CONTROL80-C.  I put them both together
  40. with the ML monitor and now there are two versions of CTRL80/MOUSE80 ready
  41. for you to use.
  42.  
  43.  Use "c80-mouse.1a00" for non-card games.
  44.  
  45.  Use "c80c-mouse.2300" for card or dice games.
  46.  
  47. If you want just MOUSE 80 without CONTROL 80 (in other words, if you're
  48. not planning on having your program published on LS) then there's a
  49. version assembled at $1300 called appropriately enough, "mouse 80.1300".
  50.  
  51.      On Side One of LS 128 #24 is a file called "frame".  It's a small
  52. BASIC 7.0 file that loads one of the CTRL80/MOUSE80 files, installs both
  53. CONTROL80 and MOUSE80, then ends.  "frame" is what I suggest you use for a
  54. framework for your next program that uses these two fantastic tools.
  55. Let's look at the code, line by line.
  56.  
  57.  10 ifpeek(215)<>128 etc.
  58.  
  59. This line simply tells the user to switch to 80 columns if he's in the 40
  60. column mode.  Friendly, but not necessary.
  61.  
  62.  20 poke828,183:r=rnd(-ti)
  63.  
  64. The POKE disables the F-keys.  The RND function is to insure true
  65. randomness.  Again, unnecessary unless you want your programs to use the
  66. F-keys.
  67.  
  68.  30 dv=peek(186):ifdv<8thendv=8
  69.  
  70. This should be in all programs.  It allows your program to be used from
  71. any drive, provided you make all disk access in your program use the
  72. variable 'dv' for the drive number.
  73.  
  74.  40 scnclr:graphic1,1:graphic0:graphic5:fast:color6,1
  75.  
  76. You MUST use this line to move the start of BASIC up to $4000, freeing up
  77. the area from $1c00 to $4000 for ML code or screens.
  78.  
  79.  50 bload"c80-mouse.1a00",u(dv),b0,p4864
  80.  
  81. This loads the combined ML routines into place at $1300.  The MOUSE
  82. routine is at $1a00.  Note that it's loading from drive 'dv'.  If you're
  83. writing a card game, use "c80c-mouse.2300" in place of "c80-mouse.1a00" in
  84. this command.  The mouse ML will then be at $2300, so you must define the
  85. variable 'mo' equal to dec("2300") rather than dec("1a00").
  86.  
  87.  60 sys4864:mo=dec("1a00"):sysmo
  88.  
  89. The first SYS installs CONTROL80.  The next command sets the base for all
  90. MOUSE commands, 'mo', then the last SYS installs the MOUSE routine.  Check
  91. the docs for MOUSE 80 (on this disk) and you'll see that all commands are
  92. based upon 'mo'.  For instance, 
  93.  
  94.   sysmo+9
  95.  
  96. turns the mouse on.  Again, if you're using "c80c-mouse.2300", you need to
  97. substitute "2300" for "1a00" in this line.
  98.  
  99.  70 bload"font1",u(dv),b0,14336
  100.  
  101. This loads your custom font into Bank 0 at $3800, waiting for CONTROL80 to
  102. process it to the 80-column chip.
  103.  
  104.  80 fcopy14336,0,1
  105.  
  106. This strange-looking command is a CONTROL80 command that installs the font
  107. data found at 14336 ($3800).  If you don't use a custom font in your
  108. programs you are missing out on one of the MAJOR things about your C-128
  109. that makes it a better programmer's computer than any IBM behemoth.
  110.  
  111. NOTE: Until you run the program and install CONTROL80, the 'fcopy' command
  112. will look like an open parenthesis, '('.  You shouldn't try to edit
  113. CONTROL80 lines until CONTROL80 is installed and the code actually says
  114. 'fcopy' and not '('.  How to install CONTROL80?  Either do a SYS4864 in
  115. the immediate mode (after loading the ML) or simply run the program.
  116.  
  117.  90 - 110 are some POKEs that set the boundaries for the mouse.  You will
  118. want boundaries in your program, but not necessarily the same ones in
  119. these lines.  They limit the mouse to the visible screen.
  120.  
  121.  120 sys mo+9
  122.  
  123. This turns on the mouse.
  124.  
  125.  130 block586,20,42
  126.  
  127. This is a CONTROL80 command that prints some asterisks on the screen.
  128. Both line 120 and 130 are simply there to show that CONTROL80 and MOUSE80
  129. are indeed working.
  130.  
  131.      I hope no one thinks that it would be bad form or unethical to use
  132. the program "frame" as a start for their program.  It's ridiculous for
  133. anyone to be proprietary about programs like these.  Anything published on
  134. LOADSTAR is "owned" by you, the subscriber, and can be used by you as you
  135. wish.  In fact, I will be pleased and flattered if you use "frame" for
  136. your next program.  I'll know you have the good judgment to use tried and
  137. tested routines rather than spend the time to invent your own wheel.
  138.  
  139.      So print out the docs for MOUSEMOVER and CONTROL80-C (you'll need
  140. them) and start on that magnificent 80-column program you've always wanted
  141. to write.  Then send it to LOADSTAR 128 when done.  LOADSTAR always gives
  142. preference to CONTROL80 programs and if it works with a mouse...that's
  143. even better.
  144.  
  145.      Finally, because I wanted "frame" to be a bare bones skeleton for
  146. your program, it isn't accessible from the LS 128 menu.  Just load it when
  147. you want to start working with it.
  148.  
  149. FT
  150.  
  151.                        \\\\\ RETURN - Menu \\\\\
  152.  
  153.