home *** CD-ROM | disk | FTP | other *** search
/ The Fred Fish Collection 1.5 / ffcollection-1-5-1992-11.iso / ff_progs / mouse_ut / mousutil.lzh / MOUSEUTIL / MOUSEUTIL1.1.ASM < prev    next >
Assembly Source File  |  1991-08-16  |  9KB  |  442 lines

  1. ******************************************************************
  2. *                                                                *
  3. *            Assembly Code For: MouseUtil Version 1.1            *
  4. *                Programming By:  Luciano Bertato                *
  5. *                     CompuServe: 73246,1744                     *
  6. *             Canada Remote Systems: LUCIANO BERTATO             *
  7. *                   Date: Friday July 15, 1988                   *
  8. *                                                                *
  9. ******************************************************************
  10.  
  11. ** external reference
  12.  
  13.    XREF     _AbsExecBase
  14.  
  15. ** macros
  16.  
  17. LIBCALL  MACRO
  18.            XREF    _LVO\1
  19.            CLR.L   d0
  20.            MOVEA.L _AbsExecBase,a6
  21.            JSR     _LVO\1(a6)
  22.          ENDM
  23.  
  24. CALL     MACRO
  25.            XREF    _LVO\1
  26.            JSR     _LVO\1(a6)
  27.          ENDM
  28.  
  29. FILL     MACRO
  30.            MOVE.L  #\1,d0
  31.            MOVE.L  #\2,d1
  32.            MOVE.L  #\3,d2
  33.            MOVE.L  #\4,d3
  34.            MOVEA.L RPort,a1
  35.            CALL    RectFill
  36.          ENDM
  37.  
  38. ** open everything ***********************************************
  39.  
  40. ** start
  41.  
  42. _main:
  43.    movem.l  d0-d7/a0-a6,-(sp)
  44.  
  45.    movea.l  #IntuiName,a1
  46.    LIBCALL  OpenLibrary
  47.    move.l   d0,IntuitionBase
  48.    beq      abort1
  49.  
  50.    movea.l  #DosName,a1
  51.    LIBCALL  OpenLibrary
  52.    move.l   d0,DosBase
  53.    beq      abort2
  54.  
  55.    movea.l  #GfxName,a1
  56.    LIBCALL  OpenLibrary
  57.    move.l   d0,GfxBase
  58.    beq      abort3
  59.  
  60.    movea.l  #PrefBuffer,a0
  61.    movea.l  IntuitionBase,a6
  62.    move.l   #PrefBufferSize,d0
  63.    CALL     GetPrefs
  64.    tst.w    d0
  65.    beq      abort4
  66.    move.l   d0,a0
  67.    move.w   PointerTicks(a0),d0
  68.    move.w   d0,TickValue
  69.    cmp.w    #4,d0
  70.    beq      Fourset
  71.    cmp.w    #2,d0
  72.    beq      Twoset
  73.    or.w     #SELECTED,OneGadget+12
  74.    bra      Windowmake
  75. Twoset:
  76.    or.w     #SELECTED,TwoGadget+12
  77.    bra      Windowmake
  78. Fourset:
  79.    or.w     #SELECTED,FourGadget+12
  80.  
  81. Windowmake:
  82.    movea.l  #window,a0
  83.    movea.l  IntuitionBase,a6
  84.    CALL     OpenWindow
  85.    move.l   d0,Windowptr
  86.    beq      abort4
  87.    move.l   d0,a0
  88.    move.l   wd_RPort(a0),RPort
  89.  
  90. ******************************************************************
  91.  
  92. **waiting for gadget selection
  93.  
  94. AdjustLoop:
  95.    movea.l  Windowptr,a0
  96.    movea.l  wd_UserPort(a0),a0
  97.    move.b   MP_SIGBIT(a0),d1
  98.    moveq.l  #1,d0
  99.    lsl.l    d1,d0
  100.    movea.l  _AbsExecBase,a6
  101.    CALL     Wait
  102.  
  103. ******************************************************************
  104.  
  105.    movea.l  Windowptr,a0
  106.    movea.l  wd_UserPort(a0),a0
  107.    movea.l  _AbsExecBase,a6
  108.    CALL     GetMsg
  109.    movea.l  d0,a1
  110.    move.l   a1,-(sp)
  111.    movea.l  im_IAddress(a1),a0
  112.    move.w   gg_GadgetID(a0),d0
  113.    cmp.w    #8,d0
  114.    beq      Done
  115.    cmp.w    #16,d0
  116.    bne      AdjustTicks
  117.    move.w   TickValue,d0
  118.    bsr      ChangeTicks
  119.    bra      Done
  120. AdjustTicks:
  121.    bsr      ChangeTicks
  122.    movea.l  (sp)+,a1
  123.    bsr      Reply
  124.  
  125.    move.w   NewTickValue,d0
  126.    cmp.w    #1,d0
  127.    bne      Jump1
  128.    or.w     #SELECTED,OneGadget+12
  129.    bra      Jump2
  130. Jump1:
  131.    and.w    #DESELECTED,OneGadget+12
  132. Jump2:
  133.    cmp.w    #2,d0
  134.    bne      Jump3
  135.    or.w     #SELECTED,TwoGadget+12
  136.    bra      Jump4
  137. Jump3:
  138.    and.w    #DESELECTED,TwoGadget+12
  139. Jump4:
  140.    cmp.w    #4,d0
  141.    bne      Jump5
  142.    or.w     #SELECTED,FourGadget+12
  143.    bra      Jump6
  144. Jump5:
  145.    and.w    #DESELECTED,FourGadget+12
  146. Jump6:
  147.    movea.l  GfxBase,a6
  148.    movea.l  RPort,a1
  149.    moveq.l  #COLOR,d0
  150.    CALL     SetAPen
  151.  
  152.    FILL     $3b,$2e,$7c,$38
  153.    FILL     $7f,$2e,$c0,$38
  154.    FILL     $c3,$2e,$104,$38
  155.  
  156.    movea.l  #OneGadget,a0
  157.    movea.l  Windowptr,a1
  158.    movea.l  #0,a2
  159.    movea.l  IntuitionBase,a6
  160.    CALL     RefreshGadgets
  161.  
  162.    bra      AdjustLoop
  163.  
  164. ** exit program **************************************************
  165.  
  166. **Done
  167.  
  168. Done:
  169.    movea.l  (sp)+,a1
  170.    bsr      Reply
  171.  
  172. **abort
  173.  
  174. abort5:
  175.    movea.l  Windowptr,a0
  176.    movea.l  IntuitionBase,a6
  177.    CALL     CloseWindow
  178. abort4:
  179.    movea.l  GfxBase,a1
  180.    LIBCALL  CloseLibrary
  181. abort3:
  182.    movea.l  DosBase,a1
  183.    LIBCALL  CloseLibrary
  184. abort2:
  185.    movea.l  IntuitionBase,a1
  186.    LIBCALL  CloseLibrary
  187. abort1:
  188.    movem.l  (sp)+,d0-d7/a0-a6
  189.    clr.l    d0
  190.    rts
  191.  
  192. ******************************************************************
  193.  
  194. **subroutines
  195.  
  196. ChangeTicks:
  197.    movea.l  #PrefBuffer,a0
  198.    lea      PointerTicks(a0),a1
  199.    move.w   d0,(a1)
  200.    move.w   d0,NewTickValue
  201.    movea.l  IntuitionBase,a6
  202.    move.l   #PrefBufferSize,d0
  203.    moveq.l  #1,d1
  204.    CALL     SetPrefs
  205.    rts
  206. Reply:
  207.    movea.l  _AbsExecBase,a6
  208.    CALL     ReplyMsg
  209.    rts
  210.  
  211. ******************************************************************
  212.  
  213.    SECTION  data,DATA
  214.  
  215. window:
  216.    dc.w     30,30,320,90
  217.    dc.b     0,1
  218.    dc.l     IDCMPflags,flags,DoneGadget,0,title,0,0
  219.    dc.w     1,1,640,200,WBENCHSCREEN
  220.  
  221. ******************************************************************
  222.  
  223. DoneGadget:
  224.    dc.l     CancelGadget
  225.    dc.w     200,70,50,11
  226.    dc.w     GADGHCOMP,RELVERIFY,BOOLGADGET
  227.    dc.l     Done_border,0,Done_text,0,0
  228.    dc.w     8
  229.    dc.l     0
  230. Done_text:
  231.    dc.b     1,0,1,0
  232.    dc.w     2,2
  233.    dc.l     0,DG_text,0
  234. Done_border:
  235.    dc.w     -1,-1
  236.    dc.b     1,0,JAM1,5
  237.    dc.l     DoneXY,0
  238. DoneXY:
  239.    dc.w     0,0
  240.    dc.w     51,0
  241.    dc.w     51,12
  242.    dc.w     0,12
  243.    dc.w     0,0
  244. DG_text:
  245.    dc.b     ' Done ',0,0
  246.  
  247. ******************************************************************
  248.  
  249. CancelGadget:
  250.    dc.l     OneGadget
  251.    dc.w     70,70,66,11
  252.    dc.w     GADGHCOMP,RELVERIFY,BOOLGADGET
  253.    dc.l     Cancel_border,0,Cancel_text,0,0
  254.    dc.w     16
  255.    dc.l     0
  256. Cancel_text:
  257.    dc.b     1,0,1,0
  258.    dc.w     2,2
  259.    dc.l     0,CG_text,0
  260. Cancel_border:
  261.    dc.w     -1,-1
  262.    dc.b     1,0,JAM1,5
  263.    dc.l     CancelXY,0
  264. CancelXY:
  265.    dc.w     0,0
  266.    dc.w     67,0
  267.    dc.w     67,12
  268.    dc.w     0,12
  269.    dc.w     0,0
  270. CG_text:
  271.    dc.b     ' Cancel ',0,0
  272.  
  273. ******************************************************************
  274.  
  275. OneGadget:
  276.    dc.l     TwoGadget
  277.    dc.w     195,46,66,11
  278.    dc.w     GADGHCOMP,RELVERIFY,BOOLGADGET
  279.    dc.l     One_border,0,One_text,0,0
  280.    dc.w     1
  281.    dc.l     0
  282. One_text:
  283.    dc.b     1,0,1,0
  284.    dc.w     31,2
  285.    dc.l     0,OG_text,0
  286. One_border:
  287.    dc.w     -1,-1
  288.    dc.b     1,0,JAM1,5
  289.    dc.l     OneXY,0
  290. OneXY:
  291.    dc.w     0,0
  292.    dc.w     67,0
  293.    dc.w     67,12
  294.    dc.w     0,12
  295.    dc.w     0,0
  296. OG_text:
  297.    dc.b     '1',0
  298.  
  299. ******************************************************************
  300.  
  301. TwoGadget:
  302.    dc.l     FourGadget
  303.    dc.w     127,46,66,11
  304.    dc.w     GADGHCOMP,RELVERIFY,BOOLGADGET
  305.    dc.l     Two_border,0,Two_text,0,0
  306.    dc.w     2
  307.    dc.l     0
  308. Two_text:
  309.    dc.b     1,0,1,0
  310.    dc.w     31,2
  311.    dc.l     0,TG_text,0
  312. Two_border:
  313.    dc.w     -1,-1
  314.    dc.b     1,0,JAM1,5
  315.    dc.l     TwoXY,0
  316. TwoXY:
  317.    dc.w     0,0
  318.    dc.w     67,0
  319.    dc.w     67,12
  320.    dc.w     0,12
  321.    dc.w     0,0
  322. TG_text:
  323.    dc.b     '2',0
  324.  
  325. ******************************************************************
  326.  
  327. FourGadget:
  328.    dc.l     0
  329.    dc.w     59,46,66,11
  330.    dc.w     GADGHCOMP,RELVERIFY,BOOLGADGET
  331.    dc.l     Four_border,0,Four_text,0,0
  332.    dc.w     4
  333.    dc.l     0
  334. Four_text:
  335.    dc.b     1,0,1,0
  336.    dc.w     31,2
  337.    dc.l     0,FG_text,Four_text2
  338. Four_text2:
  339.    dc.b     1,0,1,0
  340.    dc.w     10,-26
  341.    dc.l     0,FG_text2,Four_text3
  342. Four_text3:
  343.    dc.b     1,0,1,0
  344.    dc.w     0,-9
  345.    dc.l     0,FG_text3,Four_text4
  346. Four_text4:
  347.    dc.b     1,0,1,0
  348.    dc.w     168,-9
  349.    dc.l     0,FG_text4,0
  350. Four_border:
  351.    dc.w     -1,-1
  352.    dc.b     1,0,JAM1,5
  353.    dc.l     FourXY,0
  354. FourXY:
  355.    dc.w     0,0
  356.    dc.w     67,0
  357.    dc.w     67,12
  358.    dc.w     0,12
  359.    dc.w     0,0
  360. FG_text:
  361.    dc.b     '4',0
  362. FG_text2:
  363.    dc.b     'Select The Mouse Speed:',0
  364. FG_text3:
  365.    dc.b     'Slow',0,0
  366. FG_text4:
  367.    dc.b     'Fast',0,0
  368.  
  369. ******************************************************************
  370.  
  371. title:
  372.    dc.b     ' MouseUtil V1.1 ',0,0
  373. IntuiName:
  374.    dc.b     'intuition.library',0
  375. DosName:
  376.    dc.b     'dos.library',0
  377. GfxName:
  378.    dc.b     'graphics.library',0,0
  379.  
  380. ******************************************************************
  381.  
  382. WBENCHSCREEN EQU $0001
  383. ACTIVATE EQU $1000
  384. WINDOWDRAG EQU $0002
  385. WINDOWCLOSE EQU $0008
  386. SMART_REFRESH EQU $0000
  387. STRGADGET EQU $0004
  388. BOOLGADGET EQU $0001
  389. PROPGADGET EQU $0003
  390. TOGGLESELECT EQU $0100
  391. RELVERIFY EQU $0001
  392. GADGIMMEDIATE EQU $0002
  393. FOLLOWMOUSE EQU $0008
  394. SELECTED EQU $0080
  395. DESELECTED EQU $FF7F
  396. GADGHCOMP EQU $0000
  397. GADGHBOX EQU $0001
  398. GADGHIMAGE EQU $0002
  399. GADGHNONE EQU $0003
  400. CLOSEWINDOW EQU $00000200
  401. GADGETUP EQU $00000040
  402. FREEVERT EQU $0004
  403. FREEHORIZ EQU $0002
  404. AUTOKNOB EQU $0001
  405. JAM1 EQU $0000
  406. MP_SIGBIT EQU $0F
  407. wd_UserPort EQU $56
  408. wd_RPort EQU $32
  409. im_IAddress EQU $1c
  410. gg_GadgetID EQU 38
  411. PointerTicks EQU $6c
  412. PrefBufferSize EQU 232
  413. COLOR EQU 0
  414. flags EQU ACTIVATE!WINDOWDRAG!SMART_REFRESH
  415. IDCMPflags EQU GADGETUP
  416.  
  417. ******************************************************************
  418.  
  419.    SECTION  mem,BSS
  420.  
  421. IntuitionBase:
  422.    ds.l     1   ;intuition base address pointer
  423. DosBase:
  424.    ds.l     1   ;dos base address pointer
  425. GfxBase:
  426.    ds.l     1   ;graphics base address pointer
  427. Windowptr:
  428.    ds.l     1   ;pointer to window
  429. RPort:
  430.    ds.l     1   ;rp pointer for window
  431. TickValue:
  432.    ds.w     1   ;original mouse speed
  433. NewTickValue:
  434.    ds.w     1   ;changed mouse speed
  435. PrefBuffer:
  436.    ds.b     232 ;preferences buffer
  437.  
  438. ******************************************************************
  439.  
  440.    END
  441.  
  442.