about summary refs log tree commit diff stats
path: root/subx/opcodes
blob: 77630208de04903b4f2e8d9a3e51be7fc02a7baa (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
Opcodes currently supported by SubX:
  01: add r32 to rm32
  03: add rm32 to r32
  05: add imm32 to R0 (EAX)
  09: rm32 = bitwise OR of r32 with rm32
  0b: r32 = bitwise OR of r32 with rm32
  0d: R0 = bitwise OR of imm32 with R0 (EAX)
  21: rm32 = bitwise AND of r32 with rm32
  23: r32 = bitwise AND of r32 with rm32
  25: R0 = bitwise AND of imm32 with R0 (EAX)
  29: subtract r32 from rm32
  2b: subtract rm32 from r32
  2d: subtract imm32 from R0 (EAX)
  31: rm32 = bitwise XOR of r32 with rm32
  33: r32 = bitwise XOR of r32 with rm32
  35: R0 = bitwise XOR of imm32 with R0 (EAX)
  39: compare: set SF if rm32 < r32
  3b: compare: set SF if r32 < rm32
  3d: compare: set SF if R0 < imm32
  50: push R0 (EAX) to stack
  51: push R1 (ECX) to stack
  52: push R2 (EDX) to stack
  53: push R3 (EBX) to stack
  54: push R4 (ESP) to stack
  55: push R5 (EBP) to stack
  56: push R6 (ESI) to stack
  57: push R7 (EDI) to stack
  58: pop top of stack to R0 (EAX)
  59: pop top of stack to R1 (ECX)
  5a: pop top of stack to R2 (EDX)
  5b: pop top of stack to R3 (EBX)
  5c: pop top of stack to R4 (ESP)
  5d: pop top of stack to R5 (EBP)
  5e: pop top of stack to R6 (ESI)
  5f: pop top of stack to R7 (EDI)
  68: push imm32 to stack
  74: jump disp8 bytes away if ZF is set
  75: jump disp8 bytes away if ZF is not set
  7c: jump disp8 bytes away if lesser (SF != OF)
  7d: jump disp8 bytes away if greater or equal (SF == OF)
  7e: jump disp8 bytes away if lesser or equal (ZF is set or SF != OF)
  7f: jump disp8 bytes away if greater (ZF is unset, SF == OF)
  81: combine rm32 with imm32 based on subop
  87: swap the contents of r32 and rm32
  88: copy r8 (lowermost byte of r32) to r8/m8-at-r32
  89: copy r32 to rm32
  8a: copy r8/m8-at-r32 to r8 (lowermost byte of r32)
  8b: copy rm32 to r32
  8f: pop top of stack to rm32
  b8: copy imm32 to R0 (EAX)
  b9: copy imm32 to R1 (ECX)
  ba: copy imm32 to R2 (EDX)
  bb: copy imm32 to R3 (EBX)
  bc: copy imm32 to R4 (ESP)
  bd: copy imm32 to R5 (EBP)
  be: copy imm32 to R6 (ESI)
  bf: copy imm32 to R7 (EDI)
  c3: return from most recent unfinished call
  c7: copy imm32 to rm32
  cd: software interrupt
  e8: call disp32
  e9: jump disp16 bytes away
  eb: jump disp8 bytes away
  f4: halt
  f7: bitwise complement of rm32
  ff: jump/push/call rm32 based on subop
  0f 84: jump disp16 bytes away if ZF is set
  0f 85: jump disp16 bytes away if ZF is not set
  0f 8c: jump disp16 bytes away if lesser (SF != OF)
  0f 8d: jump disp16 bytes away if greater or equal (SF == OF)
  0f 8e: jump disp16 bytes away if lesser or equal (ZF is set or SF != OF)
  0f 8f: jump disp16 bytes away if greater (ZF is unset, SF == OF)
  0f af: multiply rm32 into r32
Run `subx help instructions` for details on words like 'r32' and 'disp8'.