Hi Walter,
Just a note about your includes.
Each Include file should jump over it's own subroutines, but not to the main program.
The Include has no idea where the Start label is, and may be jumping over other Include files or important code.
By jumping over only the code in the Include itself, it can't interfere with anything else.
Code:
'define variables for INC_SUB.INC (whatever your include file is called)
goto OverINC_SUB 'this jumps over the include file.
'otherwise it would start to try to run your subroutines at power up
'all your subroutines below here
sub_a:
'a code goes here
return
sub_b:
'b code goes here
return
OverINC_SUB
I've written quite a few Includes already, and found that when writing them for other people to use,
the following format with three sections in the Include file seems to work the best.- Constants and Variables used by the module, should be declared in the module.
- An Initialization section that runs on power-up and resets.
- And the Subroutines, that get Jumped over.
Code:
<font color="#0000FF"><b><i>'****************************************************************
'* Name : IncludeTemplate.pbp *
'* Author : Darrel Taylor *
'* Date : 5/26/2009 *
'****************************************************************
;---[Variables Aliases and Constants]---------------------------------------
</i></b></font><b>Result </b><font color="#008000"><b>VAR WORD </b></font><font color="#0000FF"><b><i>; Global Variables that will be used in the Main program
</i></b></font><b>ModInput </b><font color="#008000"><b>VAR BYTE </b></font><font color="#0000FF"><b><i>; should have easy to remember names.
;------------------
</i></b></font><b>INC_VarA </b><font color="#008000"><b>VAR WORD </b></font><font color="#0000FF"><b><i>; Local variables that are only used in the Include
</i></b></font><b>INC_VarB </b><font color="#008000"><b>VAR BYTE </b></font><font color="#0000FF"><b><i>; should have unique names that are unlikely to be
</i></b></font><b>INC_Const </b><font color="#008000"><b>CON </b></font><font color="#800000"><b>150 </b></font><font color="#0000FF"><b><i>; duplicated by the user, or other Includes.
;---[Initialize the INCLUDE module]-----------------------------------------
</i></b></font><b>INC_VarA </b>= <font color="#800000"><b>0 </b></font><font color="#0000FF"><b><i>; This section will run on power-up or reset.
</i></b></font><b>INC_VarB </b>= <font color="#800000"><b>100 </b></font><font color="#0000FF"><b><i>; inititialize any registers needed for this module,
</i></b></font><b>Result </b>= <font color="#800000"><b>0 </b></font><font color="#0000FF"><b><i>; dont rely on the user to initialize values (they won't)
</i></b></font><font color="#008000"><b>GOTO </b></font><b>OverINC_SUBS </b><font color="#0000FF"><b><i>; jump over Subroutines, so they don't try to execute
;---[Subroutines]-----------------------------------------------------------
</i></b></font><b>Sub_A</b>:
<b>Result </b>= <b>ModInput </b>* <b>INC_VarA</b> + <b>INC_Const
</b><font color="#008000"><b>RETURN
</b></font><font color="#0000FF"><b><i>;----------------------------
</i></b></font><b>Sub_B</b>:
<b>Result </b>= <b>ModInput </b>* <b>INC_VarB</b> + <b>INC_Const
</b><font color="#008000"><b>RETURN
</b></font><font color="#0000FF"><b><i>;---------------------------------------------------------------------------
</i></b></font><b>OverINC_SUBS</b>: <font color="#0000FF"><b><i>; This label must be unique for each Inlude file
</i></b></font>
HTH,
Bookmarks