Please create a list of System 360 opcodes and mnemonics and create a sleigh file for em
- User
Please create a list of System 360 opcodes and mnemonics and create a sleigh file for em
- Assistant
Please create a list of System 360 opcodes and mnemonics and create a sleigh file for em
Introduction
Creating a SLEIGH specification file for the IBM System/360 architecture involves understanding the instruction set and encoding schemes used by the System/360. Below is an overview of common opcodes and mnemonics for the System/360, along with guidance on how to create a SLEIGH specification file for them.
IBM System/360 Instruction Set Overview
The IBM System/360 architecture uses a variety of instruction formats and operations. Instructions are generally 2, 4, or 6 bytes long and can be categorized into several types:
Common Opcodes and Mnemonics
Here is a list of some common System/360 instructions:
| Opcode (Hex) | Mnemonic | Description | Format |
|---|---|---|---|
18 | LR | Load Register | RR |
1A | AR | Add Register | RR |
50 | ST | Store | RX |
58 | L | Load | RX |
5A | A | Add | RX |
70 | BAS | Branch and Save | RX |
47 | BC | Branch on Condition | RR |
40 | S | Subtract | RX |
45 | BAL | Branch and Link | RX |
81 | TM | Test under Mask | SI |
90 | STM | Store Multiple | RS |
98 | LM | Load Multiple | RS |
D2 | MVC | Move Characters | SS |
Creating a SLEIGH Specification File
To create a SLEIGH specification file for the IBM System/360, you'll need to define the instruction formats, address modes, registers, and the actual instructions. Here's a step-by-step guide:
Define the Language Header
Start by specifying the language's name, processor, endianness, and address size.
define namespace ibm360;
define endian big;
define alignment 1;
define space default_space type=ram size=8;
Define Registers
Identify all the registers used in the architecture.
define register offset=0 size=8 [
R0 R1 R2 R3 R4 R5 R6 R7
R8 R9 R10 R11 R12 R13 R14 R15
];
Define Instruction Formats
Create the instruction formats used in the instruction set.
token opcode (8)
{
op8 = (0, 7);
}
table main
{
opcode op8 is
{
0x18 : LR;
0x1A : AR;
0x50 : ST;
0x58 : L;
// Add other opcodes here
}
}
Define Instructions
For each instruction, define its behavior.
: LR is op8=0x18 & reg1 & reg2
{
R[reg1] = R[reg2];
}
: AR is op8=0x1A & reg1 & reg2
{
R[reg1] = R[reg1] + R[reg2];
}
: L is op8=0x58 & reg1 & mem_addr
{
R[reg1] = read_mem[mem_addr, 4];
}
// Continue defining other instructions
Handle Addressing Modes
Implement the addressing modes (e.g., indexed addressing) used in the instructions.
define token reg1 (4) op8[4:7];
define token reg2 (4) op8[0:3];
define token mem_addr (12) op8[0:11]; // Example for memory address
define symbol R is contextreg "registers" size=4;
Test and Validate
After defining the instructions, test the SLEIGH specification in Ghidra to ensure it correctly disassembles and emulates the System/360 code.
Tips
Ghidra/Processors) to understand how to structure your specification.Conclusion
Creating a SLEIGH specification for the IBM System/360 involves careful definition of the instruction formats and operations. By following the steps above and referring to official documentation, you can build a SLEIGH file that allows Ghidra to disassemble and analyze System/360 binaries.
Not yet included in a published release.