home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 289.lha / Resource_v3.20 / Example_Macros.doc < prev    next >
Encoding:
Text File  |  1989-10-07  |  30.3 KB  |  918 lines

  1.                                Macro Examples
  2.                                **************
  3.  
  4. Presented here are four examples of macros designed to better aquaint you
  5. with the features of ReSource.  These macros can be found in the file
  6. "S/RS.macros" on the ReSource distribution Disk 1.  If you have this file in
  7. the S: directory, it will be automatically loaded when you run ReSource. 
  8. Otherwise, you will need to load the file using the "LOCAL MACROS/Load macros"
  9. function, and entering the path where this file may be found.
  10.  
  11. ReSource's default execution speed for macros will be too fast for you to
  12. properly see the self-documenting messages that these macros display before
  13. they scroll away.  In order to see the messages, slow the macro execution
  14. speed by using the "LOCAL MACROS/Execution speed/Very slow" or "LOCAL MACROS/
  15. Execution speed/Wait on mouse" function.  If you choose "Very slow", the
  16. macros will execute approximately one function per second.  If you would like
  17. even more control over macro execution, choose "Wait on mouse".  ReSource
  18. will wait for you to press the left-mouse-button before executing the next
  19. macro function.
  20.  
  21. In each of the example macros below, the macro functions are listed one per
  22. line.  If a function takes a string argument, that will be found on the next
  23. line and indented.  The first three macros disassemble ARP programs.  In
  24. order for them to work properly, the programs MUST be from ARP release V39.1.
  25. All three programs can be found, and are assumed to be, in "ReSource:c" on
  26. the ReSource distribution Disk 1.  The macros will load the programs for you;
  27. no need to load them into ReSource first.
  28.  
  29. After completion of each macro, you may select the "Print file" macro if you
  30. wish a hardcopy listing of the disassembly.  This macro will send its output
  31. to the PRT: device.
  32.  
  33. Example Macro #1: Disassemble ARP 'Stack'
  34. =========================================
  35.  
  36. This macro will load, disassemble and comment ARP release V39.1 of the
  37. 'Stack' program.
  38.  
  39.  PROJECT/Open load file
  40.    'resource:c/stack'
  41.  OPTIONS 2/Multiple constants/Off
  42.  LABELS/Create single/Label - fwd ref
  43.  LABELS/Create single/Full-line comment
  44.    'Start executing here!'
  45.  CURSOR/Relative/Next line * 1
  46.  DISPLAY/Set data type/Code
  47.  LABELS/Create single/Full-line comment
  48.    'ARP resident looks for this to recognize other ARP programs'
  49.  CURSOR/Relative/Next line * 1
  50.  DISPLAY/Set data type/Longs
  51.  LABELS/Create single/Full-line comment
  52.    'Default stack size used by ARP "Resident"'
  53.  CURSOR/Relative/Next line * 2
  54.  DISPLAY/Set data type/Code
  55.  CURSOR/Relative/Next line * 1
  56.  LABELS/Edit single/Symbol
  57.    'AbsExecBase'
  58.  LABELS/Create single/Full-line comment
  59.    'Get pointer to exec library'
  60.  CURSOR/Relative/Next line * 1
  61.  LABELS/Create single/Label - fwd ref
  62.  CURSOR/Relative/Next line * 1
  63.  DISPLAY/Set Numeric base/Decimal
  64.  LABELS/Create single/End-of-line comment
  65.    'Minimum version number of ARP library'
  66.  CURSOR/Relative/Next line * 1
  67.  SYMBOLS 1/Libraries/Exec
  68.  LABELS/Create single/End-of-line comment
  69.    'Open ARP library'
  70.  CURSOR/Relative/Next line * 1
  71.  LABELS/Create single/End-of-line comment
  72.    'Did it open okay?'
  73.  CURSOR/Relative/Next line * 1
  74.  LABELS/Create single/Label - fwd ref
  75.  LABELS/Create single/End-of-line comment
  76.    'branch if opened okay'
  77.  CURSOR/Absolute/Forward reference
  78.  LABELS/Create single/Label
  79.    'ARPOpened'
  80.  CURSOR/Absolute/Previous location
  81.  CURSOR/Relative/Next line * 1
  82.  LABELS/Create single/Label - fwd ref
  83.  LABELS/Create single/Full-line comment
  84.    'The following is only executed if ARP library couldn't be opened'
  85.  CURSOR/Relative/Next line * 1
  86.  SYMBOLS 1/Libraries/Exec
  87.  CURSOR/Relative/Next line * 1
  88.  LABELS/Create single/End-of-line comment
  89.    'Dis DOS library open okay?'
  90.  CURSOR/Relative/Next line * 1
  91.  LABELS/Create single/Label - fwd ref
  92.  CURSOR/Absolute/Forward reference
  93.  LABELS/Create single/Label
  94.    'NoDOS'
  95.  CURSOR/Absolute/Previous location
  96.  CURSOR/Relative/Next line * 1
  97.  LABELS/Create single/End-of-line comment
  98.    'Put DOS base into A6 register'
  99.  CURSOR/Relative/Next line * 1
  100.  SYMBOLS 1/Libraries/DOS
  101.  LABELS/Create single/End-of-line comment
  102.    'Get Standard Out'
  103.  CURSOR/Relative/Next line * 3
  104.  LABELS/Create single/Label - fwd ref
  105.  CURSOR/Relative/Next line * 2
  106.  LABELS/Create single/End-of-line comment
  107.    'Length of string to be displayed'
  108.  CURSOR/Relative/Next line * 1
  109.  SYMBOLS 1/Libraries/DOS
  110.  CURSOR/Relative/Next line * 7
  111.  LABELS/Create single/End-of-line comment
  112.    'Put ARP library base into A6'
  113.  CURSOR/Relative/Next line * 1
  114.  LABELS/Edit single/Symbol
  115.    'AbsExecBase'
  116.  CURSOR/Relative/Next line * 1
  117.  SYMBOLS 1/Libraries/Exec
  118.  LABELS/Create single/Full-line comment
  119.    'Get a pointer to our own task structure'
  120.  CURSOR/Relative/Next line * 1
  121.  SYMBOLS 2/Prf-Pz/Process structure
  122.  LABELS/Create single/Full-line comment
  123.    'If this was run from CLI, pr_CLI should not be null'
  124.  CURSOR/Relative/Next line * 1
  125.  LABELS/Create single/Label - fwd ref
  126.  CURSOR/Absolute/Forward reference
  127.  LABELS/Create single/Label
  128.    'FromCLI'
  129.  CURSOR/Absolute/Previous location
  130.  CURSOR/Relative/Next line * 1
  131.  LABELS/Create single/Full-line comment
  132.    'The following code is only executed if run from WorkBench'
  133.  CURSOR/Relative/Next line * 1
  134.  DISPLAY/Set Numeric base/Decimal
  135.  SYMBOLS 2/Q-R/Return codes
  136.  LABELS/Create single/End-of-line comment
  137.    'Return code'
  138.  CURSOR/Relative/Next line * 2
  139.  LABELS/Create single/Full-line comment
  140.    'pr_CLI is in the D1 register.  It is a BCPL pointer, this line converts to APTR'
  141.  CURSOR/Relative/Next line * 1
  142.  LABELS/Create single/End-of-line comment
  143.    'store for later use'
  144.  CURSOR/Relative/Next line * 1
  145.  LABELS/Create single/Full-line comment
  146.    'Restore pointer to command line, and command length'
  147.  CURSOR/Relative/Next line * 1
  148.  LABELS/Create single/Label - fwd ref
  149.  CURSOR/Relative/Next line * 2
  150.  LABELS/Create single/Label - fwd ref
  151.  CURSOR/Relative/Next line * 1
  152.  SYMBOLS 1/Libraries/ARP
  153.  LABELS/Create single/Full-line comment
  154.    'This ARP call looks at the command line'
  155.  CURSOR/Relative/Next line * 1
  156.  LABELS/Create single/End-of-line comment
  157.    'pointer to our Command Line Interface'
  158.  CURSOR/Relative/Next line * 2
  159.  LABELS/Create single/End-of-line comment
  160.    'How many parameters were given?'
  161.  CURSOR/Relative/Next line * 1
  162.  LABELS/Create single/Label - fwd ref
  163.  CURSOR/Relative/Next line * 1
  164.  LABELS/Create single/Label - fwd ref
  165.  CURSOR/Relative/Next line * 1
  166.  SYMBOLS 1/Libraries/ARP
  167.  LABELS/Create single/Full-line comment
  168.    'Convert string given by user to a number, returned in D0'
  169.  CURSOR/Relative/Next line * 1
  170.  LABELS/Create single/Label - fwd ref
  171.  CURSOR/Absolute/Forward reference
  172.  LABELS/Create single/Label
  173.    'BadNumberGiven'
  174.  CURSOR/Absolute/Previous location
  175.  CURSOR/Relative/Next line * 1
  176.  DISPLAY/Set Numeric base/Decimal
  177.  LABELS/Create single/Full-line comment
  178.    'Check for minimum stack size.  Must be at least 1800 bytes'
  179.  CURSOR/Relative/Next line * 1
  180.  LABELS/Create single/Label - fwd ref
  181.  CURSOR/Absolute/Forward reference
  182.  LABELS/Create single/Label
  183.    'StackTooSmall'
  184.  CURSOR/Absolute/Previous location
  185.  CURSOR/Relative/Next line * 1
  186.  LABELS/Create single/End-of-line comment
  187.    'Divide by 4 to keep BCPL happy'
  188.  CURSOR/Relative/Next line * 1
  189.  SYMBOLS 2/C/CLI structure
  190.  LABELS/Create single/Full-line comment
  191.    'Store the new stack size into our Command Line Interface structure'
  192.  CURSOR/Relative/Next line * 1
  193.  LABELS/Create single/Label - fwd ref
  194.  CURSOR/Absolute/Forward reference
  195.  LABELS/Create single/Label
  196.    'GoodExit'
  197.  CURSOR/Absolute/Previous location
  198.  CURSOR/Relative/Next line * 1
  199.  LABELS/Create single/Label - fwd ref
  200.  CURSOR/Relative/Next line * 2
  201.  SYMBOLS 1/Libraries/ARP
  202.  CURSOR/Relative/Next line * 1
  203.  LABELS/Create single/Label - fwd ref
  204.  CURSOR/Absolute/Forward reference
  205.  LABELS/Create single/Label
  206.    'ErrorExit'
  207.  DISPLAY/Set Numeric base/Decimal
  208.  SYMBOLS 2/Q-R/Return codes
  209.  LABELS/Create single/End-of-line comment
  210.    'Return code'
  211.  CURSOR/Absolute/Previous location
  212.  CURSOR/Relative/Next line * 2
  213.  LABELS/Create single/Label - fwd ref
  214.  CURSOR/Relative/Next line * 1
  215.  LABELS/Create single/Label - fwd ref
  216.  CURSOR/Relative/Next line * 1
  217.  SYMBOLS 1/Libraries/ARP
  218.  CURSOR/Relative/Next line * 3
  219.  LABELS/Create single/Label - fwd ref
  220.  CURSOR/Absolute/Forward reference
  221.  LABELS/Create single/Label
  222.    'EXIT'
  223.  CURSOR/Absolute/Previous location
  224.  CURSOR/Relative/Next line * 1
  225.  SYMBOLS 2/C/CLI structure
  226.  LABELS/Create single/Full-line comment
  227.    'Here, we are going to print the current stack size'
  228.  LABELS/Create single/Full-line comment
  229.    'To do this, we get the number from our Command Line Interface structure,'
  230.  LABELS/Create single/Full-line comment
  231.    'multiply it by four, and show its value!'
  232.  CURSOR/Relative/Next line * 1
  233.  LABELS/Create single/End-of-line comment
  234.    'Convert back to real number'
  235.  CURSOR/Relative/Next line * 3
  236.  LABELS/Create single/Label - fwd ref
  237.  CURSOR/Relative/Next line * 1
  238.  SYMBOLS 1/Libraries/ARP
  239.  CURSOR/Relative/Next line * 1
  240.  SYMBOLS 2/Q-R/Return codes
  241.  CURSOR/Relative/Next line * 1
  242.  SYMBOLS 1/Libraries/ARP
  243.  LABELS/Create single/Full-line comment
  244.    'Although this is a JSR (subroutine call), it never returns'
  245.  DISPLAY/Fill-in data types
  246.  CURSOR/Absolute/Start of file
  247.  
  248. Example Macro #2: Disassemble ARP 'CD'
  249. =========================================
  250.  
  251. This macro load, will disassemble and comment ARP release V39.1 of the 'CD'
  252. program.
  253.  
  254.  OPTIONS 2/Multiple constants/Off
  255.  PROJECT/Open load file
  256.    'resource:c/cd'
  257.  LABELS/Create single/Label - fwd ref
  258.  LABELS/Create single/End-of-line comment
  259.    'Start executing here!'
  260.  CURSOR/Relative/Next line * 1
  261.  DISPLAY/Set data type/Code
  262.  LABELS/Create single/Full-line comment
  263.    'ARP resident looks for this to recognize other ARP programs'
  264.  CURSOR/Relative/Next line * 1
  265.  DISPLAY/Set data type/Longs
  266.  LABELS/Create single/End-of-line comment
  267.    'Default stack size useed by ARP "Resident"'
  268.  CURSOR/Relative/Next line * 2
  269.  LABELS/Create single/End-of-line comment
  270.    'Store CmdPtr and CmdLen'
  271.  CURSOR/Relative/Next line * 1
  272.  LABELS/Edit single/Symbol
  273.    'AbsExecBase'
  274.  CURSOR/Relative/Next line * 1
  275.  LABELS/Create single/Label - fwd ref
  276.  LABELS/Create single/End-of-line comment
  277.    'Prepare to open ARP library'
  278.  CURSOR/Relative/Next line * 1
  279.  DISPLAY/Set Numeric base/Decimal
  280.  LABELS/Create single/End-of-line comment
  281.    'Minimum version number'
  282.  CURSOR/Relative/Next line * 1
  283.  SYMBOLS 1/Libraries/Exec
  284.  LABELS/Create single/End-of-line comment
  285.    'Open ARP library'
  286.  CURSOR/Relative/Next line * 1
  287.  LABELS/Create single/End-of-line comment
  288.    'Did ARP open okay?'
  289.  CURSOR/Relative/Next line * 1
  290.  LABELS/Create single/Label - fwd ref
  291.  LABELS/Create single/End-of-line comment
  292.    'branch if opened okay'
  293.  CURSOR/Relative/Next line * 1
  294.  LABELS/Create single/Label - fwd ref
  295.  LABELS/Create single/Full-line comment
  296.    'Only executed if ARP not available'
  297.  CURSOR/Relative/Next line * 1
  298.  SYMBOLS 1/Libraries/Exec
  299.  LABELS/Create single/End-of-line comment
  300.    'Open DOS library'
  301.  CURSOR/Relative/Next line * 1
  302.  LABELS/Create single/End-of-line comment
  303.    'Have we got DOS library base in D0?'
  304.  CURSOR/Relative/Next line * 1
  305.  LABELS/Create single/Label - fwd ref
  306.  LABELS/Create single/End-of-line comment
  307.    'Branch if not (Panic!!)'
  308.  CURSOR/Relative/Next line * 1
  309.  LABELS/Create single/End-of-line comment
  310.    'Place DOS library base into A6 register'
  311.  CURSOR/Relative/Next line * 1
  312.  SYMBOLS 1/Libraries/DOS
  313.  LABELS/Create single/End-of-line comment
  314.    'Get StdOut handle'
  315.  CURSOR/Relative/Next line * 1
  316.  LABELS/Create single/End-of-line comment
  317.    'This will be our file handle for Write'
  318.  CURSOR/Relative/Next line * 1
  319.  LABELS/Create single/End-of-line comment
  320.    'If not StdOut, exit immediately'
  321.  CURSOR/Relative/Next line * 1
  322.  LABELS/Create single/Label - fwd ref
  323.  LABELS/Create single/End-of-line comment
  324.    'The message to display'
  325.  CURSOR/Relative/Next line * 2
  326.  DISPLAY/Set Numeric base/Decimal
  327.  LABELS/Create single/End-of-line comment
  328.    'Length of message to show'
  329.  CURSOR/Relative/Next line * 1
  330.  SYMBOLS 1/Libraries/DOS
  331.  LABELS/Create single/End-of-line comment
  332.    'Show "you need arp.library V39+"'
  333.  CURSOR/Relative/Next line * 1
  334.  LABELS/Create single/End-of-line comment
  335.    'Fix up stack'
  336.  CURSOR/Relative/Next line * 1
  337.  LABELS/Create single/End-of-line comment
  338.    'Get our of here!'
  339.  CURSOR/Relative/Next line * 5
  340.  LABELS/Create single/Label
  341.    'ArpOpenedOkay'
  342.  LABELS/Create single/End-of-line comment
  343.    'Put ARP library base into A6'
  344.  CURSOR/Relative/Next line * 1
  345. ELS/Edit single/Symbol
  346.    'AbsExecBase'
  347.  CURSOR/Relative/Next line * 1
  348.  SYMBOLS 1/Libraries/Exec
  349.  LABELS/Create single/Full-line comment
  350.    'Actually, this will be a ptr to our process also'
  351.  CURSOR/Relative/Next line * 1
  352.  SYMBOLS 2/Prf-Pz/Process structure
  353.  CURSOR/Relative/Next line * 1
  354.  LABELS/Create single/Label - fwd ref
  355.  LABELS/Create single/End-of-line comment
  356.    'Branch if we were run from CLI'
  357.  CURSOR/Relative/Next line * 1
  358.  LABELS/Create single/End-of-line comment
  359.    'Executed only if from WorkBench'
  360.  CURSOR/Relative/Next line * 1
  361.  DISPLAY/Set Numeric base/Decimal
  362.  SYMBOLS 2/Q-R/Return codes
  363.  CURSOR/Relative/Next line * 2
  364.  LABELS/Create single/End-of-line comment
  365.    'Convert BPTR to APTR'
  366.  CURSOR/Relative/Next line * 1
  367.  LABELS/Create single/End-of-line comment
  368.    'Restore CmdLen and CmdPtr'
  369.  CURSOR/Relative/Next line * 1
  370.  LABELS/Create single/Label - fwd ref
  371.  CURSOR/Relative/Next line * 2
  372.  LABELS/Create single/Label - fwd ref
  373.  CURSOR/Relative/Next line * 1
  374.  SYMBOLS 1/Libraries/ARP
  375.  LABELS/Create single/End-of-line comment
  376.    'Get ARP to collect arguments'
  377.  CURSOR/Relative/Next line * 1
  378.  LABELS/Create single/End-of-line comment
  379.    'Ptr to Command Line Interface'
  380.  CURSOR/Relative/Next line * 3
  381.  LABELS/Create single/Label - fwd ref
  382.  CURSOR/Relative/Next line * 1
  383.  LABELS/Create single/Label - fwd ref
  384.  CURSOR/Relative/Next line * 1
  385.  LABELS/Create single/Label - fwd ref
  386.  CURSOR/Relative/Next line * 5
  387.  SYMBOLS 1/Libraries/ARP
  388.  CURSOR/Relative/Next line * 2
  389.  SYMBOLS 1/Libraries/ARP
  390.  CURSOR/Relative/Next line * 1
  391.  LABELS/Create single/Label - fwd ref
  392.  CURSOR/Relative/Next line * 1
  393.  LABELS/Create single/Label - fwd ref
  394.  CURSOR/Relative/Next line * 2
  395.  LABELS/Create single/Label - fwd ref
  396.  CURSOR/Relative/Next line * 3
  397.  SYMBOLS 1/Libraries/ARP
  398.  CURSOR/Relative/Next line * 3
  399.  LABELS/Create single/Label - fwd ref
  400.  CURSOR/Relative/Next line * 2
  401.  LABELS/Create single/Label - fwd ref
  402.  CURSOR/Relative/Next line * 2
  403.  SYMBOLS 1/Libraries/ARP
  404.  CURSOR/Relative/Next line * 8
  405.  SYMBOLS 1/Libraries/ARP
  406.  CURSOR/Relative/Next line * 4
  407.  LABELS/Create single/Label - fwd ref
  408.  CURSOR/Relative/Next line * 2
  409.  SYMBOLS 1/Libraries/ARP
  410.  CURSOR/Relative/Next line * 1
  411.  LABELS/Create single/Label - fwd ref
  412.  CURSOR/Relative/Next line * 4
  413.  SYMBOLS 1/Libraries/ARP
  414.  CURSOR/Relative/Previous line * 1
  415.  SYMBOLS 2/K-L/Lock type
  416.  CURSOR/Relative/Next line * 5
  417.  SYMBOLS 1/Libraries/ARP
  418.  CURSOR/Relative/Next line * 2
  419.  SYMBOLS 1/Libraries/ARP
  420.  CURSOR/Relative/Next line * 2
  421.  LABELS/Create single/Label - fwd ref
  422.  CURSOR/Relative/Next line * 3
  423.  SYMBOLS 1/Libraries/ARP
  424.  CURSOR/Relative/Previous line * 1
  425.  SYMBOLS 2/Q-R/Return codes
  426.  CURSOR/Relative/Next line * 3
  427.  SYMBOLS 1/Libraries/ARP
  428.  CURSOR/Relative/Next line * 1
  429.  LABELS/Create single/Label - fwd ref
  430.  CURSOR/Relative/Next line * 1
  431.  CURSOR/Relative/Next line * 1
  432.  LABELS/Create single/Label - fwd ref
  433.  CURSOR/Relative/Next line * 1
  434.  LABELS/Create single/Label - fwd ref
  435.  CURSOR/Relative/Next line * 2
  436.  SYMBOLS 1/Libraries/ARP
  437.  CURSOR/Relative/Next line * 5
  438.  SYMBOLS 1/Libraries/ARP
  439.  CURSOR/Relative/Next line * 1
  440.  DISPLAY/Set Numeric base/Decimal
  441.  SYMBOLS 2/Q-R/Return codes
  442.  CURSOR/Relative/Next line * 1
  443.  LABELS/Create single/Label - fwd ref
  444.  CURSOR/Relative/Next line * 1
  445.  LABELS/Create single/Label - fwd ref
  446.  CURSOR/Relative/Next line * 1
  447.  LABELS/Create single/Label - fwd ref
  448.  CURSOR/Relative/Next line * 3
  449.  SYMBOLS 2/Prf-Pz/Process structure
  450.  CURSOR/Relative/Next line * 2
  451.  SYMBOLS 1/Libraries/ARP
  452.  CURSOR/Relative/Next line * 2
  453.  LABELS/Create single/Label - fwd ref
  454.  CURSOR/Relative/Next line * 3
  455.  CURSOR/Relative/Next line * 1
  456.  SYMBOLS 1/Libraries/ARP
  457.  DISPLAY/Fill-in data types
  458.  CURSOR/Absolute/Start of file
  459.  
  460. Example Macro #3: Disassemble ARP 'Sort'
  461. =========================================
  462.  
  463. This macro will load, disassemble and comment ARP release V39.1 of the 'Sort'
  464. program.
  465.  
  466.  OPTIONS 2/Multiple constants/Off
  467.  PROJECT/Open load file
  468.    'resource:c/sort'
  469.  */DOS command
  470.    'date >ram:rste%mpfile'
  471.  STRINGS/Get/File
  472.    'ram:rste%mpfile'
  473.  STRINGS/Edit functions/Clip end
  474.    10
  475.  STRINGS/Edit functions/Prepend
  476.    'Disassembled '
  477.  LABELS/Create single/Full-line comment
  478.    27,27
  479.  LABELS/Create single/Label - fwd ref
  480.  LABELS/Create single/End-of-line comment
  481.    'Execution starts here'
  482.  CURSOR/Relative/Next line * 1
  483.  DISPLAY/Set data type/Code
  484.  LABELS/Create single/Full-line comment
  485.    'ARP resident looks for this to recognize other ARP programs'
  486.  CURSOR/Relative/Next line * 1
  487.  DISPLAY/Set data type/Longs
  488.  LABELS/Create single/Full-line comment
  489.    'Default stack size used by ARP "Resident"'
  490.  CURSOR/Relative/Next line * 2
  491.  LABELS/Create single/End-of-line comment
  492.    'Store CmdPtr and CmdLen'
  493.  CURSOR/Relative/Next line * 1
  494.  LABELS/Edit single/Symbol
  495.    'AbsExecBase'
  496.  CURSOR/Relative/Next line * 1
  497.  LABELS/Create single/Label - fwd ref
  498.  LABELS/Create single/End-of-line comment
  499.    'Prepare to open ARP library'
  500.  CURSOR/Relative/Next line * 1
  501.  DISPLAY/Set Numeric base/Decimal
  502.  LABELS/Create single/End-of-line comment
  503.    'Minimum version number'
  504.  CURSOR/Relative/Next line * 1
  505.  SYMBOLS 1/Libraries/Exec
  506.  LABELS/Create single/End-of-line comment
  507.    'Open ARP library'
  508.  CURSOR/Relative/Next line * 1
  509.  LABELS/Create single/End-of-line comment
  510.    'Did ARP open okay?'
  511.  CURSOR/Relative/Next line * 1
  512.  LABELS/Create single/Label - fwd ref
  513.  LABELS/Create single/End-of-line comment
  514.    'branch if opened okay'
  515.  CURSOR/Relative/Next line * 1
  516.  LABELS/Create single/Label - fwd ref
  517.  LABELS/Create single/Full-line comment
  518.    'Executed only if ARP library not available'
  519.  CURSOR/Relative/Next line * 1
  520.  SYMBOLS 1/Libraries/Exec
  521.  LABELS/Create single/End-of-line comment
  522.    'Open DOS library'
  523.  CURSOR/Relative/Next line * 1
  524.  LABELS/Create single/End-of-line comment
  525.    'Have we got DOS library base in D0?'
  526.  CURSOR/Relative/Next line * 1
  527.  LABELS/Create single/Label - fwd ref
  528.  LABELS/Create single/End-of-line comment
  529.    'Branch if not (Panic!!)'
  530.  CURSOR/Relative/Next line * 1
  531.  LABELS/Create single/End-of-line comment
  532.    'Place DOS base into A6 register'
  533.  CURSOR/Relative/Next line * 1
  534.  SYMBOLS 1/Libraries/DOS
  535.  LABELS/Create single/End-of-line comment
  536.    'Get StdOut handle'
  537.  CURSOR/Relative/Next line * 1
  538.  LABELS/Create single/End-of-line comment
  539.    'This will be our file handle for Write'
  540.  CURSOR/Relative/Next line * 1
  541.  LABELS/Create single/End-of-line comment
  542.    'If not StdOut, exit immediately'
  543.  CURSOR/Relative/Next line * 1
  544.  LABELS/Create single/Label - fwd ref
  545.  LABELS/Create single/End-of-line comment
  546.    'The message to display'
  547.  CURSOR/Relative/Next line * 2
  548.  DISPLAY/Set Numeric base/Decimal
  549.  LABELS/Create single/End-of-line comment
  550.    'Length of message to show'
  551.  CURSOR/Relative/Next line * 1
  552.  SYMBOLS 1/Libraries/DOS
  553.  LABELS/Create single/End-of-line comment
  554.    'Show "you need arp.library V39+"'
  555.  CURSOR/Relative/Next line * 1
  556.  LABELS/Create single/End-of-line comment
  557.    'Fix up stack'
  558.  CURSOR/Relative/Next line * 1
  559.  LABELS/Create single/End-of-line comment
  560.    'Get out of here!'
  561.  CURSOR/Relative/Next line * 5
  562.  LABELS/Create single/Label
  563.    'ArpOpenedOkay'
  564.  LABELS/Create single/End-of-line comment
  565.    'Put ARP library base into A6'
  566.  CURSOR/Relative/Next line * 1
  567.  LABELS/Create single/End-of-line comment
  568.    'Restore CmdLen and CmdPtr'
  569.  CURSOR/Relative/Next line * 1
  570.  LABELS/Create single/Label - fwd ref
  571.  LABELS/Create single/End-of-line comment
  572.    'Prepare args for GADS()'
  573.  CURSOR/Relative/Next line * 1
  574.  DISPLAY/Set Numeric base/Decimal
  575.  LABELS/Create single/Full-line comment
  576.    'Clear a table of 20 longwords for GADS to use'
  577.  CURSOR/Relative/Next line * 2
  578.  LABELS/Create single/Label - fwd ref
  579.  CURSOR/Relative/Previous line * 1
  580.  LABELS/Create single/Label
  581.    'ClearLoop'
  582.  CURSOR/Relative/Next line * 3
  583.  LABELS/Create single/Label - fwd ref
  584.  CURSOR/Absolute/Forward reference
  585.  LABELS/Create single/Label
  586.    'HelpfulMessage'
  587.  CURSOR/Absolute/Previous location
  588.  CURSOR/Relative/Previous line * 5
  589.  CURSOR/Absolute/Forward reference
  590.  LABELS/Create single/Label
  591.    'OurTemplate'
  592.  CURSOR/Absolute/Previous location
  593.  CURSOR/Relative/Next line * 6
  594.  SYMBOLS 1/Libraries/ARP
  595.  CURSOR/Relative/Next line * 2
  596.  LABELS/Create single/Label - fwd ref
  597.  CURSOR/Absolute/Forward reference
  598.  LABELS/Create single/Label - fwd ref
  599.  CURSOR/Absolute/Forward reference
  600.  LABELS/Create single/Label
  601.    'ShowUsageMsg'
  602.  CURSOR/Absolute/Previous location
  603.  CURSOR/Relative/Next line * 2
  604.  SYMBOLS 1/Libraries/ARP
  605.  CURSOR/Relative/Next line * 1
  606.  LABELS/Create single/Label - fwd ref
  607.  CURSOR/Absolute/Forward reference
  608.  CURSOR/Relative/Next line * 1
  609.  LABELS/Create single/Label - fwd ref
  610.  CURSOR/Absolute/Forward reference
  611.  CURSOR/Relative/Next line * 3
  612.  LABELS/Create single/Label - fwd ref
  613.  CURSOR/Relative/Next line * 2
  614.  SYMBOLS 1/Libraries/ARP
  615.  CURSOR/Relative/Next line * 2
  616.  SYMBOLS 1/Libraries/ARP
  617.  CURSOR/Relative/Next line * 1
  618.  SYMBOLS 1/Libraries/ARP
  619.  CURSOR/Relative/Previous line * 2
  620.  LABELS/Create single/Label
  621.    'EXIT'
  622.  CURSOR/Relative/Previous line * 6
  623.  CURSOR/Absolute/Previous location
  624.  CURSOR/Relative/Previous line * 1
  625.  SYMBOLS 2/Q-R/Return codes
  626.  CURSOR/Absolute/Previous location
  627.  CURSOR/Relative/Previous line * 3
  628.  LABELS/Create single/Label
  629.    'ShowUsage'
  630.  CURSOR/Absolute/Previous location
  631.  CURSOR/Relative/Next line * 2
  632.  LABELS/Create single/Label - fwd ref
  633.  CURSOR/Relative/Next line * 2
  634.  LABELS/Create single/Label - fwd ref
  635.  CURSOR/Absolute/Forward reference
  636.  CURSOR/Relative/Next line * 1
  637.  LABELS/Edit single/Symbol
  638.    'AbsExecBase'
  639.  LABELS/Create single/End-of-line comment
  640.    'Get exec library base'
  641.  CURSOR/Relative/Next line * 1
  642.  SYMBOLS 1/Libraries/Exec
  643.  CURSOR/Relative/Next line * 1
  644.  LABELS/Create single/Label - fwd ref
  645.  CURSOR/Absolute/Forward reference
  646.  SYMBOLS 2/Prf-Pz/Process structure
  647.  CURSOR/Relative/Next line * 1
  648.  SYMBOLS 1/Set field/Second
  649.  SYMBOLS 2/Prf-Pz/Process structure
  650.  CURSOR/Relative/Next line * 1
  651.  LABELS/Create single/Label - fwd ref
  652.  CURSOR/Absolute/Forward reference
  653.  LABELS/Create single/Label
  654.    'T.Device.Msg'
  655.  CURSOR/Absolute/Previous location
  656.  CURSOR/Relative/Next line * 3
  657.  SYMBOLS 1/Libraries/ARP
  658.  CURSOR/Absolute/Previous location
  659.  CURSOR/Relative/Next line * 2
  660.  LABELS/Create single/Label - fwd ref
  661.  CURSOR/Relative/Next line * 1
  662.  LABELS/Create single/Label - fwd ref
  663.  CURSOR/Relative/Next line * 2
  664.  LABELS/Create single/Label - fwd ref
  665.  CURSOR/Absolute/Forward reference
  666.  LABELS/Create single/Label
  667.    'TempFileName'
  668.  CURSOR/Absolute/Previous location
  669.  CURSOR/Relative/Next line * 4
  670.  LABELS/Create single/Full-line comment
  671.    'The following is a new ARP call (undocumented at time of macro creation!)'
  672.  CURSOR/Relative/Next line * 3
  673.  SYMBOLS 2/E-G/File open parms
  674.  CURSOR/Relative/Next line * 1
  675.  SYMBOLS 1/Libraries/ARP
  676.  CURSOR/Relative/Next line * 2
  677.  LABELS/Create single/Label - fwd ref
  678.  CURSOR/Relative/Next line * 1
  679.  LABELS/Create single/Label - fwd ref
  680.  CURSOR/Relative/Next line * 2
  681.  LABELS/Create single/Label - fwd ref
  682.  CURSOR/Absolute/Previous location
  683.  CURSOR/Relative/Next line * 2
  684.  LABELS/Create single/Label - fwd ref
  685.  CURSOR/Relative/Next line * 2
  686.  SYMBOLS 1/Libraries/ARP
  687.  CURSOR/Relative/Next line * 1
  688.  LABELS/Create single/Label - fwd ref
  689.  CURSOR/Absolute/Forward reference
  690.  LABELS/Create single/Label
  691.    'BadNumber'
  692.  CURSOR/Relative/Next line * 1
  693.  LABELS/Create single/Label - fwd ref
  694.  CURSOR/Relative/Next line * 1
  695.  CURSOR/Absolute/Forward reference
  696.  LABELS/Create single/Label
  697.    'ShowError'
  698.  CURSOR/Relative/Next line * 2
  699.  CURSOR/Absolute/Forward reference
  700.  LABELS/Create single/Label
  701.    'ErrorExit'
  702.  CURSOR/Absolute/Previous location
  703.  CURSOR/Absolute/Previous location
  704.  CURSOR/Relative/Previous line * 2
  705.  CURSOR/Absolute/Previous location
  706.  CURSOR/Relative/Next line * 3
  707.  LABELS/Create single/Label - fwd ref
  708.  CURSOR/Relative/Next line * 2
  709.  SYMBOLS 1/Libraries/ARP
  710.  CURSOR/Relative/Next line * 5
  711.  SYMBOLS 1/Libraries/ARP
  712.  CURSOR/Relative/Previous line * 1
  713.  SYMBOLS 2/K-L/Lock type
  714.  CURSOR/Relative/Next line * 3
  715.  LABELS/Create single/Label - fwd ref
  716.  CURSOR/Relative/Next line * 6
  717.  SYMBOLS 1/Libraries/ARP
  718.  CURSOR/Relative/Next line * 1
  719.  SYMBOLS 2/E-G/FileInfoBlock
  720.  CURSOR/Relative/Next line * 3
  721.  SYMBOLS 1/Libraries/ARP
  722.  CURSOR/Relative/Next line * 3
  723.  SYMBOLS 1/Libraries/ARP
  724.  CURSOR/Relative/Next line * 2
  725.  LABELS/Create single/Label - fwd ref
  726.  CURSOR/Relative/Next line * 3
  727.  SYMBOLS 2/E-G/File open parms
  728.  CURSOR/Relative/Next line * 1
  729.  SYMBOLS 1/Libraries/ARP
  730.  CURSOR/Relative/Next line * 6
  731.  SYMBOLS 1/Libraries/ARP
  732.  CURSOR/Relative/Next line * 3
  733.  SYMBOLS 1/Libraries/ARP
  734.  CURSOR/Relative/Next line * 2
  735.  LABELS/Create single/Label - fwd ref
  736.  CURSOR/Relative/Next line * 4
  737.  LABELS/Create single/Label - fwd ref
  738.  CURSOR/Relative/Next line * 3
  739.  LABELS/Create single/Label - fwd ref
  740.  CURSOR/Relative/Next line * 8
  741.  SYMBOLS 1/Libraries/ARP
  742.  CURSOR/Relative/Next line * 7
  743.  LABELS/Create single/Label - fwd ref
  744.  CURSOR/Relative/Next line * 2
  745.  LABELS/Create single/Label - fwd ref
  746.  CURSOR/Relative/Next line * 7
  747.  LABELS/Create single/Label - fwd ref
  748.  CURSOR/Relative/Next line * 2
  749.  LABELS/Create single/Label - fwd ref
  750.  CURSOR/Relative/Next line * 1
  751.  LABELS/Create single/Label - fwd ref
  752.  CURSOR/Relative/Next line * 3
  753.  SYMBOLS 1/Libraries/ARP
  754.  CURSOR/Relative/Next line * 2
  755.  SYMBOLS 1/Libraries/ARP
  756.  CURSOR/Relative/Next line * 3
  757.  LABELS/Create single/Label - fwd ref
  758.  CURSOR/Relative/Next line * 2
  759.  SYMBOLS 2/E-G/File open parms
  760.  CURSOR/Relative/Next line * 1
  761.  SYMBOLS 1/Libraries/ARP
  762.  CURSOR/Relative/Next line * 4
  763.  LABELS/Create single/Label - fwd ref
  764.  CURSOR/Relative/Next line * 3
  765.  SYMBOLS 1/Libraries/ARP
  766.  CURSOR/Relative/Next line * 1
  767.  LABELS/Create single/Label - fwd ref
  768.  CURSOR/Relative/Next line * 1
  769.  SYMBOLS 1/Libraries/ARP
  770.  CURSOR/Relative/Next line * 3
  771.  LABELS/Create single/Label - fwd ref
  772.  CURSOR/Relative/Next line * 1
  773.  SYMBOLS 2/Q-R/Return codes
  774.  CURSOR/Relative/Next line * 1
  775.  LABELS/Create single/Label
  776.    '_EXIT'
  777.  CURSOR/Relative/Previous line * 4
  778.  CURSOR/Relative/Next line * $14
  779.  LABELS/Create single/Label - fwd ref
  780.  CURSOR/Relative/Next line * $17
  781.  SYMBOLS 1/Libraries/ARP
  782.  CURSOR/Relative/Next line * 5
  783.  SYMBOLS 1/Libraries/ARP
  784.  CURSOR/Relative/Next line * 2
  785.  LABELS/Create single/Label - fwd ref
  786.  CURSOR/Relative/Next line * 2
  787.  SYMBOLS 1/Libraries/ARP
  788.  CURSOR/Relative/Next line * 2
  789.  LABELS/Create single/Label - fwd ref
  790.  CURSOR/Relative/Next line * 3
  791.  SYMBOLS 1/Libraries/ARP
  792.  CURSOR/Relative/Next line * $0D
  793.  LABELS/Create single/Label - fwd ref
  794.  CURSOR/Relative/Next line * 1
  795.  LABELS/Create single/Label - fwd ref
  796.  CURSOR/Relative/Next line * 3
  797.  LABELS/Create single/Label - fwd ref
  798.  CURSOR/Relative/Next line * 3
  799.  SYMBOLS 1/Libraries/ARP
  800.  CURSOR/Relative/Next line * 3
  801.  SYMBOLS 1/Libraries/ARP
  802.  CURSOR/Relative/Next line * 1
  803.  SYMBOLS 2/Prf-Pz/Process structure
  804.  CURSOR/Relative/Next line * 1
  805.  LABELS/Create single/Label - fwd ref
  806.  CURSOR/Relative/Next line * 2
  807.  SYMBOLS 1/Libraries/ARP
  808.  CURSOR/Relative/Next line * 2
  809.  SYMBOLS 2/Prf-Pz/Process structure
  810.  CURSOR/Relative/Next line * 5
  811.  LABELS/Create single/Label - fwd ref
  812.  CURSOR/Relative/Next line * 2
  813.  LABELS/Create single/Label - fwd ref
  814.  CURSOR/Relative/Next line * 2
  815.  LABELS/Create single/Label - fwd ref
  816.  CURSOR/Relative/Next line * 9
  817.  SYMBOLS 1/Libraries/ARP
  818.  CURSOR/Relative/Next line * 3
  819.  LABELS/Create single/Label - fwd ref
  820.  CURSOR/Relative/Next line * 2
  821.  LABELS/Create single/Label - fwd ref
  822.  CURSOR/Relative/Next line * 1
  823.  SYMBOLS 1/Libraries/ARP
  824.  CURSOR/Relative/Next line * 1
  825.  SYMBOLS 1/Libraries/ARP
  826.  CURSOR/Relative/Previous line * 4
  827.  CURSOR/Absolute/Forward reference
  828.  CURSOR/Relative/Next line * 3
  829.  LABELS/Create single/Label - fwd ref
  830.  CURSOR/Relative/Next line * 1
  831.  LABELS/Create single/Label - fwd ref
  832.  CURSOR/Absolute/Previous location
  833.  CURSOR/Relative/Next line * 7
  834.  LABELS/Create single/Label - fwd ref
  835.  CURSOR/Relative/Next line * 2
  836.  LABELS/Create single/Label - fwd ref
  837.  CURSOR/Absolute/Forward reference
  838.  LABELS/Create single/Label
  839.    'CompareStringLoop'
  840.  CURSOR/Absolute/Previous location
  841.  CURSOR/Relative/Next line * 2
  842.  LABELS/Create single/Label - fwd ref
  843.  CURSOR/Relative/Next line * 1
  844.  LABELS/Create single/Label - fwd ref
  845.  CURSOR/Relative/Next line * $0B
  846.  LABELS/Create single/Label - fwd ref
  847.  CURSOR/Relative/Previous line * 1
  848.  LABELS/Create single/Label
  849.    'StringEndLoop'
  850.  CURSOR/Relative/Next line * 4
  851.  LABELS/Create single/Label - fwd ref
  852.  CURSOR/Relative/Next line * 2
  853.  LABELS/Create single/Label - fwd ref
  854.  CURSOR/Relative/Next line * 3
  855.  LABELS/Create single/Label - fwd ref
  856.  DISPLAY/Fill-in data types
  857.  CURSOR/Absolute/Start of file
  858.  
  859. Example Macro #4: Disassemble BOOT sector
  860. =========================================
  861.  
  862. This macro will disassemble and comment the boot sector of the disk in drive
  863. DF0:.
  864.  
  865.  PROJECT/Read tracks
  866.    'df0: 0 0 2'
  867.  DISPLAY/Set data type/ASCII
  868.  CURSOR/Relative/Next byte * 4
  869.  DISPLAY/Set data type/Longs
  870.  CURSOR/Relative/Next line * 1
  871.  DISPLAY/Set data type/Longs
  872.  CURSOR/Relative/Next line * 1
  873.  DISPLAY/Set data type/Code
  874.  LABELS/Create multiple/All          
  875.  DISPLAY/Fill-in data types
  876.  CURSOR/Absolute/Start of file
  877.  LABELS/Edit single/Full-line comment
  878.    'The first longword of a DOS disk is "DOS" followed by hex 0,'
  879.  LABELS/Edit single/Full-line comment
  880.    'or hex 1 if formatted using fast filesystem'
  881.  CURSOR/Relative/Next line * 1
  882.  LABELS/Edit single/Full-line comment
  883.    'The second longword of a bootable boot sector is the checksum'
  884.  CURSOR/Relative/Next line * 1
  885.  LABELS/Edit single/Full-line comment
  886.    'I'm not quite sure what the next longword is used for'
  887.  CURSOR/Relative/Next line * 1
  888.  LABELS/Edit single/Full-line comment
  889.    'If the first longword is "DOS", followed by hex 0, and'
  890.  LABELS/Edit single/Full-line comment
  891.    'the checksum is correct for the current boot sector contents,'
  892.  LABELS/Edit single/Full-line comment
  893.    'when you boot on the disk, control is passed to offset $0C, HERE'
  894.  CURSOR/Relative/Next line * 1
  895.  SYMBOLS 1/Libraries/Exec
  896.  LABELS/Create single/End-of-line comment
  897.    'is DOS still around?'
  898.  CURSOR/Relative/Next line * 2
  899.  LABELS/Create single/End-of-line comment
  900.    'branch if no DOS around'
  901.  CURSOR/Relative/Next line * 1
  902.  LABELS/Edit single/Full-line comment
  903.    'place DOS base into A0'
  904.  CURSOR/Relative/Next line * 1
  905.  SYMBOLS 1/Libraries/DOS
  906.  LABELS/Edit single/Full-line comment
  907.    'We MUST place the version number of DOS into A0 if we plan to boot properly'
  908.  CURSOR/Relative/Next line * 1
  909.  LABELS/Edit single/Full-line comment
  910.    'when we return to Kickstart, D0 must be zero if the disk is to be booted'
  911.  CURSOR/Relative/Next line * 2
  912.  LABELS/Edit single/Full-line comment
  913.    'Something is wrong!!  Don't boot on this disk!'
  914.  CURSOR/Relative/Previous line * 1
  915.  CURSOR/Absolute/Start of file
  916.  OPTIONS 1/DCB statements/ON
  917.  OPTIONS 1/DCB statements/OFF
  918.