Put the manual's sections back in opcode order
The user's edit. Moving branches to 0x60 and subroutines to 0x70 left their sections sitting where they used to be numerically, between the ALU and the registers, so the manual read in an order the opcode map no longer did. The list has always been arranged by opcode sequence rather than by importance or by how often a thing is used - arbitrary, and now canon.
This commit is contained in:
@@ -78,37 +78,6 @@ The Bytes column is the total length of the instruction, counting its opcode, an
|
||||
| 17 | SHL | 1 | A and B form a circular shift register. Rotate this register left. |
|
||||
| 18 | SHR | 1 | A and B form a circular shift register. Rotate this register right. |
|
||||
|
||||
### Branch Operations: 10 Instructions
|
||||
| Hex Code | Mnemonic | Bytes | Description |
|
||||
| -- | ---- | -- | -- |
|
||||
| 60 | BRI | 3 | Branch Immediately. Loads the immediate next two bytes of Program Memory into the Program Counter, first the most significant byte, then the least. |
|
||||
| 61 | BRQ | 3 | Branch on Q. If Q is zero, loads the immediate next two bytes of Program Memory into the Program Counter. |
|
||||
| 62 | BRA | 3 | Branch on A. If A is zero, loads the immediate next two bytes of Program Memory into the Program Counter. |
|
||||
| 63 | BRB | 3 | Branch on B. If B is zero, loads the immediate next two bytes of Program Memory into the Program Counter. |
|
||||
| 64 | BRC | 3 | Branch if Carry is set. |
|
||||
| 65 | BRD | 2 | Branch to the address held in the named Data Pointer. |
|
||||
| 66 | BNQ | 3 | Branch if Q is not zero. |
|
||||
| 67 | BNA | 3 | Branch if A is not zero. |
|
||||
| 68 | BNB | 3 | Branch if B is not zero. |
|
||||
| 69 | BNC | 3 | Branch if the Carry Flag is clear. |
|
||||
|
||||
### Subroutine Operations: 7 Instructions
|
||||
|
||||
A block of their own, because the branches and these outgrew one nibble between them. Each
|
||||
raw form sits immediately below the ordinary one it cannot be mixed with - RCAL under CALL,
|
||||
RRET under RET - since the frames differ and returning through the wrong one takes the
|
||||
machine somewhere nobody named.
|
||||
|
||||
| Hex Code | Mnemonic | Bytes | Description |
|
||||
| -- | ---- | -- | -- |
|
||||
| 70 | RCAL | 3 | Raw call. Pushes only the Program Counter, then performs an immediate branch. Two bytes of Stack, and nothing is put back. Must be returned from with RRET. |
|
||||
| 71 | CALL | 3 | Call subroutine. Pushes the Program Counter, Data Pointers 0 through 2, B and A to the Stack, then performs an immediate branch. This costs ten bytes of Stack. |
|
||||
| 72 | SWI | 2 | Software Interrupt. The next byte names a software vector. Pushes an interrupt frame and dispatches through it. Never masked. |
|
||||
| 73 | RETI | 1 | Return from an interrupt. Restores everything the frame holds and carries on from where the interrupt arrived. |
|
||||
| 74 | RRET | 1 | Return from a raw call. Takes back the Program Counter and nothing else. |
|
||||
| 76 | SRET | 1 | Return from a handler that has an answer. Restores what RET restores - A, B and Data Pointers 0 through 2 - and puts the Interrupt Flag back from the frame. The saved Q and Data Pointer 3 are dropped, so what the handler left in them is what the caller receives. |
|
||||
| 75 | RET | 1 | Return from subroutine. Restores A, B, and Data Pointers 0 through 2 from the Stack, then sets the Program Counter to the instruction after the CALL. Data Pointer 3 and Q are left as the subroutine leaves them. |
|
||||
|
||||
### Register Operations: 13 Instructions
|
||||
| Hex Code | Mnemonic | Bytes | Description |
|
||||
| -- | ---- | -- | -- |
|
||||
@@ -165,6 +134,37 @@ BRD is the only branch whose destination is not written into the program. Every
|
||||
|
||||
LDD and STD are how a program follows an address it has stored, rather than one the assembler wrote into the instruction. Together with more than one Data Pointer, they are what makes a table of addresses usable: one pointer walks the table while another follows whatever entry it is on. Naming the same pointer twice, as in `LDD.0.0`, makes that pointer follow the address it is currently holding.
|
||||
|
||||
### Branch Operations: 10 Instructions
|
||||
| Hex Code | Mnemonic | Bytes | Description |
|
||||
| -- | ---- | -- | -- |
|
||||
| 60 | BRI | 3 | Branch Immediately. Loads the immediate next two bytes of Program Memory into the Program Counter, first the most significant byte, then the least. |
|
||||
| 61 | BRQ | 3 | Branch on Q. If Q is zero, loads the immediate next two bytes of Program Memory into the Program Counter. |
|
||||
| 62 | BRA | 3 | Branch on A. If A is zero, loads the immediate next two bytes of Program Memory into the Program Counter. |
|
||||
| 63 | BRB | 3 | Branch on B. If B is zero, loads the immediate next two bytes of Program Memory into the Program Counter. |
|
||||
| 64 | BRC | 3 | Branch if Carry is set. |
|
||||
| 65 | BRD | 2 | Branch to the address held in the named Data Pointer. |
|
||||
| 66 | BNQ | 3 | Branch if Q is not zero. |
|
||||
| 67 | BNA | 3 | Branch if A is not zero. |
|
||||
| 68 | BNB | 3 | Branch if B is not zero. |
|
||||
| 69 | BNC | 3 | Branch if the Carry Flag is clear. |
|
||||
|
||||
### Subroutine Operations: 7 Instructions
|
||||
|
||||
A block of their own, because the branches and these outgrew one nibble between them. Each
|
||||
raw form sits immediately below the ordinary one it cannot be mixed with - RCAL under CALL,
|
||||
RRET under RET - since the frames differ and returning through the wrong one takes the
|
||||
machine somewhere nobody named.
|
||||
|
||||
| Hex Code | Mnemonic | Bytes | Description |
|
||||
| -- | ---- | -- | -- |
|
||||
| 70 | RCAL | 3 | Raw call. Pushes only the Program Counter, then performs an immediate branch. Two bytes of Stack, and nothing is put back. Must be returned from with RRET. |
|
||||
| 71 | CALL | 3 | Call subroutine. Pushes the Program Counter, Data Pointers 0 through 2, B and A to the Stack, then performs an immediate branch. This costs ten bytes of Stack. |
|
||||
| 72 | SWI | 2 | Software Interrupt. The next byte names a software vector. Pushes an interrupt frame and dispatches through it. Never masked. |
|
||||
| 73 | RETI | 1 | Return from an interrupt. Restores everything the frame holds and carries on from where the interrupt arrived. |
|
||||
| 74 | RRET | 1 | Return from a raw call. Takes back the Program Counter and nothing else. |
|
||||
| 76 | SRET | 1 | Return from a handler that has an answer. Restores what RET restores - A, B and Data Pointers 0 through 2 - and puts the Interrupt Flag back from the frame. The saved Q and Data Pointer 3 are dropped, so what the handler left in them is what the caller receives. |
|
||||
| 75 | RET | 1 | Return from subroutine. Restores A, B, and Data Pointers 0 through 2 from the Stack, then sets the Program Counter to the instruction after the CALL. Data Pointer 3 and Q are left as the subroutine leaves them. |
|
||||
|
||||
### Output Operations: 3 Instructions
|
||||
| Hex Code | Mnemonic | Bytes | Description |
|
||||
| -- | ---- | -- | -- |
|
||||
|
||||
Reference in New Issue
Block a user