home *** CD-ROM | disk | FTP | other *** search
/ World of A1200 / World_Of_A1200.iso / programs / develop / adev11 / docs / doc.txt < prev    next >
Text File  |  1995-02-27  |  69KB  |  1,297 lines

  1. ADEV11 Development System for AmigaDOS
  2.  
  3.  
  4. Version 2.0
  5.  
  6.  
  7.  
  8. A 68HC11 C compiler, assembler, linker, librarian and downloader for the Amiga
  9. Public Domain
  10.  
  11.  
  12.  
  13.  
  14.  
  15.  
  16.  
  17.  
  18.  
  19.  
  20. Stan Burton
  21. 1978 26 St. SE
  22. Medicine Hat, Alta, CANADA
  23. T1A 2G8
  24. Table of Contents
  25.  
  26. SECTION 1: Users Manual
  27.     1.1  SAsm        1
  28.     1.2  SC11        13
  29.     1.3  SDis        20
  30.     1.4  SSim        22
  31.     1.5  SLib        26
  32.         1.5.1 Xlib        27
  33.     1.6  SLink        28
  34.  
  35. SECTION 2: Lib11 Library Reference
  36.     2.1  
  37.  
  38. SECTION 3: Examples
  39.     3.1  Monitor
  40.  
  41. SECTION 4: Utilities
  42.     4.1  HCLoad
  43.     4.2  MHex
  44.     4.3  SProg
  45. ADEV11 Development System for AmigaDOS
  46. Users Manual
  47.  
  48. Version 2.0Acknowledgements
  49.  
  50. I would like to acknowledge the assistance and cooperation of a number of people that have contributed to the improvement of this product either through the supply of files to incorporate into the distribution or their services as bug finders and reporters.
  51.  
  52. Contributions
  53.  
  54. Paul Isaacs - AmigaGuide version of the documents
  55. Ron Eirich - HCload utility
  56.  
  57. Bug reports
  58.  
  59. Paul Issacs, Keith Vasilakes ...NAME
  60.  
  61.     SAsm
  62.  
  63. SYNOPSIS
  64.  
  65.     SAsm [options] <srcfile> [options]
  66.  
  67. DESCRIPTION
  68.  
  69. SAsm is the assembler for the DEV11 system. It is a high level macro cross assembler for the Motorola 6803, 6805, 68HC11 and 68HC16 families and for the Hitachi 6303 family. It is a highly modified version of the publicly distributable DASM V2.12.  The 68HC16 code generation has not been well tested since I do not have an HC16 to test it on.  If you find any problems with it let me know (Stan).
  70.  
  71. SAsm produces a relocatable file which can be linked together (Slink) with other modules and/or library elements to produce an executable file.  Naturally this includes the ability to have multiple segments within a module and BSS or uninitialized segments.
  72.  
  73.     (C)Copyright 1987,1988    Matthew Dillon, All Rights Reserved
  74.     (C)Copyright 1992,1993    Stan Burton, All Rights Reserved
  75.  
  76.     Publicly distributable for non-profit only.  Must be distributed as is, with NO CHANGES to the documentation or code.
  77.  
  78. COMMAND LINE
  79.  
  80.     srcfile:    if no extension is specified in the name, .a is added
  81.     outfile:    if no other output file is specified the file generated is the extension-less srcfile name with a .o extension
  82.  
  83. The following options are available:
  84.     -l[name]    generate list file, if no name is specified extension-less srcfile with .lst extension is used
  85.     -oname    generate output to a specific file
  86.     -s[name]    generate symbol file, if no name is specified extension-less srcfile with .sym extension is used
  87.     -v#    select verboseness 0-4 (default 0, see below)
  88.         0    (default) Only warnings and errors are generated
  89.         1    Segment list information is generated after each pass, Include file names are displayed and reasons why another pass is required are given.
  90.         2    Mismatches between program labels and equates are displayed        on every pass (usually none occur in the first pass unless you have re-declared a symbol name).
  91.         3    Unresolved and unreferenced symbols are displayed every pass            (unsorted, sorry)
  92.         4    An entire symbol list is displayed every pass to STDOUT.              (unsorted, sorry)
  93.  
  94.     -p#    select number of passes 2-9 (default 2)
  95.     -d    debug mode
  96.     -DSYMBOL    predefine a symbol, set to 0
  97.     -DSYMBOL=EXPRESSION     predefine a symbol, set to expression
  98.  
  99.         Example:    asm master.asm -lram:list -v3 -DVER=4
  100.  
  101. The verbose options can provide additional information about reasons for failure to assemble a file.  Part of this is the reason code:
  102.     R1,R2 reason code: R3
  103.     where    R1    is the number of times the assembler encountered something requiring another pass to resolve.
  104.         R2    is the number of references to unknown symbols which occured in the pass (but only R1 determines the need for another pass).
  105.         R3    is a BITMASK of the reasons why another pass is required.              See the end of this document for bit designations.
  106.  
  107. -expressions, as in C. (all expressions are computed with 32 bit        integers)
  108.     -no real limitation on label size, label values are 32 bits.
  109.     -complex pseudo ops, repeat loops, macros, etc....
  110.  
  111. The following special characters are used in the symbol dump:
  112.  
  113.     ????    unknown value
  114.                 str    symbol is a string
  115.                 eqm    symbol is an eqm macro
  116.                 (r)    symbol has been referenced
  117.                 (s)    symbol created with SET or EQM pseudo-op
  118.  
  119.  
  120. LABELS and SYMBOLS
  121.  
  122. A label consists of one or more characters from the set A-Z, a-z, 0-9.  The first character must be alphabetic.  There is no limit to the name length.  The value the label assumes the range of a 32 bit integer.
  123.  
  124.     The label will be set to the current segment counter either before or after a pseudo-op is executed.  Most of the time, the label is set before the pseudo-op is executed. The following pseudo-op's labels are created AFTER execution of the pseudo-op:
  125.             SEG, ALIGN
  126.  
  127.  
  128. PROCESSOR MODEL
  129.  
  130.     The processor model is chosen with the PROCESSOR pseudo-op and should be the first thing you do in your assembly file.  Only one PROCESSOR pseudo-op may be declared in the entire assembly.
  131.  
  132.  
  133. SEGMENTS
  134.  
  135.     The SEG pseudo-op creates/sets the current segment.  Segments are used to separate the various parts of a program, for example CODE and BSS_DATA; later the linker could place the CODE in the EPROM address range and the data at the ram address range. The use of DS or RMB statements in a segment planned for ROM is not logical.
  136.  
  137. As a result of the use of relocatable segments the ORG statement found in simpler assemblers is not used; its functionality is passed to the linker.
  138.  
  139.     'Uninitialized' (.U) segments do not produce output.  Therefore, output generating statements are not allowed in these segments.
  140.  
  141.  
  142. MULTIPLE SOURCE FILES
  143.  
  144. The pseudo-ops XREF and XDEF make separately assembled source files possible. XREF tells the assembler that a symbol that you will be using is available from another source file. XDEF tells the assembler to make a symbol available to other source files. So, to have a successful reference, one and only one source file must XDEF the symbol and one or more source files must XREF it. Later, when all the component source files have been assembled, the linker takes these deferred references and changes them to specific addresses.
  145.  
  146. There is currently an unnecessary limitation in the use of XREF'd symbols - only one XREF'd symbol may be used per instruction. The example below should be legal but is not legal due to this limitation.
  147.     XREF    stack,stack_size
  148.     LDS    #stack+stack_size-1
  149. The limitation was the easiest way to disallow the similar, but not legal, situations shown in the example below. The current object module format (based on the Amiga format) cannot handle these as no native Amiga assembler can - in fact the SAS assembler 'asm' (5.10b) does not handle the above situation either.
  150.     XREF    stack,stack_size
  151.     LDS    #stack-stack_size-1
  152.     LDS    #stack+stack_size*4
  153.     LDAA    #-b
  154. I hope to eventually eliminate the un-needed limitation and perhaps some day in the far far future I can eliminate the object format based limitation.
  155.  
  156. There is one more very small limitation. The assembler will report an error for the following code.
  157.     XREF    s
  158.     LDAA    #s-129
  159. It does not know what s will evaluate to and assumes 0 which gives a negative value greater than can be handled in an 8 bit value. If this proves to be a severe hardship to anyone, let me know.
  160.  
  161.     
  162. MACROS
  163.  
  164.  You cannot have a macro definition within a macro definition, but can nest macro calls.
  165.  
  166.             Arguments passed to macros are referenced with: {#}.  The first argument passed to a macro would thus be {1}.  You should always use LOCAL labels (.name) inside macros which you use more than once. {0} represents an EXACT substitution of the ENTIRE argument line.
  167.  
  168. GENERAL
  169.  
  170. ?    The other major feature in this assembler is the SUBROUTINE pseudo-op, which logically separates local labels (starting with a dot).  This allows you to reuse label names (for example, .1 .fail) rather than think up crazy combinations of the current subroutine to keep it all unique.
  171.  
  172.  
  173. PSEUDOPS
  174.  
  175.     INCLUDE  "name"
  176.         Include another assembly file.
  177.  
  178. [label]    SEG[.U]     name
  179. [label]    RSEG[.U]     name
  180.         This sets the current segment, creating it if neccessary.  If a .U extension is specified on segment creation, the segment is an UNINITIALIZED or BSS segment.  The .U is not needed when going back to an already created uninitialized segment, though it makes the code more readable.  The .z force may be used to declare that any symbols declared in this segment may be accessed by direct (page zero) addressing where appropriate.  If you need a .U and .z segment, first declare it as .U and then immediately redeclare it as .z.
  181.  
  182. [label]    DC[.BWL]   exp,exp,exp ...
  183. [label]    FDB   exp,exp,exp ...
  184. [label]    FCB   exp,exp,exp ...
  185. [label]    FCC   exp,exp,exp ...
  186.                     Declare data in the current segment.  The default size extension for DC is a byte.  FCB allows only byte size and FDB allows only word size.
  187.  
  188. [label]    DS[.BWL]   exp[,filler]
  189. [label]    RMB   exp[,filler]
  190.         Declare space (default filler is 0). Note that the number of bytes generated is exp * entrysize (1,2, or 4).      The default size extension for DS is a byte.  RMB allows only the size of byte.  Note that the default filler is always 0.
  191.  
  192. [label]    DV[.BWL]    eqmlabel exp,exp,exp....
  193.         This is equivalent to DC, but each exp in the list is passed through the symbolic expression specified by the EQM label.  The expression is held in a special symbol dotdot '..' on each call to the EQM label.
  194.         See EQM below
  195.  
  196. [label]    HEX   hh hh hh..
  197.         This sets down raw HEX data.  Spaces are optional between bytes.  NO EXPRESSIONS are allowed.  Note that you do NOT place a $ in front of the digits.  This is a short form for creating tables compactly.  Data is always layed down on a byte-by-byte basis.
  198.  
  199.                     Example:            HEX 1A45 45 13254F 3E12
  200.  
  201.     ERR
  202.         Abort assembly.
  203.  
  204. [label]    XDEF symbol,symbol,symbol
  205. [label]    PUBLIC symbol,symbol,symbol
  206.         Defines which symbols/labels are available outside of this module.
  207.  
  208. [label]  XREF symbol,symbol,symbol
  209. [label]    EXTERN symbol,symbol,symbol
  210.         Declares which symbols/labels from outside modules are used in this module.  The .z force may be used to declare that the symbols may be accessed by direct (page zero) addressing where appropriate.
  211.  
  212.     PROCESSOR model
  213.         Do not quote.  Model is one of: 6803,HD6303,68705,68HC11, 68HC16.   Can only be executed once, and should be the first thing encountered by the assembler.
  214.  
  215.     ECHO exp,exp,exp
  216.         The expressions (which may also be strings), are echod on the screen and into the list file
  217.  
  218. [label] ALIGN   N[,fill]
  219.         Align the current PC to an N byte boundry.  The default fill character is always 0.
  220.  
  221. [label] SUBROUTINE  name
  222.         This isn't really a subroutine, but a boundry between sets of temporary labels (which begin with a dot).  Temporary label names are unique within segments of code bounded by SUBROUTINE:
  223.  
  224.             CHARLIE subroutine
  225.                 ldx    #10
  226.             .1    dex
  227.                 bne    .1
  228.             BEN    subroutine
  229.                 ldx    #20
  230.             .qq    dex
  231.                 bne .qq
  232.  
  233.         Automatic temporary label boundries occur for each macro level.  Usually temporary labels are used in macros and within actual subroutines (so you don't have to think up a thousand different names)
  234.  
  235.  
  236. symbol    EQU   exp
  237.         The expression is evaluated and the result assigned to the symbol.
  238.  
  239. symbol    EQM   exp
  240.         The STRING representing the expression is assigned to the symbol.  Occurances of the symbol in later expressions causes the string to be evaluated for each occurance.  Also used in conjuction with the DV psuedo-op.
  241.  
  242. symbol    SET   exp
  243.         Same as EQU, but the symbol may be reassigned later.
  244.  
  245.     END   [symbol]
  246.         Optional. If used with a symbol name the value of that symbol will be entered into the output file as the starting address of the program.  May only be used once and only at the end of the file.  Be careful - if a symbol is not given and a comment without a preceding ';' is used the first word of the comment will be interpreted as the symbol.
  247.  
  248.     MAC   name
  249.     MACRO   name
  250.         Declare a macro.  lines between MAC and ENDM are the macro. You cannot recursively declare a macro.  You CAN recursively use a macro (reference a macro in a macro).  No label is allowed to the left of MAC or ENDM.
  251.  
  252.     ENDM
  253.         End of macro def.  NO LABEL ALLOWED ON THE LEFT!
  254.  
  255.     MEXIT
  256.         Used in conjuction with conditionals.  Exits the current macro level.
  257.  
  258. [label]    IFCONST   exp
  259. [label]    IFD   exp
  260.         Is TRUE if the expression result is defined,  FALSE otherwise and NO error is generated if the expression is undefined.
  261.  
  262. [label]    IFNCONST   exp
  263. [label]    IFND   exp
  264.         Is TRUE if the expression result is undefined, FALSE otherwise and NO error is generated if the expression is undefined.
  265.  
  266. [label]    IF   exp
  267.         Is TRUE if the expression result is defined AND non-zero.  Is FALSE if the expression result is defined AND zero.  Neither IF or ELSE will be executed if the expression result is undefined.  If the expression is undefined, another assembly pass maybe required.
  268.  
  269. [label]    ELSE
  270.         ELSE the current IF.
  271.  
  272. [label] ENDIF
  273. [label] ENDC
  274. [label] EIF
  275.         Terminate an IF. ENDIF and EIF are equivalent.
  276.  
  277. [label] REPEAT   exp
  278. [label] REPEND
  279.         Repeat code between REPEAT/REPEND 'exp' times.  if exp == 0, the code repeats forever.  exp is evaluated once.
  280.  
  281.             Y    SET    0
  282.                 REPEAT  10
  283.                             X    SET    0
  284.                 REPEAT  10
  285.                 DC    X,Y
  286.             X    SET    X + 1
  287.                 REPEND
  288.             Y    SET    Y + 1
  289.                 REPEND
  290.  
  291.         generates an output table:        0,0 1,0 2,0 ... 9,0  0,1 1,1 2,1... 9,1, etc...
  292.  
  293.         Labels within a REPEAT/REPEND should be temporary labels with a SUBROUTINE pseudoop to keep them unique.
  294.  
  295.         The Label to the left of REPEND is assigned AFTER the loop FINISHES.
  296.  
  297.  
  298. FORCED ADDRESSING MODES
  299.  
  300. [label]    XXX[.force]   operand
  301.  
  302. XXX is some mnemonic, not necessarily three characters long. The .FORCE optional extension is used to force specific addressing modes.  Force extensions are also used with DS,DC, and DV to determine the element size.
  303.  
  304.     example:    lda.z   charlie
  305.  
  306.         Force    Description            Alternate Force Extension
  307.         i    implied
  308.         ind    indirect word
  309.         0    implied
  310.         b    byte address            z d    (zeropage, direct)
  311.         bx    byte address indexed x
  312.         by    byte address indexed y
  313.         w     word address            e a    (extended, absolute)
  314.         l    longword (4 bytes) (DS/DC/DV)
  315.         r    relative
  316.         u    uninitialized (SEG)
  317.  
  318.  
  319. EXPRESSIONS
  320.  
  321.         Some operators, such as ||, can return a resolved value even if one of the expressions is not resolved.   Operators are as follows:
  322.  
  323.         NOTE WELL!  Some operations will result in non-byte values when a byte value was wanted.     Example:        ~1  is NOT $FF, but $FFFFFFFF.
  324.         Preceding it with a < (take LSB of) will solve the problem.
  325. ALL ARITHMETIC IS CARRIED OUT IN 32 BITS.  The final result will be automatically truncated to the maximum handleable by the particular machine language (usually a word) when applied to standard mnemonics.
  326.  
  327.         PRECEDENCE
  328.     UNARY
  329.  
  330.         20    ~exp    one's complement.
  331.         20    -exp    negation
  332.         20    !exp    not expression (returns 0 if exp non-zero, 1 if exp zero)
  333.         20    <exp    take LSB byte of a 16 bit expression
  334.         20    >exp    take MSB byte of an expression
  335.  
  336.     BINARY
  337.  
  338.         19    *     multiplication
  339.         19    /    division
  340.         19    %    mod
  341.         18    +    addition
  342.         18    -    subtraction
  343.         17    >>,<<    shift right, shift left
  344.         16    >,>=    greater, greater equal
  345.         16    <,<=    smaller, smaller equal
  346.         15    ==    equal to.  Try to use this instead of =
  347.         15    =    exactly the same as == (exists compatibility)
  348.         15    !=    not equal to
  349.         14    &    logical and
  350.         13    ^    logical xor
  351.         12    |    logical or
  352.         11    &&    left expression is true AND right expression is true
  353.         10    ||    left expression is true OR right expression is true
  354.          9    ?    if left expression is true, result is right expression, else result is 0.
  355.             [10 ? 20] returns 20
  356.          8    []    group expressions
  357.          7    ,    separate expressions in list (also used in addressing mode resolution, BE CAREFUL!
  358.  
  359.     CONSTANTS
  360.  
  361.     nnn    decimal
  362.             0nnn    octal
  363.             %nnn    binary
  364.             $nnn    hex
  365.             'c          character
  366.             'c'    character
  367.             "cc.."    string (NOT zero terminated if in DC/DS/DV)
  368.             [exp]d    the constant expressions is evaluated and it's decimal result turned into an ascii string.
  369.  
  370. SYMBOLS
  371.  
  372.     ..    holds evaluated value in DV pseudo op
  373.     .name    represents a temporary symbol name.  Temporary symbols may be reused inside MACROS and between SUBROUTINES, but may not be referenced across macros or across SUBROUTINEs.
  374.     .    current program counter (as of the beginning of the instruction).
  375.     name    beginning with an alpha character and containing letters, numbers, or '_'.  Represents some global symbol name.
  376.  
  377.  
  378. WHY codes:
  379.  
  380.     Each bit in the WHY word (verbose option 1) is a reason (why the assembler needs to do another pass), as follows:
  381.  
  382.     Bit    Meaning
  383.     0    expression in mnemonic not resolved
  384.     1   
  385.     2    expression in a DC not resolved
  386.     3    expression in a DV not resolved (probably in DV's EQM symbol)
  387.     4    expression in a DV not resolved (could be in DV's EQM symbol)
  388.     5    expression in a DS not resolved
  389.     6    expression in an ALIGN not resolved
  390.     7
  391.     8    ???ALIGN: Normal origin not known        (if in ORG at the time)
  392.     9    EQU:   expression not resolved
  393.     10    EQU:   value mismatch from previous pass (phase error)
  394.     11    IF:     expression not resolved
  395.     12    REPEAT: expression not resolved
  396.     13    a program label has been defined after it has been referenced (forward reference) and thus we need another pass
  397.     14    a program label's value is different from that of the previous pass (phase error)
  398.  
  399.     Certain errors will cause the assembly to abort immediately, others will wait until the current pass is over.  The remaining allow another pass to occur in the hopes the error will fix itself.
  400.  
  401. HIGH LEVEL CONSTRUCTS
  402.  
  403. The assembler allows for some high level C-like constructs that help to make your assembler source file self documenting and clearer.  The expressions allowed in these constructs are quite different, check the documentation below.
  404.  
  405. [label]    _IF   exp    If the expression (condition) evaluates to true then the statements following this statement and including up to the associated _ELSE or _ENDIF statement are executed.
  406.     _ELSE        marks then end of the true condition portion of the _IF block and the start of the false condition portion
  407.     _ENDIF    marks the end of an _IF block
  408. [label]    _FOR [exp]\\exp\\exp    The optional first expression (assignment) is executed and then the second expression (condition) is evaluated.  As long as it evaluates to true, the statements following this statement and including up to the associated _NEXT statement will be executed.  Each time the _NEXT statement is reached the third expression (assignment) is executed and then the second expression is re-evaluated.
  409.     _NEXT    marks the end of a _FOR block
  410.  
  411. If an _IF, _ELSE, _FOR or _NEXT statement causes an branch address range error you can instruct that extended addressing be used with the .w force.
  412.  
  413. There are currently two types of expression: condition and assignment.  Each consists of three parts and the parts must appear in the defined order.
  414.     <condition> := [!]<register><comparison><argument> | [!]<CCRbit>
  415.     <assignment> := <register><equate><argument>
  416.     <register> := <A|B|D|X|Y>
  417.     <comparison> := <|<=|==|!=|>|>=|.HI.|.LO.|.HS.|.LS.
  418.     <argument> := <number>|<label>|[<number>](X)|[<number>](Y)|(number)|(label)
  419.     <CCRbit> := CCRc|CCRm|CCRv
  420.     <equate> := =|+=|-=
  421.     <number> := $<hex number>|<decimal number>
  422. Although not currently allowed, expect that multiple comma separated assignment expressions will be allowed and that a reversed order assignment will be allowed.
  423.  
  424. Some examples of the use of these expressions are given below.
  425.     a) if register a is greater than 3 then add 6 to a and shift left otherwise just shift left
  426.         _IF    A>3
  427.             adda    #6
  428.             lsla
  429.         _ELSE
  430.             lsla
  431.         _ENDIF
  432.     b) convert a mixed case null terminated string to lower case
  433.         _FOR    A=(X)\\A!=0\\A=(X)
  434.             _IF    A>='A'
  435.                 _IF    A<='Z'
  436.                     adda #'a'-'A'
  437.                 _ENDIF
  438.             _ENDIF
  439.             inx
  440.         _NEXT
  441.  
  442. High level expressions can be nested up to 8 levels deep.  High level expressions are only available for the 68HC11 currently, if you want them to be available for another processor, let me know.  It is possible to generate some syntactically legal assignment statements that produce illegal opcodes.  An example of these would be X+=4.  I have not implemented these yet due to the absence of convenient opcodes (ADDX, SUBX) in the HC11 and the complexities in faking them, so don't use them.
  443. NAME
  444.  
  445.     SC11
  446.  
  447. SYNOPSIS
  448.  
  449.     SC11 <options> <file name>
  450.         Options    -a        Annotate the assembler listing with source.
  451.                 -b        Generate inline assembler for builtins.
  452.                 -D symbol    Define a preprocessor symbol.
  453.                 -I        Directory for include files.
  454.                 -l        Create a source listing file.
  455.                 -n        Turn off optimization.
  456.                 -o filename    Specify name for output.
  457.                 -p [0|filename]    Create or use precompiled header.
  458.                 -P        Generate for use in PROM.
  459.                 -q        Run quietly.
  460.                 -r        Use library for integer math.
  461.                 -U symbol    Undefine a preprocessor symbol.
  462.                 -w        Convert all auto variables to static
  463.  
  464.  
  465. DESCRIPTION
  466.  
  467. SC11 is a C compiler that produces 68HC11 source output that is ready for assembly.  The compiler is reasonably compliant with the ANSI-C standard.  It supports all C constructs except bit definitions.  Some HC11 extensions are provided.
  468.  
  469. This product has had a good amount of testing, but due to its complex nature, there could still be many bugs and, as this is a public domain product, I cannot advise its use for applications that may be critical to someones life, income or career.  If you feel that you must do so anyway, I recommend that you contact me before you start, to ensure that I am still supporting this product.
  470.  
  471.  
  472. BUILT-IN FUNCTIONS
  473.  
  474. The following functions are available as built-ins.  As such, these functions are quite a bit faster than the corresponding library functions.
  475.     strlen        strcmp        strcat
  476.     strcpy        bzero        bcopy
  477.  
  478. As well the following HC11 specific functions are provided only as built-in functions
  479.     void enable_intr(void)        generates an HC11 'CLI' instruction
  480.     void disable_intr(void)    generates an HC11 'SEI' instruction
  481.     void wait_for_intr(void)    generates an HC11 'WAI' instruction
  482.  
  483.  
  484. MEMORY FUNCTIONS
  485.  
  486. The functions malloc and free are available.  If you use them, you will get a 2K byte space of memory to allocate from.  If you do not use them, no memory is mapped for allocation.
  487. If you want to change the size of this area you must create, assemble and link with a file that looks a lot like this.
  488.     PROCESSOR 68HC11
  489.  
  490.     XDEF    __first_mem_location,__last_mem_location
  491.  
  492.     RSEG.U    BSS
  493. __first_mem_location
  494.     rmb    2048
  495. __last_mem_location
  496.  
  497.  
  498. INTERRUPTS
  499.  
  500. If an interrupt routine is to call a C routine it must preserve all registers and the D extension and mirror temporaries and of course restore them on exit.  If it will be doing floating point math, it must also preserve the 10 bytes of math registers.  This is a fairly high overhead to pay.  For those that insist on having interrupts call C routines I plan to add an interrupt keyword for functions that forces them to preserve these registers.
  501.  
  502. Currently, many of the library routines in C_lib.lib and math.lib are not re-entrant. If another task, process or interrupt calls a non re-entrant function that is used by the
  503. main program or another interrupt, if nested interrupts are possible, bad and unpredictable things will happen.  Better yet there is currently no list of which functions are and are not
  504. re-entrant.  BE SAFE - DON'T DO IT.
  505.  
  506. Instead of calling C functions with interrupts, it is reccommended that the interrupt handler service the interrupt then set a flag that the main program checks and on finding it set executes the calls.
  507.  
  508.  
  509. PRINTF, SPRINTF, FPRINTF, SCANF, SSCANF, FSCANF
  510.  
  511. There are 4 versions of each function in the printf family of functions and 4 versions of each function in the scanf family of functions.  The default versions are ANSI compatible.  The printf
  512. family uses the function __print which is very large and it would be a shame to use an 8 Kbyte function to
  513.     printf("Hello World");
  514. Similarly the scanf family uses the function __print which is also very large and it would be a shame to use an 8 Kbyte function to
  515.     scanf("%s",string);
  516.  
  517. For something as simple as the examples above you should consider using puts or fputs or gets or fgets, they are smaller and faster.  If you need printf or scanf, the linker can be told to
  518. substitute one of the other formatting functions, __sm_print, __med_print or __lg_print for __print and __sm_scan, __med_scan or __lg_scan for __scan.  The differences are;
  519.     __print        Everything is included
  520.     __lg_print    Floats excluded
  521.     __med_print    Floats and longs excluded
  522.     __sm_print    Floats and longs excluded and width, precision, 'l' and 'h' are ignored
  523.     __scan        Everything is included
  524.     __lg_scan    Floats excluded
  525.     __med_scan    Floats and longs excluded
  526.     __sm_scan    Floats, longs and octal excluded and 'l' and 'h' are ignored,
  527.  
  528. Currently none of the long or float handling is in the library.  In their place are stubs that do nothing.
  529.  
  530.  
  531. ERROR REPORTING
  532.  
  533. The error detecting/reporting of this compiler is quite poor.  I have never had it crash but it will hang.  If you have it hang I reccomend that you run another compiler, such as SAS/C, over the code to find the problem.
  534.  
  535.  
  536. STACK USAGE
  537.  
  538. As on most compilers there is a need for more stack for a larger function.  With this compiler it doesn't take much of a function to exceed the default stack size of 4000 bytes.  Stack checking saves your system from a crash - so it is only a small hassle to increase the stack and try again. I plan to give the program more stack by default.
  539.  
  540.  
  541. ZERO PAGE USAGE
  542.  
  543. It is very important from the execution time perpective that you have the 6 bytes of pseudo registers in page zero.  This does not seem like an unreasonable demand so the system defaults to that way.  If you cannot use any zero page ram, you will have to modify the C_lib.inc file to remove the .z from the zpage segment and then reassemble all C compiler generated sources including the library sources and then link with zpage at its correct location.
  544.  
  545. Similarly, if you choose to use floating point routines, another 10 bytes of page zero will be required.
  546.  
  547.  
  548. HC11 REGISTER USAGE
  549.  
  550. A C routine may use any of the HC11 registers.  In addition to this it may use 6 bytes of pseudo registers which are used to speed calculations.  Two of these bytes act as an extension to the D regster for use with long variables.  The other 4 bytes act as mirror temporaries of the extended D register.
  551.  
  552.     L99999999    L99999990        D register
  553.  
  554.     L99999995    L99999996    L99999997    L99999998
  555.  
  556. If a C routine is to call an assembly routine, the assembly routine must preserve only the Y and S registers.  The subroutine will be called with all parameters pushed on the stack, as is traditional with the C language.  The parameters are pushed onto the stack in the reverse order that they are listed in the function prototype.  The Y register points to the data frame for the calling function which should not be changed.  The result of the routine, if there is one, will be in the B register if it is a char size result, in the D register if it is a word size result or in the D register and the D extension word.
  557.  
  558. In order for an assembly routine to call a C routine, the assembly routine must setup like a C routine.  Parameters must be pushed to the stack and the stack must have enough space for the auto (local) variables of the C routine(s).
  559.  
  560. C source symbols have an underscore prepended to them when they are translated to assembler.  Therefore, if the C program calls an assembler function "find_mouse", the assembler functions name in the assembler source would be "_find_mouse".
  561.  
  562.  
  563. FUNCTION RETURN VALUES
  564.  
  565. For the results of functions returning either char or long sized to be used properly in following expressions it is ESSENTIAL that the function prototype be known before the function is used.  If it is not known the compiler will assume int meaning that a byte of garbage will be appended to the char as the MS byte, or that the upper word of the long will be lost.
  566.  
  567.  
  568. FUNCTION PARAMETERS
  569.  
  570. In using var args type functions such as fprintf, fscanf and their derivatives and unprototyped functions, it is important to understand how arguments are pushed to the stack for these calls.  All expressions (a single variable is consider a simple expression) are pushed to the stack in the size that the expression evaluates to:
  571.     a char variable is pushed as 8 bits
  572.     an int,short or pointer variable is pushed as 16 bits
  573.     a long variable is pushed as 32 bits
  574.     an expression is pushed as the longest type used in the expression
  575.     an expression that mixes signed and unsigned types of the same size is promoted to the next larger size unless the size is long
  576.     a numeric constant is pushed as the smallest signed size that it can fit into. Ex. 127 => char, 128 => int
  577.  
  578. So if an unprototyped or var args function is expecting an int and you pass it the number 4, it will not work the way you expect.  You will have to cast it to the required size or if the function is fully prototyped (not var args) the cast will be done automatically for you.
  579.  
  580. For integer specifiers %d, %x, etc., fprintf and fscanf have a default size of int.  If you wish to use a long you must you the l specifier (%ld, %lx) and either pass a long variable, long expression or long cast.  The %c specifier has a default size of char.  If you pass it an int it
  581. will not work as you expect, in this case you must cast to a char.
  582.  
  583. This concern is not present in 68000 C compilers because they always promote the type to long since that is the natural size of the processor.  But to produce efficient code for the HC11 we must do it this way.  Intel processors (at least with 16 bit compilers) suffer some of these problems.
  584.  
  585.  
  586. INPUT/OUTPUT
  587.  
  588. You are expected to provide 4 routines if you plan to do character I/O.  putchar, getchar, puts, gets; these are documented in any C book.
  589.  
  590.  
  591. BIT FIELDS
  592.  
  593. This compiler does not support bit fields
  594.  
  595.  
  596. CUSTOMIZING C.O
  597.  
  598. You are strongly advised to link with c.o for all your C programs. However, c.o is not provided with this release (or any other).  Only the source file (c.a) is provided since it MUST be customized to suit your environment.  It is a very small program, currently the only
  599. thing that must be setup is the stack pointer.  Once this is done use SAsm to assemble c.a and produce c.o.
  600.  
  601.  
  602. THE PROM (-P) OPTION
  603.  
  604. This option causes all non-constant initialized data to be generated in the data segment IDATA.  This name has special meaning to the linker, causing it to generate a mirror BSS allocation for it.  The linker also generates 3 symbols, __IDATAfrom, __IDATAend and IDATAto.  If there is no IDATA segment, these symbols are generated with unknown but identical values.  Using these symbols a simple routine in C_lib called __init_data copies the initialization data to the BSS segment. This allows for ram variables in a BSS segment to have initial values coming from the PROM.  When linking, the IDATA segment should be located in RAM memory, the initialization values are automatically tacked onto the end of the CODE segment or a CODE segment is created. If you link with the module c.o all of this will be taken care of for you.
  605.  
  606.  
  607. BIT OPERATION OPTIMIZATIONS
  608.  
  609. Certain operations can be optimized into bit operations which are much faster than other operation.  To use them you must design your program to take advantage of them.  Any variables that you will be doing bit operations on must be char or unsigned char type and must be accessible via a dereference, which includes function parameters, auto variables in functions and pointer referenced variables.
  610.  
  611. For the first type of bit optimization you must use the &= or |= operations and you must use a constant as the bit pattern.  This will make use of the 6811 instructions BSET and BCLR.  For example;
  612.     char r;
  613.     void main(unsigned char *s) {
  614.         char t;
  615.           char *u_ptr;
  616.  
  617.         r |= 4;            <== NOT Optimized, not pointer accessible
  618.         t = t | 4;        <== NOT Optimized, not |= operator
  619.         s &= 5;        <== Optimized
  620.         s &= ~6;        <== Optimized
  621.         *u_ptr |= 0x30;    <== Optimized
  622.     }
  623.  
  624. The second type of optimization is employed when a dereferrenced variable is anded with a constant as part of a conditional expression.  This uses the 6811 instructions BRSET and BRCLR  For example;
  625.     unsigned char *ptr;
  626.     void main( void ) {
  627.         if (*ptr & 0x80) {    /* if MSB set then ...
  628.  
  629.         }
  630.     }
  631.  
  632. The above constraints are a function of the limitations of the bit operations of the HC11.
  633. CODING FOR MAXIMIZING EFFICIENCY
  634.  
  635. The auto increment/decrement reference is much faster as
  636.     *++aptr
  637. than as
  638.     *aptr++
  639. particularly on int and long sized data.
  640.  
  641. STANDARD C FUNCTIONS (C_lib.lib)
  642.  
  643. The following functions are available through the C_lib.lib library.  They are currently not prototyped here since such prototypes are available from many other sources and because to do so would take time from more worthwhile enterprises.
  644. strlen        sprintf
  645. fprintf        printf
  646. isalnum    isalpha
  647. iscntrl        isdigit
  648. isgraph        islower
  649. isprint        ispunct
  650. isspace        isupper
  651. isxdigit        atoi
  652. atol        ungetc    
  653. fputc        putc
  654. fgetc        getc
  655. getchar        putchar
  656. feof        ferror
  657. puts        fputs
  658. malloc        free
  659. memcpy    memset
  660. sscanf        fscanf
  661. scanf
  662.  
  663. The following functions are useful functions that I have seen in other compilers but are not standardized ... and currently not documented, sorry.
  664. stci_d        stcu_d
  665. stci_h        stcl_d
  666. stcul_d        stcl_h
  667. stcc_d        stcuc_d
  668. stcc_h        stci_o
  669. stcl_o        stcc_o
  670. NAME
  671.  
  672.     SDis
  673.  
  674. SYNOPSIS
  675.  
  676.     SDis <options> <file name>
  677.         Options    -a<num>    additional address specification (n in hexadecimal)
  678.                 -f<name>    filename of additional address specifications
  679.                 -l8        toggle labels for 8 bit immediates    (default off)
  680.                 -l16        toggle labels for 16 bit immediates    (default on)
  681.                 -x        generate XREF's rather than EQU's
  682.                             for labels external to S-record file
  683.  
  684. DESCRIPTION
  685.  
  686. SDis is the dis-assembler for the DEV11 system.  It accepts a Motorola S-record format file and outputs a symbolic dis-assembled file to stdout, by default the console.  The output file is assembler (SAsm) ready and would assemble to be exactly the same as the file that was
  687. dis-assembled.
  688.  
  689. SDis is what I call a tracking dis-assembler; which means that it must have the address of an executable instruction to start from and it follows the executable code thru statement by statement building up a map of where executable code is found.  Normally it gets the starting address from the S9 record, if your file has one.  Otherwise or if other addresses must be known, as might be the case with a monitor ROM with many entry points, the dis-assembler asks for an address(es) to start from or address(es) can be provided on the command line or from a file.  A tracking dis-assembler will not attempt to dis-assemble data; it knows the difference (but it can be intentionally fooled).
  690.  
  691. If a file is used to supply additional code entry addresses, the format of the file is one Hex address per line in the file.  Blank lines are ignored
  692.  
  693. Unfortunately, some compilers (including SC11) produce code from a switch statement that fools SDis.  The construct is;
  694.     jsr    switch_handler
  695.     fcb    case1_val
  696.     fdb    case1_vector
  697.     fcb    case2_val
  698.     fdb    case2_vector
  699. The handler never returns from the jsr, instead it fiddles the stack and jumps to one of the vectors.  If you see non-sense instructions or '???' not in a comment this is what you have run into.
  700.  
  701. The above example also shows how the disassembler can miss some code areas, thinking they are data instead.  Since it cannot know the format of the data following the JSR or any vector lookup table, it cannot know that there is code at the vector addresses.  This is where a human brain is required.  After the first disassembly analyse the data areas to see if they are vector lookup tables; if so get the addresses and enter them in by hand during the next disassembly.
  702.  
  703. If SDis finds a place in the file that it believes is data but does not have a label, i.e. that address is not accessed by any of the code that it knows about, it will print out "??? no label."  Generally, this means that the data is not accessed by the program.  If you inspect the the hex dump of this data you may discover that it is in fact executable code.  Again, this would be code that is not used in the program.  Unused code or data is a sign that a linker and library routines have been used to build the program as this process often results in the inclusion of extraneous routines.
  704.  
  705. No disassembler can know the difference between a constant and an address in an immediate statement.  For example;
  706.     label    rmb    1
  707.         ldaa    #label
  708.         ldaa    #$30
  709. If 'label' evaluates to an address of $30 then no difference exists between the two ldaa statements.  But the difference is critcal if the dis-assembled code is to be relocated.  In hopes of helping, there are two options that determine how these cases are disassembled - as constants or labels and for 8 bit immediates if the value is in the range of ASCII a comment containing the character is appended.  BUT, you will still have to sort out which are really constants if you wish to relocate!NAME
  710.  
  711.     SSim
  712.  
  713. SYNOPSIS
  714.  
  715.     SSim [NTSC|PAL] [LORES] [NOLACE]
  716.  
  717.                 Note: the screen defaults to DBL_NTSC HIRES LACE
  718.  
  719. NOTES
  720.  
  721. Special thanks go to Motorola Inc. for supplying the reference materials that were essential to this product and consequently for the education as to the depth and breadth of the 'HC11 family.
  722.  
  723. The large number of peripherals and variations of peripherals in this family has made difficult to model everything in the time that I can devote to a public domain product.  Unmodelled members of the family are disabled in the menus.  Additionally, the following peripherals and functions are not modelled on any processor.
  724.     EEPROM programming        SPI
  725. If these are particularly important to you, let me know, I'll see what I can do.
  726.  
  727.  
  728. DESCRIPTION
  729.  
  730. SSim is a highly capable simulator for the 68HC11 processor.  It is different from Sim68 (for IBM PC's) in many ways.  First, it is more GUI based, second, it simulates the memory and the operation of regisiters specific to the selected processor and third, it allows for simulating external peripherals via an ARexx interface.  The ARexx simulation could be done by CanDo or AmigaVision to provide a graphical display of, say, an operators panel.
  731.  
  732.  
  733. DISPLAYS
  734.  
  735. The display windows show various representations of information that are important  while simulating.  The displays change during the simulation as the data that they display changes.  Most displays can be set to display in hex, binary or decimal format.
  736.  
  737. The Register window shows the contents of the internal registers.  Initially the registers contain 'XXXX' indicating that the contents are not known.  It is possible for the simulation to work but the program to not work if your program relies on the simulators assumption that the registers default to 0.  For example: if the first instruction to execute after reset is 'ORAA #4' the register display will show the contents as '04' when only the state of one bit can be known for sure.
  738.  
  739. The Stack window shows the bytes in the stack above the current stack pointer.  This is particularly useful for resolving problems with values passed to functions via the stack (C style).  Higher address memory is shown above the stack pointer.
  740.  
  741. The Memory window can display and eventually modify the contents of 64 bytes of memory.
  742.  
  743. The Source window shows the instructions that have been and will be executed.  Note that this is somewhat different from what you would expect from a source level debugger, which would show the source lines before and after the current line.  This display choice was made due to the nature of assembler programs, i.e. it takes 20 lines of assembler to do anything.  It is more import to know where you have been than where you could have been.
  744.  
  745. The Source window contains a '>' that marks the next instruction to be executed.  Above this is a history of statements that have been executed so far.  Below it is a disassembly of the code following the next instruction.
  746.  
  747. The Control window has 5 buttons that control the simulation;
  748.     a) Run - This button tells the simulation to continue executing statements until a breakpoint is hit or an error occurs.
  749.     b) Stop - This button, which is only useful while Running, causes the simulation to stop.
  750.     c) Step - This button tells the simulation to step to the instruction following the next instruction.  If the next instruction is a JSR the simulation will continue executing until the following instruction is reached, thereby stepping over the next instruction.
  751.     d) Step Into - This button tells the simulation to step to the instruction that will execute after the next instruction.  If the next instruction is a JSR the simulation will 'step into' the subroutine.
  752.     e) Reset - This button performs the same function as applying a low level to the processors ~Reset pin.  The reset vector is fetched from memory and the processors registers are set accordingly.
  753.  
  754.  
  755. The Serial window has a display for the text that is output by the simulated serial port output (Tx) and two string entry gadgets for entering characters to go to the serial port input (Rx & RxHex).  All printable characters and most control characters can be entered into the Rx gadget.
  756. CR and LF can be entered by pressing ctrl-M and ctrl-J respectively.  The RxHex input allows for hexadecimal entry of characters to the serial port.  Entry to this gadget MUST always be multiples of two characters.  The RxHex gadget is read from after the Rx gadget is empty.
  757.  
  758. The Ports window shows the output values of port A thru H (if applicable) for the simulated processor.
  759.  
  760. The Break Points window allows for the entry of addresses at which the simulation will halt.
  761.  
  762. The Analog window allows for the entry of floating point voltage values for the analog inputs.  The values entered must be between 0.000 and 5.000 inclusive.
  763.  
  764.  
  765. OPERATION
  766.  
  767. When the program is first started no processor is selected and therefore there is no memory or registers.  It would be pointless to try to load a program, view memory or set breakpoints at this time.
  768.  
  769. The first operation is to select a processor or load a previously saved simulation, which contains the processor choice.  Currently the most common processors are available but eventually all will be available.  Once a processor has been selected the simulation will have the appropriate memory for that processor.  This memory map can be viewed and eventually modified.  Processor operations on registers that would remap these memories in the real processor will cause them to be relocated in the simulation.
  770.  
  771. If a processor was selected, it may be necessary to inform the simulation about external memory and peripherals; this is done with the window raised by the Configure/Memory Map menu item.  External memory may be added to the internal maps for the processor.  The type for this kind of
  772. map is User since external (to SSim) simulation is not required.  For external peripherals, those that attach to the bus or ports, the map sets the address for the peripheral and the type is set to ARexx.  This will cause the simulation to try to exchange data with an external ARexx program when that address is read or written (see the section on ARexx for details of the exchange).
  773.  
  774. An S-record file can be loaded into the simulation.  If the loading process attempts to write to non-existant memory locations you will get an error message.  More than one load can be done to merge various pieces of code.
  775.  
  776. Now that a processor has been chosen, the map has been set and the code has been loaded, which is expected to contain vectors, the processor can be reset by pressing the reset button on the middle panel.  This should load the reset vector and display the disassembled code in the source
  777. window.  Much later on I hope to have it display the source from the original file which would include comments and for C programmers the original C statements.
  778.  
  779. The control panel in conjunction with the other windows can now be used to debug the program.
  780.  
  781.  
  782. SIMULATION OPTIONS
  783.  
  784. There are currently 2 options, both respecting the slow speed of the simulation (and I have an A4000).
  785.     a) Run Fast - stops the continuous display updates of the Registers, Stack and Memory windows while the simulation is running as opposed to stepping.  With Run Fast active during a long run there is no indication that anything is happening.
  786.     b) Baud x 16 - this departs from strict simulation by allowing the serial output to run 16 times faster than usual.  If you don't require strict simulation this option will keep you from getting old waiting for character output.
  787.  
  788.  
  789. AREXX
  790.  
  791. Whenever an instruction results in a change to any of the processors external ports or any read or write to any area of the memory map that has been mapped as AREXX, an ARexx interaction is required.  If a NOTIFY message has been received at the ARexx port, an ARexx reply is formed and the NOTIFY message is returned to the sender port.  Also, at the end of every instruction, if a INSTR message has been received by the program, the result value of the message is set to the number of E clock cycles that passed during that instruction and the message is replied.  If an AREXX program wishes to receive all messages it must keep a NOTIFY message continually on the AREXX port.  If it can send more than one such message that is best, otherwise it will have to send another NOTIFY message as soon as the current one is returned.  To give this
  792. a better chance of success, SSim runs at a priority of -1.
  793.  
  794. The ARexx messages are:
  795. Notify                    SSim will never send this
  796. Instr
  797. Port A/B/C/D/E/F/G/H <data>
  798. Mem <WO> <W/B> <addr> <data>        or
  799. Mem <RO> <W/B> <addr>
  800. Serial <in/out> <"string">
  801. Analog <in/out> <#> <value>        value is 0 to 4095 which spans range of VRL and VRH
  802. QUIT                    arexx program never sends this
  803.  
  804. data values can be in decimal or hex if preceded by a '$'
  805.  
  806. If a Mem command is given with a read mode, the simulation will stop until there is a response from the arexx program.  The response must be another Mem command with the same address.
  807.  
  808. I suspect that AmigaVision 1.70z or better is required to properly access this data by using the ?<forgot>? command which only appears in the readme.
  809.  
  810.  
  811. CAVAETS
  812.  
  813. SSim requires AmigaDOS 2.04 or better, in fact, 2.04 may leave open some possibilities for crashes that are not possible on 2.1 and up.
  814.  
  815. It is not possible to successfully save a simulation until both a processor has been chosen and reset.
  816. NAME
  817.  
  818.     slib
  819.  
  820. SYNOPSIS
  821.  
  822.     slib [-a<1>] [-d<1>] [-l[<1>]] [-r<1>] [-w<1>] [-x<1>]  <library name>
  823.  
  824.                 <1>  - one file
  825.  
  826. DESCRIPTION
  827.  
  828. Slib is the librarian for the ADev11 system. This version, done by Paul Issacs,  replaces the old slib, now called xlib.  Xlib will be phased out but is included now  since the two programs are significantly different.  The following options are recognized by slib:
  829.  
  830.     -a    Specifies an object file that will be added to the library.  The object file must not already be in the library.  The -a option may be used more than once.
  831.  
  832.     -d    Specifies an object module that will be deleted from the library.
  833.  
  834.     -l    Causes a listing of the library to be sent to a file or to stdout if the filename is omitted. The listing includes the name of the module, its size (not the code size), and the symbols that are available from that module.  The -l option can be used more than once.
  835.  
  836.     -r    Specifies an object module to be replaced in the library.  If the module is not in the library, the specified module is added to the library.  The -r option may be used more than once.
  837.  
  838.     -w    Specifies a file that contains option commands to be processed by slib.  The file may be broken into lines, but each line must start with an option.  A command file can specify another command file and more than one command file can be used.  An example file might look as shown below.
  839.                 -adownload.o
  840.                 -rcowtown.o
  841.                 -l
  842.  
  843.     -x    Specifies an object module in the library that is to be copied to the modules original filename.
  844.  
  845. One and only one library must be specified for each invocation of slib.NAME
  846.  
  847.     xlib
  848.  
  849. SYNOPSIS
  850.  
  851.     xlib [-a<1>] [-r<1>] [-l] [-c<1>] <library name>
  852.  
  853.                 <1>  - one file
  854.  
  855. DESCRIPTION
  856.  
  857. Xlib is the old librarian for the ADev11 system. It is being phased out and new developments should not use it.  The following options are recognized by slib:
  858.  
  859.     -a    Specifies an object file that will be added to the library.  The -a option may be used more than once.
  860.  
  861.     -c    Specifies a file that contains option commands to be processed by slib.  The file may be broken into lines, but each line must start with an option.  A command file can specify another command file and more than one command file can be used.  An example file might look as shown below.
  862.                 -adownload.o
  863.                 -rcowtown.o
  864.                 -l
  865.  
  866.     -l    Causes a listing of the library to be sent to the console (unless redirected). The listing includes the name of the module, its size (not the code size), and the symbols that are available from that module.  The -l option can be used more than once.
  867.  
  868.     -r    Specifies an object module to be removed from the library.  The -r option may be used more than once.
  869.  
  870. One and only one library must be specified for each invocation of slib.NAME
  871.  
  872.     slink
  873.     slink1.3
  874.  
  875. SYNOPSIS
  876.  
  877.     slink [FROM <1+>] [TO <1>] [WITH <1>] [LIB <1+>] [MEM <range> <1+>]
  878.         [MAP <1>]
  879.  
  880.                 <1>  - one file
  881.                 <1+> - one or more files (separated by commas)
  882.                 <range> = <hex address>-<hex address>
  883.  
  884. DESCRIPTION
  885.  
  886. Slink is the linker for the DEV11 system. Slink accepts keyword commands to control the process of linking.  Keywords are not case sensitive.  The following keywords are recognized by slink:
  887.  
  888.     FROM    Provides a list of object files that will become the root of the output file.  FROM must be used once and may be used more than once with each use adding to the root, but you must specify at least one file for each use.
  889.  
  890.     LIB    Provides a list of library files to be scanned to resolve symbols not found in the root files. Only the modules containing the unresolved symbols will be included in the output file.  LIB can be used more than once.
  891.  
  892.     MEM    Specifies an area of memory and provides a list of the segment names that are to be located in that area.  The linker must know where to place every segment that is used.  MEM is usually used more than once. 
  893.  
  894.     TO    Specifies the output file to create.  The file will be an S-record format file. TO must be used once and only once.
  895.  
  896.     WITH    Specifies a file that contains keyword commands to be processed by slink.  The file may be broken into lines,  but each line must start with a keyword.  A WITH file can WITH another file and more than one WITH file may be used.  An example file might look as shown below.
  897.                 FROM download.o
  898.                 TO download.sr
  899.                 MEM 100-7fff EXT_RAM
  900.                 MEM 8000-83ff INT_RAM
  901.                 MEM 0-ff ZPAGE
  902.                 MEM fe00-ffd5 EEPROM, CODE
  903.                 MEM ffd6-ffff VECTORS
  904.  
  905.     MAP        Causes a link map listing to be generated.  This file contains information such as the addresses of all global symbols and the addresses of the hunks from each module.
  906.  
  907. There is a reserved segment name called CHKSUM that works like any other segment except that it is generated by the linker.  To use the CHKSUM feature, you link the CHKSUM segment in with the rest of the segments in the EPROM (doesn't matter where).  This produces a word size value in the EPROM such that the sum of all the words of the rom is zero.  This segment name can only appear once in a link.  The following assumptions have been made about the use of CHKSUM: that some code exists within 255 bytes of the start of the rom, the rom extends to 0xFFFF and unused rom is erased to 0xFF.  The linker determines the start of the rom by anding the lowest address that it sees with 0xFF00.  See the example chksum in the examples directory.  If you have segments that generate S-records that are not in the EPROM, which you shouldn't, these will screw-up the computation.
  908.  
  909. The segment name IDATA has special meaning to the linker, causing it to generate a mirror BSS allocation for it.  The linker also generates 3 symbols, __IDATAfrom, __IDATAend and __IDATAto.  If there is no IDATA segment, these symbols are generated with unknown but identical values.  Using these symbols a simple routine in C_lib called __init_data copies the initialization data to the BSS segment. This allows for ram variables in a BSS segment to have initial values coming from the PROM.  When linking, the IDATA segment should be located in RAM memory, the initialization values are automatically tacked onto the end of the CODE segment or a CODE segment is created.
  910.  
  911.  
  912. EXAMPLE
  913.  
  914. The following line invokes the linker using the command file download.sln and creating the linker map file download.map.
  915.  
  916.     Slink MAP download.map WITH download.slnADEV11 Development System for AmigaDOS
  917. Library Reference
  918.  
  919. Version 1.0Function List
  920.  
  921. FUNCTION    DESCRIPTION    LIBRARY
  922. __asc2byte    convert ASCII string to byte    lib11.lib
  923. __find_spc    find first space ' ' character in string    lib11.lib
  924. __put_asc    print out word size number (signed)    lib11.lib
  925. __put_asc_sm    print out byte size number (signed)    lib11.lib
  926. __put_asc_str    make string from word size number (signed)    lib11.lib
  927. __put_asc_str_sm    make string from byte size number (signed)    lib11.lib
  928. __put_asc_str_u    make string from word size number (unsigned)    lib11.lib
  929. __put_asc_str_usm    make string from byte size number (unsigned)    lib11.lib
  930. __put_asc_u    print out word size number (unsigned)    lib11.lib
  931. __put_asc_usm    print out byte size number (unsigned)    lib11.lib
  932. __put_hex    print out word size hex number (signed)    lib11.lib
  933. __put_hex_sm    print out byte size hex number (signed)    lib11.lib
  934. __put_hex_str    make string from word size hex number (signed)    lib11.lib
  935. __put_hex_str_sm    make string from byte size hex number (signed)    lib11.lib
  936. __put_oct    print out word size oct number (signed)    lib11.lib
  937. __put_oct_sm    print out byte size oct number (signed)    lib11.lib
  938. __put_oct_str    make string from word size oct number (signed)    lib11.lib
  939. __put_oct_str_sm    make string from byte size oct number (signed)    lib11.lib
  940. __search    search for string in string list    lib11.lib
  941. __skip_spc    find first non-space ' ' character in string    lib11.lib
  942. __str_lookup    find string in string list from ordinate    lib11.lib
  943.  
  944.  
  945. *The names used above are the ones that would be used to access the functions from an assembler program.  From a C program one less leading underscore would be used, although none of these functions would have any value to a C program due to the different ways of handling argument passing.__asc2byte
  946.  
  947. NAME
  948.  
  949.     __asc2byte
  950.  
  951. SYNOPSIS
  952.  
  953.     IN:    X     pointer to string
  954.  
  955.     OUT:    A    value result
  956.         X    pointer to first non-numeric character
  957.         B    modified
  958.         Y    not modified
  959.  
  960. DESCRIPTION
  961.  
  962. This function converts an ASCII number in a string to a binary value.  The conversion stops at the first non-numeric character.__find_spc, __skip_spc
  963. NAME
  964.  
  965.     __find_spc
  966.     __skip_spc
  967.  
  968. SYNOPSIS
  969.  
  970.     (__find_spc)
  971.     IN:    X    pointer to string
  972.     OUT:    X    pointer to space character or NULL
  973.         A    space character or NULL
  974.         B,Y    not modified
  975.  
  976.     (__skip_spc)
  977.     IN:    X    pointer to string
  978.     OUT:    X    pointer to non-space character
  979.         A    non-space character
  980.         B,Y    not modified
  981.  
  982. DESCRIPTION
  983.  
  984. These functions search through a string to find the presence or absence of a space.__put_asc, __put_asc_sm, __put_asc_u, __put_asc_usm
  985.  
  986. NAME
  987.  
  988.     __put_asc
  989.     __put_asc_sm
  990.     __put_asc_u
  991.     __put_asc_usm
  992.  
  993. SYNOPSIS
  994.  
  995.     (__put_asc, __put_asc_u)
  996.     IN:    D    value to convert
  997.     OUT:    D,X    modified
  998.         Y    not modified
  999.  
  1000.     (__put_asc_sm, __put_asc_usm)
  1001.     IN:    B    value to convert
  1002.     OUT:    D,X    modified
  1003.         Y    not modified
  1004.  
  1005. DESCRIPTION
  1006.  
  1007. These functions convert a binary number to ASCII and print it.   They use a common variable called __z_blank that determines how many of the leading digits are to be considered for zero blanking.  For example, with __put_asc which is a 5 digit routine;
  1008.  
  1009. Normally, with an N digit routine, a __z_blank of N-1 would be used.  __z_blank is modified by the function.__put_asc_str, __put_asc_str_sm, __put_asc_str_u, __put_asc_str_usm
  1010.  
  1011. NAME
  1012.  
  1013.     __put_asc_str
  1014.     __put_asc_str_sm
  1015.     __put_asc_str_u
  1016.     __put_asc_str_usm
  1017.  
  1018. SYNOPSIS
  1019.  
  1020.     (__put_asc_str, __put_asc_str_u)
  1021.     IN:    D    value to convert
  1022.         X    address of string to store result
  1023.     OUT:    D,X    modified
  1024.         Y    not modified
  1025.  
  1026.     (__put_asc_str_sm, __put_asc_str_usm)
  1027.     IN:    B    value to convert
  1028.         X    address of string to store result
  1029.     OUT:    D,X    modified
  1030.         Y    not modified
  1031.  
  1032. DESCRIPTION
  1033.  
  1034. These functions convert a binary number to ASCII and store it in the string pointed to by the X register.  They use a common variable called __z_blank that determines how many of the leading digits are to be considered for zero blanking.  For example, with __put_asc_str which is a 5 digit routine;
  1035.  
  1036. Normally, with an N digit routine, a __z_blank of N-1 would be used.  __z_blank is modified by the function.__put_hex, __put_hex_sm
  1037.  
  1038. NAME
  1039.  
  1040.     __put_hex
  1041.     __put_hex_sm
  1042.  
  1043. SYNOPSIS
  1044.  
  1045.     (__put_hex)
  1046.     IN:    D    value to convert
  1047.     OUT:    D    modified
  1048.         X,Y    not modified
  1049.  
  1050.     (__put_hex_sm)
  1051.     IN:    B    value to convert
  1052.     OUT:    A,B    modified
  1053.         X,Y    not modified
  1054.  
  1055. DESCRIPTION
  1056.  
  1057. These functions convert a binary number to HEX ASCII and print it.   They use a common variable called __z_blank that determines how many of the leading digits are to be considered for zero blanking.  For example, with __put_hex which is a 4 digit routine;
  1058.  
  1059. Normally, with an N digit routine, a __z_blank of N-1 would be used.  __z_blank is modified by the function.__put_hex_str, __put_hex_str_sm
  1060.  
  1061. NAME
  1062.  
  1063.     __put_hex_str
  1064.     __put_hex_str_sm
  1065.  
  1066. SYNOPSIS
  1067.  
  1068.     (__put_hex_str)
  1069.     IN:    D    value to convert
  1070.     OUT:    D    modified
  1071.         X,Y    not modified
  1072.  
  1073.     (__put_hex_str_sm)
  1074.     IN:    B    value to convert
  1075.     OUT:    A,B    modified
  1076.         X,Y    not modified
  1077.  
  1078. DESCRIPTION
  1079.  
  1080. These functions convert a binary number to HEX ASCII and store it in the string pointed to by the X register.   They use a common variable called __z_blank that determines how many of the leading digits are to be considered for zero blanking.  For example, with __put_hex_str which is a 4 digit routine;
  1081.  
  1082. Normally, with an N digit routine, a __z_blank of N-1 would be used.  __z_blank is modified by the function.__put_oct, __put_oct_sm
  1083.  
  1084. NAME
  1085.  
  1086.     __put_oct
  1087.     __put_oct_sm
  1088.  
  1089. SYNOPSIS
  1090.  
  1091.     (__put_oct)
  1092.     IN:    D    value to convert
  1093.     OUT:    D    modified
  1094.         X,Y    not modified
  1095.  
  1096.     (__put_oct_sm)
  1097.     IN:    B    value to convert
  1098.     OUT:    A,B    modified
  1099.         X,Y    not modified
  1100.  
  1101. DESCRIPTION
  1102.  
  1103. These functions convert a binary number to OCTAL ASCII and print it.   They use a common variable called __z_blank that determines how many of the leading digits are to be considered for zero blanking.  For example, with __put_oct which is a 5 digit routine;
  1104.  
  1105. Normally, with an N digit routine, a __z_blank of N-1 would be used.  __z_blank is modified by the function.__put_oct_str, __put_oct_str_sm
  1106.  
  1107. NAME
  1108.  
  1109.     __put_oct_str
  1110.     __put_oct_str_sm
  1111.  
  1112. SYNOPSIS
  1113.  
  1114.     (__put_oct_str)
  1115.     IN:    D    value to convert
  1116.     OUT:    D    modified
  1117.         X,Y    not modified
  1118.  
  1119.     (__put_oct_str_sm)
  1120.     IN:    B    value to convert
  1121.     OUT:    A,B    modified
  1122.         X,Y    not modified
  1123.  
  1124. DESCRIPTION
  1125.  
  1126. These functions convert a binary number to OCTAL ASCII and store it in the string pointed to by the X register.   They use a common variable called __z_blank that determines how many of the leading digits are to be considered for zero blanking.  For example, with __put_oct_str which is a 5 digit routine;
  1127.  
  1128. Normally, with an N digit routine, a __z_blank of N-1 would be used.  __z_blank is modified by the function.__search, __str_lookup
  1129.  
  1130. NAME
  1131.  
  1132.     __search
  1133.     __str_lookup
  1134.  
  1135. SYNOPSIS
  1136.     (__search)
  1137.     IN:    X    pointer to search string
  1138.         Y    pointer to string list
  1139.     OUT:    X    not modified
  1140.         Y    modified
  1141.         A    ordinate of string in list or -1
  1142.         B    not modified
  1143.  
  1144.     (__str_lookup)
  1145.     IN:    X    pointer to string list
  1146.     OUT:    X    pointer to string
  1147.         Y    not modified    
  1148.         D    modified
  1149.  
  1150. DESCRIPTION
  1151.  
  1152. These functions perform inverse actions on string lists.  `search' searches for a string in the list and returns its ordinal number (first string in list => 0).  `str_lookup' finds a string given the ordinal number.
  1153.  
  1154. A string list is a linear sequence of strings terminated by a null string, for example:
  1155.     DC    "string0",0
  1156.     DC    "string1",0
  1157.     DC    "string2",0
  1158.     DC    0ADEV11 Development System for AmigaDOS
  1159. Examples
  1160.  
  1161. Version 1.1NAME
  1162.  
  1163.     monitor
  1164.  
  1165. DESCRIPTION
  1166.  
  1167. Monitor is a simple monitor program that fits in the EEPROM of a 68HC11F1 or any HC11 which meets the following memory requirements; 504 bytes of non-volatile, 404 bytes of ram.  It provides some basic I/O calls.  It is different from the typical debug monitor in that the program under test can supplement the commands of the monitor and that the program under test is expected to be command driven rather than jumping to an address in the program to start it.
  1168.  
  1169.  
  1170. COMMAND SET
  1171.  
  1172. The basic command set is very limited with all commands associated with downloading an S-record file.
  1173.     S0    accept an S0 (identification) record
  1174.     S1    accept an S1 (data) record
  1175.     S9    accept an S9 (start address) record. When this is received execution immediately transfers to that location via a JSR. This code should initialize any variables, registers and/or interrupts, hook up to the command list and then return.
  1176.  
  1177. RESOURCES
  1178.  
  1179. The following resources are available to the code under test.
  1180.  
  1181.  
  1182.     Vectors
  1183.  
  1184. All of the vectors are available as 3 byte RAM locations.  When the associated interrupt occurs a jump is made to the first of these bytes.  Normally a jump instruction would be placed here; a $7E would be the first byte and the address of your function would be the second and third (MSB first).  The vector names are listed below.
  1185.  
  1186. SCI_JMP    SPI_JMP        PULSE_IN_JMP
  1187. PULSE_OVF_JMP    TIMER_OVF_JMP    TIMER_IC4_JMP
  1188. TIMER_OC4_JMP    TIMER_OC3_JMP    TIMER_OC2_JMP
  1189. TIMER_OC1_JMP    TIMER_IC3_JMP    TIMER_IC2_JMP
  1190. TIMER_IC1_JMP    RT_INTR_JMP    IRQ_JMP
  1191. XIRQ_JMP    SWI_JMP        OPC_JMP
  1192. COP_FAIL_JMP    MON_FAIL_JMP
  1193.  
  1194.  
  1195.     Variables
  1196.  
  1197. Only one variable is available to the code under test.
  1198.  
  1199. EXT_TABLE    A non-zero address in this variable is used as a pointer to a command table which the monitor will search if it receives a command that it cannot resolve in its own table.  If the command is found, the associated address is jumped to via a JSR.
  1200.  
  1201.             A command table consists of a sequence of individual commands followed by a null byte. The individual commands consist of a null terminated command name string followed by the 2 byte address of the code to be executed when the command is given.
  1202.  
  1203.     Functions
  1204.  
  1205. The following monitor functions are available to the program under test.
  1206.  
  1207. GETC        Gets a character from the serial port
  1208. GETS        Gets a null terminated string from the serial port
  1209. PUTC        Puts a character to the serial port
  1210. PUTS        Puts a null terminated string to the serial port
  1211. PCRLF    Puts a newline (carriage return/line feed) to the serial port
  1212. RDBYTE    Gets a hex ASCII byte from the serial port
  1213. str_cmp    Compares two strings
  1214.  
  1215. These functions are available by XREFing them and linking with board.o (supplied). A sample link command file (your.sln) is also provided. Note that the board.a segment names (BOARD_VECTORS and BOARD_RAM) must be first in their memory area and must correlate with the memory areas used to generate the monitor.
  1216.  
  1217.  
  1218. BUILDING THE MONITOR
  1219.  
  1220. To generate the S-record file to program your EEPROM  or EPROM configure the file download.sln to match the memory available on your board. There are three _SIZE equates in download.a that may also require change. Perform a make operation using the file lmkfile. If you have the SAS/C compiler this will work directly, other make utilities may require simple changes. If you do not have a make utiltiy then you will have to do the link by hand.
  1221.     slink with download.sln
  1222.  
  1223.  
  1224. OPERATION
  1225.  
  1226. When the processor is reset the monitor does a memory check to see that the memory that it expects is present and functional. It then checks to see wether the reset that started the monitor was due to a reset input or a power up. If it was a reset input then the monitor checks for an EXT_TABLE and if that is found it executes the first command in that table. It then sends a prompt character ('>') to the serial port and waits for a command to be entered.
  1227.  
  1228. Due to a shortage of EEPROM memory on the F1 no editing of the command line is possible and the commands, both monitor and user, are case sensitive.
  1229.  
  1230. When a command is entered and found in a table a JSR to the associated address is performed. At this point the X register points to the command line string and any additional arguments may be extracted.  All registers, except the stack, may be changed. When the command code execution is complete its last statement must be an RTS which returns control to the monitor which issues another prompt.
  1231. ADEV11 Development System for AmigaDOS
  1232. Utilities
  1233.  
  1234. Version 1.1NAME
  1235.  
  1236.     HCLoad
  1237.  
  1238. SYNOPSIS
  1239.  
  1240.     HCLoad [-options] srecord_data
  1241.     HCLoad [-options] -ssrecord_data
  1242.         where:
  1243.             srecord_data    a mandatory data file containing S records
  1244.  
  1245. DESCRIPTION
  1246.  
  1247.    This program loads Motorola S record files into the EPROM, EEPROM or RAM of an MC68HC11 type micro-processor. The micro-processor must have it's serial port connected to the Amiga's serial port and the micro-processor must be reset into the bootstrap mode.
  1248.  
  1249. HCload, when first run, downloads a bootstrap program to the MC68HC11 processor. The bootstrap program can be either one of the built in bootloaders or an external one custom made for the processor. This bootstrap program then in turn will load a S record file into the appropriate EPROM, EEPROM or RAM. As the program runs a byte counter is displayed to give an indication of progress. If for some reason the MC68HC11 cannot load the data sent to it, HCload will time out and notify the operator.
  1250.  
  1251.    The bootloader for the 711k4 processor will automatically determine what type of memory is being addressed by the S record and automatically switch to the proper programming algorithm for that memory. This allows RAM, EEPROM and EPROM to be programmed with the same utility.
  1252.  
  1253. HCLoad accepts the following options:
  1254.     -fx.xxx    Where x.xxx is the MC68HC11 xtal frequency in MHz. Default is 8.00. This option is used to adjust the Amiga baud rates to that of the MC68HC11 when using xtals other than 8.00 MHz.
  1255.     -p#    The Amiga serial port number. Port 0 is the default.
  1256.     -hxxxxx    Where hxxxxx is the MC68HC11 processor type.  Depending on the processor type different bootloaders are used.  These are the current built in bootloader selection options.
  1257.                 -hc711k4
  1258.                 -hc811e2
  1259.                 -hc11f1
  1260.             The default is -hc811e2
  1261.        -bfile    Where file is the name of a binary file to be used instead of the built in bootloaders.  This allows a user to create a bootloader for newly released processor types or to have a custom bootloader. The file must contain the starting character and the correct number of data bytes as specified by Motorola.
  1262. EXAMPLE
  1263.  
  1264.     HCload -stest.srec -f4.95 -p3 -hc711k4
  1265.  
  1266.    The example will first upload the built in hc711k4 bootloader.  Serial port 3 will be used (for those lucky enough to have a multi-serial card) and the Amiga baud rates will be adjusted by a
  1267. ratio of 4.95/8.00. When the bootloader is finished, the file "test.srec" which contains Motorola S records will be uploaded.  If a transfer address was specified in the file then execution will begin at this address.
  1268.  
  1269.  
  1270. NOTE
  1271.  
  1272. HCload was written by Ron Eirich, its original author, the version made available in the previous releases was a modification of his original work.  He has kindly updated and contributed it to this release.  If you have any problems with it, contact me.
  1273. NAME
  1274.  
  1275.     MHex
  1276.  
  1277. SYNOPSIS
  1278.  
  1279.     MHex [<options>] in_file_name out_file_name
  1280.         where options are    -s<num>    EPROM start address
  1281.                     -e<num>    EPROM end address
  1282.  
  1283. DESCRIPTION
  1284.  
  1285. MHex is a utility for converting an S-record file into a binary file.  After loading the specified S-record file, the utility will ask for the start and end address for the EPROM (or memory block) if these were not specified on the command line. MHex must know this since the binary file has no address information and thus every byte must be generated sequentially from the start of the device to the last used location.
  1286. NAME
  1287.  
  1288.     SProg
  1289.  
  1290. SYNOPSIS
  1291.  
  1292.     SProg
  1293.  
  1294. DESCRIPTION
  1295.  
  1296. SProg is a Graphical User Interface (GUI) for controlling an EPROM programmer.  It was designed with the A.R.T. EPP-2 (available from Jameco Electronics) in mind but with an idea to control other programmers.  This programmer is relativly inexpensive, but very capable and handles a wide range of EEPROM devices.  Best of all, it is not IBM PC specific.  If you use another programmer and cannot use the builtin configurability of this program, send me a copy of its commands and I will see if I can make some changes.
  1297.