<commit_before>NOS LINK
========

This is a assembling linker, or linking assembler, for the 0x10c DCPU-16 v1.1.

It accepts Notch-style assembly code. You may specify as many assembly files as you wish, and they will be linked as assembled.


Prerequisites
-------------
You'll need ruby. I'm using 1.8; but, it should work with 1.9 as well.

You'll also need the 'trollop' rubygem. I use it for command-line arguments processing. This is the only ruby dependency.


Usage
-----

    nos_link -o output_binary assembly_module [space separated list of additional modules]

Try --help for more options.


Assembler Syntax and Directives
------------------------------

nos_link accepts standard Notch-style assembly. This differs from traditional assembly in location of colon in label definition.

Labels may be any collection of letters, numbers, periods, and underscores. They must not start with a digit.

Labels named identically to register names (a, x, i, j...) or operand value names (push, pop, pc, sp...) will be masked by the the register they shadow. This means that if you have a label defined with ':a', it cannot be referenced by any instruction parameter--the expression will be interpreted as the 'a' register instead.

Any label starting with a '.' will be treated as local. They are bound to the most immediately preceeding global label. Local labels may only be referenced by instructions in the same global label scope.

    :expon
      set a, 0x42
      set b, 0x42
    :.local_label
      mul a, b
      set pc, .local_label
    
Currently the only actively supported assembler directive is '.hidden' (which may also be spelled '.private'). The .hidden directive indicates to the linker that the given label is not available for reference from the rest of te program. Additionally, it indicates that the .hidden symbol should be preferred to global symbols of the same name for references from within the same assembly module.

The syntax is:

    .hidden symbol_name

Example: 

      .hidden expon
    :expon
      set a, 0x42
      set b, 0x42
    :.local_label
      mul a, b
      set pc, .local_label

Data word support will also be added shortly.<commit_msg>Updated documentation to reflect introduction of data words.<commit_after>NOS LINK
========

This is a assembling linker, or linking assembler, for the 0x10c DCPU-16 v1.1.

It accepts Notch-style assembly code. You may specify as many assembly files as you wish, and they will be linked as assembled.


Prerequisites
-------------
You'll need ruby. I'm using 1.8; but, it should work with 1.9 as well.

You'll also need the 'trollop' rubygem. I use it for command-line arguments processing. This is the only ruby dependency.


Usage
-----

    nos_link -o output_binary assembly_module [space separated list of additional modules]

Try --help for more options.


Assembler Syntax and Directives
------------------------------

nos_link accepts standard Notch-style assembly. This differs from traditional assembly in location of colon in label definition.

Labels may be any collection of letters, numbers, periods, and underscores. They must not start with a digit.

Labels named identically to register names (a, x, i, j...) or operand value names (push, pop, pc, sp...) will be masked by the the register they shadow. This means that if you have a label defined with ':a', it cannot be referenced by any instruction parameter--the expression will be interpreted as the 'a' register instead.

Any label starting with a '.' will be treated as local. They are bound to the most immediately preceeding global label. Local labels may only be referenced by instructions in the same global label scope.

    :expon
      set a, 0x42
      set b, 0x42
    :.local_label
      mul a, b
      set pc, .local_label
    
Currently the only actively supported assembler directive is '.hidden' (which may also be spelled '.private'). The .hidden directive indicates to the linker that the given label is not available for reference from the rest of te program. Additionally, it indicates that the .hidden symbol should be preferred to global symbols of the same name for references from within the same assembly module.

The syntax is:

    .hidden symbol_name

Example: 

      .hidden expon
    :expon
      set a, 0x42
      set b, 0x42
    :.local_label
      mul a, b
      set pc, .local_label

Data can be inlined into assembly modules either as individual words, or as text strings.

Example:
    :single_word_example
      .word 0x10 ; encode the literal value 16
      .uint16_t 0x10 ; .uint16_t is an alias for .word
    :string_example
      .string "This is a string."

(There is currently no support for the comma-separated numeric literals style.)
{'fraction_non_alphanumeric': 0.0732221987761131, 'fraction_numerical': 0.012238868959696138, 'mean_word_length': 3.136125654450262, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1481186', 'n_tokens_mistral': 1298, 'n_tokens_neox': 1184, 'n_words': 691}