home *** CD-ROM | disk | FTP | other *** search
/ World of A1200 / World_Of_A1200.iso / programs / develop / adev11 / beginners_readme < prev    next >
Text File  |  1995-02-27  |  4KB  |  83 lines

  1.                          INTRODUCTION
  2.  
  3. NOTE: SOME OF THESE PROGRAMS REQUIRE AMIGADOS 2.0
  4.  
  5. This development system uses some features and methods that may not be
  6. familiar to you if you have used only simple assemblers in the past.  This
  7. note should explain everything - I hope.
  8.  
  9. The process of generating an S-record file with this system is the same
  10. as for producing an executable from C source with a C compiler.  You
  11. first compile/assemble which produces relocatable .o file(s) and then link
  12. the .o file(s) to produce an executable/S-record file.
  13.  
  14. The reason for these two phases is modularity.  The larger the project, the
  15. more you need to segment it into managable units (modules).  This reduces
  16. regeneration time since only those modules that have been changed need to
  17. be re-assembled.  In the source code, segments are used much like ORG
  18. statements, which they replace, but they allow much greater flexibilty by
  19. leaving address determination until the link stage.  Segments make it
  20. possible to have re-usable modules and, in conjunction with the linker,
  21. allow the different modules to create code that does not overlap or
  22. conflict or extend beyond the bounds of available memory.
  23.  
  24. When more than one module is used, segments are used in conjunction with the
  25. XREF and XDEF statements which tell the assembler which labels are defined
  26. outside of this module (XREF) and which labels from this module are to
  27. be made available to other modules (XDEF).  For example, if module A wishes
  28. to access a symbol from module B, module A must XREF it and module B must
  29. XDEF it.  The advantage of XREF/XDEF is that symbol clashes are eliminated.
  30. If four modules all define a symbol atemp and do not XDEF it, the four
  31. symbols are unique - changing the contents of one does not change the
  32. contents of the others.  If the four modules need a common symbol then ONE
  33. module defines it and XDEF's it, the others that need it XREF it.
  34.  
  35. The two phases are individually invoked as shown in the simple example
  36. below; in all but the simplest cases you would use a make file and the
  37. 'with' option of slink.
  38.  
  39. SAsm motor.asm
  40. slink from motor.o to motor.sr mem 4000-5000 CODE
  41.  
  42. Notice the use of CODE in the mem-spec. The name must be the name of a
  43. segment that you have defined.  To define a segment in your source create
  44. a line like this;
  45.  
  46.         RSEG CODE
  47.  
  48. The name can be anything you like but the names CODE and DATA are commonly
  49. used; CODE for the portion that might go into ROM/EPROM/EEPROM, DATA for
  50. the portion that might go into RAM (generally containing mostly RMB's). If
  51. the entire program runs from RAM then just use CODE - BUT the statement
  52. must appear before any RMB's or opcodes otherwise they go into a default
  53. segment (the name of which I can't remember).
  54.  
  55. If you want an S9 (start address) record to be generated, one source file
  56. must have a label after an end statement as shown here.
  57.  
  58.         END  start
  59.  
  60. This tells the assembler to generate a relocatable S9 record which the
  61. linker will use to produce an S9 record in the output file.  As a side
  62. note any other time the END statement is optional.
  63.  
  64. Part of the advantage of segments and modules is that the ones that are
  65. commonly used can be kept in a library and linked with your program.
  66. Linking with a library is different than linking with a list of modules,
  67. only those parts of the library that are needed are included, as
  68. determined from unresolved references to symbols after linking the modules.
  69. This release contains a library containing functions that I commonly use.
  70. It also contains a librarian (Slib) that you can use to build your own
  71. library or modify mine.
  72.  
  73. Another advantage of segments and the deferred memory placement (linking)
  74. that that entails is that code, such as utilities and functions, that you
  75. sweat and toil to produce can be delivered to another person without
  76. delivering the source. The user can still place it into his memory map
  77. but, without reverse engineering it, he cannot steal or modify it.
  78.  
  79. If the use of RSEG instead of ORG still seems like an unjustifiable change,
  80. understand that I did not invent it.  You will find SEG's, RSEG's or something
  81. very similar in use in all professional assemblers.  In time you will come to
  82. understand the value of them.
  83.