Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- The bytes of the assembly code will be as follows
- Instruction Memnoic | First Byte | Second Byte | Third Byte | Fourth Byte | Fifth Byte | Sixth Byte | Seventh Byte | Eighth Byte
- 0) NOP | 0x00 |
- 1) LD REGISTER , Value | 0x01 |0x0->0x0C | 1st Val Byte | 2nd Val Byte | 3rd Val Byte| 4th Val Byte |
- 2) LD REGISTER , REGISTER | 0x02 | 0x00 -> 0x0C | 0x00 ->0x0C | 0x00 to 0x0C mean registers A to F and 6 to 12.
- 3) LD REGISTER, $REGISTER | 0x03 | 0x00 -> 0x0C | 0x00 ->0x0C | 0x00 to 0x0C mean registers A to F and 6 to 12. //Loads the value stored in memory address of $REGISTER
- 4) ST Value, REGISTER |0x04 | 1st Value Byte | 2nd VByte | 3rd Vbyte | 4th VByte | 0x00->0x0C | 0x00 to 0x0c means Registers A to F and 6 to 12
- 5) ST Value, $REGISTER |0x05 | 1st Value Byte | 2nd VByte | 3rd Vbyte | 4th VByte | 0x00->0x0C | 0x00 to 0x0c means Registers A to F and 6 to 12
- Opcode #5 stores Value to the memory address the register points to not the register itself.
- 6) ADD REGISTER, REGISTER | 0x06 | 0x00 ->0x0C | 0x00 ->0x0C //Adds two registers values together, the result always stored in the first 32 bit register.
- 7) ADD REGISTER, VALUE | 0x07 | 0x0->0x0C | 1st Val Byte | 2nd Val Byte | 3rd Val Byte| 4th Val Byte | //Adds the value to the REGISTER
- 8) ADD REGISTER, $REGISTER | 0x08 | 0x0->0x0C | 0x0-> 0x0C | //Adds the value that is in the address R. points to, to R.. not the same as adding the value OF R. to R..
- Note, the first and second bytes of all Register, Register opcodes represent the index of the registers from 0x00 to 0x0C IE Register A is 0x00 and Register B is 0x01
- 9) SUB REGISTER, REGISTER | 0x09 |0x00 ->0x0c | 0x00 ->0x0c | //subtracts the value of 2nd Register from 1st Register. Stores result in 1st Register
- 10) SUB REGISTER, VALUE |0x0A | 0x00 ->0x0c | 1st Val Byte | 2nd Val Byte | 3rd Val Byte | 4th Val Byte //Subtracts the Value from the chosen register, result stored in register
- 11) SUB REGISTER, $REGISTER | 0x0B | 0x00->0x0c | //Subtracts the value stored in memory that $REGISTER points to, from REGISTER
- //For these two I'll just AND it with 255.. but to get it back I have to do some signing or something..
- Tch UGH. olol...
- 12) ST8 VALUE, REGISTER | 0x0C |1st Value Byte | 0x00 ->0x0c | //Stores the value padded to only 1 byte in Register
- 13) ST8 VALUE, $REGISTER | 0x0D |1st Value Byte | 0x00 ->0x0c | //Stores the value padded to only 1 byte in the address the Register Points to
- 14) ST16 VALUE, REGISTER | 0x0E | 1st Value Byte | 2nd Value Byte | 0x00 ->0x0c | //Stores the 2 byte value in the register
- 15) ST16 Value, $REGISTER | 0x0F |1st Value Byte | 2nd Value Byte | 0x00 ->0x0c | //Stores the 2 byte value in the address the $REGISTER points to as a 16 bit value
- 16) LD8 REGISTER, $ADDRESS | 0x10 | 0x00 ->0x0c | 1st Addr Byte | 2nd AddrByte|3rd AddrByte|4th Addr Byte| //Load the 8 bit value from the address into REGISTER
- 17) LD8 REGISTER, REGISTER | 0x11 | 0x00 ->0x0c | 0x00->0x0c //Load the 8 bit value in REGISTER to REGISTER
- 18) LD16 REGISTER, $ADDRESS|0x12 | 0x00 ->0x0c | 1st Addr Byte | 2nd AddrByte| 3rd AddrByte|4th Addr Byte | //Load the 16 bit value from the $ADDRESS into REGISTER
- 19) LD16 REGISTER, REGISTER |0x13 | 0x00->0x0c | 0x00 ->0x0c | //Load the 16 bit value in REGISTER into REGISTER
- 20) CMP REGISTER, REGISTER |0x14 | 0x00->0x0c | 0x00 ->0x0c | //Compares the values stored in R, R and saves a boolean result in the first bit of REGISTER F
- 21) CMP REGISTER, $REGISTER|0x15 | 0x00->0x0c | 0x00 ->0x0c | //Compares the value of REGISTER with the value in memory that $REGISTER points to, stores in 1st bit of F
- 22) CMP REGISTER, VALUE |0x16 | 0x00->0x0c |1st value byte |2nd Val Byte | 3rd Val Byte | 4th Val Byte| //Compares a hardcoded value to the value in a Register, stores result in 1st bit of F register.
- 23) CMP16 REGISTER, $REGISTER | 0x17 |0x00 ->0x0c | 0x00->0x0c | Compares a 16 bit value that $REGISTER points to, to a value in REGISTER
- 24) CMP8 REGISTER, $REGISTER | 0x18 |0x00 ->0x0c | 0x00->0x0c | Compares an 8 bit value that $REGISTER points to, to a value in REGISTER
- 25) BEQ $ADDRESS | 0x19 | 1st Addr Byte | 2nd Addr Byte | 3rd Addr Byte | 4th Addr Byte //Branch if last comparison result was true, to the address listed
- 26) BEQ $REGISTER | 0x1A |0x00 ->0x0c Branch if last comparison result was true to the address in $REGISTER
- //Which $REGISTER points to.
- 27) BNEQ $REGISTER | 0x1B |0x00 ->0x0c | //Branch if the last comparison result was not true, to the address in $REGISTER
- 28) BNEQ $ADDRESS | 0x1C |1st Addr Byte| 2nd Addr Byte | 3rd Addr Byte | 4th Addr Byte //Branch if last comparison result was false to addres listed
- 29) SUB $ADDRESS | 0x1D |1st Addr Byte | 2nd Addr Byte | 3rd Addr Byte | 4th Addr Byte //go to the subroutine of the address listed
- 30) SUB $REGISTER | 0x1E |0x00 ->0x0c | //Call the subroutine stored at the memory address that $REGISTER points to
- 31) RET | 0x1F | //Return to the previous address on the stack from a subroutine
- 32) JMP $REGISTER | 0x20 |0x00 ->0x0c | //Jump to the address stored in $REGISTER (does not allow return call will cause stack underflow if stack empty)
- 33) JMP $ADDRESS |0x21 |1st Addr Byte| 2nd Addr Byte | 3rd Addr Byte | 4th Addr Byte //Jumps to the address that's hardcoded here
- 34) OR REGISTER, VALUE |0x22 |0x00->0x0c | 1st Value Byte | 2nd Value Byte | 3rd Value Byte | 4th Value Byte // Performs a bitewise OR on the two inputs, the result stored in REGISTER
- 35) OR REGISTER, $REGISTER |0x23 |0x00 ->0x0c | 0x00->0x0c| //Peforms Bitewise OR on REGISTER and the value in the memory address $REGISTER points to and the result is stored in REGISTER
- 36) AND REGISTER, VALUE |0x24 |0x00->0x0c |1st value Byte| 2nd Value Byte | 3rd Value Byte | 4th Value Byte //Performs bitwise AND on two inputs
- 37) AND REGISTER, $REGISTER |0x25 |0x00->0x0c | 0x00->0x0c | //Performs Bitwise AND on REGISTER and the value in memory address $REGISTER points to and the result is stored in REGISTER
- 38) XOR REGISTER, VALUE |0x26 |0x00->0x0c | 1st Value Byte | 2nd Value Byte | 3rd value Byte|4th Value Byte //Performs bitwise XOR on two Inputs result is stored in REGISTER
- 39) XOR REGISTER, $REGISTER |0x27 |0x00->0x0c | 0x00->0x0c | //Performs bitwise XOR on REGISTER and the value in memory address $REGISTER points to and the result is
- stored in REGISTER
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement