MODE Files and Build Automation
Version: 1.0
Date: October 17, 2025
Status: Complete
- Introduction
- MODE File Basics
- Command Execution
- Input/Output Redirection
- Calling Other MODE Files
- Build Automation
- Real-World Examples
- Best Practices
MODE files are SINTRAN III batch script files that automate sequences of commands. They are the equivalent of shell scripts in Unix or batch files in DOS.
Key features:
- Execute SINTRAN commands sequentially
- Run programs and pass input
- Redirect output to files
- Call other MODE files
- Automate complex build processes
Use MODE files for:
- Build automation (compile, assemble, link)
- Repetitive tasks
- Multi-step processes
- System initialization
- Testing and validation
Example use cases:
- Compile all modules in a project
- Build and test in one command
- Deploy system updates
- Generate documentation
Extension: :MODE (e.g., BUILD:MODE)
Content: Plain text file with SINTRAN commands, one per line
Example:
@cc Building program...
@NPL SOURCE:NPL
@MAC SOURCE:MAC
@NRL
PROG-FILE "PROGRAM"
LOAD SOURCE
EXIT
@cc Build complete!
@MODE FILENAME:MODEor simply:
@MODE FILENAMEExample:
@MODE BUILD:MODECRITICAL CONCEPT: The @ symbol determines whether a line is a SINTRAN command or program input.
@NPL SOURCE:NPL % SINTRAN: Start NPL compiler
@MAC SOURCE:MAC % SINTRAN: Start MAC assembler
@NRL % SINTRAN: Start linker
@CC This is a message % SINTRAN: Display message
@DELETE FILE:BRF % SINTRAN: Delete file
These are SINTRAN system commands executed by the operating system.
PROG-FILE "HELLO" % Input TO NRL
LOAD MODULE % Input TO NRL
EXIT % Input TO NRL (exits NRL)
These lines are sent as input to whatever program is currently running (started by the last @ command).
% Start the NRL linker (SINTRAN command - has @)
@NRL
% The following lines are INPUT to NRL (no @)
IMAGE 100
PROG-FILE "HELLO"
LOAD HELLO
EXIT % Exits NRL, returns to SINTRAN
% Back at SINTRAN level, run the program (SINTRAN command - has @)
@HELLO
@CC Starting assembly... % SINTRAN: Display message
% Start the assembler (SINTRAN command - has @)
@NORD-500-ASSEMBLER
% Input to the assembler (no @)
ASSEMBLE PROGRAM:SYMB
LIST
LINES 60
EXIT % Exits assembler
@CC Assembly complete! % SINTRAN: Display message
| Line Type | Starts with @? |
Who Executes It? | Example |
|---|---|---|---|
| SINTRAN Command | ✅ Yes | Operating System | @NPL SOURCE:NPL |
| Program Input | ❌ No | Currently Running Program | PROG-FILE "TEST" |
| Comment/Message | ✅ Yes (@cc or @CC) |
Displayed during execution | @cc Building... |
Remember: After starting a program with @PROGRAM-NAME, all following lines without @ are sent as input to that program until it exits (usually with EXIT).
Note: MODE files run automatically without user interaction - they are batch scripts.
@NPL SOURCE:NPL % Compile NPL
@MAC SOURCE:MAC % Assemble
@LIST-FILES % List directory
@DELETE FILE:BRF % Delete file
Start program:
@PROGRAM % Run program
Program with parameters:
@PROGRAM PARAM1 PARAM2 % Pass parameters
@NRL % Start NRL
PROG-FILE "OUTPUT" % Input to NRL
LOAD MODULE % Input to NRL
EXIT % Input to NRL
How it works:
@NRLstarts the NRL program- Next lines are fed as input to NRL
- Program processes input until it exits
@cc This message will be displayed during execution
@cc =========================================
@cc NORD-500 Build Process
@cc =========================================
@cc or @CC (Comment Command): Displays text during MODE file execution. This is the ONLY way to add comments or status messages in MODE files.
Format: @cc <text> or @CC <text>
Rules:
- There should be a space between the second C and the text
- Case doesn't matter:
@ccand@CCboth work - The text is displayed during execution
- Useful for progress messages, status updates, section headers, and documentation
Examples:
@cc ================================================
@cc Multi-Module Build Script
@cc ================================================
@cc Step 1: Compiling modules...
@NPL SOURCE:NPL
@cc Step 2: Assembling...
@MAC SOURCE:MAC
@cc Step 3: Linking...
@NRL
PROG-FILE "PROGRAM"
LOAD SOURCE
EXIT
@cc Build complete!
Note: MODE files have no other comment syntax. If you want to document your MODE file, use @cc (it will be displayed when the MODE file runs).
Redirect program output to file:
OUTPUT FILE: @FILENAME
Example:
OUTPUT FILE: @BUILD-LOG:TXT
@NPL SOURCE:NPL
@MAC SOURCE:MAC
OUTPUT FILE: @ % Back to terminal
INPUT FILE: @COMMANDS:TXT
@PROGRAM
INPUT FILE: @ % Back to keyboard
OUTPUT FILE: @LOG:TXT
INPUT FILE: @COMMANDS:TXT
@PROGRAM
INPUT FILE: @
OUTPUT FILE: @
Main MODE file can call other MODE files:
% MASTER:MODE
@MODE COMPILE:MODE % Call compile script
@MODE LINK:MODE % Call link script
@MODE TEST:MODE % Call test script
COMPILE:MODE:
@NPL MODULE1:NPL
@NPL MODULE2:NPL
@NPL MODULE3:NPL
@MAC MODULE1:MAC
@MAC MODULE2:MAC
@MAC MODULE3:MAC
LINK:MODE:
@NRL
IMAGE 100
PROG-FILE "APP"
LOAD MODULE1
LOAD MODULE2
LOAD MODULE3
EXIT
BUILD:MODE:
@MODE COMPILE:MODE
@MODE LINK:MODE
@cc Build complete
File: BUILD-NPL:MODE
@cc Compile, assemble, and link NPL program
OUTPUT FILE: @BUILD-LOG:TXT
@cc Compile
@NPL %1:NPL
@cc Assemble
@MAC %1:MAC
@cc Link
@NRL
PROG-FILE "%1"
LOAD %1
EXIT
OUTPUT FILE: @
@cc Build complete: %1:PROG
Usage:
@MODE BUILD-NPL MYPROGRAMResult: Creates MYPROGRAM:PROG
File: BUILD-C:MODE
@cc Build C program with runtime
@CC-100 %1:C
@NRL
IMAGE 100
PROG-FILE "%1"
LOAD CC-2HEADER
LOAD %1
LOAD CC-2BANK
LOAD CC-2TRAILER
EXIT
@cc C build complete
File: BUILD-PROJECT:MODE
@cc Build complete project
@cc Compiling modules...
@cc Compile all NPL modules
@NPL MAIN:NPL
@NPL UTILS:NPL
@NPL DATABASE:NPL
@NPL NETWORK:NPL
@cc Assembling...
@cc Assemble all
@MAC MAIN:MAC
@MAC UTILS:MAC
@MAC DATABASE:MAC
@MAC NETWORK:MAC
@cc Linking...
@cc Link all modules
@NRL
IMAGE 100
PROG-FILE "PROJECT"
LOAD MAIN
LOAD UTILS
LOAD DATABASE
LOAD NETWORK
LIBRARY SYSLIB
MAP
EXIT
@cc Build successful!
@cc Run with: @PROJECT
File: REBUILD:MODE
@cc Clean and rebuild project
@cc Cleaning old files...
@DELETE MAIN:MAC
@DELETE MAIN:BRF
@DELETE UTILS:MAC
@DELETE UTILS:BRF
@DELETE PROJECT:PROG
@cc Starting build...
@MODE BUILD-PROJECT:MODE
@cc Rebuild complete!
From actual SINTRAN source:
@NPL NORD PL NOVEMBER 1979
@DEV ABSTR,1,1
% ... (input file loaded here) ...
@MAC
)9SLPL
)9ASSM 100,LIST-FILE,(OTS-CRS-BRF-1)IDB-VIA-MONC-OPR
?)9TSS
@BRF-EDITOR
RENAME-SYMBOL RI1F RIDB1F
RENAME-SYMBOL RINF RIDBNF
CHANGE-FILE (OTS-CRS-BRF-1)IDB-VIA-MONC-OPR
MAKE-LIBRARY-UNITS (OTS-CRS-BRF-1)IDB-VIA-MONC-OPR
EXIT
This shows:
- Batch compilation
- MAC assembly with special directives
- BRF-EDITOR post-processing
- Symbol renaming
- Library unit creation
File: XMSG-START:MODE (from SINTRAN)
OUTPUT FILE: @BUILD-OUTPUT
@CC-100 CAT:C
@NRL
IMAGE 100
PROG-FILE "CAT"
LOAD CC-2HEADER
LOAD CAT
LOAD CC-2BANK
LOAD CC-2TRAILER
EXIT
OUTPUT FILE: @
File: TEST:MODE
@cc Running test suite...
@cc Build test program
@NPL TEST-SUITE:NPL
@MAC TEST-SUITE:MAC
@NRL
PROG-FILE "TEST-SUITE"
LOAD TEST-SUITE
EXIT
@cc Run tests
OUTPUT FILE: @TEST-RESULTS:TXT
@TEST-SUITE
OUTPUT FILE: @
@cc Check results
@cc Tests complete. Results in TEST-RESULTS:TXT
Good structure:
@cc ================================================
@cc Build Main Application
@cc Author: Name
@cc Date: 2025-10-18
@cc ================================================
@cc Clean phase
@cc Cleaning...
@DELETE OLD-FILES
@cc Build phase
@cc Building...
@NPL SOURCE:NPL
@MAC SOURCE:MAC
@cc Link phase
@cc Linking...
@NRL
PROG-FILE "APP"
LOAD SOURCE
EXIT
@cc Done
@cc Complete!
Check for errors:
@NPL SOURCE:NPL
% If compilation fails, MODE file continues
% Add manual checks if needed
@CC Check for errors above
? % Wait for user to verify
Always log builds:
OUTPUT FILE: @BUILD-LOG:TXT
@CC Build started
@NPL SOURCE:NPL
@MAC SOURCE:MAC
@CC Build completed
OUTPUT FILE: @
Use parameters:
% BUILD:MODE - Generic build script
% Usage: @MODE BUILD PROGRAM-NAME
@NPL %1:NPL
@MAC %1:MAC
@NRL
PROG-FILE "%1"
LOAD %1
EXIT
Break into modules:
BUILD:MODE → Main build script
├─ COMPILE:MODE → Compile phase
├─ ASSEMBLE:MODE → Assembly phase
├─ LINK:MODE → Link phase
└─ TEST:MODE → Test phase
Always comment:
% ============================================
% PROJECT BUILD SCRIPT
% ============================================
% Purpose: Build entire project from source
% Dependencies: NPL, MAC, NRL, SYSLIB
% Output: PROJECT:PROG
% ============================================
@ECHO "Starting build..."
% Compile phase
% Compiles all NPL modules to MAC
@NPL MODULE1:NPL % Main module
@NPL MODULE2:NPL % Utilities
@NPL MODULE3:NPL % I/O handlers
% ... etc ...
| Command | Purpose | Example |
|---|---|---|
@COMMAND |
Run SINTRAN command | @NPL SOURCE:NPL |
? |
Wait for user | ? |
% |
Comment | % This is a comment |
OUTPUT FILE: |
Redirect output | OUTPUT FILE: @LOG:TXT |
INPUT FILE: |
Redirect input | INPUT FILE: @DATA:TXT |
@MODE |
Call other MODE | @MODE SUBSCRIPT:MODE |
Simple build:
@NPL %1:NPL
@MAC %1:MAC
@NRL
PROG-FILE "%1"
LOAD %1
EXIT
Build with logging:
OUTPUT FILE: @BUILD-LOG:TXT
@NPL SOURCE:NPL
@MAC SOURCE:MAC
OUTPUT FILE: @
Multi-module:
@MODE COMPILE-ALL:MODE
@MODE LINK-ALL:MODE
@MODE TEST-ALL:MODE
Problem:
@NRL % @ = SINTRAN: Start NRL
PROG-FILE "TEST" % No @ = Input to NRL
@PROGRAM % Wrong! @ = SINTRAN command, but NRL still running!
Why this fails: The @PROGRAM line has @, so SINTRAN tries to execute it as a system command. But NRL is still running and hasn't exited yet, causing confusion.
Solution:
@NRL % @ = SINTRAN: Start NRL
PROG-FILE "TEST" % No @ = Input to NRL
LOAD SOURCE % No @ = Input to NRL
EXIT % No @ = Input to NRL (exits NRL)
@PROGRAM % @ = SINTRAN: Now at SINTRAN level
Remember: All lines without @ go to the currently running program. Use EXIT (no @) to exit the program first, then you can use @ commands again.
Problem:
@NRL
PROG-FILE "TEST"
LOAD SOURCE
% Missing EXIT - MODE file hangs
Solution:
@NRL
PROG-FILE "TEST"
LOAD SOURCE
EXIT % Always exit programs
Problem:
OUTPUT FILE: @LOG:TXT
@NPL SOURCE:NPL
% Long script continues...
% Everything goes to LOG:TXT (invisible)
Solution:
OUTPUT FILE: @LOG:TXT
@NPL SOURCE:NPL
OUTPUT FILE: @ % Reset to terminal
@CC Compilation done
- SINTRAN-COMMANDS-REFERENCE.md - Complete SINTRAN III command reference including @CC
- COMPILER-COMMANDS-REFERENCE.md - Compiler and linker commands
- LINKING-GUIDE.md - Understanding the build process
- QUICK-START-EXAMPLES.md - Basic examples
- LINKING-GUIDE.md - NRL linking
- NPL-DEVELOPER-GUIDE.md - NPL language
- Kernel Documentation:
SINTRAN\OS\
Last Updated: October 17, 2025
Version: 1.0
Status: Complete