Line 4... |
Line 4... |
2. 16-bit address bus
|
2. 16-bit address bus
|
3. fixed 16-bit instruction length
|
3. fixed 16-bit instruction length
|
4. use a small amount of "rich" instructions to do powerful things
|
4. use a small amount of "rich" instructions to do powerful things
|
5. 1 instruction per clock cycle
|
5. 1 instruction per clock cycle
|
|
|
|
Relative moves:
|
|
In order to provide uesfulness to the segment-carryover feature, there are a few options for moving a "relative" amount to a register, including IP and SP
|
|
A relative move differs in most of the opcodes in that the relative factor is treated as a signed value.
|
|
so for instance, a
|
|
mov r0,50
|
|
mov_relative r0, -10
|
|
|
|
in the ned, r0 will end up being 40. Although this feature won't see much use in general registers, IP and SP are special because of the option of using the
|
|
segment-carryover feature. This means that SP and IP, while being 8-bit registers, can function very similar to a 16-bit register, enabling full usage of the available address space.
|
|
|
Register list:
|
Register list:
|
r0-r5 general purpose registers
|
r0-r5 general purpose registers
|
sp stack pointer (represented as r6)
|
sp stack pointer (represented as r6)
|
ip instruction pointer register (represented as r7)
|
ip instruction pointer register (represented as r7)
|
cs, ds, es, ss segment registers (code segment, data segment, extra segment, stack segment)
|
cs, ds, es, ss segment registers (code segment, data segment, extra segment, stack segment)
|
Line 21... |
Line 31... |
last 1 bit: conditional
|
last 1 bit: conditional
|
|
|
second byte:
|
second byte:
|
first 1 bit: second portion of condition (if not immediate) (1 for only if false)
|
first 1 bit: second portion of condition (if not immediate) (1 for only if false)
|
next 1 bit: use extra segment
|
next 1 bit: use extra segment
|
next 3 bits: other register
|
next 3 bits: other register. If not 3rd register, top bit specifies which register bank, others unused
|
last 3 bits: extra opcode information or third register. such as for ADD it could be target=source+third_register
|
last 3 bits: extra opcode information or third register. such as for ADD it could be target=source+third_register
|
|
|
...or second byte is immediate value
|
...or second byte is immediate value
|
|
|
For opcodes requiring 3 registers but without room, the target opcode is assume to be the second operation. Such as for AND, target=source AND target
|
For opcodes requiring 3 registers but without room, the target opcode is assume to be the second operation. Such as for AND, target=source AND target
|
Line 34... |
Line 44... |
immediates:
|
immediates:
|
1. move reg, immediate
|
1. move reg, immediate
|
2. move [reg], immediate
|
2. move [reg], immediate
|
3. push and move reg, immediate (or call immediate)
|
3. push and move reg, immediate (or call immediate)
|
4. push immediate
|
4. push immediate
|
5. jmp immediate
|
5. mov (relative) immediate
|
|
|
|
|
groups: (limited to 2 registers and no immediates. each group has 8 opcodes)
|
groups: (limited to 2 registers and no immediates. each group has 8 opcodes)
|
group 1:
|
group 1:
|
move(store) [reg],reg
|
move(store) [reg],reg
|
move(load) reg,[reg]
|
move(load) reg,[reg]
|
Line 87... |
Line 98... |
push extended segmentreg, reg (equivalent to push seg; push reg)
|
push extended segmentreg, reg (equivalent to push seg; push reg)
|
pop extended segmentreg, reg (equivalent to pop reg; pop seg)
|
pop extended segmentreg, reg (equivalent to pop reg; pop seg)
|
reset processor (will completely reset the processor to starting state, but not RAM or anything else)
|
reset processor (will completely reset the processor to starting state, but not RAM or anything else)
|
|
|
group 6:
|
group 6:
|
set register bank 0
|
set default register bank to 0 (can be condensed to 1 opcode)
|
set register bank 1
|
set default register bank to 1
|
push extended reg, reg
|
push extended reg, reg
|
pop extended reg,reg
|
pop extended reg,reg
|
|
enable carryover seg
|
|
disable CS carryover seg
|
|
mov relative reg, reg
|
|
exchange reg, reg
|
|
|
3 register instructions:
|
3 register instructions:
|
1. add reg1, reg2, reg3 (reg1=reg2+reg3)
|
1. add reg1, reg2, reg3 (reg1=reg2+reg3)
|
2. sub reg1, reg2, reg3
|
2. sub reg1, reg2, reg3
|
|
|
Line 141... |
Line 155... |
DS is used in all "normal" memory references
|
DS is used in all "normal" memory references
|
SS is used in all push and pop instructions
|
SS is used in all push and pop instructions
|
ES is used when the ExtraSegment bit is set for either push/pop or normal memory references
|
ES is used when the ExtraSegment bit is set for either push/pop or normal memory references
|
CS is only used for fetching instructions
|
CS is only used for fetching instructions
|
|
|
|
Segment carryover:
|
|
In order to overcome the limitations of only having a 256 byte segment, there is a workaround option to "pretend" that IP is a 16 bit register.
|
|
When CS carryover is enabled, when IP rollover from 255 to 0 or whatever, CS will be incremented. This makes it so that if you start at address 0:0.
|
|
you can continue as far as needed into the address space without having to do ugly far jumps at each of the borders.
|
|
|
|
|
States needed:
|
States needed:
|
0. reset
|
0. reset
|
1. decode current instruction (All without memory capable within 1 clock cycle)
|
1. decode current instruction (All without memory capable within 1 clock cycle)
|
2. increment IP(and SP if needed) and fetch next instruction
|
2. increment IP(and SP if needed) and fetch next instruction
|