70
then FF will be written to FLBPR immediately after unlocking - see Register Display and Change
(page 55) for more details of the 'R' command.
9.4 Autostart Macro
If a macro named 'AUTOSTART' is part of a library file already loaded when the MCU is re-booted,
then this macro will be played automatically after the FLASH is unlocked, and after any boot script.
Even where a macro library file does contain an 'Autostart' macro, the automatic playing may be
suppressed by checking the 'Disable Autostart macro (if any)' box on the Settings>Macros tab.
Here is an example of an auto start macro which will un-protect FLASH memory, write an S19 file
to memory and start a program executing on a 908JB8 chip:
DEFM Autostart ; Macro to load and execute a file
begin
R FLBPR=FF ; Un-protect FLASH
LD "[MyDocs]\Asm\Test.S19" ; Load a file
G DC00 ; begin execution
end
The need for an 'autostart' macro has been partially obviated in Xplor8 Version 5 by the addition of
the Boot Script facility (see page 69).
9.5 Replaceable Parameters
Macros may contain replaceable parameters. Up to 10 parameters may be specified, from @0 to @9
or %0 to %9. @0 is the same parameter as %0, and reference to one is a reference to the other.
Following the name of the macro on the DEFM (define Macro) line should be a list of the parameters
that will be used in the macro.
Replaceable parameters may be defined (on the DEFM line) in any order, for example:
DEFM MyMacro @3 @5 @1
is valid. But note that when the macro is called as a command, then it will require three arguments,
and these will be allocated in strict left-to-right order. So, calling MyMacro thus:
MYMACRO 8000 8001 8002
will assign $8000 to @3, $8001 to @5 and $8002 to @1.
In the following (over-complicated) example MACRO3 is called by MACRO4, with one replaceable
parameter:
DEFM MACRO3 @0 ; macro takes one replaceable parameter
BEGIN
LD @0 ; (LD %0 would do the same thing)
END
DEFM MACRO4
Kommentare zu diesen Handbüchern