- /* COMET II仮想マシンのリセット */
- reset(memsize, clocks);
- /* アセンブル。ラベル表作成のため、2回行う */
- for(pass = FIRST; pass <= SECOND; pass++) {
- if(pass == FIRST) {
- create_cmdtype_code(); /* 命令の名前とタイプがキーのハッシュ表を作成 */
- asptr = malloc_chk(sizeof(ASPTR), "asptr"); /* アセンブル時のプロパティ用の領域確保 */
- }
- for(i = optind; i < argc; i++) {
- /* データの格納開始位置 */
- if(pass == FIRST) {
- beginptr[i] = asptr->ptr;
- } else if(pass == SECOND) {
- asptr->ptr = beginptr[i];
- }
- asptr->prog = NULL;
- if(execmode.trace == true || execmode.dump == true || asmode.src == true ||
- asmode.label == true || asmode.asdetail == true)
- {
- fprintf(stdout, "\nAssemble %s (%d)\n", argv[i], pass);
- }
- if((res = assemble(argv[i], pass)) == false) {
- freecerr(); /* エラーの解放 */
- exit(-1);
- }
- }
- if(pass == FIRST && asmode.label == true) {
- fprintf(stdout, "\nLabel::::\n");
- printlabel();
- if(asmode.onlylabel == true) {
- return 0;
- }
- }
- if(pass == SECOND) {
- freelabel(); /* ラベルハッシュ表を解放 */
- free_chk(asptr->prog, "asptr.prog"); /* プログラム名を解放 */
- free_chk(asptr, "asptr"); /* アセンブル時のプロパティを解放 */
- free_cmdtype_code(); /* 命令の名前とタイプがキーのハッシュ表を解放 */
- }