Atari ST Mouse Editor (MOUSEDIT.BAS)

Atari ST Mouse Editor by Kevin Kennedy

Description

Atari ST Mouse Editor by Kevin Kennedy

From the Antic disk of October 1986 (Vol. 5 No. 6).

The magazine article

From the Antic Software Archive at atarimagazines.com. The program remains the property of its author and publisher.

What is in this file

BASIC listing · 7.5 KB

Text
1000  'Atari ST Mouse Editor
1010  '(c) 1986 Antic Publishing  Ver. 070286
1020  'Written by Kevin Kennedy
1030  '
1040   TRUE=1: FALSE=0: DESIGNING=TRUE: OUTPUT=2
1050   LEFT=1: RIGHT=2: BOTH=3
1060   fullw OUTPUT: clearw OUTPUT: color 1,2,10,1,1: MP=1
1070   dim MOUSE( 16,16 ), MOUSE2( 16 ), SHADOW( 16 )
1080   for A=1 to 16
1090      for B=1 to 16
1100           MOUSE( A, B )=0
1110      next B
1120   next A
1130   close #1
1140   gosub GRID
1150   gosub OPTIONPR
1160  '
1170  '- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1180   while DESIGNING
1190      gosub BTOWAIT
1200      if MX>157 then gosub SELECT else gosub DRAW
1210      gosub BTFWAIT
1220   wend
1230  end
1240  '
1250  '---------------------------------------------------------------
1260  GRID:
1270   for A=0 to 128 step 8
1280      linef A, 0, A, 128
1290   next A
1300   for A=0 to 128 step 8
1310      linef 0, A, 128, A
1320   next A
1330  return
1340  '
1350  '---------------------------------------------------------------
1360  MOUSESTAT:
1370   A#=GB
1380   IOUT=peek( A#+12 )
1390   gemsys( 79 )
1400   MX=peek( IOUT+2 )
1410   MY=peek( IOUT+4 )
1420   BUTTON=peek( IOUT+6 )
1430   KB=peek( IOUT+8 )
1440  return
1450  '
1460  '---------------------------------------------------------------
1470  OPTIONPR:
1480   color 1, 3, 10: X=186: Y=35: X2=287: Y2=142: gosub ROUND
1490   color 1, 0, 10: X=187: Y=36: X2=286: Y2=141: gosub ROUND
1500   gotoxy 21,2: print  "RESET MOUSE"
1510   gotoxy 21,4: print  "CHANGE MOUSE"
1520   gotoxy 21,6: print  "SAVE SHAPE"
1530   gotoxy 21,8: print  "LOAD SHAPE"
1540   gotoxy 21,10: print  "SAVE STATE"
1550   gotoxy 21,12: print  "LOAD STATE"
1560   color 1, 3, 3
1570   for A=32 to 121 step 18
1580      linef 186, A, 286, A
1590   next A
1600   color 1, 3, 10
1610  return
1620  '
1630  '---------------------------------------------------------------
1640  SELECT:
1650   SELECTION=0
1660   restore LINEDATUM
1670   for A=1 to 6
1680      read Y
1690      if(MX>186)*(MX<286)*(MY>35)*(MY<142)then 1700 else return
1700      if( MY>=Y )*( MY<Y+17 )then goto 1720
1710   next A
1720   SEL=A
1730   if( A<1 )+( A>6 )then return else color 1, 2, 10: fill 189, A*18+7
1740   on SEL gosub GRAFMOUSE, REDES, SAVEA, LOADA, SVE, LOD
1750   color 1, 0, 10: fill 189, SEL*18+7: color 1, 2, 10
1760  return
1770  '
1780  LINEDATUM:
1790   data 35, 53, 71, 89, 107, 125
1800  '
1810  '---------------------------------------------------------------
1820  BTOWAIT:
1830   gosub MOUSESTAT
1840   if BUTTON then return else 1820
1850  '
1860  '---------------------------------------------------------------
1870  BTFWAIT:
1880   gosub MOUSESTAT
1890   if BUTTON then 1870 else return
1900  '
1910  '---------------------------------------------------------------
1920  VIEW:
1930   A=X2+146: B=Y2+20
1940   COL=MOUSE( X2, Y2 ): CO=COL: if COL=2 then CO=0
1950   color 1, 2, CO: linef A, B, A, B: B=B+40
1960   if COL=1 then CO=2
1970   if COL=2 then CO=1
1980   color 1, 2, CO: linef A, B, A, B
1990  return
2000  '
2010  '---------------------------------------------------------------
2020  REDES:
2030   gosub CLEARLIN
2040   gosub HOTSPOT
2050   if RET=1 then return
2060   for Y=1 to 16
2070      for X=1 to 16
2080           A=MOUSE( X, Y )
2090           if A=1 then ADD=ADD+2^( 16-X )
2100           if A=2 then ADD2=ADD2+2^( 16-X )
2110      next X
2120      MOUSE2( Y )=ADD: ADD=0: SHADOW( Y )=ADD2: ADD2=0
2130   next Y
2140   gosub CHANGE
2150  return
2160  '
2170  '---------------------------------------------------------------
2180  SAVEA:
2190   gosub INFILE
2200   if RET then return
2210   open "O", #1, FILE$
2220   for Y=1 to 16
2230      for X=1 to 16
2240           if RET then return
2250           print  #1,MOUSE( X, Y )
2260      next X
2270   next Y
2280   close #1
2290  return
2300  '
2310  '---------------------------------------------------------------
2320  LOADA:
2330   gosub INFILE: close #1
2340   if RET then return
2350   open "I", #1, FILE$
2360   for Y=1 to 16
2370      for X=1 to 16
2380           input #1, MOUSE( X, Y )
2390      next X
2400   next Y
2410   close #1: gosub DISARRAY
2420  return
2430  '
2440  '---------------------------------------------------------------
2450  SVE:
2460   gosub INFILE
2470   if RET then return
2480   open "O", #1, FILE$
2490   print  #1, HOTX; HOTY; MASKC; POINTC
2500   for A=1 to 16
2510      print  #1, SHADOW( A )
2520   next A
2530   for A=1 to 16
2540      print  #1, MOUSE2( A )
2550   next A
2560   close #1
2570  return
2580  '
2590  '---------------------------------------------------------------
2600  LOD:
2610   gosub INFILE
2620   if RET then return
2630   open "I", #1, FILE$
2640   input #1, HOTX, HOTY, MASKC, POINTC
2650   for A=1 to 16
2660      input #1, SHADOW( A )
2670   next A
2680   for A=1 to 16
2690      input #1, MOUSE2( A )
2700   next A
2710   close #1
2720   gosub CHANGE
2730  return
2740  '
2750  '---------------------------------------------------------------
2760  DRAW:
2770   if( MX<129 )*( MY>20 )*( MY<149 )then 2780 else return
2780   X2=int( MX/8 )+1: Y2=int(( MY-21 )/8 )+1
2790   if MOUSE( X2,Y2 )then MOUSE( X2, Y2 )=0: F=0 else gosub XDRAW
2800   color 1, F, 10: fill X2*8-4, Y2*8-4: gosub VIEW
2810  return
2820  '
2830  '---------------------------------------------------------------
2840  XDRAW:
2850   if( BUTTON=LEFT )+( BUTTON=BOTH )then MOUSE( X2,Y2 )=1: F=2
2860   if BUTTON=RIGHT then MOUSE( X2, Y2 )=2: F=3
2870  return
2880  '
2890  '---------------------------------------------------------------
2900  CHANGE:
2910   poke CONTRL,111: B=0: C=0: poke CONTRL+2,0: poke CONTRL+6,37
2920   poke INTIN,HOTX: poke INTIN+2, HOTY
2930   poke INTIN+4,1: poke INTIN+6,MASKC: poke INTIN+8,POINTC
2940   for A=10 to 40 step 2
2950      B=B+1: poke INTIN+A,SHADOW( B )
2960   next A
2970   for A=42 to 72 step 2
2980      C=C+1: poke INTIN+A,MOUSE2( C )
2990   next A
3000   vdisys(0)
3010  return
3020  '
3030  '---------------------------------------------------------------
3040  CLEARLIN:
3050   gotoxy 0,15: print  "                             "
3060  return
3070  '
3080  '---------------------------------------------------------------
3090  INFILE:
3100   FILE$="": gosub CLEARLIN: gotoxy 0,15: input "FILENAME ",FILE$
3110   if FILE$="" then RET=TRUE else RET=FALSE
3120  return
3130  '
3140  '---------------------------------------------------------------
3150  DISARRAY:
3160   for Y=1 to 16
3170      for X=1 to 16
3180           A=MOUSE( X, Y )
3190           if A=0 then CO=0
3200           if A=1 then CO=2
3210           if A=2 then CO=3
3220           color 1, CO, 10: fill X*8-4, Y*8-4: X2=X: Y2=Y: gosub VIEW
3230      next X
3240   next Y
3250  return
3260  '
3270  '---------------------------------------------------------------
3280  ROUND:
3290   poke CONTRL,11: poke CONTRL+2,2: poke CONTRL+6,0: poke CONTRL+10,9
3300   poke PTSIN,X: poke PTSIN+2,Y: poke PTSIN+4,X2: poke PTSIN+6,Y2
3310   VDISYS( 1 )
3320  return
3330  '
3340  '---------------------------------------------------------------
3350  GRAFMOUSE:
3360   A#=GB: IIN=peek( A#+8 ): poke IIN,0: gemsys( 78 )
3370  return
3380  '
3390  '---------------------------------------------------------------
3400  HOTSPOT:
3410   gotoxy 0, 15: print "Press left button on HotSpot"
3420   gosub BTFWAIT: gosub BTOWAIT: X2=int( MX/8 ): Y2=int(( MY-21 )/8 )
3430   gosub CLEARLIN: gotoxy 0,15: print "HotSpot is at ";X2;",";Y2
3440   if( X2<0 )+( X2>15 )+( Y2<0 )+( Y2>15 )then RET=TRUE: return
3450   HOTX=X2: HOTY=Y2: RET=FALSE
3460   gotoxy 0,15: input "Mask color, Pointer color ",MASKC,POINTC
3470  return