projects
/
YACASL2.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
ユニットテストの修正
[YACASL2.git]
/
src
/
struct.c
diff --git
a/src/struct.c
b/src/struct.c
index
7c3e785
..
1fb4326
100644
(file)
--- a/
src/struct.c
+++ b/
src/struct.c
@@
-3,37
+3,42
@@
/* COMET IIのメモリ */
WORD *memory;
/* COMET IIのメモリ */
WORD *memory;
-/* COMET IIのCPUレジスタ */
-WORD GR[REGSIZE], SP, PR, FR;
-
-/* メモリーサイズ */
+/* メモリサイズ */
int memsize = DEFAULT_MEMSIZE;
int memsize = DEFAULT_MEMSIZE;
+/* COMET IIのCPU */
+CPU *cpu;
+
/* クロック周波数 */
int clocks = DEFAULT_CLOCKS;
/* クロック周波数 */
int clocks = DEFAULT_CLOCKS;
-/* 実行開始番地 */
-WORD startptr = 0x0;
-
-/* 実行終了番地 */
-WORD endptr = 0x0;
+/* CASL2プログラムのプロパティ */
+PROGPROP *progprop;
/* COMET II仮想マシンのリセット */
void reset()
{
int i;
/* COMET II仮想マシンのリセット */
void reset()
{
int i;
- for(i = 0; i < REGSIZE; i++) {
- GR[i] = 0x0;
- }
- SP = PR = FR = 0x0;
- memory = malloc(memsize * sizeof(WORD));
+
+ /* メモリの初期化 */
+ memory = malloc_chk(memsize * sizeof(WORD), "memory");
for(i = 0; i < memsize; i++) {
memory[i] = 0x0;
}
for(i = 0; i < memsize; i++) {
memory[i] = 0x0;
}
+ /* CPUの初期化 */
+ cpu = malloc_chk(sizeof(CPU), "cpu");
+ for(i = 0; i < GRSIZE; i++) {
+ cpu->gr[i] = 0x0;
+ }
+ cpu->sp = cpu->pr = cpu->fr = 0x0;
+ /* CASL2プログラムのプロパティ */
+ progprop = malloc_chk(sizeof(PROGPROP), "progprop");
}
/* COMET II仮想マシンのシャットダウン */
void shutdown()
{
}
/* COMET II仮想マシンのシャットダウン */
void shutdown()
{
+ free(progprop);
+ free(cpu);
free(memory);
}
free(memory);
}