Some changes

This commit is contained in:
2025-02-16 17:28:10 +01:00
parent 0fc4040ad7
commit 4d3755e2ce
18 changed files with 562 additions and 80 deletions

View File

@@ -10,7 +10,7 @@
`HLT` - Halt CPU execution
### **MOV_RN_IMM**
### **MOV_IMM_RN**
`MOV R1, 0x10` - Move immediate value `0x10` to register `R1`
@@ -178,18 +178,73 @@
`RET` - Return from subroutine
### **JMP_BIT_CLEAR_RN**
### **BIT_TC_RN**
`JMPBC R1, 3, 0x4000` - Jump to address `0x4000` if bit `3` in register `R1` is **not set**.
### **JMP_BIT_CLEAR_ADDR**
### **BIT_TC_ADDR**
`JMPBC 0x2000, 5, 0x5000` - Jump to address `0x5000` if bit `5` in memory at address `0x2000` is **not set**.
### **JMP_BIT_SET_RN**
### **BIT_TS_RN**
`JMPBS R2, 1, 0x6000` - Jump to address `0x6000` if bit `1` in register `R2` **is set**.
### **JMP_BIT_SET_ADDR**
### **BIT_TS_ADDR**
`JMPBS 0x3000, 7, 0x7000` - Jump to address `0x7000` if bit `7` in memory at address `0x3000` **is set**.
### **BITS_ADDR**
`BITS [0x2000], 3` - Set bit `3` in memory at address `0x2000`
- Reads a memory address as an argument.
- Reads a bit index from the next byte.
- Ensures the bit index is between `0-7`.
- Sets the specified bit in the memory address.
- Increments the program counter.
### **BITC_ADDR**
`BITC [0x2000], 5` - Clear bit `5` in memory at address `0x2000`
- Reads a memory address as an argument.
- Reads a bit index from the next byte.
- Ensures the bit index is between `0-7`.
- Clears the specified bit in the memory address.
- Increments the program counter.
### **BITS_RN**
`BITS R1, 2` - Set bit `2` in register `R1`
- Reads a register number.
- Reads a bit index from the next byte.
- Ensures the register is valid (`0 - REG_COUNT - 1`).
- Ensures the bit index is between `0-7`.
- Sets the specified bit in the register.
- Increments the program counter.
### **BITC_RN**
`BITC R2, 6` - Clear bit `6` in register `R2`
- Reads a register number.
- Reads a bit index from the next byte.
- Ensures the register is valid (`0 - REG_COUNT - 1`).
- Ensures the bit index is between `0-7`.
- Clears the specified bit in the register.
- Increments the program counter.
### **BITS (Special Instruction)**
- This mnemonic decides between `BITS_RN` and `BITS_ADDR` based on the operand.
- If the operand is a register, `BITS_RN` is used.
- If the operand is a memory address, `BITS_ADDR` is used.
### **BITC (Special Instruction)**
- This mnemonic decides between `BITC_RN` and `BITC_ADDR` based on the operand.
- If the operand is a register, `BITC_RN` is used.
- If the operand is a memory address, `BITC_ADDR` is used.
`JMPBS 0x3000, 7, 0x7000` - Jump to address `0x7000` if bit `7` in memory at address `0x3000` **is set**.