Fixed CMP

This commit is contained in:
g1n 2022-04-20 17:47:28 +03:00
parent 15b40c48c8
commit 60d733d36d
Signed by: g1n
GPG Key ID: 8D352193D65D4E2C
2 changed files with 96 additions and 103 deletions

View File

@ -197,22 +197,22 @@
<div id="content" class="content">
<h1 class="title">ocpu</h1>
<div id="outline-container-org59ce0e8" class="outline-2">
<h2 id="org59ce0e8">GRU ocpu - yet another cpu design</h2>
<div class="outline-text-2" id="text-org59ce0e8">
<div id="outline-container-orgebc8d28" class="outline-2">
<h2 id="orgebc8d28">GRU ocpu - yet another cpu design</h2>
<div class="outline-text-2" id="text-orgebc8d28">
</div>
<div id="outline-container-orgf798eeb" class="outline-3">
<h3 id="orgf798eeb">Features</h3>
<div class="outline-text-3" id="text-orgf798eeb">
<div id="outline-container-orgea57f0e" class="outline-3">
<h3 id="orgea57f0e">Features</h3>
<div class="outline-text-3" id="text-orgea57f0e">
<ul class="org-ul">
<li>little endian</li>
<li>16-bit</li>
</ul>
</div>
</div>
<div id="outline-container-orgc029f05" class="outline-3">
<h3 id="orgc029f05">Registers</h3>
<div class="outline-text-3" id="text-orgc029f05">
<div id="outline-container-orgb176908" class="outline-3">
<h3 id="orgb176908">Registers</h3>
<div class="outline-text-3" id="text-orgb176908">
<table border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
@ -408,9 +408,9 @@
</div>
</div>
<div id="outline-container-orged9566e" class="outline-3">
<h3 id="orged9566e">Instuctions</h3>
<div class="outline-text-3" id="text-orged9566e">
<div id="outline-container-org97202a6" class="outline-3">
<h3 id="org97202a6">Instuctions</h3>
<div class="outline-text-3" id="text-org97202a6">
<table border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
@ -618,22 +618,16 @@
</tbody>
<tbody>
<tr>
<td class="org-left">CMP reg, imm16, imm16</td>
<td class="org-left">CMP reg, imm16</td>
<td class="org-right">0x26</td>
<td class="org-left">Compare</td>
</tr>
<tr>
<td class="org-left">CMP reg, reg, imm16</td>
<td class="org-left">CMP reg, reg</td>
<td class="org-right">0xC6</td>
<td class="org-left">&#xa0;</td>
</tr>
<tr>
<td class="org-left">CMP reg, reg, reg</td>
<td class="org-right">&#xa0;</td>
<td class="org-left">&#xa0;</td>
</tr>
</tbody>
<tbody>
<tr>

165
ocpu.org
View File

@ -63,89 +63,88 @@
** Instuctions
|-----------------------+--------+-------------------------------------------|
| Instructions | Opcode | Description |
|-----------------------+--------+-------------------------------------------|
| MOV reg, imm16 | 0x01 | Place value to register. |
| MOV reg, reg | 0xA1 | Takes 2 bytes as arguments: |
| | | 1 - Opcode of register |
| | | 2 - Value or register |
| | | |
|-----------------------+--------+-------------------------------------------|
| ADD reg, imm16 | 0x10 | Add |
| ADD reg, reg | 0xB0 | |
|-----------------------+--------+-------------------------------------------|
| ADC reg, imm16 | 0x11 | Add with carry |
| ADC reg, reg | 0xB1 | |
|-----------------------+--------+-------------------------------------------|
| SUB reg, imm16 | 0x12 | Subtract |
| SUB reg, reg | 0xB2 | |
|-----------------------+--------+-------------------------------------------|
| MUL reg, imm16 | 0x13 | Multiply |
| MUL reg, reg | 0xB3 | |
|-----------------------+--------+-------------------------------------------|
| DIV reg, imm16 | 0x14 | Divide |
| DIV reg, reg | 0xB4 | |
|-----------------------+--------+-------------------------------------------|
| INC reg | 0x15 | Increment |
| | | |
|-----------------------+--------+-------------------------------------------|
| DEC reg | 0x16 | Decrement |
|-----------------------+--------+-------------------------------------------|
| NOT reg | 0x20 | Logical NOT |
|-----------------------+--------+-------------------------------------------|
| AND reg, imm16 | 0x21 | Logical AND |
| AND reg, reg | 0xC1 | |
|-----------------------+--------+-------------------------------------------|
| OR reg, imm16 | 0x22 | Logical OR |
| OR reg, reg | 0xC2 | |
|-----------------------+--------+-------------------------------------------|
| NOR reg, imm16 | 0x23 | Logical NOR |
| NOR reg, reg | 0xC3 | |
|-----------------------+--------+-------------------------------------------|
| XOR reg, imm16 | 0x24 | Logical XOR |
| XOR reg, reg | 0xC4 | |
|-----------------------+--------+-------------------------------------------|
| NAND reg, imm16 | 0x25 | Logical NAND |
| NAND reg, reg | 0xC5 | |
|-----------------------+--------+-------------------------------------------|
| CMP reg, imm16, imm16 | 0x26 | Compare |
| CMP reg, reg, imm16 | 0xC6 | |
| CMP reg, reg, reg | | |
|-----------------------+--------+-------------------------------------------|
| PUSH imm16 | 0x30 | Push to stack |
|-----------------------+--------+-------------------------------------------|
| POP | 0x31 | Pop to stack |
|-----------------------+--------+-------------------------------------------|
| JMP imm16 | 0x40 | Jump |
|-----------------------+--------+-------------------------------------------|
| JSR imm16 | 0x41 | Jump to subroutine |
|-----------------------+--------+-------------------------------------------|
| JC imm16 | 0x42 | Jump with carry |
|-----------------------+--------+-------------------------------------------|
| JNC imm16 | 0x43 | Jump without carry |
|-----------------------+--------+-------------------------------------------|
| JZ imm16 | 0x44 | Jump if zero |
|-----------------------+--------+-------------------------------------------|
| JNZ imm16 | 0x45 | Jump if non-zero |
|-----------------------+--------+-------------------------------------------|
| JE imm16 | 0x46 | Jump if equal |
|-----------------------+--------+-------------------------------------------|
| JL imm16 | 0x47 | Jump if lower |
|-----------------------+--------+-------------------------------------------|
| JH imm16 | 0x48 | Jump if higher |
|-----------------------+--------+-------------------------------------------|
| RTS | 0x49 | Return from subroutine |
|-----------------------+--------+-------------------------------------------|
| INB imm16 | 0x50 | Copies value from I/O port to destination |
|-----------------------+--------+-------------------------------------------|
| OUTB imm16 | 0x51 | Copies value from operand to I/O port |
|-----------------------+--------+-------------------------------------------|
| NOP | 0x90 | No operation |
|-----------------------+--------+-------------------------------------------|
| SEC | 0x61 | Set carry flag |
|-----------------------+--------+-------------------------------------------|
| CLC | 0x62 | Clear carry flag |
|-----------------+--------+-------------------------------------------|
| Instructions | Opcode | Description |
|-----------------+--------+-------------------------------------------|
| MOV reg, imm16 | 0x01 | Place value to register. |
| MOV reg, reg | 0xA1 | Takes 2 bytes as arguments: |
| | | 1 - Opcode of register |
| | | 2 - Value or register |
| | | |
|-----------------+--------+-------------------------------------------|
| ADD reg, imm16 | 0x10 | Add |
| ADD reg, reg | 0xB0 | |
|-----------------+--------+-------------------------------------------|
| ADC reg, imm16 | 0x11 | Add with carry |
| ADC reg, reg | 0xB1 | |
|-----------------+--------+-------------------------------------------|
| SUB reg, imm16 | 0x12 | Subtract |
| SUB reg, reg | 0xB2 | |
|-----------------+--------+-------------------------------------------|
| MUL reg, imm16 | 0x13 | Multiply |
| MUL reg, reg | 0xB3 | |
|-----------------+--------+-------------------------------------------|
| DIV reg, imm16 | 0x14 | Divide |
| DIV reg, reg | 0xB4 | |
|-----------------+--------+-------------------------------------------|
| INC reg | 0x15 | Increment |
| | | |
|-----------------+--------+-------------------------------------------|
| DEC reg | 0x16 | Decrement |
|-----------------+--------+-------------------------------------------|
| NOT reg | 0x20 | Logical NOT |
|-----------------+--------+-------------------------------------------|
| AND reg, imm16 | 0x21 | Logical AND |
| AND reg, reg | 0xC1 | |
|-----------------+--------+-------------------------------------------|
| OR reg, imm16 | 0x22 | Logical OR |
| OR reg, reg | 0xC2 | |
|-----------------+--------+-------------------------------------------|
| NOR reg, imm16 | 0x23 | Logical NOR |
| NOR reg, reg | 0xC3 | |
|-----------------+--------+-------------------------------------------|
| XOR reg, imm16 | 0x24 | Logical XOR |
| XOR reg, reg | 0xC4 | |
|-----------------+--------+-------------------------------------------|
| NAND reg, imm16 | 0x25 | Logical NAND |
| NAND reg, reg | 0xC5 | |
|-----------------+--------+-------------------------------------------|
| CMP reg, imm16 | 0x26 | Compare |
| CMP reg, reg | 0xC6 | |
|-----------------+--------+-------------------------------------------|
| PUSH imm16 | 0x30 | Push to stack |
|-----------------+--------+-------------------------------------------|
| POP | 0x31 | Pop to stack |
|-----------------+--------+-------------------------------------------|
| JMP imm16 | 0x40 | Jump |
|-----------------+--------+-------------------------------------------|
| JSR imm16 | 0x41 | Jump to subroutine |
|-----------------+--------+-------------------------------------------|
| JC imm16 | 0x42 | Jump with carry |
|-----------------+--------+-------------------------------------------|
| JNC imm16 | 0x43 | Jump without carry |
|-----------------+--------+-------------------------------------------|
| JZ imm16 | 0x44 | Jump if zero |
|-----------------+--------+-------------------------------------------|
| JNZ imm16 | 0x45 | Jump if non-zero |
|-----------------+--------+-------------------------------------------|
| JE imm16 | 0x46 | Jump if equal |
|-----------------+--------+-------------------------------------------|
| JL imm16 | 0x47 | Jump if lower |
|-----------------+--------+-------------------------------------------|
| JH imm16 | 0x48 | Jump if higher |
|-----------------+--------+-------------------------------------------|
| RTS | 0x49 | Return from subroutine |
|-----------------+--------+-------------------------------------------|
| INB imm16 | 0x50 | Copies value from I/O port to destination |
|-----------------+--------+-------------------------------------------|
| OUTB imm16 | 0x51 | Copies value from operand to I/O port |
|-----------------+--------+-------------------------------------------|
| NOP | 0x90 | No operation |
|-----------------+--------+-------------------------------------------|
| SEC | 0x61 | Set carry flag |
|-----------------+--------+-------------------------------------------|
| CLC | 0x62 | Clear carry flag |
0x0* - MOV instructions (maybe it will for LDA or something)