Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <===========================>
- <===== Project AuR_ASM =====>
- <===========================>
- | 16bit Architecture for a Virtual CPU Simulator
- | using the .Net v4.7 framework.
- |
- | Features include simple keyboard input and simple output
- | to a virtual screen.
- | Intended use is for educational purposes to explore,
- | learn, and understand: assembly language, assemblers,
- | machine code, how CPUs work, and why explorer.exe keeps crashing.
- <====================>
- <===== Notation =====>
- <====================>
- | <reg> - Any register (r0 - r11)
- | <val> - Any 32bit constant value
- | <mem> - Any 32bit memory address
- <=====================>
- <===== Registers =====>
- <=====================>
- | Registers use 4bit addressing
- === Register Addresses: (16 Registers) ===
- 0 r0
- 1 r1
- 2 r2
- 3 r3
- 4 r4
- 5 r5
- 6 r6
- 7 r7
- 8 r8
- 9 r9
- 10 r10
- 11 r11
- 12 Base Pointer (BP)
- 13 Stack Pointer (SP)
- 14 Control Register (CR)
- 15 Instruction Pointer (IP)
- === Control Register Flag Bits ===
- 0 Carry Flag (CF)
- 1 Zero Flag (ZF)
- 2 Test Flag (TF)
- 3 Sign Flag (SF)
- 4 Interrupt Flag (IF)
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- <===========================>
- <===== Instruction Codes ===>
- <===========================>
- | Using any instruction that doesn't have a function
- | will result in the program terminating
- | Instruction set uses 8bit addressing
- === MISC ===
- 0 - HALT
- 1 -
- 2 -
- 3 -
- 4 -
- 5 -
- 6 -
- 7 -
- 8 -
- 9 -
- 10 -
- 11 -
- 12 -
- 13 -
- 14 -
- 15 -
- 16 - SYS <reg>
- 17 - SYS <val>
- 18 -
- 19 -
- 20 -
- 21 -
- 22 -
- 23 -
- 24 -
- 25 -
- 26 -
- 27 -
- 28 -
- 29 -
- 30 -
- 31 -
- === Logic ===
- | Modifies ZF
- | Returns result to left operand
- 32 - AND <reg>, <reg>
- 33 - AND <reg>, <val>
- 34 - OR <reg>, <reg>
- 35 - OR <reg>, <val>
- 36 - XOR <reg>, <reg>
- 37 - XOR <reg>, <val>
- 38 - NOT <reg>
- === Arithmetic ===
- | Modifies CF and ZF
- | Returns result to left operand
- 40 - ADD <reg>, <reg>
- 41 - SUB <reg>, <reg>
- 42 - MUL <reg>, <reg>
- 43 - DIV <reg>, <reg> (left = Quotient, right = Remainder)
- === Memory ===
- 48 - MOV <reg>, <reg>
- 49 - MOV <reg>, <val>
- 50 - INC <reg>
- 51 - DEC <reg>
- 52 - SHL <reg>
- 53 - SHL <reg>, <reg> (Result goes into left operand)
- 54 - SHL <reg>, <val> (Result goes into left operand)
- 55 - SHR <reg>
- 56 - SHR <reg>, <reg> (Result goes into left operand)
- 57 - SHR <reg>, <val> (Result goes into left operand)
- 64 - R8 <reg>, <mem>
- 65 - R16 <reg>, <mem>
- 66 - R32 <reg>, <mem>
- 67 - W8 <reg>, <mem>
- 68 - W16 <reg>, <mem>
- 69 - W32 <reg>, <mem>
- 70 - PUSH <reg>
- 71 - POP <reg>
- === Compare ===
- | Modifies TF
- 80 - TEST <reg> = <reg>
- 81 - TEST <reg> = <val>
- 82 - TEST <reg> < <reg>
- 83 - TEST <reg> < <val>
- 84 - TEST <reg> > <reg>
- 85 - TEST <reg> > <val>
- 86 - TEST <reg> <= <reg>
- 87 - TEST <reg> <= <val>
- 88 - TEST <reg> >= <reg>
- 89 - TEST <reg> >= <val>
- === Jump ===
- | Checks TF
- 100 - JMP <reg>
- 101 - JMP <mem>
- 102 - JMP <val>
- 103 - JT <reg>
- 104 - JT <mem>
- 105 - JT <val>
- 106 - JF <reg>
- 107 - JF <mem>
- 108 - JF <val>
- === Call ===
- | Pushes current position + 1 onto the call stack before
- | jumping to specified address
- 128 - RET
- 129 - CALL <reg>
- 130 - CALL <mem>
- 131 - CALL <val>
- <========================>
- <===== System Calls =====>
- <========================>
- |
- Hex | --------- Name -------------- | - Registers ----------------------------- +
- --- | ----------------------------- | -- r0 -- | -- r1 -- | -- r2 -- | -- r3 -- |
- __ | 0 - | | | | | (Nothing)
- __ | 10 - Enable/Disable Scrn | Bool | | | | (Turns the screen on/off)
- __ | 11 - Clear Screen | | | | | (Resets the screen to blank state)
- __ | 12 - Read input | KeyCode | | | | (Reads a byte from the input buffer)
- __ | 32 - Set Pixel | X | Y | ColorID | | (Sets pixel at X,Y to whatever the color code value is in r2)
- __ | 33 - Get Pixel Color | X | Y | ColorID | | (Returns pixel color at X,Y to r2)
- __ | 36 - SetPrint Char | X | Y | PrintID | | (Blockland Only)
- __ | 37 - GetPrint Char | X | Y | PrintID | | (Blockland Only)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement