home *** CD-ROM | disk | FTP | other *** search
/ back2roots/padua / padua.7z / padua / audio / MultiPlayer132sr.lha / globals.asm < prev    next >
Assembly Source File  |  1992-09-14  |  6KB  |  199 lines

  1. * MultiPlayer
  2. * Copyright (C) 1992 Bryan Ford
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation; either version 2 of the License, or
  7. * (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program; if not, write to the Free Software
  16. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  17. *
  18. * I (the author of MultiPlayer) can be contacted on the Internet at
  19. * "bryan.ford@m.cc.utah.edu".  See "Player.doc" for other addresses.
  20. *
  21. * $Id: globals.asm,v 4.2 92/06/21 11:14:16 BAF Exp Locker: BAF $
  22. *
  23.  
  24.         include "bry/macros.i"
  25.  
  26. *** Globals macros
  27. defrefs macro
  28.         ifnc    '','\1'
  29.         defrefs \2,\3,\4,\5,\6,\7,\8,\9,\10
  30.         xref    \1
  31.         dc.l    \1
  32.         endc
  33.         endm
  34.  
  35. globmrt macro   ; routine1,routine2,...
  36.         defrefs \1,\2,\3,\4,\5,\6,\7,\8,\9,\10
  37.         endm
  38.  
  39. globrt  macro   ; routine1,routine2,...
  40.         cnop    0,4
  41.         dc.l    0
  42.         defrefs \1,\2,\3,\4,\5,\6,\7,\8,\9,\10
  43.         endm
  44.  
  45. glob    macro   ; name
  46.         xdef    \1,_\1
  47. \1:
  48. _\1:
  49.         endm    ; Define actual variable right afterwards...
  50.  
  51. globb   macro   ; name,value,routine1,routine2,...
  52.         glob    \1
  53.         dc.b    \2
  54.         endm
  55.  
  56. globw   macro   ; name,value,routine1,routine2,...
  57.         glob    \1
  58.         dc.w    \2
  59.         endm
  60.  
  61. globl   macro   ; name,value,routine1,routine2,...
  62.         glob    \1
  63.         dc.l    \2
  64.         endm
  65.  
  66. globu   macro   ; name,value,routine1,routine2,...
  67.         glob    \1
  68.         ds.b    \2
  69.         endm
  70.  
  71.         code    text
  72.  
  73. *** GlobSetByte - Set a byte global, calling the PreMod and PostMod routines
  74. * a0 = Pointer to byte global
  75. * d0 = New value for global
  76. * a1 = Pointer to routine NOT to call (or 0 to call all routines)
  77.         xdef    GlobSetByte,_GlobSetByte
  78. _GlobSetByte
  79.         move.l  4(sp),a0
  80.         move.l  8(sp),d0
  81.         move.l  12(sp),a1
  82. GlobSetByte
  83.         movem.l d0/a0-a1,-(sp)
  84.         bsr.b   GlobPreMod
  85.         movem.l (sp)+,d0/a0-a1
  86.         move.b  d0,(a0)
  87.         bra.b   GlobPostMod
  88.  
  89. *** GlobSetWord - Set a word global, calling the PreMod and PostMod routines
  90. * a0 = Pointer to word global
  91. * d0 = New value for global
  92. * a1 = Pointer to routine NOT to call (or 0 to call all routines)
  93.         xdef    GlobSetWord,_GlobSetWord
  94. _GlobSetWord
  95.         move.l  4(sp),a0
  96.         move.l  8(sp),d0
  97.         move.l  12(sp),a1
  98. GlobSetWord
  99.         movem.l d0/a0-a1,-(sp)
  100.         bsr.b   GlobPreMod
  101.         movem.l (sp)+,d0/a0-a1
  102.         move.w  d0,(a0)
  103.         bra.b   GlobPostMod
  104.  
  105. *** GlobSetLong - Set a longword global, calling the PreMod and PostMod routines
  106. * a0 = Pointer to longword global
  107. * d0 = New value for global
  108. * a1 = Pointer to routine NOT to call (or 0 to call all routines)
  109.         xdef    GlobSetLong,_GlobSetLong
  110. _GlobSetLong
  111.         move.l  4(sp),a0
  112.         move.l  8(sp),d0
  113.         move.l  12(sp),a1
  114. GlobSetLong
  115.         movem.l d0/a0-a1,-(sp)
  116.         bsr.b   GlobPreMod
  117.         movem.l (sp)+,d0/a0-a1
  118.         move.l  d0,(a0)
  119.         bra.b   GlobPostMod
  120.  
  121. *** GlobPreMod - Call the appropriate set of routines before modifying a global
  122. * a0 = Pointer to global variable
  123. * a1 = Pointer to routine NOT to call (or 0 to call all routines)
  124.         xdef    GlobPreMod,_GlobPreMod
  125. _GlobPreMod
  126.         move.l  4(sp),a0
  127.         move.l  8(sp),a1
  128. GlobPreMod
  129.         tst.l   -(a0)
  130.         bne.b   GlobPreMod
  131.         bra.b   GlobPostMod
  132.  
  133. *** GlobPostMod - Call the appropriate set of routines after a global has been modified
  134. * a0 = Pointer to global variable
  135. * a1 = Pointer to routine NOT to call (or 0 to call all routines)
  136.         xdef    GlobPostMod,_GlobPostMod
  137. _GlobPostMod
  138.         move.l  4(sp),a0
  139.         move.l  8(sp),a1
  140. GlobPostMod
  141.         movem.l d2/a2-a3,-(sp)
  142.         move.l  a0,a3
  143.         move.l  a1,d2
  144.         bra.b   \next
  145. \do
  146.         cmp.l   d0,d2
  147.         beq.b   \next
  148.         move.l  d0,a2
  149.         move.l  d2,a0
  150.         jsr     (a2)
  151. \next
  152.         move.l  -(a3),d0
  153.         bnz.b   \do
  154.         movem.l (sp)+,d2/a2-a3
  155.         rts
  156.  
  157.         data    __MERGED
  158.  
  159.         globrt  _progwinlistdetach
  160.         globrt  _progwinlistattach
  161.         glob    modlist
  162.         dc.l    modlist+4
  163.         dc.l    0
  164.         dc.l    modlist
  165.  
  166.         globrt
  167.         globrt  _programcurmodchanged,_settingswinupdate,_windowsettingsupdate
  168.         globu   curmod,4
  169.  
  170.         globrt
  171.         globrt  _programcurmodchanged,_settingswinupdate,_windowsettingsupdate,_progwinselmod
  172.         globu   selmod,4
  173.  
  174.         globrt
  175.         globrt  playervolume,_programsettingschanged
  176.         globw   volume,-1               ; Module volume 0-100, -1 if disabled
  177.         globw   balance,0               ; Module balance -50-50
  178.  
  179.         globrt
  180.         globrt  playerspeed,_programsettingschanged
  181.         globw   speed,0                 ; Module speed, 10-200, 50=normal, 0 if disabled
  182.  
  183.         globrt
  184.         globrt  _programsettingschanged
  185.         globb   modflags,0              ; Copy of ModNode.flags
  186.  
  187. * filter: -1=disabled, 0=module, 1=off, 2=on
  188.         globrt
  189.         globrt  ptfilter,_programsettingschanged
  190.         globb   filter,-1
  191.  
  192. * prefsglob - Triggered any time the preferences are changed
  193.         globrt
  194.         globrt  _prefswinupdate,_mainprefschanged,_gui_flashywinopenclose
  195.         globmrt _windowsettingsupdate,playervolume,playerspeed
  196.         glob    prefsglob
  197.  
  198.         end
  199.