| 1 | Overview |
| 2 | ======== |
| 3 | |
| 4 | This directory contains programs written in NED1 assembly for use with the |
| 5 | NEDsim screensaver. |
| 6 | |
| 7 | |
| 8 | Status |
| 9 | ====== |
| 10 | |
| 11 | All programs in this directory are complete and verified to run on NEDsim. |
| 12 | |
| 13 | |
| 14 | Instructions |
| 15 | ============ |
| 16 | |
| 17 | First, note that none of this is necessary if you simply wish to run a custom |
| 18 | program on the NEDsim screensaver. Any NED1 a.out format executable may be |
| 19 | passed to the screensaver on the CLI using the flag `-binary filename.out`. |
| 20 | |
| 21 | The instructions that follow explain how to directly embed NED machine code in |
| 22 | the NEDsim binary as built-in, default programs. |
| 23 | |
| 24 | The first step is simply copying a NED1 assembly file into the present |
| 25 | directory with a `.ned_asm` suffix. The filename (minus the suffix) determines |
| 26 | the identifier name in C. For example, if you add a file named |
| 27 | `example.ned_asm`, then in C it would be accessed as `example[]` and its size |
| 28 | would be tracked in `example_size`. |
| 29 | |
| 30 | The second step requires editing `NEDsim.c` in the parent directory, adding a |
| 31 | new entry to the `ned_programs[]` array based on the name chosen in the |
| 32 | previous step. Continuing the previous example, the new entry would resemble |
| 33 | this: |
| 34 | |
| 35 | { |
| 36 | example, |
| 37 | &example_size, |
| 38 | 0x20000000 |
| 39 | } |
| 40 | |
| 41 | Note that `0x20000000` is the address of the RAM Window displayed by the |
| 42 | screensaver. You may move this window around if you wish to display a different |
| 43 | region of system memory; it has no bearing on code execution, only on the |
| 44 | screensaver's display. Since code is loaded starting at `0x20000000`, using |
| 45 | this value will display the machine code and is a suitable fallback for |
| 46 | programs without interesting memory patterns. |
| 47 | |
| 48 | With your NED1 assembly file in this directory and an appropriate entry added |
| 49 | to the `NEDsim.c` file, simply recompile NEDsim and your code will be embedded |
| 50 | in the NEDsim binary as a new default program. |