YACASL2
Loading...
Searching...
No Matches
exec.c File Reference
#include "exec.h"
#include "monitor.h"
Include dependency graph for exec.c:

Go to the source code of this file.

Functions

char * pr2str (WORD pr)
 プログラムレジスタ(PR)を表すWORD値を文字列に変換
void svcin ()
 標準入力から文字データを読込(SVC 1)
void svcout ()
 標準出力へ文字データを書出(SVC 2)
void setfr (WORD adr)
 ロード/論理積/論理和/排他的論理和のフラグ設定。OFは常に0
WORD get_r_r1 (WORD oprx)
 WORD値からr/r1を取得
WORD get_x_r2 (WORD oprx)
 WORD値からx/r2を取得
WORD get_adr_x (WORD adr, WORD oprx)
 2つのWORD値からadr[,x]を取得
WORD get_val_adr_x (WORD adr, WORD oprx)
 2つのWORD値からadr[,x]のアドレスに格納されている値を取得
CLOCK clock_str2clock (const char *str)
 クロック周波数を表す数値文字列を、正の整数値であるCLOCK型の数値に変換。変換できない場合は、エラーを表示して0を返す
void addcerrlist_exec ()
 実行エラーをエラーリストに追加する
void nop ()
 NOP命令。語長1(OPのみ)
void ld_r_adr_x ()
 LD命令 - オペランドr,adr,x。語長2.
void ld_r1_r2 ()
 LD命令 - オペランドr1,r2。語長1.
void st ()
 ST命令。語長2.
void lad ()
 LAD命令。語長2.
void adda (WORD r, WORD val)
void adda_r_adr_x ()
 ADDA命令 - オペランドr,adr,x。語長2.
void adda_r1_r2 ()
 ADDA命令 - オペランドr1,r2。語長1.
void suba_r_adr_x ()
 SUBA命令 - オペランドr,adr,x。語長2.
void suba_r1_r2 ()
 SUBA命令 - オペランドr1,r2。語長1.
void addl_gr (WORD r, WORD val, bool add)
void addl_r_adr_x ()
 ADDL命令 - オペランドr,adr,x。語長2.
void addl_r1_r2 ()
 ADDL命令 - オペランドr1,r2。語長1.
void subl_r_adr_x ()
 SUBL命令 - オペランドr,adr,x。語長2.
void subl_r1_r2 ()
 SUBL命令 - オペランドr1,r2。語長1.
void and_r_adr_x ()
 AND命令 - オペランドr,adr,x。語長2.
void and_r1_r2 ()
 AND命令 - オペランドr1,r2。語長1.
void or_r_adr_x ()
 OR命令 - オペランドr,adr,x。語長2.
void or_r1_r2 ()
 OR命令 - オペランドr1,r2。語長1.
void xor_r_adr_x ()
 XOR命令 - オペランドr,adr,x。語長2.
void xor_r1_r2 ()
 XOR命令 - オペランドr1,r2。語長1.
void cpa (WORD r, WORD val)
void cpa_r_adr_x ()
 CPA命令 - オペランドr,adr,x。語長2.
void cpa_r1_r2 ()
 CPA命令 - オペランドr1,r2。語長1.
void cpl (WORD r, WORD val)
void cpl_r_adr_x ()
 CPL命令 - オペランドr,adr,x。語長2.
void cpl_r1_r2 ()
 CPL命令 - オペランドr1,r2。語長1.
void sla ()
 SLA命令 - オペランドr,adr,x。語長2.
void sra ()
 SRA命令 - オペランドr,adr,x。語長2.
void sll ()
 SLL命令 - オペランドr,adr,x。語長2.
void srl ()
 SRL命令 - オペランドr,adr,x。語長2.
void jmi ()
 JMI命令。語長2.
void jnz ()
 JNZ命令。語長2.
void jze ()
 JZE命令。語長2.
void jump ()
 JUMP命令。語長2.
void jpl ()
 JPL命令。語長2.
void jov ()
 JOV命令。語長2.
void push ()
 PUSH命令。語長2.
void pop ()
 POP命令。語長1.
void call ()
 CALL命令。語長2.
void ret ()
 RET命令。語長1(OPのみ)
void svc ()
 SVC命令。語長2.
void exec ()
 COMET II仮想マシンを実行する

Variables

static CERR cerr_exec []
 実行エラーの定義
EXECMODE execmode = {false, false, false, 0, 0xFFFF, false, false, false}
 実行モード: trace, logical, dump, dump_start, dump_end, reverse, monitor, step

Function Documentation

◆ adda()

void adda ( WORD r,
WORD val )

Definition at line 259 of file exec.c.

Here is the caller graph for this function:

◆ adda_r1_r2()

void adda_r1_r2 ( )

ADDA命令 - オペランドr1,r2。語長1.

Definition at line 285 of file exec.c.

Here is the call graph for this function:

◆ adda_r_adr_x()

void adda_r_adr_x ( )

ADDA命令 - オペランドr,adr,x。語長2.

Definition at line 278 of file exec.c.

Here is the call graph for this function:

◆ addcerrlist_exec()

void addcerrlist_exec ( )

実行エラーをエラーリストに追加する

Definition at line 221 of file exec.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ addl_gr()

void addl_gr ( WORD r,
WORD val,
bool add )

Definition at line 306 of file exec.c.

Here is the caller graph for this function:

◆ addl_r1_r2()

void addl_r1_r2 ( )

ADDL命令 - オペランドr1,r2。語長1.

Definition at line 345 of file exec.c.

Here is the call graph for this function:

◆ addl_r_adr_x()

void addl_r_adr_x ( )

ADDL命令 - オペランドr,adr,x。語長2.

Definition at line 338 of file exec.c.

Here is the call graph for this function:

◆ and_r1_r2()

void and_r1_r2 ( )

AND命令 - オペランドr1,r2。語長1.

Definition at line 373 of file exec.c.

Here is the call graph for this function:

◆ and_r_adr_x()

void and_r_adr_x ( )

AND命令 - オペランドr,adr,x。語長2.

Definition at line 366 of file exec.c.

Here is the call graph for this function:

◆ call()

void call ( )

CALL命令。語長2.

Definition at line 648 of file exec.c.

Here is the call graph for this function:

◆ clock_str2clock()

CLOCK clock_str2clock ( const char * str)

クロック周波数を表す数値文字列を、正の整数値であるCLOCK型の数値に変換。変換できない場合は、エラーを表示して0を返す

Returns
クロック周波数を表すCLOCK型の正の整数値。エラー時は0
Parameters
strクロック周波数を表す数値文字列

Definition at line 92 of file exec.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cpa()

void cpa ( WORD r,
WORD val )

Definition at line 408 of file exec.c.

Here is the caller graph for this function:

◆ cpa_r1_r2()

void cpa_r1_r2 ( )

CPA命令 - オペランドr1,r2。語長1.

Definition at line 425 of file exec.c.

Here is the call graph for this function:

◆ cpa_r_adr_x()

void cpa_r_adr_x ( )

CPA命令 - オペランドr,adr,x。語長2.

Definition at line 418 of file exec.c.

Here is the call graph for this function:

◆ cpl()

void cpl ( WORD r,
WORD val )

Definition at line 432 of file exec.c.

Here is the caller graph for this function:

◆ cpl_r1_r2()

void cpl_r1_r2 ( )

CPL命令 - オペランドr1,r2。語長1.

Definition at line 449 of file exec.c.

Here is the call graph for this function:

◆ cpl_r_adr_x()

void cpl_r_adr_x ( )

CPL命令 - オペランドr,adr,x。語長2.

Definition at line 442 of file exec.c.

Here is the call graph for this function:

◆ exec()

void exec ( )

COMET II仮想マシンを実行する

Definition at line 684 of file exec.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_adr_x()

WORD get_adr_x ( WORD adr,
WORD oprx )

2つのWORD値からadr[,x]を取得

Returns
adr[,x]を表すWORD値
Parameters
adrアドレスを表すWORD値
oprxオペランドを表すWORD値

Definition at line 196 of file exec.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_r_r1()

WORD get_r_r1 ( WORD oprx)

WORD値からr/r1を取得

Returns
r/r1を表すWORD値
Parameters
oprxオペランドを表すWORD値

Definition at line 170 of file exec.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_val_adr_x()

WORD get_val_adr_x ( WORD adr,
WORD oprx )

2つのWORD値からadr[,x]のアドレスに格納されている値を取得

Returns
adr[,x]のアドレスに格納されている値を表すWORD値
Parameters
adrアドレスを表すWORD値
oprxオペランドを表すWORD値

Definition at line 207 of file exec.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_x_r2()

WORD get_x_r2 ( WORD oprx)

WORD値からx/r2を取得

Returns
x/r2を表すWORD値
Parameters
oprxオペランドを表すWORD値

Definition at line 183 of file exec.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ jmi()

void jmi ( )

JMI命令。語長2.

Definition at line 569 of file exec.c.

Here is the call graph for this function:

◆ jnz()

void jnz ( )

JNZ命令。語長2.

Definition at line 579 of file exec.c.

Here is the call graph for this function:

◆ jov()

void jov ( )

JOV命令。語長2.

Definition at line 615 of file exec.c.

Here is the call graph for this function:

◆ jpl()

void jpl ( )

JPL命令。語長2.

Definition at line 605 of file exec.c.

Here is the call graph for this function:

◆ jump()

void jump ( )

JUMP命令。語長2.

Definition at line 599 of file exec.c.

Here is the call graph for this function:

◆ jze()

void jze ( )

JZE命令。語長2.

Definition at line 589 of file exec.c.

Here is the call graph for this function:

◆ lad()

void lad ( )

LAD命令。語長2.

Definition at line 252 of file exec.c.

Here is the call graph for this function:

◆ ld_r1_r2()

void ld_r1_r2 ( )

LD命令 - オペランドr1,r2。語長1.

Definition at line 238 of file exec.c.

Here is the call graph for this function:

◆ ld_r_adr_x()

void ld_r_adr_x ( )

LD命令 - オペランドr,adr,x。語長2.

Definition at line 231 of file exec.c.

Here is the call graph for this function:

◆ nop()

void nop ( )

NOP命令。語長1(OPのみ)

Definition at line 226 of file exec.c.

Here is the call graph for this function:

◆ or_r1_r2()

void or_r1_r2 ( )

OR命令 - オペランドr1,r2。語長1.

Definition at line 387 of file exec.c.

Here is the call graph for this function:

◆ or_r_adr_x()

void or_r_adr_x ( )

OR命令 - オペランドr,adr,x。語長2.

Definition at line 380 of file exec.c.

Here is the call graph for this function:

◆ pop()

void pop ( )

POP命令。語長1.

Definition at line 633 of file exec.c.

Here is the call graph for this function:

◆ pr2str()

char * pr2str ( WORD pr)

プログラムレジスタ(PR)を表すWORD値を文字列に変換

Returns
文字列「PR:XXXX」(Xは16進数の数字)
Parameters
prプログラムレジスタ(PR)を表すWORD値

Definition at line 101 of file exec.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ push()

void push ( )

PUSH命令。語長2.

Definition at line 625 of file exec.c.

Here is the call graph for this function:

◆ ret()

void ret ( )

RET命令。語長1(OPのみ)

Definition at line 656 of file exec.c.

◆ setfr()

void setfr ( WORD adr)

ロード/論理積/論理和/排他的論理和のフラグ設定。OFは常に0

Parameters
adrアドレス

Definition at line 157 of file exec.c.

Here is the caller graph for this function:

◆ sla()

void sla ( )

SLA命令 - オペランドr,adr,x。語長2.

算術演算なので、第15ビットは送り出されない

Definition at line 456 of file exec.c.

Here is the call graph for this function:

◆ sll()

void sll ( )

SLL命令 - オペランドr,adr,x。語長2.

Definition at line 517 of file exec.c.

Here is the call graph for this function:

◆ sra()

void sra ( )

SRA命令 - オペランドr,adr,x。語長2.

算術演算なので、第15ビットは送り出されない 空いたビット位置には符号と同じものが入る

Definition at line 485 of file exec.c.

Here is the call graph for this function:

◆ srl()

void srl ( )

SRL命令 - オペランドr,adr,x。語長2.

Definition at line 543 of file exec.c.

Here is the call graph for this function:

◆ st()

void st ( )

ST命令。語長2.

Definition at line 245 of file exec.c.

Here is the call graph for this function:

◆ suba_r1_r2()

void suba_r1_r2 ( )

SUBA命令 - オペランドr1,r2。語長1.

Definition at line 299 of file exec.c.

Here is the call graph for this function:

◆ suba_r_adr_x()

void suba_r_adr_x ( )

SUBA命令 - オペランドr,adr,x。語長2.

Definition at line 292 of file exec.c.

Here is the call graph for this function:

◆ subl_r1_r2()

void subl_r1_r2 ( )

SUBL命令 - オペランドr1,r2。語長1.

Definition at line 359 of file exec.c.

Here is the call graph for this function:

◆ subl_r_adr_x()

void subl_r_adr_x ( )

SUBL命令 - オペランドr,adr,x。語長2.

Definition at line 352 of file exec.c.

Here is the call graph for this function:

◆ svc()

void svc ( )

SVC命令。語長2.

Definition at line 666 of file exec.c.

Here is the call graph for this function:

◆ svcin()

void svcin ( )

標準入力から文字データを読込(SVC 1)

Definition at line 109 of file exec.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ svcout()

void svcout ( )

標準出力へ文字データを書出(SVC 2)

Definition at line 133 of file exec.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ xor_r1_r2()

void xor_r1_r2 ( )

XOR命令 - オペランドr1,r2。語長1.

Definition at line 401 of file exec.c.

Here is the call graph for this function:

◆ xor_r_adr_x()

void xor_r_adr_x ( )

XOR命令 - オペランドr,adr,x。語長2.

Definition at line 394 of file exec.c.

Here is the call graph for this function:

Variable Documentation

◆ cerr_exec

CERR cerr_exec[]
static
Initial value:
= {
{ 201, "Program Register (PR) - memory overflow" },
{ 202, "Stack Pointer (SP) - stack overflow" },
{ 203, "Stack Pointer (SP) - stack underflow" },
{ 204, "OP in word #1 - not command code" },
{ 205, "r/r1 in word #1 - not GR" },
{ 206, "x/r2 in word #1 - not GR" },
{ 207, "address in word #2 - out of memory" },
{ 208, "SVC input - memory overflow" },
{ 209, "SVC output - memory overflow" },
{ 214, "CPU Clocks - not positive integer" },
{ 215, "Memory Size - not integer or out of range: 1 - 65536" },
}

実行エラーの定義

Definition at line 73 of file exec.c.

◆ execmode

EXECMODE execmode = {false, false, false, 0, 0xFFFF, false, false, false}

実行モード: trace, logical, dump, dump_start, dump_end, reverse, monitor, step

実行モード: trace, logical, dump, reverse, monitor, step

Definition at line 90 of file exec.c.