The Official Sam Mouse interface used and Atari ST type Mouse as opposed to the then more common serial mouse.
The mouse driver code once loaded would populate the variables XMOUSE, YMOUSE and BUTTON that could be read by the user.
The paper magazine Based On An Idea... contains full details of the mouse including a breakdown of the interfaces function.
There are issues when using the Mouse Driver and other pieces of code as noted by Geoff Bridges.
If the E-Tracker player was loaded first, then the music was lost when the mouse driver was loaded and if the mouse code was loaded first then mouse control was lost when the music code was loaded. Whats happening here is simply that both programs load their code into the same place, so the second one loaded overwrites the first one!
The area selected for the code is the system heap starting at memory location 16384. Space can be reserved in the heap for a code routine and the mouse driver program does this automaticaly, but the E-Tracker loader does not.
Heap space can be reserved in machine code by calling the ROM routine at address 262 or by using the RESERVED function in MASTERBASIC. There is no command in SAM BASIC to reserve heap space but the system variable HEAPEND (SVAR 456) can be poked with the new heap end. Assuming that the code starts from 16384 (which is the case for the E-TRACKER code), the value to poke to SVAR 456 is 16384+ 125(the code length).
This can be poked before OR after the E-TRACKER code is loaded, but MUST be poked before the mouse driver code is loaded. The modified "Int-music" listing is below. Note that the program has been RENUMbered and so the lines may not be the same number as in the original.
10 REM This is the E-TRACKER Int-music program modified to be used with a mouse driver installed 20 IF DPEEK SVAR 456=16384 30 DPOKE SVAR 456,16509 40 LOAD "mdriver"CODE 50 END IF 60 PRINT "PLEASE WAIT" 70 LET PAGE=11: LET ADR=16384 80 DO 90 READ A: EXIT IF A<0 100 POKE ADR,A: LET ADR=ADR+1 110 LOOP 120 REM REPLACE 'MUSIC' BELOW WITH THE FILENAME OF YOUR COMPI LED MUSIC 130 LOAD "MUSIC"CODE 16384*(PAGE+1): POKE &5100+PAGE,32 140 CLS : PRINT "TO START MUSIC : CALL 16384"'"TO STOP MUSIC : CALL 16387" 150 CALL 16384: POKE SVAR 666,5 160 PRINT "Mouse is now active"'"POKE SVAR 666,0 to clear mous e pointer"'"POKE SVAR 666,1 to 7 to enable pointer" 170 DATA 195,6,64,195,32,64,243,42,112,91 180 DATA 34,34,64,33,52,64,34,112,91,62 190 DATA PAGE,211,251,205,0,128,62,1,211,251 200 DATA 251,201,243,33,0,0,34,112,91,62 210 DATA PAGE,211,251,205,0,128,62,1,211,251 220 DATA 251,201,203,89,40,3,195,73,0,197 230 DATA 213,221,229,253,229,8,217,245,197,213 240 DATA 229,205,89,64,225,209,193,241,8,217 250 DATA 253,225,221,225,209,193,195,73,0,219 260 DATA 251,50,109,64,237,115,113,64,49,0 270 DATA 192,62,PAGE,211,251,205,6,128,62,0 280 DATA 211,251,49,0,0,201,-1 310 DO 320 IF BUTTON 1 330 IF YMOUSE>183 THEN CALL 16384 340 IF YMOUSE>173 AND YMOUSE<183 THEN CALL 16387 345 PAUSE 10 350 END IF 360 LOOP
Lines 20 to 50 are the new additions. The IF....END IF sequence is used to avoid reloading the mouse driver if the program is stopped and then re-RUN. Line 150 turns the music on and activates the mouse pointer. Lines 310 to 360 are a 'test' routine to show the use of the mouse and music combination.
Pressing the left button with the pointer on the top line of text will turn the music on. Pressing the left button on the second line of text will stop the music. The PAUSE in line 345 is to slow down the DO..LOOP to enable the mouse driver to update the position readings. In normal use there would be more program code to allow enough time for the mouse update.
Replacement Atari mice are hard to source so an alternative is to use any USB mouse (not just those that support PS/2 protocol only) and this interface wired for Atari pin out https://www.waitingforfriday.com/?p=827, this has been tested and works fine with the Sam with both wired and wireless optical mice.