ND-500 Instruction Set Documentation¶
This directory contains the complete ND-500 instruction set specification in multiple formats.
Directory Contents¶
1. instructions.json (831 KB, 14,772 lines)¶
Machine-readable instruction database
- Complete metadata for all 1,078 instruction variants
- Generated by nd500-opcodes tool
- Includes opcodes, mnemonics, function names, addressing modes, prefixes, operand templates
Structure:
{
"generator": "nd500-opcodes",
"architecture": "ND-500",
"totalInstructions": 1078,
"instructions": [...]
}
2. instructions.md (190 KB, 1,086 lines)¶
Human-readable instruction table
- Markdown table format for easy browsing
- All 1,078 instruction variants listed
- Columns: Opcode, Mnemonic, C# Function, Class, Operands, Variant, Prefixes
3. yaml/ (805 KB, 241 files)¶
Individual YAML files for each unique instruction
- One YAML file per unique instruction (grouped by function name)
- All variants of the same instruction included in each file
- Compatible with documentation tools and parsers
YAML File Format:
instruction:
name: "instruction_name"
function: "FunctionName"
mnemonic: "mnemonic"
description: |
Detailed description of the instruction
Operation: result ← operation
Operands: N
Variants: M opcode(s)
category: "CLASS_NAME"
instruction_class: "class_name"
privilege: "user" or "supervisor"
operand_count: N
variants:
- variant: 1/M
opcode: "0xXXXX"
opcode_binary: "xxxx_xxxx_xxxx_xxxx"
opcode_decimal: NNNNN
prefix_mask: "0xXX"
prefixes:
- PREFIX1
- PREFIX2
addressing_modes:
- MODE1
- MODE2
operand_templates:
- "0xXXXXXXXX"
metadata:
- "metadata_string"
Instruction Statistics¶
- Total instruction variants: 1,078
- Unique instructions: 241
- Instruction classes: 13
- MOVE - Data movement operations
- ARITHMETIC - Mathematical operations
- LOGICAL - Logical operations
- COMPARE - Comparison operations
- SHIFT - Shift operations
- BITFIELD - Bit manipulation
- BRANCH - Control flow
- CALL - Subroutine calls
- STRING - String operations
- FLOAT_MATH - Floating point math
- CONTROL - Control instructions
- SYSTEM - System operations
- IO - Input/output operations
Using the YAML Files¶
Example: Reading the NEG instruction¶
cat yaml/neg.yaml
Shows:
- Instruction name: "neg"
- Function: Negate operation (two's complement)
- 20 opcode variants
- Prefixes: BY, H, W, F, D, R_N
- Category: ARITHMETIC
- Privilege: user
Example: Finding all comparison instructions¶
grep -l 'category: "COMPARE"' yaml/*.yaml
Example: Finding supervisor-privileged instructions¶
grep -l 'privilege: "supervisor"' yaml/*.yaml
Instruction Prefixes¶
Prefixes modify instruction behavior:
- BI - Bit (1-bit)
- BY - Byte (8-bit)
- H - Halfword (16-bit)
- W - Word (32-bit)
- F - Float (32-bit floating point)
- D - Double (64-bit floating point)
- R_N - Register/None
Addressing Modes¶
The ND-500 supports 14 addressing modes:
- LOCAL - Local variable addressing
- RECORD - Record field addressing
- CONSTANT - Immediate constant
- REGISTER - Register direct
- PRE_INDEXED - Pre-indexed addressing
- ABSOLUTE - Absolute addressing
- LOCAL_INDIRECT - Indirect through local
- RECORD_INDIRECT - Indirect through record
- ABSOLUTE_INDIRECT - Indirect through absolute address
- DESCRIPTOR - Descriptor addressing
- POST_INDEXED - Post-indexed addressing
- And more...
Generation¶
The YAML files are generated from instructions.json using:
python3 generate_yaml_instructions.py
This script:
- Reads
instructions.json - Groups instructions by function name
- Generates one YAML file per unique instruction
- Includes all variants within each file
Example YAML Files¶
assignto.yaml- Load/assign operation (:=mnemonic, 24 variants)neg.yaml- Negate operation (20 variants)comp.yaml- Compare operation (24 variants)add.yaml- Addition operationmove.yaml- Move data between operandsand.yaml- Logical AND operation
Cross-Reference¶
For the official ND-500 instruction set documentation, see:
- ../ND-05.009.4 EN ND-500 Reference Manual.md - Official Norsk Data reference manual
- Part II (Chapters 10-17) contains detailed instruction descriptions
- Chapter 10: Data transfer and logical instructions
- Chapter 11: Arithmetical instructions
- Chapter 12: Mathematical functions
- Chapter 13: Control instructions
- Chapter 14: String instructions
- Chapter 15: Miscellaneous instructions
- Chapter 16: Special instructions
- Chapter 17: Binary coded decimal instructions
File Naming Convention¶
YAML files are named after the instruction function name in lowercase:
- Special characters replaced with descriptive names
:=→assignto.yaml=:→assignfrom.yamlb:=→assignbaseregto.yamlr:=→assignrecordregto.yaml
License¶
Generated from ND-500 architecture specifications. Based on Norsk Data ND-500 instruction set (© 1988 Norsk Data A.S).