CPU

設計進捗

2009年9月18日

ジャンプ・コール・リターンの3つの命令が実行できるようになった。とりあえず、バックアップの意味もかねて、記事を上げる。

現在設計中のコンピューターの特徴は、次のとおり。

・データラインは8ビット、アドレスラインは14ビット(16384 bytes)。
・2つの8ビット汎用レジスター、X, Y。
・フラグは、ゼロとキャリーの2つ。これらを含むFレジスターは、データ読み書きのセグメントアドレスを含む。
・ プログラムカウンタは、12ビット。従って、全アドレスのうち4分の1の、4096バイトのみがプログラミングに利用できる。
・スタックポインタは、8ビット。全アドレスの最後の256バイトのみが、スタック領域として利用できる部分。
・すべての命令が2バイトで記述される。

細かな仕様は、次のとおり。
data line: 8 bits
address line: 14 bits (8 bits + 6 bits; 256 x 64)

registors X(8), Y(8), F(8), PC(12), SP(8)
F: Z, C, S5, S4, S3, S2, S1, S0 (Z, C: zero and carry flags; S: segment registor)
stack segment is always 0x3f
program can be written from 0x0000 to 0x0fff


All 2 byte commands

0x00, 0x01, ... , 0x0f: goto, operand: 12 bits.
0x10, 0x11, ... , 0x1f: call, operand: 12 bits.
0x20, 0x21, ... , 0x27: X=XX, [X]=XX, X=(XX), (XX)=X, Y=XX, [Y]=XX, X=(XX), (XX)=X
0x28, 0x29, ... , 0x2f: (see below)
0x2800 - 0x280f: X=X(NOP), X=Y, X=F, X=SP, reserved, X=[Y],
0x2810 - 0x281f: Y=X, Y=Y (reserved), Y=F, Y=SP, Y=[X], reserved,
0x2820 - 0x282f: F=X, F=Y, F=F (reserved), F=SP, F=[X], F=[Y],
0x2830 - 0x283f: SP=X, SP=Y, SP=F, SP=SP, SP=[X], SP=[Y],
0x2880 - 0x288f: [X]=X, [X]=Y, [X]=F, [X]=SP, reserved, reserved,
0x2890 - 0x289f: [Y]=X, [Y]=Y, [Y]=F, [Y]=SP, reserved, reserved,
0x2900 - 0x29ff: stack-using processes
    bit 0-1: X, Y, F, or none
    bit 2: use also c7 for read/write
    bit 3: SP++ or SP-- at c4
    bit 4: SP++ or SP-- at c6
    bit 5: SP++ or SP-- at c8
    bit 6: 0: SP++, 1: SP--
    bit 7: 0: read, 1: write (c5)
0x2900 - 0x2907: X=[SP], Y=[SP], F=[SP],
0x2908 - 0x290f: [SP]=X, [SP]=Y, [SP]=F,
0x2910 - 0x2917: pop X, pop Y, pop F, SP++
0x2918 - 0x291f: [++SP]=X, [++SP]=Y, [++SP]=F,
0x2920 - 0x2927: X=[SP++], Y=[SP++], F=[SP++],
0x2928 - 0x292f: [SP++]=X, [SP++]=Y, [SP++]=F,
0x2930 - 0x2937: X=[++SP++], Y=[++SP++], F=[++SP++], SP+=2, , , , return
0x2938 - 0x293f: [++SP++]=X, [++SP++]=Y, [++SP++]=F,
0x2960 - 0x2967: X=[SP++++], Y=[SP++++], F=[SP++++], 
0x2968 - 0x296f: [SP++++]=X, [SP++++]=Y, [SP++++]=F,
0x2970 - 0x2977: X=[++SP++++], Y=[++SP++++], F=[++SP++++], SP+=3
0x2978 - 0x2978: [++SP++++]=X, [++SP++++]=Y, [++SP++++]=F,
0x2990 - 0x2997: X=[--SP], Y=[--SP], F=[--SP], SP--
0x2998 - 0x299f: [--SP]=X, [--SP]=Y, [--SP]=F,
0x29a0 - 0x29a7: X=[SP--], Y=[SP--], F=[SP--],
0x29a8 - 0x29af: push X, push Y, push F,
0x29b0 - 0x29b7: X=[--SP--], Y=[--SP--], F=[--SP--], SP-=2
0x29b8 - 0x29bf: [--SP--]=X, [--SP--]=Y, [--SP--]=F,
0x29e0 - 0x29e7: X=[SP----], Y=[SP----], F=[SP----],
0x29e8 - 0x29ef: [SP----]=X, [SP----]=Y, [SP----]=F,
0x29f0 - 0x29f7: X=[--SP----], Y=[--SP----], F=[--SP----], SP-=3
0x29f8 - 0x29ff: [--SP----]=X, [--SP----]=Y, [--SP----]=F,


0x2f00 - 0x2fff: 
0x30, 0x31, ... , 0x38: (XX)=X+Y, (XX)=X-Y, (XX)=X&Y, (XX)=X|Y, (XX)=X+Y+C, (XX)=X-Y-C, (XX)=X^Y, (XX)=~X
0x38, 0x31, ... , 0x3f: X=++(XX), X=--(XX), X=++Y, X=--Y, Y=++(XX), Y=--(XX), Y=++X, Y=--X
0x40, 0x41, ... , 0x4f: jz, operand: 12 bits.
0x50, 0x51, ... , 0x5f: jc, operand: 12 bits.
0x60, 0x61, ... , 0x6f: jnz, operand: 12 bits.
0x70, 0x71, ... , 0x7f: jnc, operand: 12 bits.
0x80, 0x81, ... , 0x8f: reserved
0x90, 0x91, ... , 0x9f: reserved
0xa0, 0xa1, ... , 0xaf: reserved
0xb0, 0xb1, ... , 0xbf: reserved
0xc0, 0xc1, ... , 0xcf: reserved
0xd0, 0xd1, ... , 0xdf: reserved
0xe0, 0xe1, ... , 0xef: reserved
0xf0, 0xf1, ... , 0xff: reserved

(XX) = [3Fh:XX]; used as registors; genelary, F0-FF (16 registors) are used.

コメント

コメントはありません

コメント送信