//asmpass2.cpp -- pass2 -- @by tsaiwn@csie.nctu.edu.tw /***************** 把檔案從頭到尾讀第二次稱 Pass 2 To Do: (1) scan the input again, generate machine code You will need the symbol table generated in pass1 For example, JUMP 2,OK ? what is the address of OK: ? (2) print out the Source Listing 請參考課本 Chapter 2, P.51 (ORG 相當於課本的 START) 當然也要先看看 asmprot.h 和主程式中define的資料結構 要負責生出 machine code, 由 fpOut 檔輸出 同時也該產生source listing, 由標準輸出(stdout)印出(用printf()即可) ===> 參考我在 pass1 中寫的輸出部份 此部份做好則可將 pass1 中的輸出部份去掉或comment掉 (main 中的也可去掉) ************/ #include #include "asmprot.h" int pass2(FILE* fpIn, FILE* fpOut) { /** 用 strcmp( str1, str2) 來比較字串 **/ /** if(strcmp(str1,str2) == 0 ) { 字串str1 和 str2 相等 } **/ /*********************/ /*********************/ }//pass2