summaryrefslogtreecommitdiff
path: root/docs/opcodes/opcode-d8-binop-lit8.html
blob: 26005e9fc3e9026e6f64b523f7b373b2216d6827 (plain)
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html>

<head>
<title>binop/lit8</title>
<link rel=stylesheet href="opcode.css">
</head>

<body>

<h1>binop/lit8</h1>

<h2>Purpose</h2>

<p>
Perform the indicated binary op on the indicated register (first argument) and
literal value (second argument), storing the result in the destination register.
</p>

<h2>Details</h2>

<table class="instruc">
<thead>
<tr>
  <th>Op &amp; Format</th>
  <th>Mnemonic / Syntax</th>
  <th>Arguments</th>
</tr>
</thead>
<tbody>
<tr>
  <td>d8..e2 22b</td>
  <td><i>binop</i>/lit8 vAA, vBB, #+CC<br/>
    d8: add-int/lit8<br/>
    d9: rsub-int/lit8<br/>
    da: mul-int/lit8<br/>
    db: div-int/lit8<br/>
    dc: rem-int/lit8<br/>
    dd: and-int/lit8<br/>
    de: or-int/lit8<br/>
    df: xor-int/lit8<br/>
    e0: shl-int/lit8<br/>
    e1: shr-int/lit8<br/>
    e2: ushr-int/lit8
  </td>
  <td><code>A:</code> destination register (8 bits)<br/>
    <code>B:</code> source register (8 bits)<br/>
    <code>C:</code> signed int constant (8 bits)</td>
</tr>
</tbody>
</table>

<h2>Constraints</h2>

<ul>
  <li>
    Both A and B must be valid register indices in the current stackframe.
  </li>
  <li>
    Registers vA and vB must be defined. They must both contain integer values.
  </li>
  <li>
    C is an immediate, signed integer constant taken from the instruction stream
    (actually this means there are no special requirements for C at all).
  </li>
</ul>

<h2>Behavior</h2>

<ul>
  <li>
    The given operation &lt;binop&gt; is performed according to the semantics
    specified in table XXX.
  </li>
  <li>
    Argument C is sign-extended to 32 bits before.
  </li>
  <li>
    The result is stored in register vA, that is, vA'=vB &lt;binop&gt; vC.
  </li>
  <li>
    As usual, neighboring registers might get undefined, if vA was part of a
    register pair originally.
  </li>
</ul>

<h2>Exceptions</h2>

<ul>
  <li>
    ArithmeticException if an error occurs during the instruction.
  </li>
</ul>

</body>
</html>