Previous page Select page Next page


Let's take it a stage even further. Right now, our pegObject routine is still "hard-wired" into the program. We want to be able to make this routine available to all your other programs without having to cut and paste all over the place. The only answer is to pull it out of your program and save it separately. Then you can call it from any program. Let's see how to do it:

  1. Select the "Project" menu and select the "Add Module" option. You will now see a new folder in the project tree on the right hand side of the screen. It's called "Module1".
  2. Go to your main program, select and cut the pegObject routine.
  3. Double click Module1 in the project tree and, when the code window for the module appears, paste the code under the .Code section.
  4. In the properties window for the module, change its name to pegObject.
  5. In the project tree, right click the module and select "Save As ..." option to save the module as a file. I suggest you make a new folder under the goSuite called "Modules" and save it there as "pegObject.asm".
  6. That's it.

The invocation to the routine remains unchanged but the file is stored externally to the program and we can invoke it from any other program.

The process outlined above seems a little complicated but, remember, that's only because we had the code already written in our main program. If we were writing a new application that needed this module, all we have to do to embed it into the code is to select the Project menu and select "Add existing file ..." and navigate to the location of you module file. As soon as you have loaded the file, its routines will be visible in the properties window of that module. Easy.

Previous page Select page Next page