sys                55 include/struct.h extern SYSTEM *sys;
sys               376 src/assemble.c     if(adr >= sys->memsize) {
sys               381 src/assemble.c     (sys->memory)[adr] = word;
sys               813 src/assemble.c     fwrite(sys->memory, sizeof(WORD), execptr->end, fp);
sys               246 src/disassemble.c         cmd = sys->memory[i] & 0xFF00;
sys               249 src/disassemble.c         if(sys->memory[i] == 0) {
sys               256 src/disassemble.c             disassemble_dc(sys->memory[i], i);
sys               259 src/disassemble.c                 disassemble_cmd_adr_x(cmdtype, cmdname, sys->memory[i], sys->memory[i+1], i);
sys               262 src/disassemble.c                 disassemble_cmd_r(cmdtype, cmdname, sys->memory[i], i);
sys                 9 src/dump.c         fprintf(stdout, "#%04X: adr :", sys->cpu->pr);
sys                10 src/dump.c         if(end > sys->memsize) {
sys                11 src/dump.c             end = sys->memsize;
sys                13 src/dump.c         for(int i = 0; i < sys->memsize && i < col; i++) {
sys                22 src/dump.c                 fprintf(stdout, "#%04X: %04X: ", sys->cpu->pr, i);
sys                29 src/dump.c             fprintf(stdout, "%04X", sys->memory[i]);
sys                40 src/dump.c         char *sp = word2bit(sys->cpu->sp);
sys                41 src/dump.c         char *pr = word2bit(sys->cpu->pr);
sys                42 src/dump.c         char *fr = word2bit(sys->cpu->fr);
sys                47 src/dump.c             fprintf(stdout, "#%04X: GR%d: ", sys->cpu->pr, i);
sys                48 src/dump.c             print_dumpword(sys->cpu->gr[i], execmode.logical);
sys                51 src/dump.c         fprintf(stdout, "#%04X: SP:  %6d = #%04X = %s\n", sys->cpu->pr, sys->cpu->sp, sys->cpu->sp, sp);
sys                52 src/dump.c         fprintf(stdout, "#%04X: PR:  %6d = #%04X = %s\n", sys->cpu->pr, sys->cpu->pr, sys->cpu->pr, pr);
sys                53 src/dump.c         fprintf(stdout, "#%04X: FR (OF SF ZF): %s\n", sys->cpu->pr, fr + L3BIT); /* FRは下位3けたを表示 */
sys               107 src/exec.c             sys->memory[sys->cpu->gr[1]] = sys->memory[sys->cpu->gr[2]] = 0x0;
sys               115 src/exec.c             if(sys->cpu->gr[1] + i > execptr->end) {
sys               119 src/exec.c             sys->memory[sys->cpu->gr[1] + i] = buf[i];
sys               121 src/exec.c         sys->memory[sys->cpu->gr[2]] = i + 1;
sys               130 src/exec.c         for(i = 0; i < sys->memory[sys->cpu->gr[2]]; i++) {
sys               131 src/exec.c             if(sys->cpu->gr[1] + i > execptr->end) {
sys               138 src/exec.c             if(((w = sys->memory[sys->cpu->gr[1]+i]) >= 0x20 && w <= 0x7E) ||    /* JIS X 0201ラテン文字 */
sys               151 src/exec.c         sys->cpu->fr = 0x0;
sys               154 src/exec.c             sys->cpu->fr += SF;
sys               158 src/exec.c             sys->cpu->fr += ZF;
sys               168 src/exec.c             setcerr(205, s = pr2str(sys->cpu->pr));    /* r/r1 in word #1 - not GR */
sys               181 src/exec.c             setcerr(206, s = pr2str(sys->cpu->pr));    /* r/r1 in word #1 - not GR */
sys               194 src/exec.c             a += sys->cpu->gr[x];
sys               204 src/exec.c         if((a = get_adr_x(adr, oprx)) >= sys->memsize) {
sys               205 src/exec.c             setcerr(207, s = pr2str(sys->cpu->pr + 1));    /* address in word #2 - out of memory */
sys               209 src/exec.c         return sys->memory[a];
sys               220 src/exec.c         sys->cpu->pr += 1;
sys               225 src/exec.c         WORD w[] = {sys->memory[sys->cpu->pr], sys->memory[sys->cpu->pr + 1]};
sys               226 src/exec.c         setfr(sys->cpu->gr[get_r_r1(w[0])] = get_val_adr_x(w[1], w[0]));
sys               227 src/exec.c         sys->cpu->pr += 2;
sys               232 src/exec.c         WORD w[] = {sys->memory[sys->cpu->pr]};
sys               233 src/exec.c         setfr(sys->cpu->gr[get_r_r1(w[0])] = sys->cpu->gr[get_x_r2(w[0])]);
sys               234 src/exec.c         sys->cpu->pr += 1;
sys               239 src/exec.c         WORD w[] = {sys->memory[sys->cpu->pr], sys->memory[sys->cpu->pr + 1]};
sys               240 src/exec.c         sys->memory[get_adr_x(w[1], w[0])] = sys->cpu->gr[get_r_r1(w[0])];
sys               241 src/exec.c         sys->cpu->pr += 2;
sys               246 src/exec.c         WORD w[] = {sys->memory[sys->cpu->pr], sys->memory[sys->cpu->pr + 1]};
sys               247 src/exec.c         sys->cpu->gr[get_r_r1(w[0])] = get_adr_x(w[1], w[0]);
sys               248 src/exec.c         sys->cpu->pr += 2;
sys               255 src/exec.c         sys->cpu->fr = 0x0;
sys               258 src/exec.c         if((tmp = (short)(sys->cpu->gr[r]) + (short)val) > 32767 || tmp < -32768) {
sys               259 src/exec.c             sys->cpu->fr += OF;
sys               262 src/exec.c         sys->cpu->gr[r] = (WORD)(tmp & 0xFFFF);
sys               263 src/exec.c         if((sys->cpu->gr[r] & 0x8000) == 0x8000) {
sys               264 src/exec.c             sys->cpu->fr += SF;
sys               265 src/exec.c         } else if(sys->cpu->gr[r] == 0x0) {
sys               266 src/exec.c             sys->cpu->fr += ZF;
sys               272 src/exec.c         WORD w[] = {sys->memory[sys->cpu->pr], sys->memory[sys->cpu->pr + 1]};
sys               274 src/exec.c         sys->cpu->pr += 2;
sys               279 src/exec.c         WORD w[] = {sys->memory[sys->cpu->pr]};
sys               280 src/exec.c         adda(get_r_r1(w[0]), sys->cpu->gr[get_x_r2(w[0])]);
sys               281 src/exec.c         sys->cpu->pr += 1;
sys               286 src/exec.c         WORD w[] = {sys->memory[sys->cpu->pr], sys->memory[sys->cpu->pr + 1]};
sys               288 src/exec.c         sys->cpu->pr += 2;
sys               293 src/exec.c         WORD w[] = {sys->memory[sys->cpu->pr]};
sys               294 src/exec.c         adda(get_r_r1(w[0]), ~(sys->cpu->gr[get_x_r2(w[0])]) + 1);
sys               295 src/exec.c         sys->cpu->pr += 1;
sys               303 src/exec.c         o = sys->cpu->gr[r];
sys               304 src/exec.c         sys->cpu->fr = 0;    /* flag initialize */
sys               309 src/exec.c                 sys->cpu->fr += OF;
sys               313 src/exec.c                 sys->cpu->fr += OF;
sys               320 src/exec.c         sys->cpu->gr[r] = (WORD)s;
sys               323 src/exec.c             sys->cpu->fr += SF;
sys               326 src/exec.c             sys->cpu->fr += ZF;
sys               332 src/exec.c         WORD w[] = {sys->memory[sys->cpu->pr], sys->memory[sys->cpu->pr + 1]};
sys               334 src/exec.c         sys->cpu->pr += 2;
sys               339 src/exec.c         WORD w[] = {sys->memory[sys->cpu->pr]};
sys               340 src/exec.c         addl_gr(get_r_r1(w[0]), sys->cpu->gr[get_x_r2(w[0])], true);
sys               341 src/exec.c         sys->cpu->pr += 1;
sys               346 src/exec.c         WORD w[] = {sys->memory[sys->cpu->pr], sys->memory[sys->cpu->pr + 1]};
sys               348 src/exec.c         sys->cpu->pr += 2;
sys               353 src/exec.c         WORD w[] = {sys->memory[sys->cpu->pr]};
sys               354 src/exec.c         addl_gr(get_r_r1(w[0]), sys->cpu->gr[get_x_r2(w[0])], false);
sys               355 src/exec.c         sys->cpu->pr += 1;
sys               360 src/exec.c         WORD w[] = {sys->memory[sys->cpu->pr], sys->memory[sys->cpu->pr + 1]};
sys               361 src/exec.c         setfr(sys->cpu->gr[get_r_r1(w[0])] &= get_val_adr_x(w[1], w[0]));
sys               362 src/exec.c         sys->cpu->pr += 2;
sys               367 src/exec.c         WORD w[] = {sys->memory[sys->cpu->pr]};
sys               368 src/exec.c         setfr(sys->cpu->gr[get_r_r1(w[0])] &= sys->cpu->gr[get_x_r2(w[0])]);
sys               369 src/exec.c         sys->cpu->pr += 1;
sys               374 src/exec.c         WORD w[] = {sys->memory[sys->cpu->pr], sys->memory[sys->cpu->pr + 1]};
sys               375 src/exec.c         setfr(sys->cpu->gr[get_r_r1(w[0])] |= get_val_adr_x(w[1], w[0]));
sys               376 src/exec.c         sys->cpu->pr += 2;
sys               381 src/exec.c         WORD w[] = {sys->memory[sys->cpu->pr]};
sys               382 src/exec.c         setfr(sys->cpu->gr[get_r_r1(w[0])] |= sys->cpu->gr[get_x_r2(w[0])]);
sys               383 src/exec.c         sys->cpu->pr += 1;
sys               388 src/exec.c         WORD w[] = {sys->memory[sys->cpu->pr], sys->memory[sys->cpu->pr + 1]};
sys               389 src/exec.c         setfr(sys->cpu->gr[get_r_r1(w[0])] ^= get_val_adr_x(w[1], w[0]));
sys               390 src/exec.c         sys->cpu->pr += 2;
sys               395 src/exec.c         WORD w[] = {sys->memory[sys->cpu->pr]};
sys               396 src/exec.c         setfr(sys->cpu->gr[get_r_r1(w[0])] ^= sys->cpu->gr[get_x_r2(w[0])]);
sys               397 src/exec.c         sys->cpu->pr += 1;
sys               402 src/exec.c         sys->cpu->fr = 0;
sys               403 src/exec.c         if((short)sys->cpu->gr[r] < (short)val) {
sys               404 src/exec.c             sys->cpu->fr = SF;
sys               405 src/exec.c         } else if(sys->cpu->gr[r] == val) {
sys               406 src/exec.c             sys->cpu->fr = ZF;
sys               412 src/exec.c         WORD w[] = {sys->memory[sys->cpu->pr], sys->memory[sys->cpu->pr + 1]};
sys               414 src/exec.c         sys->cpu->pr += 2;
sys               419 src/exec.c         WORD w[] = {sys->memory[sys->cpu->pr]};
sys               420 src/exec.c         cpa(get_r_r1(w[0]), sys->cpu->gr[get_x_r2(w[0])]);
sys               421 src/exec.c         sys->cpu->pr += 1;
sys               426 src/exec.c         sys->cpu->fr = 0x0;
sys               427 src/exec.c         if(sys->cpu->gr[r] < val) {
sys               428 src/exec.c             sys->cpu->fr = SF;
sys               429 src/exec.c         } else if(sys->cpu->gr[r] == val) {
sys               430 src/exec.c             sys->cpu->fr = ZF;
sys               436 src/exec.c         WORD w[] = {sys->memory[sys->cpu->pr], sys->memory[sys->cpu->pr + 1]};
sys               438 src/exec.c         sys->cpu->pr += 2;
sys               443 src/exec.c         WORD w[] = {sys->memory[sys->cpu->pr]};
sys               444 src/exec.c         cpl(get_r_r1(w[0]), sys->cpu->gr[get_x_r2(w[0])]);
sys               445 src/exec.c         sys->cpu->pr += 1;
sys               450 src/exec.c         WORD w[] = {sys->memory[sys->cpu->pr], sys->memory[sys->cpu->pr + 1]};
sys               452 src/exec.c         WORD sign = sys->cpu->gr[r] & 0x8000;
sys               455 src/exec.c         sys->cpu->fr = 0;
sys               456 src/exec.c         sys->cpu->gr[r] &= 0x7FFF;
sys               458 src/exec.c             last = sys->cpu->gr[r] & 0x4000;
sys               459 src/exec.c             sys->cpu->gr[r] <<= 1;
sys               461 src/exec.c         sys->cpu->gr[r] = sign | (sys->cpu->gr[r] & 0x7FFF);
sys               464 src/exec.c             sys->cpu->fr += OF;
sys               468 src/exec.c             sys->cpu->fr += SF;
sys               471 src/exec.c         if(sys->cpu->gr[r] == 0x0) {
sys               472 src/exec.c             sys->cpu->fr += ZF;
sys               474 src/exec.c         sys->cpu->pr += 2;
sys               479 src/exec.c         WORD w[] = {sys->memory[sys->cpu->pr], sys->memory[sys->cpu->pr + 1]};
sys               481 src/exec.c         WORD sign = sys->cpu->gr[r] & 0x8000;
sys               484 src/exec.c         sys->cpu->fr = 0;
sys               485 src/exec.c         sys->cpu->gr[r] &= 0x7FFF;
sys               487 src/exec.c             last = sys->cpu->gr[r] & 0x1;
sys               488 src/exec.c             sys->cpu->gr[r] >>= 1;
sys               490 src/exec.c                 sys->cpu->gr[r] |= 0x4000;
sys               493 src/exec.c         sys->cpu->gr[r] = sign | sys->cpu->gr[r];
sys               496 src/exec.c             sys->cpu->fr += OF;
sys               500 src/exec.c             sys->cpu->fr += SF;
sys               503 src/exec.c         if(sys->cpu->gr[r] == 0x0) {
sys               504 src/exec.c             sys->cpu->fr += ZF;
sys               506 src/exec.c         sys->cpu->pr += 2;
sys               511 src/exec.c         WORD w[] = {sys->memory[sys->cpu->pr], sys->memory[sys->cpu->pr + 1]};
sys               515 src/exec.c         sys->cpu->fr = 0x0;
sys               517 src/exec.c             last = sys->cpu->gr[r] & 0x8000;
sys               518 src/exec.c             sys->cpu->gr[r] <<= 1;
sys               522 src/exec.c             sys->cpu->fr += OF;
sys               525 src/exec.c         if((sys->cpu->gr[r] & 0x8000) > 0x0) {
sys               526 src/exec.c             sys->cpu->fr += SF;
sys               529 src/exec.c         if(sys->cpu->gr[r] == 0x0) {
sys               530 src/exec.c             sys->cpu->fr += ZF;
sys               532 src/exec.c         sys->cpu->pr += 2;
sys               537 src/exec.c         WORD w[] = {sys->memory[sys->cpu->pr], sys->memory[sys->cpu->pr + 1]};
sys               541 src/exec.c         sys->cpu->fr = 0x0;
sys               543 src/exec.c             last = sys->cpu->gr[r] & 0x0001;
sys               544 src/exec.c             sys->cpu->gr[r] >>= 1;
sys               548 src/exec.c             sys->cpu->fr += OF;
sys               551 src/exec.c         if((sys->cpu->gr[r] & 0x8000) > 0x0) {
sys               552 src/exec.c             sys->cpu->fr += SF;
sys               555 src/exec.c         if(sys->cpu->gr[r] == 0x0) {
sys               556 src/exec.c             sys->cpu->fr += ZF;
sys               558 src/exec.c         sys->cpu->pr += 2;
sys               563 src/exec.c         WORD w[] = {sys->memory[sys->cpu->pr], sys->memory[sys->cpu->pr + 1]};
sys               564 src/exec.c         if((sys->cpu->fr & (SF | ZF)) == 0) {
sys               565 src/exec.c             sys->cpu->pr = get_adr_x(w[1], w[0]);
sys               567 src/exec.c             sys->cpu->pr += 2;
sys               573 src/exec.c         WORD w[] = {sys->memory[sys->cpu->pr], sys->memory[sys->cpu->pr + 1]};
sys               574 src/exec.c         if((sys->cpu->fr & SF) > 0) {
sys               575 src/exec.c             sys->cpu->pr = get_adr_x(w[1], w[0]);
sys               577 src/exec.c             sys->cpu->pr += 2;
sys               583 src/exec.c         WORD w[] = {sys->memory[sys->cpu->pr], sys->memory[sys->cpu->pr + 1]};
sys               584 src/exec.c         if((sys->cpu->fr & ZF) == 0) {
sys               585 src/exec.c             sys->cpu->pr = get_adr_x(w[1], w[0]);
sys               587 src/exec.c             sys->cpu->pr += 2;
sys               593 src/exec.c         WORD w[] = {sys->memory[sys->cpu->pr], sys->memory[sys->cpu->pr + 1]};
sys               594 src/exec.c         if((sys->cpu->fr & ZF) > 0) {
sys               595 src/exec.c             sys->cpu->pr = get_adr_x(w[1], w[0]);
sys               597 src/exec.c             sys->cpu->pr += 2;
sys               603 src/exec.c         WORD w[] = {sys->memory[sys->cpu->pr], sys->memory[sys->cpu->pr + 1]};
sys               604 src/exec.c         if((sys->cpu->fr & OF) > 0) {
sys               605 src/exec.c             sys->cpu->pr = get_adr_x(w[1], w[0]);
sys               607 src/exec.c             sys->cpu->pr += 2;
sys               613 src/exec.c         WORD w[] = {sys->memory[sys->cpu->pr], sys->memory[sys->cpu->pr + 1]};
sys               614 src/exec.c         sys->cpu->pr = get_adr_x(w[1], w[0]);
sys               619 src/exec.c         assert(sys->cpu->sp > execptr->end && sys->cpu->sp <= sys->memsize);
sys               620 src/exec.c         WORD w[] = {sys->memory[sys->cpu->pr], sys->memory[sys->cpu->pr + 1]};
sys               621 src/exec.c         sys->memory[--(sys->cpu->sp)] = get_adr_x(w[1], w[0]);
sys               622 src/exec.c         sys->cpu->pr += 2;
sys               627 src/exec.c         assert(sys->cpu->sp > execptr->end);
sys               628 src/exec.c         WORD w[] = {sys->memory[sys->cpu->pr]};
sys               631 src/exec.c         if(sys->cpu->sp >= sys->memsize) {
sys               632 src/exec.c             setcerr(203, s = pr2str(sys->cpu->pr));        /* Stack Pointer (SP) - stack underflow */
sys               635 src/exec.c             sys->cpu->gr[get_r_r1(w[0])] = sys->memory[(sys->cpu->sp)++];
sys               636 src/exec.c             sys->cpu->pr += 1;
sys               642 src/exec.c         assert(sys->cpu->sp > execptr->end && sys->cpu->sp <= sys->memsize);
sys               643 src/exec.c         WORD w[] = {sys->memory[sys->cpu->pr], sys->memory[sys->cpu->pr + 1]};
sys               644 src/exec.c         sys->memory[--(sys->cpu->sp)] = sys->cpu->pr + 1;
sys               645 src/exec.c         sys->cpu->pr = get_adr_x(w[1], w[0]);
sys               650 src/exec.c         assert(sys->cpu->sp <= sys->memsize);
sys               651 src/exec.c         if(sys->cpu->sp == sys->memsize) {
sys               653 src/exec.c         } else if(sys->cpu->sp < sys->memsize) {
sys               654 src/exec.c             sys->cpu->pr = sys->memory[(sys->cpu->sp)++] + 1;
sys               660 src/exec.c         WORD w[] = {sys->memory[sys->cpu->pr], sys->memory[sys->cpu->pr + 1]};
sys               673 src/exec.c         sys->cpu->pr += 2;
sys               690 src/exec.c         for (sys->cpu->pr = execptr->start; ; ) {
sys               694 src/exec.c                     fprintf(stdout, "#%04X: Register::::\n", sys->cpu->pr);
sys               698 src/exec.c                     fprintf(stdout, "#%04X: Memory::::\n", sys->cpu->pr);
sys               705 src/exec.c                 (execmode.monitor == true && sys->cpu->pr == execptr->start) ||
sys               706 src/exec.c                 execmode.step == true || getbps(sys->cpu->pr) == true)
sys               708 src/exec.c                 if(sys->cpu->pr == execptr->start) {
sys               714 src/exec.c             if(sys->cpu->pr >= sys->memsize) {
sys               715 src/exec.c                 setcerr(201, s = pr2str(sys->cpu->pr));        /* Program Register (PR) - memory overflow */
sys               719 src/exec.c             if(sys->cpu->sp <= execptr->end) {
sys               720 src/exec.c                 setcerr(202, s = pr2str(sys->cpu->pr));        /* Stack Pointer (SP) - stack overflow */
sys               725 src/exec.c             if((cmdptr = getcmdptr(sys->memory[sys->cpu->pr] & 0xFF00)) == NULL) {
sys               726 src/exec.c                 setcerr(204, s = pr2str(sys->cpu->pr));            /* OP in word #1 - not command code */
sys               747 src/exec.c             } while(clock_end - clock_begin < CLOCKS_PER_SEC / sys->clocks);
sys                37 src/load.c         end = start + fread(sys->memory + start, sizeof(WORD), sys->memsize - start, fp);
sys                38 src/load.c         if(end == sys->memsize) {
sys               319 src/monitor.c          reset(sys->memsize, sys->clocks);     /* COMET II仮想マシンのリセット */
sys               327 src/monitor.c              fprintf(stdout, "#%04X: Register::::\n", sys->cpu->pr);
sys               337 src/monitor.c              fprintf(stdout, "#%04X: Register::::\n", sys->cpu->pr);
sys                 7 src/struct.c   SYSTEM *sys = NULL;
sys               255 src/struct.c       sys = malloc_chk(sizeof(SYSTEM), "sys");
sys               257 src/struct.c       sys->memsize = memsize;
sys               259 src/struct.c       sys->clocks = clocks;
sys               261 src/struct.c       sys->memory = calloc_chk(sys->memsize, sizeof(WORD), "memory");
sys               263 src/struct.c       sys->cpu = malloc_chk(sizeof(CPU), "cpu");
sys               265 src/struct.c           sys->cpu->gr[i] = 0x0;
sys               267 src/struct.c       sys->cpu->sp = sys->memsize;   /* スタックポインタ */
sys               268 src/struct.c       sys->cpu->pr = 0x0;            /* プログラムレジスタ */
sys               269 src/struct.c       sys->cpu->fr = 0x0;            /* フラグレジスタ */
sys               281 src/struct.c       FREE(sys->memory);
sys               282 src/struct.c       FREE(sys->cpu);
sys               283 src/struct.c       FREE(sys);