@会网络的老鼠

涂飞平的博客空间

一个初步的设计思路 [原]

12 年前 0

{***register Table ***
register index(1byte) commant(size=2byte)
0 px(VM System Reserved)
1 ax
2 bx
3 cx
4 dx
5 sp
6 bp
7 ex(exception register)
8 si
9 di
10 fr0(float register)
11 fr1
12 fr2
13 fr3
14 flag
15 ba (base address 4byte & VM System Reserved)
16 ip (instruction pointer & VM System Reserved)
***register End ***

***Instruction Table***
operation(1byte) commant InstructionLong(byte)
0 nop 1
1 halt 1
2 mov(r to r) eg: mov ax,bx 3
3 mov(r to m) eg: mov [1234],ax 4
4 mov(m to r) eg: mov ax,[1234] 4
5 mov(i to r) eg: mov ax,1234 4
6 push(push r) eg: push ax 2
7 push(push i) eg: push 123 3
8 push(push m) eg: push [123] 3
9 pop(pop r) eg: pop ax 2
10 pop(pop m) eg: pop [123] 3
11 jmp(jmp m) eg: jmp [123] 3
12 jmp(jmp i) eg: jmp 123 3
13 jmp(jmp r) eg: jmp ax 2
14 jz(jz m) eg: jz [123] 3
15 jz(jz r) eg: jz ax 2
16 jz(jz i) eg: jz 123 3
17 jnz(jnz m) eg: jnz [123] 3
18 jnz(jnz r) eg: jnz ax 2
19 jnz(jnz i) eg: jnz 123 3
20 ja(ja m) eg: ja [123] 3
21 ja(ja r) eg: ja ax 2
22 ja(ja i) eg: ja 123 3
23 jb(jb m) eg: jb [123] 3
24 jb(jb r) eg: jb ax 2
25 jb(jb i) eg: jb 123 3
26 jaz(jaz m) eg: jaz [123] 3
27 jaz(jaz r) eg: jaz ax 2
28 jaz(jaz i) eg: jaz 123 3
29 jbz(jbz m) eg: jbz [123] 3
30 jbz(jbz r) eg: jbz ax 2
31 jbz(jbz i) eg: jbz 123 3
32 cmp(cmp r,r) eg:cmp ax,bx 3
33 cmp(cmp r,m) eg:cmp ax,[123] 4
34 cmp(cmp r,i) eg:cmp ax,123 4
35 test(test r,r) eg: test ax,ax 3
36 test(test r,m) eg: test ax,[123] 4
37 test(test r,i) eg: test ax,123 4
38 call(call r) eg: call ax 2
39 call(call m) eg: call [123] 3
40 call(call i) eg: call 123 3
41 ret(ret n) eg: ret 4 2(n must is 1 byte)
42 int(int n) eg: int 2 2(n must is 1 byte)
43 iret(iret) eg: iret 1
44 add(add r,i) eg: add ax,123 4
45 add(add r,m) eg: add ax,[123] 4
46 add(add r,r) eg: add ax,bx 3
47 sub(sub r,i) eg: sub ax,123 4
48 sub(sub r,m) eg: sub ax,[123] 4
49 sub(sub r,r) eg: sub ax,bx 3
50 mul(mul r,i) eg: mul ax,123 4
51 mul(mul r,m) eg: mul ax,[123] 4
52 mul(mul r,r) eg: mul ax,bx 3
53 div(div r,i) eg: div ax,123 4
54 div(div r,m) eg: div ax,[123] 4
55 div(div r,r) eg: div ax,bx 3
56 imul(imul r,i) eg: imul ax,123 4
57 imul(imul r,m) eg: imul ax,[123] 4
58 imul(imul r,r) eg: imul ax,bx 3
59 idiv(idiv r,i) eg: idiv ax,123 4
60 idiv(idiv r,m) eg: idiv ax,[123] 4
61 idiv(idiv r,r) eg: idiv ax,bx 3
62 shl(shl r,i) eg: shl ax,3 3
63 shl(shl r,r) eg: shl ax,bx 3
64 shr(shr r,i) eg: shr ax,3 3
65 shr(shr r,r) eg: shr ax,ax 3
66 inc(inc r) eg: inc ax 2
67 dec(dec r) eg: dec ax 2
68 and(and r,r) eg: and ax,bx 3
69 and(and r,i) eg: and ax,123 4
70 and(and r,m) eg: and ax,[123] 4
71 or(or r,r) eg: or ax,bx 3
72 or(or r,i) eg: or ax,123 4
73 or(or r,m) eg: or ax,[123] 4
74 xor(xor r,r) eg: xor ax,bx 3
75 lea(lea r,m) eg: lea ax,[123] 4
76 in(in r,i) eg: in ax,12 4
77 out(our r,i) eg: out ax,12 4
***Instruction End ***}

编写评论