*****************************************************************************
*        Example Macros V1.00 ©1994 The Puzzle Factory, Inc.                *
*        This macro file may be freely redistributed as long as this        *
*        copyright notice is not removed.                                   *
*                                                                           *
*    The contents of this file is provided without warrantee of any kind    *
*    and the entire responsibility for use is assumed by the end user.      *
*****************************************************************************

;>>>        PLEASE READ THIS FILE BEFORE USING THE RS.MACROS FILE         <<<
;
;This file contains a number of example macros which you may use to do useful
;things, to learn more about your Amiga, or to better understand haw to write
;your own ReSource macros.
;
;IMPORTANT NOTE                                                IMPORTANT NOTE
;It is not possible to provide standard macros that may be freely used in all
;situations with a tool such as ReSource.  Because the macro itself can't
;know what sort of code or data it is being used on, it it up to the user to
;ensure that it will be used with some degree of intelligence.  The following
;example will, perhaps, illustrate the problem.
;
;Suppose that there exists in your code, a NewWindow structure.  After
;disassembly, but before using the "NewWindow" macro, it looks like this:
;
;lbL000A54     dl      0
;              dl      $12D0077
;              dl      $FFFF0000
;              dl      $2200002
;              dw      $140E
;              dl      lbL000A84
;              dw      0
;              dw      0
;              dl      MyTitle.MSG
;              dw      0
;              dw      0
;              dw      0
;              dw      0
;              dw      0
;              dw      0
;              dw      0
;              dw      0
;              dw      1
;
;After using the "NewWindow" macro, it looks like this:
;
;lbW000A54     dw      0,0,301,119
;              db      $FF,$FF
;              dl      (IDCMP_GADGETDOWN|IDCMP_CLOSEWINDOW)
;              dl      (WFLG_DRAGBAR|WFLG_DEPTHGADGET|WFLG_CLOSEGADGET|WFLG_SMART_REFRESH|WFLG_GIMMEZEROZERO|WFLG_ACTIVATE|WFLG_NOCAREREFRESH)
;              dl      lbL000A84
;              dl      0
;              dl      MyTitle.MSG
;              dl      0
;              dl      0
;              dw      0,0,0,0
;              dw      WBENCHSCREEN
;
;This is all well and good, and you are, hopefully, happy with the result.
;
;But suppose that in this particular program the programmer decided to access
;some variables in the NewWindow structure, and the C compiler that produced
;the executable put labels in the middle of structure fields, rather than
;using offsets from the structure beginning (this actually happens quite
;frequently).  Now the disassembled, but unstructured data will look like
;this:
;
;lbW000A54     dw      0
;lbW000A56     dw      0          ;nw_TopEdge
;lbW000A58     dw      $12D       ;nw_Width
;lbL000A5A     dl      $77FFFF    ;nw_Height
;              dl      $220
;              dw      2
;lbW000A64     dw      $140E      ;nw_Flags+2 (word)
;              dl      lbL000A84
;              dw      0
;              dw      0
;              dl      MyTitle.MSG
;              dw      0
;              dw      0
;              dw      0
;              dw      0
;              dw      0
;              dw      0
;              dw      0
;              dw      0
;              dw      1
;
;And after using the "NewWindow" macro, it looks like this:
;
;lbW000A54     dw      0
;lbW000A56     dw      0          ;nw_TopEdge
;lbW000A58     dw      $12D       ;nw_Width
;lbL000A5A     dl      $77FFFF    ;nw_Height
;              db      0,0
;              dl      (IDCMP_NEWSIZE|IDCMP_VANILLAKEY|IDCMP_CHANGEWINDOW)
;lbW000A64     dw      (WFLG_DRAGBAR|WFLG_SIZEBRIGHT|WFLG_SMART_REFRESH|WFLG_BACKDROP|WFLG_REPORTMOUSE|WFLG_GIMMEZEROZERO|WFLG_NOCAREREFRESH|WFLG_NW_EXTENDED|WFLG_WINDOWTICKED|WFLG_ZOOMED|$80000)
;              dl      lbL000A84
;              dw      0
;              dw      0
;              dl      MyTitle.MSG
;              dw      0
;              dw      0,0,0,0
;              dw      0
;              dw      0
;              dw      0
;              dw      1
;
;As you can see, the addition of the labels into the middle of this data,
;caused the macro to completely mess up the NewWindow structure.  Depending
;on your assembler, this may still assemble correctly, but I wouldn't count
;on it.  About the only thing one can do in a case like this is to not use
;the macro, or to write a very long and very complicated macro that attempts
;to be all things to all programs.  What should really happen is to change
;the assembly source so that, after finishing the disassembly, so that
;"lbW000A64" for example, is referenced as "lbW000A62+2", or better, as
;"_NewWindow+nw_Flags+2".
;
;Because of these problems, it is very important to cast a discerning eye at
;any code or data you plan on converting with a ReSource macro.
;
;WHY NOT JUST IMPROVE RESOURCE MACROS?
;Macros were not ever intended to be used for this purpose.  ReSource Macros
;were intended to be used to do simple repetitive tasks.  ReSource Command
;Language (RCL) was intended for tasks where complex decisions are needed to
;be made about the code being disassembled.  We have plans to release a
;variety of RCL scripts in the future.  Stay tuned for announcements.
;
;                      ---------------/---------------
;NOTES
;All the macros in this file that operate on structures, place a blank line
;at the beginning of the structure, and none at the end.  This is an important
;consideration because otherwise it is possible that multiple blank lines will
;be inserted between structures.
;
;Each macro comes with instructions on its use.  Please read these in order
;to know what assumptions are present in the macro so that you may get good
;use from them.
;
;TPF


;Set tabs:          |       |                 |       |       |       |

	ifd	__m68
CAPE	set	1
	ENDC
	ifd	CAPE
	bnryonly
	endc

	dc.l	$BABEF00F	; ReSource macros identifier
	dc.l	0	; number of words of user data following
	dc.b	'   - General Macros -   '	; User-defined name #1.
	dc.b	'  - Intuition Macros -  '	; User-defined name #2.
	dc.b	'- Miscellaneous Macros -'	; User-defined name #3.
************************************************************************
;Whenever the disassembly shows location 4 (AbsExecBase), use this macro to
;rename it to something more meaningful.  This macro only calls a symbol
;base, but you may find it more convenient to just hit KP-1.

	dc.l	1	; Macro number 1
	dc.l	macroend01-macrostart01

macnamestart01	dc.b	'Conv. 4 -> AbsExecBase  '
	ifgt	24-(*-macnamestart01)
	dcb.b	24-(*-macnamestart01),0
	endc

macrostart01	dc.w	$0177	; SYMBOLS/Trap Vectors
	dc.w	0	; reserved
macroend01:
************************************************************************
;This macro will search for "jsr<tab>_LVO" or "jmp<tab>_LVO" and rename the
;preceeding label with the name of the system call preceeded by an underscore.
;So "jsr<tab>_LVOOpenWindow" will produce a label named "_OpenWindow".
;This is very useful for those annoying little C language stubs.
;The actual library calls must have already been parsed and named before
;using this macro.  This macro works with old syntax.

	dc.l	2	; Macro number 2
	dc.l	macroend02-macrostart02

macnamestart02	dc.b	'SysCalls: Old syntax    '
	ifgt	24-(*-macnamestart02)
	dcb.b	24-(*-macnamestart02),0
	endc

macrostart02	dc.w	$0677	; CURSOR/Pattern search/Set pattern string
	dc.w	(2$-1$)

1$	dc.b	'j(mp|sr)	_LVO',0,1
	cnop	0,2

2$	dc.w	$004E	; CURSOR/Pattern search/Find next occurrence
	dc.w	$020A	; STRINGS/Get/Symbol
	dc.w	$0205	; STRINGS/Edit functions/Clip start
	dc.w	(4$-3$)

3$	dc.b	'_LVO',0,1
	cnop	0,2

4$	dc.w	$0207	; STRINGS/Edit functions/Prepend
	dc.w	(6$-5$)

5$	dc.b	'_',0,1
	cnop	0,2

6$	dc.w	$0187	; CURSOR/Relative/Previous label
	dc.w	$0213	; STRINGS/Put/Label
	dc.w	$0186	; CURSOR/Relative/Next label
	dc.w	0	; reserved
macroend02:
************************************************************************
;This macro is identical to the one directly above, but works with new syntax.

	dc.l	3	; Macro number 3
	dc.l	macroend03-macrostart03

macnamestart03	dc.b	'SysCalls: New syntax    '
	ifgt	24-(*-macnamestart03)
	dcb.b	24-(*-macnamestart03),0
	endc

macrostart03	dc.w	$0677	; CURSOR/Pattern search/Set pattern string
	dc.w	(2$-1$)

1$	dc.b	'j(mp|sr)	''(_LVO',0,1
	cnop	0,2

2$	dc.w	$004E	; CURSOR/Pattern search/Find next occurrence
	dc.w	$020A	; STRINGS/Get/Symbol
	dc.w	$0205	; STRINGS/Edit functions/Clip start
	dc.w	(4$-3$)

3$	dc.b	'_LVO',0,1
	cnop	0,2

4$	dc.w	$0207	; STRINGS/Edit functions/Prepend
	dc.w	(6$-5$)

5$	dc.b	'_',0,1
	cnop	0,2

6$	dc.w	$0187	; CURSOR/Relative/Previous label
	dc.w	$0213	; STRINGS/Put/Label
	dc.w	$0186	; CURSOR/Relative/Next label
	dc.w	0	; reserved
macroend03:
************************************************************************
;This macro is useful when you have a number of labels in a program that jump
;to the C stubs converted by the 2 macros directly above.  Position the line
;with the "JMP" instruction on the cursor line, and execute this macro.
;The label on the "JMP" line will be converted to "<label>.jmp".
;So "Label jmp _OpenWindow" will produce "_OpenWindow.jmp jmp _OpenWindow".
;The cursor line must already have a label.

	dc.l	4	; Macro number 4
	dc.l	macroend04-macrostart04

macnamestart04	dc.b	'Create LibCall Name.jmp '
	ifgt	24-(*-macnamestart04)
	dcb.b	24-(*-macnamestart04),0
	endc

macrostart04	dc.w	$0040	; CURSOR/Absolute/Forward reference
	dc.w	$0209	; STRINGS/Get/Label
	dc.w	$003F	; CURSOR/Absolute/Previous location
	dc.w	$0208	; STRINGS/Edit functions/Append
	dc.w	(2$-1$)

1$	dc.b	'.jmp',0,1
	cnop	0,2

2$	dc.w	$0213	; STRINGS/Put/Label
	dc.w	0	; reserved
macroend04:
************************************************************************
;ReSource almost always detects WORD jump tables, but occasionally misses
;one.  You can clean it up by putting the table base loaction on the cursor
;line and calling this macro.  It will end by itself when it runs out of
;words to convert.

	dc.l	5	; Macro number 5
	dc.l	macroend05-macrostart05

macnamestart05	dc.b	'WORD size JMP Table     '
	ifgt	24-(*-macnamestart05)
	dcb.b	24-(*-macnamestart05),0
	endc

macrostart05	dc.w	$0056	; */Convert specific EA's/Set base #1
	dc.w	$0677	; CURSOR/Pattern search/Set pattern string
	dc.w	(2$-1$)

1$	dc.b	'(	dc.w	|	dw	)',0,1
	cnop	0,2

2$	dc.w	$0247	; MACROS 1/Set macro label/#1
	dc.w	$7FA1	; MACROS 1/Set macro label/#1
	dc.w	$0256	; CURSOR/Pattern search/Search this line
	dc.w	$0059	; */Convert specific EA's/Cvert W/base 1
	dc.w	$8211	; CURSOR/Relative/Next byte * 2
	dc.w	$0251	; MACROS 1/Previous macro label/#1
	dc.w	0	; reserved
macroend05:
************************************************************************
;This macro gets the reference label of a "JMP" instruction, and renames
;the label on the "JMP" line, "<label>.jmp".
;So "Label jmp strcmp" will produce "strcmp.jmp jmp strcmp".

	dc.l	6	; Macro number 6
	dc.l	macroend06-macrostart06

macnamestart06	dc.b	'Name from Fwd Ref       '
	ifgt	24-(*-macnamestart06)
	dcb.b	24-(*-macnamestart06),0
	endc

macrostart06	dc.w	$0040	; CURSOR/Absolute/Forward reference
	dc.w	$0209	; STRINGS/Get/Label
	dc.w	$003F	; CURSOR/Absolute/Previous location
	dc.w	$0208	; STRINGS/Edit functions/Append
	dc.w	(2$-1$)

1$	dc.b	'.jmp',0,1
	cnop	0,2

2$	dc.w	$0213	; STRINGS/Put/Label
	dc.w	$0186	; CURSOR/Relative/Next label
	dc.w	0	; reserved
macroend06:
************************************************************************
;This is a dangerous macro!
;This macro loops forever or until aborted!
;If you have some image data, and would like to convert it to binary, first
;set the data size, words or longwords.  Then call this macro with the start
;of the data on the cursor line.  Select the abort function, either from the
;1st menu or from the keyboard, when you get near the bottom of the data to
;convert.
;If you do not have real fast reflexes, change the line at "macrostart07"
;to "dc.w    $019C   ; MACROS 1/Execution speed/Slow".

	dc.l	7	; Macro number 7
	dc.l	macroend07-macrostart07

macnamestart07	dc.b	'Convert to binary       '
	ifgt	24-(*-macnamestart07)
	dcb.b	24-(*-macnamestart07),0
	endc

macrostart07	dc.w	$019B	; MACROS 1/Execution speed/Fast
	dc.w	$002D	; DISPLAY/Set Numeric base/Binary
	dc.w	$810A	; CURSOR/Relative/Next line * 1
	dc.w	$0251	; MACROS 1/Previous macro label/#1
	dc.w	0	; reserved
macroend07:
************************************************************************
;This is a dangerous macro!
;This macro loops forever or until aborted!
;Many times you will have a number of subroutines in a program that you
;would like to treat as "black boxes".  That is, starting with a global label
;and containing only local labels.  It is generally safe to treat programs
;written in C this way, but programs written in assembler may have entry
;points anywhere.
;To use this macro, position the 2nd label (the label after the global label)
;on the cursor line, and execute this macro.  Select the abort function,
;either from the 1st menu or from the keyboard, when you get to the last label
;to convert.
;If you do not have real fast reflexes, change the line at "macrostart08"
;to "dc.w    $019C   ; MACROS 1/Execution speed/Slow".

	dc.l	8	; Macro number 8
	dc.l	macroend8-macrostart8

macnamestart8	dc.b	'Local labels            '
	ifgt	24-(*-macnamestart8)
	dcb.b	24-(*-macnamestart8),0
	endc

macrostart8	dc.w	$019B	; MACROS 1/Execution speed/Fast
	dc.w	$029D	; STRINGS/Accumulator/Decimal
	dc.w	$0225	; STRINGS/Define string/Acm
	dc.w	(2$-1$)

1$	dc.b	'1$',0,1
	cnop	0,2

2$	dc.w	$0247	; MACROS 1/Set macro label/#1
	dc.w	$7FA1	; MACROS 1/Set macro label/#1
	dc.w	$0213	; STRINGS/Put/Label
	dc.w	$0186	; CURSOR/Relative/Next label
	dc.w	$0206	; STRINGS/Edit functions/Clip end
	dc.w	(4$-3$)

3$	dc.b	'$',0,1
	cnop	0,2

4$	dc.w	$0216	; STRINGS/Maths functions/Increment
	dc.w	$0208	; STRINGS/Edit functions/Append
	dc.w	(6$-5$)

5$	dc.b	'$',0,1
	cnop	0,2

6$	dc.w	$0251	; MACROS 1/Previous macro label/#1
	dc.w	0	; reserved
macroend8:
************************************************************************
;This is the minimum "Auto-configuration" macro that ReSource will produce.
;If you have made changes to your ReSource environment, substitute your
;"Auto-configuration" macro for this macro (must be macro 19).

	dc.l	19	; Macro number 19
	dc.l	macroend19-macrostart19

macnamestart19	dc.b	' Auto-configuration     '
	ifgt	24-(*-macnamestart19)
	dcb.b	24-(*-macnamestart19),0
	endc

macrostart19	dc.w	$0384	; DISPLAY 2/Set comments column
	dc.w	(2$-1$)

1$	dc.b	'$34',0,1
	cnop	0,2

2$	dc.w	$0339	; MACROS 3/Execute/(#19)
	dc.w	0	; reserved
macroend19:
************************************************************************
*                 ---==== End of General Macros ====---                *
************************************************************************
;After disassembly, and if there are no extraneous labels, position the
;start of the structure on the cursor line, and execute this macro to get
;a symbolic NewScreen structure.

	dc.l	20	; Macro number 20
	dc.l	macroend20-macrostart20

macnamestart20	dc.b	'NewScreen               '
	ifgt	24-(*-macnamestart20)
	dcb.b	24-(*-macnamestart20),0
	endc

macrostart20	dc.w	$001F	; LABELS/Create single/Full-line comment
	dc.w	(2$-1$)

1$	dc.b	';',0,1
	cnop	0,2

2$	dc.w	$0014	; DISPLAY/Set data type/Words
	dc.w	$850A	; CURSOR/Relative/Next line * 5
	dc.w	$0017	; DISPLAY/Set data type/Bytes
	dc.w	$820A	; CURSOR/Relative/Next line * 2
	dc.w	$0014	; DISPLAY/Set data type/Words
	dc.w	$031F	; SYMBOLS/View modes
	dc.w	$810A	; CURSOR/Relative/Next line * 1
	dc.w	$0678	; SYMBOLS/Screen types
	dc.w	$810A	; CURSOR/Relative/Next line * 1
	dc.w	$0013	; DISPLAY/Set data type/Longs
	dc.w	$8409	; CURSOR/Relative/Previous line * 4
	dc.w	$02C4	; DISPLAY 2/Mult constants override/Set
	dc.w	$8509	; CURSOR/Relative/Previous line * 5
	dc.w	$02C4	; DISPLAY 2/Mult constants override/Set
	dc.w	$005C	; DISPLAY/Set Numeric base/Decimal
	dc.w	0	; reserved
macroend20:
************************************************************************
;After disassembly, and if there are no extraneous labels, position the
;start of the structure on the cursor line, and execute this macro to get
;a symbolic NewWindow structure.

	dc.l	21	; Macro number 21
	dc.l	macroend21-macrostart21

macnamestart21	dc.b	'NewWindow               '
	ifgt	24-(*-macnamestart21)
	dcb.b	24-(*-macnamestart21),0
	endc

macrostart21	dc.w	$001F	; LABELS/Create single/Full-line comment
	dc.w	(2$-1$)

1$	dc.b	';',0,1
	cnop	0,2

2$	dc.w	$0014	; DISPLAY/Set data type/Words
	dc.w	$840A	; CURSOR/Relative/Next line * 4
	dc.w	$0017	; DISPLAY/Set data type/Bytes
	dc.w	$820A	; CURSOR/Relative/Next line * 2
	dc.w	$0013	; DISPLAY/Set data type/Longs
	dc.w	$0113	; SYMBOLS/IDCMP classes
	dc.w	$810A	; CURSOR/Relative/Next line * 1
	dc.w	$014F	; SYMBOLS/Window flags
	dc.w	$860A	; CURSOR/Relative/Next line * 6
	dc.w	$0014	; DISPLAY/Set data type/Words
	dc.w	$840A	; CURSOR/Relative/Next line * 4
	dc.w	$0014	; DISPLAY/Set data type/Words
	dc.w	$0678	; SYMBOLS/Screen types
	dc.w	$8409	; CURSOR/Relative/Previous line * 4
	dc.w	$02C4	; DISPLAY 2/Mult constants override/Set
	dc.w	$005C	; DISPLAY/Set Numeric base/Decimal
	dc.w	$8909	; CURSOR/Relative/Previous line * 9
	dc.w	$02C4	; DISPLAY 2/Mult constants override/Set
	dc.w	$8409	; CURSOR/Relative/Previous line * 4
	dc.w	$02C4	; DISPLAY 2/Mult constants override/Set
	dc.w	$005C	; DISPLAY/Set Numeric base/Decimal
	dc.w	0	; reserved
macroend21:
************************************************************************
;After disassembly, and if there are no extraneous labels, position the
;start of the structure on the cursor line, and execute this macro to get
;a symbolic TextAttr structure.

	dc.l	22	; Macro number 22
	dc.l	macroend22-macrostart22

macnamestart22	dc.b	'TextAttr                '
	ifgt	24-(*-macnamestart22)
	dcb.b	24-(*-macnamestart22),0
	endc

macrostart22	dc.w	$0040	; CURSOR/Absolute/Forward reference
	dc.w	$001D	; LABELS/Create single/Label
	dc.w	(2$-1$)

1$	dc.b	'FontName',0,1
	cnop	0,2

2$	dc.w	$003F	; CURSOR/Absolute/Previous location
	dc.w	$810A	; CURSOR/Relative/Next line * 1
	dc.w	$0014	; DISPLAY/Set data type/Words
	dc.w	$810A	; CURSOR/Relative/Next line * 1
	dc.w	$0017	; DISPLAY/Set data type/Bytes
	dc.w	$010C	; SYMBOLS/Font styles
	dc.w	$810A	; CURSOR/Relative/Next line * 1
	dc.w	$010A	; SYMBOLS/FontFlags
	dc.w	0	; reserved
macroend22:
************************************************************************
;3 steps to easy IntuiText label creation:
;Use this macro and the "<name>.Text" and "IntuiText Names" macros to create
;meaningful labels easily.
;Only use these macros if there are no extraneous labels in the IntuiText
;structure.
;Do step 1 for all IntuiText structures in a group.  Then do step 2 for all
;"it_IText" data.  Then do step 3 for all IntuiText structures.
;
;Step 1 in easy IntuiText label creation:
;After disassembly, and if there are no extraneous labels, position the
;start of the structure on the cursor line, and execute this macro to get
;a symbolic IntuiText structure.
;If appropriate, then use the "<name>.Text" and "IntuiText Names" macros.

	dc.l	23	; Macro number 23
	dc.l	macroend23-macrostart23

macnamestart23	dc.b	'IText                   '
	ifgt	24-(*-macnamestart23)
	dcb.b	24-(*-macnamestart23),0
	endc

macrostart23	dc.w	$0017	; DISPLAY/Set data type/Bytes
	dc.w	$840A	; CURSOR/Relative/Next line * 4
	dc.w	$0014	; DISPLAY/Set data type/Words
	dc.w	$820A	; CURSOR/Relative/Next line * 2
	dc.w	$0013	; DISPLAY/Set data type/Longs
	dc.w	$830A	; CURSOR/Relative/Next line * 3
	dc.w	$0042	; LABELS/Edit single/Full-line comment
	dc.w	(2$-1$)

1$	dc.b	';',0,1
	cnop	0,2

2$	dc.w	$8509	; CURSOR/Relative/Previous line * 5
	dc.w	$02C4	; DISPLAY 2/Mult constants override/Set
	dc.w	$8409	; CURSOR/Relative/Previous line * 4
	dc.w	$02C4	; DISPLAY 2/Mult constants override/Set
	dc.w	0	; reserved
macroend23:
************************************************************************
;Step 2 in easy IntuiText label creation:
;This macro is useful for creating consistant names for IntuiText structures
;and their "it_IText" data.
;When ReSource detects referenced ASCII, it creates a label out of the ASCII
;text, and appends ".MSG".
;This macro will replace the "MSG" part with "Text".
;Don't use on labels that don't end in "MSG".
;After using the "IText" macro and this one, then use the "IntuiText Names"
;macro, if appropriate.

	dc.l	24	; Macro number 24
	dc.l	macroend24-macrostart24

macnamestart24	dc.b	'<name>.Text             '
	ifgt	24-(*-macnamestart24)
	dcb.b	24-(*-macnamestart24),0
	endc

macrostart24	dc.w	$0209	; STRINGS/Get/Label
	dc.w	$0206	; STRINGS/Edit functions/Clip end
	dc.w	(2$-1$)

1$	dc.b	'MSG',0,1
	cnop	0,2

2$	dc.w	$0208	; STRINGS/Edit functions/Append
	dc.w	(4$-3$)

3$	dc.b	'Text',0,1
	cnop	0,2

4$	dc.w	$0213	; STRINGS/Put/Label
	dc.w	$810A	; CURSOR/Relative/Next line * 1
	dc.w	0	; reserved
macroend24:
************************************************************************
;Step 3 in easy IntuiText label creation:
;After using the "IText" and "<name>.Text" macros, then use this one, if
;appropriate.
;Position the start of the IntuiText structure on the cursor line, and
;execute this macro to get a meaningful name for the IntuiText structure.
;It will end up with the name "<text>.ITxt".

	dc.l	25	; Macro number 25
	dc.l	macroend25-macrostart25

macnamestart25	dc.b	'IntuiText Names         '
	ifgt	24-(*-macnamestart25)
	dcb.b	24-(*-macnamestart25),0
	endc

macrostart25	dc.w	$000A	; CURSOR/Relative/Next line
	dc.w	$820A	; CURSOR/Relative/Next line * 2
	dc.w	$0040	; CURSOR/Absolute/Forward reference
	dc.w	$0209	; STRINGS/Get/Label
	dc.w	$003F	; CURSOR/Absolute/Previous location
	dc.w	$0187	; CURSOR/Relative/Previous label
	dc.w	$0206	; STRINGS/Edit functions/Clip end
	dc.w	(2$-1$)

1$	dc.b	'Text',0,1
	cnop	0,2

2$	dc.w	$0208	; STRINGS/Edit functions/Append
	dc.w	(4$-3$)

3$	dc.b	'ITxt',0,1
	cnop	0,2

4$	dc.w	$0213	; STRINGS/Put/Label
	dc.w	$0186	; CURSOR/Relative/Next label
	dc.w	0	; reserved
macroend25:
************************************************************************
;After disassembly, and if there are no extraneous labels, position the
;start of the structure on the cursor line, and execute this macro to get
;a symbolic Menu structure.

	dc.l	26	; Macro number 26
	dc.l	macroend26-macrostart26

macnamestart26	dc.b	'Menu                    '
	ifgt	24-(*-macnamestart26)
	dcb.b	24-(*-macnamestart26),0
	endc

macrostart26	dc.w	$0013	; DISPLAY/Set data type/Longs
	dc.w	$810A	; CURSOR/Relative/Next line * 1
	dc.w	$0014	; DISPLAY/Set data type/Words
	dc.w	$840A	; CURSOR/Relative/Next line * 4
	dc.w	$0014	; DISPLAY/Set data type/Words
	dc.w	$810A	; CURSOR/Relative/Next line * 1
	dc.w	$0013	; DISPLAY/Set data type/Longs
	dc.w	$820A	; CURSOR/Relative/Next line * 2
	dc.w	$0014	; DISPLAY/Set data type/Words
	dc.w	$840A	; CURSOR/Relative/Next line * 4
	dc.w	$001F	; LABELS/Create single/Full-line comment
	dc.w	(2$-1$)

1$	dc.b	';',0,1
	cnop	0,2

2$	dc.w	$8409	; CURSOR/Relative/Previous line * 4
	dc.w	$02C4	; DISPLAY 2/Mult constants override/Set
	dc.w	$8309	; CURSOR/Relative/Previous line * 3
	dc.w	$011E	; SYMBOLS/Menu flags
	dc.w	$8409	; CURSOR/Relative/Previous line * 4
	dc.w	$02C4	; DISPLAY 2/Mult constants override/Set
	dc.w	$005C	; DISPLAY/Set Numeric base/Decimal
	dc.w	$8109	; CURSOR/Relative/Previous line * 1
	dc.w	$0040	; CURSOR/Absolute/Forward reference
	dc.w	0	; reserved
macroend26:
************************************************************************
;After disassembly, and if there are no extraneous labels, position the
;start of the structure on the cursor line, and execute this macro to get
;a symbolic MenuItem structure.

	dc.l	27	; Macro number 27
	dc.l	macroend27-macrostart27

macnamestart27	dc.b	'MenuItem                '
	ifgt	24-(*-macnamestart27)
	dcb.b	24-(*-macnamestart27),0
	endc

macrostart27	dc.w	$0013	; DISPLAY/Set data type/Longs
	dc.w	$810A	; CURSOR/Relative/Next line * 1
	dc.w	$0014	; DISPLAY/Set data type/Words
	dc.w	$840A	; CURSOR/Relative/Next line * 4
	dc.w	$0014	; DISPLAY/Set data type/Words
	dc.w	$011F	; SYMBOLS/MenuItem flags
	dc.w	$810A	; CURSOR/Relative/Next line * 1
	dc.w	$0013	; DISPLAY/Set data type/Longs
	dc.w	$830A	; CURSOR/Relative/Next line * 3
	dc.w	$0017	; DISPLAY/Set data type/Bytes
	dc.w	$820A	; CURSOR/Relative/Next line * 2
	dc.w	$0013	; DISPLAY/Set data type/Longs
	dc.w	$810A	; CURSOR/Relative/Next line * 1
	dc.w	$0014	; DISPLAY/Set data type/Words
	dc.w	$810A	; CURSOR/Relative/Next line * 1
	dc.w	$0042	; LABELS/Edit single/Full-line comment
	dc.w	(2$-1$)

1$	dc.b	';',0,1
	cnop	0,2

2$	dc.w	$8409	; CURSOR/Relative/Previous line * 4
	dc.w	$02C4	; DISPLAY 2/Mult constants override/Set
	dc.w	$8809	; CURSOR/Relative/Previous line * 8
	dc.w	$02C4	; DISPLAY 2/Mult constants override/Set
	dc.w	$005C	; DISPLAY/Set Numeric base/Decimal
	dc.w	$8109	; CURSOR/Relative/Previous line * 1
	dc.w	$0040	; CURSOR/Absolute/Forward reference
	dc.w	0	; reserved
macroend27:
************************************************************************
;After disassembly, and if there are no extraneous labels, position the
;start of the structure on the cursor line, and execute this macro to get
;a symbolic (old style) Gadget structure.

	dc.l	28	; Macro number 28
	dc.l	macroend28-macrostart28

macnamestart28	dc.b	'Gadget                  '
	ifgt	24-(*-macnamestart28)
	dcb.b	24-(*-macnamestart28),0
	endc

macrostart28	dc.w	$001F	; LABELS/Create single/Full-line comment
	dc.w	(2$-1$)

1$	dc.b	';',0,1
	cnop	0,2

2$	dc.w	$810A	; CURSOR/Relative/Next line * 1
	dc.w	$0014	; DISPLAY/Set data type/Words
	dc.w	$840A	; CURSOR/Relative/Next line * 4
	dc.w	$0014	; DISPLAY/Set data type/Words
	dc.w	$010E	; SYMBOLS/Gadget flags
	dc.w	$810A	; CURSOR/Relative/Next line * 1
	dc.w	$010D	; SYMBOLS/Gadget activation
	dc.w	$810A	; CURSOR/Relative/Next line * 1
	dc.w	$010F	; SYMBOLS/Gadget types
	dc.w	$810A	; CURSOR/Relative/Next line * 1
	dc.w	$0013	; DISPLAY/Set data type/Longs
	dc.w	$850A	; CURSOR/Relative/Next line * 5
	dc.w	$0014	; DISPLAY/Set data type/Words
	dc.w	$005C	; DISPLAY/Set Numeric base/Decimal
	dc.w	$810A	; CURSOR/Relative/Next line * 1
	dc.w	$0013	; DISPLAY/Set data type/Longs
	dc.w	$8D09	; CURSOR/Relative/Previous line * $0D
	dc.w	$02C4	; DISPLAY 2/Mult constants override/Set
	dc.w	$005C	; DISPLAY/Set Numeric base/Decimal
	dc.w	$8109	; CURSOR/Relative/Previous line * 1
	dc.w	$0040	; CURSOR/Absolute/Forward reference
	dc.w	0	; reserved
macroend28:
************************************************************************
;After disassembly, and if there are no extraneous labels, position the
;start of the structure on the cursor line, and execute this macro to get
;a symbolic Image structure.

	dc.l	29	; Macro number 29
	dc.l	macroend29-macrostart29

macnamestart29	dc.b	'Image                   '
	ifgt	24-(*-macnamestart29)
	dcb.b	24-(*-macnamestart29),0
	endc

macrostart29	dc.w	$0014	; DISPLAY/Set data type/Words
	dc.w	$850A	; CURSOR/Relative/Next line * 5
	dc.w	$0013	; DISPLAY/Set data type/Longs
	dc.w	$810A	; CURSOR/Relative/Next line * 1
	dc.w	$0017	; DISPLAY/Set data type/Bytes
	dc.w	$820A	; CURSOR/Relative/Next line * 2
	dc.w	$0013	; DISPLAY/Set data type/Longs
	dc.w	$8209	; CURSOR/Relative/Previous line * 2
	dc.w	$02C4	; DISPLAY 2/Mult constants override/Set
	dc.w	$8609	; CURSOR/Relative/Previous line * 6
	dc.w	$02C4	; DISPLAY 2/Mult constants override/Set
	dc.w	$005C	; DISPLAY/Set Numeric base/Decimal
	dc.w	$840A	; CURSOR/Relative/Next line * 4
	dc.w	$0042	; LABELS/Edit single/Full-line comment
	dc.w	(2$-1$)

1$	dc.b	';',0,1
	cnop	0,2

2$	dc.w	0	; reserved
macroend29:
************************************************************************
;After disassembly, and if there are no extraneous labels, position the
;start of the structure on the cursor line, and execute this macro to get
;a symbolic Border structure.

	dc.l	30	; Macro number 30
	dc.l	macroend30-macrostart30

macnamestart30	dc.b	'Border                  '
	ifgt	24-(*-macnamestart30)
	dcb.b	24-(*-macnamestart30),0
	endc

macrostart30	dc.w	$0014	; DISPLAY/Set data type/Words
	dc.w	$820A	; CURSOR/Relative/Next line * 2
	dc.w	$0017	; DISPLAY/Set data type/Bytes
	dc.w	$840A	; CURSOR/Relative/Next line * 4
	dc.w	$0013	; DISPLAY/Set data type/Longs
	dc.w	$820A	; CURSOR/Relative/Next line * 2
	dc.w	$0042	; LABELS/Edit single/Full-line comment
	dc.w	(2$-1$)

1$	dc.b	';',0,1
	cnop	0,2

2$	dc.w	$8609	; CURSOR/Relative/Previous line * 6
	dc.w	$02C4	; DISPLAY 2/Mult constants override/Set
	dc.w	$005C	; DISPLAY/Set Numeric base/Decimal
	dc.w	$8209	; CURSOR/Relative/Previous line * 2
	dc.w	$02C4	; DISPLAY 2/Mult constants override/Set
	dc.w	$005C	; DISPLAY/Set Numeric base/Decimal
	dc.w	0	; reserved
macroend30:
************************************************************************
*                ---==== End of Intuition Macros ====---               *
************************************************************************
;When disassembling ILBM (and related) data, it is often easier to see what
;is going on if it is not just a jumble of bytes, words or longwords.
;This macro will convert a "CMAP" color table to orderly data; 3 bytes per
;line.
;Position the 1st entry (just past the size longword) on the cursor line, and
;execute this macro.  Continue (repeat macro or press the spacebar) until all
;entrys are done.
;Don't go over onto the next data chunk.  Undoing what this macro does is a
;pain.

	dc.l	39	; Macro number 39
	dc.l	macroend39-macrostart39

macnamestart39	dc.b	'Make CMAP (1 entry)','     '
	ifgt	24-(*-macnamestart39)
	dcb.b	24-(*-macnamestart39),0
	endc

macrostart39	dc.w	$0017	; DISPLAY/Set data type/Bytes
	dc.w	$830A	; CURSOR/Relative/Next line * 3
	dc.w	$0017	; DISPLAY/Set data type/Bytes
	dc.w	$8309	; CURSOR/Relative/Previous line * 3
	dc.w	$02C4	; DISPLAY 2/Mult constants override/Set
	dc.w	$810A	; CURSOR/Relative/Next line * 1
	dc.w	0	; reserved
macroend39:
************************************************************************
;Put any floppy disk installed under V36 or later, OFS or FFS, into DF0: and
;excute this macro to see a commented disassembly of the boot sector.

	dc.l	54	; Macro number 54
	dc.l	macroend54-macrostart54

macnamestart54	dc.b	'Disassemble BOOT sector '
	ifgt	24-(*-macnamestart54)
	dcb.b	24-(*-macnamestart54),0
	endc

macrostart54	dc.w	$01A4	; MACROS 1/Execution speed/Very slow
	dc.w	$0273	; PROJECT/Read tracks
	dc.w	(2$-1$)

1$	dc.b	'df0: 0 0 2',0,1
	cnop	0,2

2$	dc.w	$000B	; DISPLAY/Set data type/ASCII
	dc.w	$810A	; CURSOR/Relative/Next line * 1
	dc.w	$0013	; DISPLAY/Set data type/Longs
	dc.w	$820A	; CURSOR/Relative/Next line * 2
	dc.w	$000E	; DISPLAY/Set data type/Code
	dc.w	$8309	; CURSOR/Relative/Previous line * 3
	dc.w	$001F	; LABELS/Create single/Full-line comment
	dc.w	(4$-3$)

3$	dc.b	'The 1st longword of a bootblock is "DOS" followed by hex 0',0,1
	cnop	0,2

4$	dc.w	$001F	; LABELS/Create single/Full-line comment
	dc.w	(6$-5$)

5$	dc.b	'or hex 1, if formatted using FastFileSystem.',0,1
	cnop	0,2

6$	dc.w	$810A	; CURSOR/Relative/Next line * 1
	dc.w	$001F	; LABELS/Create single/Full-line comment
	dc.w	(8$-7$)

7$	dc.b	'The 2nd longword of a bootblock is the block checksum.',0,1
	cnop	0,2

8$	dc.w	$810A	; CURSOR/Relative/Next line * 1
	dc.w	$001F	; LABELS/Create single/Full-line comment
	dc.w	(10$-9$)

9$	dc.b	'The 3rd longword of a bootblock is the location of the root block.',0,1
	cnop	0,2

10$	dc.w	$005C	; DISPLAY/Set Numeric base/Decimal
	dc.w	$810A	; CURSOR/Relative/Next line * 1
	dc.w	$0034	; LABELS/Create single/Label - fwd ref
	dc.w	$0040	; CURSOR/Absolute/Forward reference
	dc.w	$001D	; LABELS/Create single/Label
	dc.w	(12$-11$)

11$	dc.b	'ExpansionName',0,1
	cnop	0,2

12$	dc.w	$003F	; CURSOR/Absolute/Previous location
	dc.w	$810A	; CURSOR/Relative/Next line * 1
	dc.w	$005C	; DISPLAY/Set Numeric base/Decimal
	dc.w	$001E	; LABELS/Create single/End-of-line comment
	dc.w	(14$-13$)

13$	dc.b	'V2.04 or better',0,1
	cnop	0,2

14$	dc.w	$810A	; CURSOR/Relative/Next line * 1
	dc.w	$008C	; SYMBOLS/Offsets/Exec
	dc.w	$001E	; LABELS/Create single/End-of-line comment
	dc.w	(16$-15$)

15$	dc.b	'Open the expansion library',0,1
	cnop	0,2

16$	dc.w	$810A	; CURSOR/Relative/Next line * 1
	dc.w	$001E	; LABELS/Create single/End-of-line comment
	dc.w	(18$-17$)

17$	dc.b	'Did it open OK?',0,1
	cnop	0,2

18$	dc.w	$810A	; CURSOR/Relative/Next line * 1
	dc.w	$0034	; LABELS/Create single/Label - fwd ref
	dc.w	$0040	; CURSOR/Absolute/Forward reference
	dc.w	$001D	; LABELS/Create single/Label
	dc.w	(20$-19$)

19$	dc.b	'1$',0,1
	cnop	0,2
20$
	dc.w	$003F	; CURSOR/Absolute/Previous location
	dc.w	$001E	; LABELS/Create single/End-of-line comment
	dc.w	(22$-21$)

21$	dc.b	'Branch if no',0,1
	cnop	0,2

22$	dc.w	$810A	; CURSOR/Relative/Next line * 1
	dc.w	$001E	; LABELS/Create single/End-of-line comment
	dc.w	(24$-23$)

23$	dc.b	'Move base into an address reg',0,1
	cnop	0,2

24$	dc.w	$810A	; CURSOR/Relative/Next line * 1
	dc.w	$05BE	; SYMBOLS/eb_Flags bitdefs
	dc.w	$0051	; SYMBOLS/Select field/Second
	dc.w	$008D	; SYMBOLS/Offsets/Expansion
	dc.w	$001E	; LABELS/Create single/End-of-line comment
	dc.w	(26$-25$)

25$	dc.b	'Special kludge',0,1
	cnop	0,2

26$	dc.w	$810A	; CURSOR/Relative/Next line * 1
	dc.w	$008C	; SYMBOLS/Offsets/Exec
	dc.w	$001E	; LABELS/Create single/End-of-line comment
	dc.w	(28$-27$)

27$	dc.b	'Close expansion library',0,1
	cnop	0,2

28$	dc.w	$810A	; CURSOR/Relative/Next line * 1
	dc.w	$0034	; LABELS/Create single/Label - fwd ref
	dc.w	$0040	; CURSOR/Absolute/Forward reference
	dc.w	$001D	; LABELS/Create single/Label
	dc.w	(30$-29$)

29$	dc.b	'DosName',0,1
	cnop	0,2

30$	dc.w	$003F	; CURSOR/Absolute/Previous location
	dc.w	$810A	; CURSOR/Relative/Next line * 1
	dc.w	$008C	; SYMBOLS/Offsets/Exec
	dc.w	$001E	; LABELS/Create single/End-of-line comment
	dc.w	(32$-31$)

31$	dc.b	'Find resident tag',0,1
	cnop	0,2

32$	dc.w	$810A	; CURSOR/Relative/Next line * 1
	dc.w	$001E	; LABELS/Create single/End-of-line comment
	dc.w	(34$-33$)

33$	dc.b	'Did we find it?',0,1
	cnop	0,2

34$	dc.w	$810A	; CURSOR/Relative/Next line * 1
	dc.w	$0034	; LABELS/Create single/Label - fwd ref
	dc.w	$0040	; CURSOR/Absolute/Forward reference
	dc.w	$001D	; LABELS/Create single/Label
	dc.w	(36$-35$)
35$
	dc.b	'2$',0,1
	cnop	0,2

36$	dc.w	$003F	; CURSOR/Absolute/Previous location
	dc.w	$001E	; LABELS/Create single/End-of-line comment
	dc.w	(38$-37$)

37$	dc.b	'Branch if no',0,1
	cnop	0,2

38$	dc.w	$810A	; CURSOR/Relative/Next line * 1
	dc.w	$001E	; LABELS/Create single/End-of-line comment
	dc.w	(40$-39$)

39$	dc.b	'Move tag into an address reg',0,1
	cnop	0,2

40$	dc.w	$810A	; CURSOR/Relative/Next line * 1
	dc.w	$00D8	; SYMBOLS/ResidentTag
	dc.w	$001E	; LABELS/Create single/End-of-line comment
	dc.w	(42$-41$)

41$	dc.b	'Get address of init routine in A0',0,1
	cnop	0,2

42$	dc.w	$810A	; CURSOR/Relative/Next line * 1
	dc.w	$001E	; LABELS/Create single/End-of-line comment
	dc.w	(44$-43$)

43$	dc.b	'Indicate success!',0,1
	cnop	0,2

44$	dc.w	$0186	; CURSOR/Relative/Next label
	dc.w	$001E	; LABELS/Create single/End-of-line comment
	dc.w	(46$-45$)

45$	dc.b	'Indicate failure ;^(',0,1
	cnop	0,2

46$	dc.w	$0186	; CURSOR/Relative/Next label
	dc.w	$0186	; CURSOR/Relative/Next label
	dc.w	$810A	; CURSOR/Relative/Next line * 1
	dc.w	$02C2	; DISPLAY 2/DCB override/Set
	dc.w	$0017	; DISPLAY/Set data type/Bytes
	dc.w	$005C	; DISPLAY/Set Numeric base/Decimal
	dc.w	$001E	; LABELS/Create single/End-of-line comment
	dc.w	(48$-47$)

47$	dc.b	'Not used for normal bootblock',0,1
	cnop	0,2

48$	dc.w	$001F	; LABELS/Create single/Full-line comment
	dc.w	(50$-49$)

49$	dc.b	';',0,1
	cnop	0,2

50$	dc.w	$0015	; CURSOR/Absolute/Start of file
	dc.w	0	; reserved
macroend54:
************************************************************************
;This macro removes repeats from the RS.KeyTable file.
;We don't think that executing this macro is particularly useful, or even a
;good idea, but thought that many people would be interested in seeing the
;kind of useful file transformations that may be done with ReSource macros.
;If you do execute this macro, back up your RS.KeyTable file first!

	dc.l	55	; Macro number 55
	dc.l	macroend55-macrostart55

macnamestart55	dc.b	'Remove KT Repeats       '
	ifgt	24-(*-macnamestart55)
	dcb.b	24-(*-macnamestart55),0
	endc

macrostart55	dc.w	$003C	; PROJECT/Open load file
	dc.w	(2$-1$)

1$	dc.b	'RS.keytable',0,1
	cnop	0,2

2$	dc.w	$0014	; DISPLAY/Set data type/Words
	dc.w	$0035	; reserved
	dc.w	$0247	; MACROS 1/Set macro label/#1
	dc.w	$7FA1	; MACROS 1/Set macro label/#1
	dc.w	$020E	; STRINGS/Get/Symbol value
	dc.w	$7FFD	; MACROS 1/Directives/Start conditional
	dc.w	$0258	; STRINGS/Maths functions/Logical AND
	dc.w	(4$-3$)

3$	dc.b	'$7FFF',0,1
	cnop	0,2

4$	dc.w	$7FFE	; MACROS 1/Directives/End conditional
	dc.w	$0226	; */Zap
	dc.w	(6$-5$)

5$	dc.b	$1B,$1B,0,1
	cnop	0,2

6$	dc.w	$810A	; CURSOR/Relative/Next line * 1
	dc.w	$0251	; MACROS 1/Previous macro label/#1
	dc.w	0	; reserved
macroend55:
************************************************************************
;This macro will send the assembly output file from ReSource to PRT: just
;as though you had selected "SAVE/Save .asm/All".

	dc.l	56	; Macro number 56
	dc.l	macroend56-macrostart56

macnamestart56	dc.b	'Print current file      '
	ifgt	24-(*-macnamestart56)
	dcb.b	24-(*-macnamestart56),0
	endc

macrostart56	dc.w	$004C	; SAVE/Tabs/Spaces
	dc.w	$0279	; STRINGS/Get/Filename
	dc.w	$0207	; STRINGS/Edit functions/Prepend
	dc.w	(2$-1$)

1$	dc.b	'echo > prt: ',$27,0,1
	cnop	0,2

2$	dc.w	$0208	; STRINGS/Edit functions/Append
	dc.w	(4$-3$)

3$	dc.b	$27,0,1
	cnop	0,2

4$	dc.w	$01C9	; */DOS command
	dc.w	(6$-5$)

5$	dc.b	$1B,$1B,0,1
	cnop	0,2

6$	dc.w	$01C9	; */DOS command
	dc.w	(8$-7$)

7$	dc.b	'date > prt:',0,1
	cnop	0,2

8$	dc.w	$01C9	; */DOS command
	dc.w	(10$-9$)

9$	dc.b	'echo > prt: " "',0,1
	cnop	0,2

10$	dc.w	$0018	; SAVE/Save .asm/All
	dc.w	(12$-11$)

11$	dc.b	'prt:',0,1
	cnop	0,2

12$	dc.w	$01C9	; */DOS command
	dc.w	(14$-13$)

13$	dc.b	'echo > prt: "',$0C,'"',0,1
	cnop	0,2

14$	dc.w	$004B	; SAVE/Tabs/Real tabs
	dc.w	0	; reserved
macroend56:
************************************************************************
*              ---==== End of Miscellaneous Macros ====---             *
************************************************************************

	end
