変数名の整理
[YACASL2.git] / src / struct.c
1 #include "casl2.h"
2
3 /* COMET IIのメモリ */
4 WORD *memory;
5
6 /* メモリサイズ */
7 int memsize = DEFAULT_MEMSIZE;
8
9 /* COMET IIのCPU */
10 CPU *cpu;
11
12 /* クロック周波数 */
13 int clocks = DEFAULT_CLOCKS;
14
15 /* CASL2プログラムのプロパティ */
16 PROGPROP *progprop;
17
18 /* COMET II仮想マシンのリセット */
19 void reset()
20 {
21     int i;
22     /* メモリの初期化 */
23     memory = malloc_chk(memsize * sizeof(WORD), "memory");
24     for(i = 0; i < memsize; i++) {
25         memory[i] = 0x0;
26     }
27     /* CPUの初期化 */
28     cpu = malloc_chk(sizeof(CPU), "cpu");
29     for(i = 0; i < GRSIZE; i++) {
30         cpu->gr[i] = 0x0;
31     }
32     cpu->sp = cpu->pr = cpu->fr = 0x0;
33     /* CASL2プログラムのプロパティ */
34     progprop = malloc_chk(sizeof(PROGPROP), "progprop");
35 }
36
37 /* COMET II仮想マシンのシャットダウン */
38 void shutdown()
39 {
40     free(cpu);
41     free(memory);
42 }