root/doc_inner/doxygen/latex/monitor_8c_source.tex

/* [<][>][^][v][top][bottom][index][help] */
\doxysection{monitor.\+c}
\label{monitor_8c_source}\index{src/monitor.c@{src/monitor.c}}
\textbf{ Go to the documentation of this file.}
\begin{DoxyCode}{0}
\DoxyCodeLine{00001\ \textcolor{preprocessor}{\#include\ "{}monitor.h"{}}}
\DoxyCodeLine{00002\ }
\DoxyCodeLine{00006\ \textcolor{keyword}{static}\ BPSLIST\ *bps[BPSTABSIZE];}
\DoxyCodeLine{00007\ }
\DoxyCodeLine{00011\ \textcolor{keyword}{static}\ \textcolor{keywordtype}{char}\ *monitor\_prompt\ =\ \textcolor{stringliteral}{"{}(comet2\ monitor)"{}};}
\DoxyCodeLine{00012\ }
\DoxyCodeLine{00013\ \textcolor{keywordtype}{unsigned}\ adrhash(WORD\ adr)}
\DoxyCodeLine{00014\ \{}
\DoxyCodeLine{00015\ \ \ \ \ HKEY\ *key[1];}
\DoxyCodeLine{00016\ \ \ \ \ \textcolor{keywordtype}{unsigned}\ h;}
\DoxyCodeLine{00017\ \ \ \ \ key[0]\ =\ malloc\_chk(\textcolor{keyword}{sizeof}(HKEY),\ \textcolor{stringliteral}{"{}adrhash.key"{}});}
\DoxyCodeLine{00018\ \ \ \ \ key[0]-\/>type\ =\ INT;}
\DoxyCodeLine{00019\ \ \ \ \ key[0]-\/>val.i\ =\ adr;}
\DoxyCodeLine{00020\ \ \ \ \ h\ =\ hash(1,\ key,\ BPSTABSIZE);}
\DoxyCodeLine{00021\ \ \ \ \ FREE(key[0]);}
\DoxyCodeLine{00022\ \ \ \ \ \textcolor{keywordflow}{return}\ h;}
\DoxyCodeLine{00023\ \}}
\DoxyCodeLine{00024\ }
\DoxyCodeLine{00025\ \textcolor{keywordtype}{bool}\ getbps(WORD\ adr)}
\DoxyCodeLine{00026\ \{}
\DoxyCodeLine{00027\ \ \ \ \ BPSLIST\ *p\ =\ NULL;}
\DoxyCodeLine{00028\ }
\DoxyCodeLine{00029\ \ \ \ \ \textcolor{keywordflow}{for}(p\ =\ bps[adrhash(adr)];\ p\ !=\ NULL;\ p\ =\ p-\/>next)\ \{}
\DoxyCodeLine{00030\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}(p-\/>adr\ ==\ adr)\ \{}
\DoxyCodeLine{00031\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{true};}
\DoxyCodeLine{00032\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00033\ \ \ \ \ \}}
\DoxyCodeLine{00034\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{00035\ \}}
\DoxyCodeLine{00036\ }
\DoxyCodeLine{00037\ \textcolor{keywordtype}{bool}\ addbps(WORD\ adr)}
\DoxyCodeLine{00038\ \{}
\DoxyCodeLine{00039\ \ \ \ \ BPSLIST\ *p\ =\ NULL;}
\DoxyCodeLine{00040\ \ \ \ \ \textcolor{keywordtype}{unsigned}\ h\ =\ 0;}
\DoxyCodeLine{00041\ }
\DoxyCodeLine{00042\ \ \ \ \ \textcolor{comment}{/*\ 登録されたラベルを検索。すでに登録されている場合は終了\ */}}
\DoxyCodeLine{00043\ \ \ \ \ \textcolor{keywordflow}{if}(getbps(adr)\ ==\ \textcolor{keyword}{true})\ \{}
\DoxyCodeLine{00044\ \ \ \ \ \ \ \ \ fprintf(stderr,\ \textcolor{stringliteral}{"{}\%04X:\ Breakpoint\ is\ already\ defined.\(\backslash\)n"{}},\ adr);}
\DoxyCodeLine{00045\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{00046\ \ \ \ \ \}}
\DoxyCodeLine{00047\ \ \ \ \ \textcolor{comment}{/*\ メモリを確保\ */}}
\DoxyCodeLine{00048\ \ \ \ \ p\ =\ malloc\_chk(\textcolor{keyword}{sizeof}(BPSLIST),\ \textcolor{stringliteral}{"{}bps.next"{}});}
\DoxyCodeLine{00049\ \ \ \ \ \textcolor{comment}{/*\ アドレスを設定\ */}}
\DoxyCodeLine{00050\ \ \ \ \ p-\/>adr\ =\ adr;}
\DoxyCodeLine{00051\ \ \ \ \ \textcolor{comment}{/*\ ハッシュ表へ追加\ */}}
\DoxyCodeLine{00052\ \ \ \ \ p-\/>next\ =\ bps[h\ =\ adrhash(adr)];}
\DoxyCodeLine{00053\ \ \ \ \ bps[h]\ =\ p;}
\DoxyCodeLine{00054\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{true};}
\DoxyCodeLine{00055\ \}}
\DoxyCodeLine{00056\ }
\DoxyCodeLine{00057\ \textcolor{keywordtype}{bool}\ delbps(WORD\ adr)}
\DoxyCodeLine{00058\ \{}
\DoxyCodeLine{00059\ \ \ \ \ BPSLIST\ *p\ =\ NULL;}
\DoxyCodeLine{00060\ \ \ \ \ BPSLIST\ *q\ =\ NULL;}
\DoxyCodeLine{00061\ \ \ \ \ \textcolor{keywordtype}{unsigned}\ h\ =\ 0;}
\DoxyCodeLine{00062\ \ \ \ \ \textcolor{keywordtype}{bool}\ res\ =\ \textcolor{keyword}{false};}
\DoxyCodeLine{00063\ }
\DoxyCodeLine{00064\ \ \ \ \ p\ =\ bps[h\ =\ adrhash(adr)];}
\DoxyCodeLine{00065\ \ \ \ \ \textcolor{keywordflow}{if}(p\ !=\ NULL)\ \{}
\DoxyCodeLine{00066\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}(p-\/>adr\ ==\ adr)\ \{}
\DoxyCodeLine{00067\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}(p-\/>next\ ==\ NULL)\ \{}
\DoxyCodeLine{00068\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ FREE(bps[h]);}
\DoxyCodeLine{00069\ \ \ \ \ \ \ \ \ \ \ \ \ \}\ \textcolor{keywordflow}{else}\ \{}
\DoxyCodeLine{00070\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ bps[h]\ =\ p-\/>next;}
\DoxyCodeLine{00071\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ FREE(p);}
\DoxyCodeLine{00072\ \ \ \ \ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00073\ \ \ \ \ \ \ \ \ \ \ \ \ res\ =\ \textcolor{keyword}{true};}
\DoxyCodeLine{00074\ \ \ \ \ \ \ \ \ \}\ \textcolor{keywordflow}{else}\ \{}
\DoxyCodeLine{00075\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{for}(;\ p-\/>next\ !=\ NULL;\ p\ =\ p-\/>next)\ \{}
\DoxyCodeLine{00076\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ q\ =\ p-\/>next;}
\DoxyCodeLine{00077\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}(q-\/>adr\ ==\ adr)\ \{}
\DoxyCodeLine{00078\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ p-\/>next\ =\ q-\/>next;}
\DoxyCodeLine{00079\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ FREE(q);}
\DoxyCodeLine{00080\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ res\ =\ \textcolor{keyword}{true};}
\DoxyCodeLine{00081\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{break};}
\DoxyCodeLine{00082\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00083\ \ \ \ \ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00084\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00085\ \ \ \ \ \}}
\DoxyCodeLine{00086\ \ \ \ \ \textcolor{keywordflow}{return}\ res;}
\DoxyCodeLine{00087\ \}}
\DoxyCodeLine{00088\ }
\DoxyCodeLine{00089\ \textcolor{keywordtype}{void}\ listbps()}
\DoxyCodeLine{00090\ \{}
\DoxyCodeLine{00091\ \ \ \ \ \textcolor{keywordtype}{int}\ cnt\ =\ 0;}
\DoxyCodeLine{00092\ \ \ \ \ BPSLIST\ *p\ =\ NULL;}
\DoxyCodeLine{00093\ }
\DoxyCodeLine{00094\ \ \ \ \ fprintf(stdout,\ \textcolor{stringliteral}{"{}List\ of\ breakpoints\(\backslash\)n"{}});}
\DoxyCodeLine{00095\ \ \ \ \ \textcolor{keywordflow}{for}(\textcolor{keywordtype}{int}\ i\ =\ 0;\ i\ <\ BPSTABSIZE;\ i++)\ \{}
\DoxyCodeLine{00096\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{for}(p\ =\ bps[i];\ p\ !=\ NULL;\ p\ =\ p-\/>next)\ \{}
\DoxyCodeLine{00097\ \ \ \ \ \ \ \ \ \ \ \ \ fprintf(stdout,\ \textcolor{stringliteral}{"{}\#\%04X\(\backslash\)n"{}},\ p-\/>adr);}
\DoxyCodeLine{00098\ \ \ \ \ \ \ \ \ \ \ \ \ cnt++;}
\DoxyCodeLine{00099\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00100\ \ \ \ \ \}}
\DoxyCodeLine{00101\ \ \ \ \ \textcolor{keywordflow}{if}(cnt\ ==\ 0)\ \{}
\DoxyCodeLine{00102\ \ \ \ \ \ \ \ \ fprintf(stdout,\ \textcolor{stringliteral}{"{}(No\ breakpoints.)\(\backslash\)n"{}});}
\DoxyCodeLine{00103\ \ \ \ \ \}}
\DoxyCodeLine{00104\ \}}
\DoxyCodeLine{00105\ }
\DoxyCodeLine{00106\ \textcolor{keywordtype}{void}\ freebpslist(BPSLIST\ *head)}
\DoxyCodeLine{00107\ \{}
\DoxyCodeLine{00108\ \ \ \ \ BPSLIST\ *p\ =\ NULL;}
\DoxyCodeLine{00109\ \ \ \ \ BPSLIST\ *q\ =\ NULL;}
\DoxyCodeLine{00110\ \ \ \ \ \textcolor{keywordflow}{for}(p\ =\ head;\ p\ !=\ NULL;\ p\ =\ q)\ \{}
\DoxyCodeLine{00111\ \ \ \ \ \ \ \ \ q\ =\ p-\/>next;}
\DoxyCodeLine{00112\ \ \ \ \ \ \ \ \ FREE(p);}
\DoxyCodeLine{00113\ \ \ \ \ \}}
\DoxyCodeLine{00114\ \}}
\DoxyCodeLine{00115\ }
\DoxyCodeLine{00116\ \textcolor{keywordtype}{void}\ freebps()}
\DoxyCodeLine{00117\ \{}
\DoxyCodeLine{00118\ \ \ \ \ \textcolor{keywordflow}{for}(\textcolor{keywordtype}{int}\ i\ =\ 0;\ i\ <\ BPSTABSIZE;\ i++)\ \{}
\DoxyCodeLine{00119\ \ \ \ \ \ \ \ \ freebpslist(bps[i]);}
\DoxyCodeLine{00120\ \ \ \ \ \ \ \ \ bps[i]\ =\ NULL;}
\DoxyCodeLine{00121\ \ \ \ \ \}}
\DoxyCodeLine{00122\ \}}
\DoxyCodeLine{00123\ }
\DoxyCodeLine{00124\ MONARGS\ *monargstok(\textcolor{keyword}{const}\ \textcolor{keywordtype}{char}\ *str)}
\DoxyCodeLine{00125\ \{}
\DoxyCodeLine{00126\ \ \ \ \ MONARGS\ *args\ =\ malloc\_chk(\textcolor{keyword}{sizeof}(MONARGS),\ \textcolor{stringliteral}{"{}args"{}});}
\DoxyCodeLine{00127\ \ \ \ \ \textcolor{keywordtype}{char}\ *tok\ =\ NULL;}
\DoxyCodeLine{00128\ \ \ \ \ \textcolor{keywordtype}{char}\ *p\ =\ NULL;}
\DoxyCodeLine{00129\ \ \ \ \ \textcolor{keywordtype}{char}\ sepc\ =\ \textcolor{charliteral}{'\ '};}
\DoxyCodeLine{00130\ }
\DoxyCodeLine{00131\ \ \ \ \ args-\/>argc\ =\ 0;}
\DoxyCodeLine{00132\ \ \ \ \ \textcolor{keywordflow}{if}(!str\ ||\ !str[0])\ \{}
\DoxyCodeLine{00133\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ args;}
\DoxyCodeLine{00134\ \ \ \ \ \}}
\DoxyCodeLine{00135\ \ \ \ \ tok\ =\ p\ =\ strdup\_chk(str,\ \textcolor{stringliteral}{"{}argstok.p"{}});}
\DoxyCodeLine{00136\ \ \ \ \ \textcolor{keywordflow}{do}\ \{}
\DoxyCodeLine{00137\ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{int}\ i\ =\ strcspn(p,\ \textcolor{stringliteral}{"{}\ "{}});}
\DoxyCodeLine{00138\ \ \ \ \ \ \ \ \ sepc\ =\ p[i];}
\DoxyCodeLine{00139\ \ \ \ \ \ \ \ \ args-\/>argv[(args-\/>argc)++]\ =\ strndup\_chk(p,\ i,\ \textcolor{stringliteral}{"{}args-\/>argv[]"{}});}
\DoxyCodeLine{00140\ \ \ \ \ \ \ \ \ p\ +=\ i\ +\ 1;}
\DoxyCodeLine{00141\ \ \ \ \ \}\ \textcolor{keywordflow}{while}(sepc\ ==\ \textcolor{charliteral}{'\ '});}
\DoxyCodeLine{00142\ \ \ \ \ FREE(tok);}
\DoxyCodeLine{00143\ \ \ \ \ \textcolor{keywordflow}{return}\ args;}
\DoxyCodeLine{00144\ \}}
\DoxyCodeLine{00145\ }
\DoxyCodeLine{00146\ MONCMDLINE\ *monlinetok(\textcolor{keyword}{const}\ \textcolor{keywordtype}{char}\ *line)}
\DoxyCodeLine{00147\ \{}
\DoxyCodeLine{00148\ \ \ \ \ \textcolor{keywordtype}{char}\ *tokens\ =\ NULL;}
\DoxyCodeLine{00149\ \ \ \ \ \textcolor{keywordtype}{char}\ *p\ =\ NULL;}
\DoxyCodeLine{00150\ \ \ \ \ \textcolor{keywordtype}{int}\ i\ =\ 0;}
\DoxyCodeLine{00151\ \ \ \ \ MONCMDLINE\ *moncmdl\ =\ NULL;}
\DoxyCodeLine{00152\ }
\DoxyCodeLine{00153\ \ \ \ \ \textcolor{keywordflow}{if}(!line[0]\ ||\ line[0]\ ==\ \textcolor{charliteral}{'\(\backslash\)n'})\ \{}
\DoxyCodeLine{00154\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ NULL;}
\DoxyCodeLine{00155\ \ \ \ \ \}}
\DoxyCodeLine{00156\ \ \ \ \ p\ =\ tokens\ =\ strdup\_chk(line,\ \textcolor{stringliteral}{"{}tokens"{}});}
\DoxyCodeLine{00157\ \ \ \ \ \textcolor{comment}{/*\ コメントを削除\ */}}
\DoxyCodeLine{00158\ \ \ \ \ strip\_casl2\_comment(p);}
\DoxyCodeLine{00159\ \ \ \ \ \textcolor{comment}{/*\ 文字列末尾の改行と空白を削除\ */}}
\DoxyCodeLine{00160\ \ \ \ \ strip\_end(p);}
\DoxyCodeLine{00161\ }
\DoxyCodeLine{00162\ \ \ \ \ moncmdl\ =\ malloc\_chk(\textcolor{keyword}{sizeof}(MONCMDLINE),\ \textcolor{stringliteral}{"{}moncmdl"{}});}
\DoxyCodeLine{00163\ \ \ \ \ \textcolor{comment}{/*\ コマンドの取得\ */}}
\DoxyCodeLine{00164\ \ \ \ \ i\ =\ strcspn(p,\ \textcolor{stringliteral}{"{}\ \(\backslash\)t\(\backslash\)n"{}});}
\DoxyCodeLine{00165\ \ \ \ \ moncmdl-\/>cmd\ =\ strndup\_chk(p,\ i,\ \textcolor{stringliteral}{"{}moncmdl-\/>cmd"{}});}
\DoxyCodeLine{00166\ \ \ \ \ \textcolor{comment}{/*\ コマンドと引数の間の空白をスキップ\ */}}
\DoxyCodeLine{00167\ \ \ \ \ p\ +=\ i;}
\DoxyCodeLine{00168\ \ \ \ \ \textcolor{keywordflow}{while}(*p\ ==\ \textcolor{charliteral}{'\ '}\ ||\ *p\ ==\ \textcolor{charliteral}{'\(\backslash\)t'})\ \{}
\DoxyCodeLine{00169\ \ \ \ \ \ \ \ \ p++;}
\DoxyCodeLine{00170\ \ \ \ \ \}}
\DoxyCodeLine{00171\ \ \ \ \ \textcolor{comment}{/*\ 引数として、改行までの文字列を取得\ */}}
\DoxyCodeLine{00172\ \ \ \ \ \textcolor{keywordflow}{if}(strcspn(p,\ \textcolor{stringliteral}{"{}\(\backslash\)n"{}})\ >\ 0)\ \{}
\DoxyCodeLine{00173\ \ \ \ \ \ \ \ \ moncmdl-\/>args\ =\ monargstok(p);}
\DoxyCodeLine{00174\ \ \ \ \ \}\ \textcolor{keywordflow}{else}\ \{}
\DoxyCodeLine{00175\ \ \ \ \ \ \ \ \ moncmdl-\/>args\ =\ malloc\_chk(\textcolor{keyword}{sizeof}(MONARGS),\ \textcolor{stringliteral}{"{}moncmdl.args"{}});}
\DoxyCodeLine{00176\ \ \ \ \ \ \ \ \ moncmdl-\/>args-\/>argc\ =\ 0;}
\DoxyCodeLine{00177\ \ \ \ \ \}}
\DoxyCodeLine{00178\ \ \ \ \ FREE(tokens);}
\DoxyCodeLine{00179\ \ \ \ \ \textcolor{keywordflow}{return}\ moncmdl;}
\DoxyCodeLine{00180\ \}}
\DoxyCodeLine{00181\ }
\DoxyCodeLine{00182\ \textcolor{keywordtype}{bool}\ stracmp(\textcolor{keywordtype}{char}\ *str1,\ \textcolor{keywordtype}{int}\ str2c,\ \textcolor{keywordtype}{char}\ *str2v[])}
\DoxyCodeLine{00183\ \{}
\DoxyCodeLine{00184\ \ \ \ \ \textcolor{keywordtype}{int}\ i;}
\DoxyCodeLine{00185\ \ \ \ \ \textcolor{keywordflow}{if}(str1\ ==\ NULL)\ \{}
\DoxyCodeLine{00186\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{00187\ \ \ \ \ \}}
\DoxyCodeLine{00188\ \ \ \ \ \textcolor{keywordflow}{for}(i\ =\ 0;\ i\ <\ str2c;\ i++)\ \{}
\DoxyCodeLine{00189\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}(strcmp(str1,\ str2v[i])\ ==\ 0)\ \{}
\DoxyCodeLine{00190\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{true};}
\DoxyCodeLine{00191\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00192\ \ \ \ \ \}}
\DoxyCodeLine{00193\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{00194\ \}}
\DoxyCodeLine{00195\ }
\DoxyCodeLine{00196\ \textcolor{keywordtype}{void}\ warn\_ignore\_arg(\textcolor{keywordtype}{int}\ argc,\ \textcolor{keywordtype}{char}\ *argv[])}
\DoxyCodeLine{00197\ \{}
\DoxyCodeLine{00198\ \ \ \ \ \textcolor{keywordtype}{int}\ i;}
\DoxyCodeLine{00199\ \ \ \ \ \textcolor{keywordflow}{for}(i\ =\ 0;\ i\ <\ argc;\ i++)\ \{}
\DoxyCodeLine{00200\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}(i\ >\ 0)\ \{}
\DoxyCodeLine{00201\ \ \ \ \ \ \ \ \ \ \ \ \ fprintf(stderr,\ \textcolor{stringliteral}{"{}\ "{}});}
\DoxyCodeLine{00202\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00203\ \ \ \ \ \ \ \ \ fprintf(stderr,\ \textcolor{stringliteral}{"{}\%s"{}},\ argv[i]);}
\DoxyCodeLine{00204\ \ \ \ \ \}}
\DoxyCodeLine{00205\ \ \ \ \ fprintf(stderr,\ \textcolor{stringliteral}{"{}:\ ignored.\(\backslash\)n"{}});}
\DoxyCodeLine{00206\ \}}
\DoxyCodeLine{00207\ }
\DoxyCodeLine{00208\ \textcolor{keywordtype}{void}\ mon\_break(\textcolor{keywordtype}{int}\ argc,\ \textcolor{keywordtype}{char}\ *argv[])}
\DoxyCodeLine{00209\ \{}
\DoxyCodeLine{00210\ \ \ \ \ WORD\ w;}
\DoxyCodeLine{00211\ \ \ \ \ \textcolor{keywordtype}{int}\ i\ =\ 0;}
\DoxyCodeLine{00212\ \ \ \ \ \textcolor{keywordflow}{if}(stracmp(argv[0],\ 2,\ (\textcolor{keywordtype}{char}*\ [])\{\textcolor{stringliteral}{"{}l"{}},\ \textcolor{stringliteral}{"{}list"{}}\}))\ \{}
\DoxyCodeLine{00213\ \ \ \ \ \ \ \ \ i++;}
\DoxyCodeLine{00214\ \ \ \ \ \ \ \ \ listbps();}
\DoxyCodeLine{00215\ \ \ \ \ \}\ \textcolor{keywordflow}{else}\ \textcolor{keywordflow}{if}(stracmp(argv[0],\ 2,\ (\textcolor{keywordtype}{char}*\ [])\{\textcolor{stringliteral}{"{}r"{}},\ \textcolor{stringliteral}{"{}reset"{}}\}))\ \{}
\DoxyCodeLine{00216\ \ \ \ \ \ \ \ \ i++;}
\DoxyCodeLine{00217\ \ \ \ \ \ \ \ \ freebps();}
\DoxyCodeLine{00218\ \ \ \ \ \ \ \ \ fprintf(stdout,\ \textcolor{stringliteral}{"{}All\ breakpoints\ are\ deleted.\(\backslash\)n"{}});}
\DoxyCodeLine{00219\ \ \ \ \ \}\ \textcolor{keywordflow}{else}\ \{}
\DoxyCodeLine{00220\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}(argc\ >\ 1)\ \{}
\DoxyCodeLine{00221\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}((w\ =\ nh2word(argv[1]))\ ==\ 0x0)\ \{}
\DoxyCodeLine{00222\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ fprintf(stderr,\ \textcolor{stringliteral}{"{}\%s:\ address\ error\(\backslash\)n"{}},\ argv[1]);}
\DoxyCodeLine{00223\ \ \ \ \ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00224\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00225\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}(stracmp(argv[0],\ 2,\ (\textcolor{keywordtype}{char}*\ [])\{\textcolor{stringliteral}{"{}a"{}},\ \textcolor{stringliteral}{"{}add"{}}\}))\ \{}
\DoxyCodeLine{00226\ \ \ \ \ \ \ \ \ \ \ \ \ i\ +=\ 2;}
\DoxyCodeLine{00227\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}(addbps(w)\ ==\ \textcolor{keyword}{true})\ \{}
\DoxyCodeLine{00228\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ fprintf(stdout,\ \textcolor{stringliteral}{"{}\#\%04X:\ breakpoint\ added\(\backslash\)n"{}},\ w);}
\DoxyCodeLine{00229\ \ \ \ \ \ \ \ \ \ \ \ \ \}\ \textcolor{keywordflow}{else}\ \{}
\DoxyCodeLine{00230\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ fprintf(stdout,\ \textcolor{stringliteral}{"{}No\ breakpoint\ added\(\backslash\)n"{}});}
\DoxyCodeLine{00231\ \ \ \ \ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00232\ \ \ \ \ \ \ \ \ \}\ \textcolor{keywordflow}{else}\ \textcolor{keywordflow}{if}(stracmp(argv[0],\ 2,\ (\textcolor{keywordtype}{char}*\ [])\{\textcolor{stringliteral}{"{}d"{}},\ \textcolor{stringliteral}{"{}del"{}}\}))\ \{}
\DoxyCodeLine{00233\ \ \ \ \ \ \ \ \ \ \ \ \ i\ +=\ 2;}
\DoxyCodeLine{00234\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}(delbps(w)\ ==\ \textcolor{keyword}{true})\ \{}
\DoxyCodeLine{00235\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ fprintf(stdout,\ \textcolor{stringliteral}{"{}\#\%04X:\ breakpoint\ deleted\(\backslash\)n"{}},\ w);}
\DoxyCodeLine{00236\ \ \ \ \ \ \ \ \ \ \ \ \ \}\ \textcolor{keywordflow}{else}\ \{}
\DoxyCodeLine{00237\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ fprintf(stdout,\ \textcolor{stringliteral}{"{}No\ breakpoint\ deleted\(\backslash\)n"{}});}
\DoxyCodeLine{00238\ \ \ \ \ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00239\ \ \ \ \ \ \ \ \ \}\ \textcolor{keywordflow}{else}\ \textcolor{keywordflow}{if}(stracmp(argv[0],\ 3,\ (\textcolor{keywordtype}{char}*\ [])\{\textcolor{stringliteral}{"{}?"{}},\ \textcolor{stringliteral}{"{}h"{}},\ \textcolor{stringliteral}{"{}help"{}}\}))\ \{}
\DoxyCodeLine{00240\ \ \ \ \ \ \ \ \ \ \ \ \ i++;}
\DoxyCodeLine{00241\ \ \ \ \ \ \ \ \ \ \ \ \ fprintf(stdout,\ \textcolor{stringliteral}{"{}breakpoint\ manipulate:\(\backslash\)n"{}});}
\DoxyCodeLine{00242\ \ \ \ \ \ \ \ \ \ \ \ \ fprintf(stdout,\ \textcolor{stringliteral}{"{}\ \ \ \ b[reak]\ a[dd]\ <address>\(\backslash\)n"{}});}
\DoxyCodeLine{00243\ \ \ \ \ \ \ \ \ \ \ \ \ fprintf(stdout,\ \textcolor{stringliteral}{"{}\ \ \ \ b[reak]\ d[el]\ <address>\(\backslash\)n"{}});}
\DoxyCodeLine{00244\ \ \ \ \ \ \ \ \ \ \ \ \ fprintf(stdout,\ \textcolor{stringliteral}{"{}\ \ \ \ b[reak]\ l[ist]\(\backslash\)n"{}});}
\DoxyCodeLine{00245\ \ \ \ \ \ \ \ \ \ \ \ \ fprintf(stdout,\ \textcolor{stringliteral}{"{}\ \ \ \ b[reak]\ r[eset]\(\backslash\)n"{}});}
\DoxyCodeLine{00246\ \ \ \ \ \ \ \ \ \}\ \textcolor{keywordflow}{else}\ \{}
\DoxyCodeLine{00247\ \ \ \ \ \ \ \ \ \ \ \ \ fprintf(stderr,\ \textcolor{stringliteral}{"{}\%s:\ Not\ breakpoint\ manipulate\ command.\ see\ \`{}b\ ?'.\(\backslash\)n"{}},\ argv[0]);}
\DoxyCodeLine{00248\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00249\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}(argc\ >\ i)\ \{}
\DoxyCodeLine{00250\ \ \ \ \ \ \ \ \ \ \ \ \ warn\_ignore\_arg(argc\ -\/\ i,\ argv\ +\ i);}
\DoxyCodeLine{00251\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00252\ \ \ \ \ \}}
\DoxyCodeLine{00253\ \}}
\DoxyCodeLine{00254\ }
\DoxyCodeLine{00255\ \textcolor{keywordtype}{void}\ mon\_dump(\textcolor{keywordtype}{int}\ argc,\ \textcolor{keywordtype}{char}\ *argv[])}
\DoxyCodeLine{00256\ \{}
\DoxyCodeLine{00257\ \ \ \ \ \textcolor{keywordtype}{int}\ i\ =\ 0;}
\DoxyCodeLine{00258\ \ \ \ \ WORD\ dump\_start\ =\ 0,\ dump\_end\ =\ 0x40;}
\DoxyCodeLine{00259\ \ \ \ \ \textcolor{keywordflow}{if}(argc\ >\ 0\ \&\&\ stracmp(argv[0],\ 2,\ (\textcolor{keywordtype}{char}*\ [])\{\textcolor{stringliteral}{"{}a"{}},\ \textcolor{stringliteral}{"{}auto"{}}\}))\ \{}
\DoxyCodeLine{00260\ \ \ \ \ \ \ \ \ execmode.dump\ =\ \textcolor{keyword}{true};}
\DoxyCodeLine{00261\ \ \ \ \ \ \ \ \ i++;}
\DoxyCodeLine{00262\ \ \ \ \ \}\ \textcolor{keywordflow}{else}\ \textcolor{keywordflow}{if}(argc\ >\ 0\ \&\&\ stracmp(argv[0],\ 2,\ (\textcolor{keywordtype}{char}*\ [])\{\textcolor{stringliteral}{"{}no"{}},\ \textcolor{stringliteral}{"{}noauto"{}}\}))\ \{}
\DoxyCodeLine{00263\ \ \ \ \ \ \ \ \ execmode.dump\ =\ \textcolor{keyword}{false};}
\DoxyCodeLine{00264\ \ \ \ \ \ \ \ \ i++;}
\DoxyCodeLine{00265\ \ \ \ \ \}}
\DoxyCodeLine{00266\ \ \ \ \ \textcolor{keywordflow}{if}(argc\ >\ i)\ \{}
\DoxyCodeLine{00267\ \ \ \ \ \ \ \ \ dump\_start\ =\ nh2word(argv[i++]);}
\DoxyCodeLine{00268\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}(argc\ >\ i)\ \{}
\DoxyCodeLine{00269\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}(argv[i][0]\ ==\textcolor{charliteral}{'+'})\ \{}
\DoxyCodeLine{00270\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ dump\_end\ =\ dump\_start\ +\ nh2word(argv[i]\ +\ 1);}
\DoxyCodeLine{00271\ \ \ \ \ \ \ \ \ \ \ \ \ \}\ \textcolor{keywordflow}{else}\ \{}
\DoxyCodeLine{00272\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ dump\_end\ =\ nh2word(argv[i]);}
\DoxyCodeLine{00273\ \ \ \ \ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00274\ \ \ \ \ \ \ \ \ \}\ \textcolor{keywordflow}{else}\ \{}
\DoxyCodeLine{00275\ \ \ \ \ \ \ \ \ \ \ \ \ dump\_end\ +=\ dump\_start;}
\DoxyCodeLine{00276\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00277\ \ \ \ \ \ \ \ \ i++;}
\DoxyCodeLine{00278\ \ \ \ \ \}}
\DoxyCodeLine{00279\ \ \ \ \ \textcolor{keywordflow}{if}(argc\ >\ i)\ \{}
\DoxyCodeLine{00280\ \ \ \ \ \ \ \ \ warn\_ignore\_arg(argc\ -\/\ i,\ argv\ +\ i);}
\DoxyCodeLine{00281\ \ \ \ \ \}}
\DoxyCodeLine{00282\ \ \ \ \ dumpmemory(dump\_start,\ dump\_end);}
\DoxyCodeLine{00283\ \ \ \ \ execmode.dump\_start\ =\ dump\_start;}
\DoxyCodeLine{00284\ \ \ \ \ execmode.dump\_end\ =\ dump\_end;}
\DoxyCodeLine{00285\ \}}
\DoxyCodeLine{00286\ }
\DoxyCodeLine{00287\ MONCMDTYPE\ monitorcmd(\textcolor{keywordtype}{char}\ *cmd,\ MONARGS\ *args)}
\DoxyCodeLine{00288\ \{}
\DoxyCodeLine{00289\ \ \ \ \ MONCMDTYPE\ cmdtype\ =\ MONREPEAT;}
\DoxyCodeLine{00290\ \ \ \ \ \textcolor{keywordflow}{if}(stracmp(cmd,\ 2,\ (\textcolor{keywordtype}{char}*\ [])\{\textcolor{stringliteral}{"{}a"{}},\ \textcolor{stringliteral}{"{}assemble"{}}\}))\ \{}
\DoxyCodeLine{00291\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}(args-\/>argc\ ==\ 0)\ \{}
\DoxyCodeLine{00292\ \ \ \ \ \ \ \ \ \ \ \ \ fprintf(stderr,\ \textcolor{stringliteral}{"{}Error:\ Input\ file\ name.\(\backslash\)n"{}});}
\DoxyCodeLine{00293\ \ \ \ \ \ \ \ \ \}\ \textcolor{keywordflow}{else}\ \textcolor{keywordflow}{if}(args-\/>argc\ ==\ 1)\ \{}
\DoxyCodeLine{00294\ \ \ \ \ \ \ \ \ \ \ \ \ assemble(1,\ (\textcolor{keywordtype}{char}*\ [])\{args-\/>argv[0]\},\ 0);}
\DoxyCodeLine{00295\ \ \ \ \ \ \ \ \ \}\ \textcolor{keywordflow}{else}\ \{}
\DoxyCodeLine{00296\ \ \ \ \ \ \ \ \ \ \ \ \ assemble(1,\ (\textcolor{keywordtype}{char}*\ [])\{args-\/>argv[0]\},\ nh2word(args-\/>argv[1]));}
\DoxyCodeLine{00297\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00298\ \ \ \ \ \}\ \textcolor{keywordflow}{else}\ \textcolor{keywordflow}{if}(stracmp(cmd,\ 2,\ (\textcolor{keywordtype}{char}*\ [])\{\textcolor{stringliteral}{"{}b"{}},\ \textcolor{stringliteral}{"{}break"{}}\}))\ \{}
\DoxyCodeLine{00299\ \ \ \ \ \ \ \ \ mon\_break(args-\/>argc,\ args-\/>argv);}
\DoxyCodeLine{00300\ \ \ \ \ \}\ \textcolor{keywordflow}{else}\ \textcolor{keywordflow}{if}(stracmp(cmd,\ 2,\ (\textcolor{keywordtype}{char}*\ [])\{\textcolor{stringliteral}{"{}c"{}},\ \textcolor{stringliteral}{"{}continue"{}}\}))\ \{}
\DoxyCodeLine{00301\ \ \ \ \ \ \ \ \ execmode.step\ =\ \textcolor{keyword}{false};}
\DoxyCodeLine{00302\ \ \ \ \ \ \ \ \ cmdtype\ =\ MONNEXT;}
\DoxyCodeLine{00303\ \ \ \ \ \}\ \textcolor{keywordflow}{else}\ \textcolor{keywordflow}{if}(stracmp(cmd,\ 2,\ (\textcolor{keywordtype}{char}*\ [])\{\textcolor{stringliteral}{"{}d"{}},\ \textcolor{stringliteral}{"{}dump"{}}\}))\ \{}
\DoxyCodeLine{00304\ \ \ \ \ \ \ \ \ mon\_dump(args-\/>argc,\ args-\/>argv);}
\DoxyCodeLine{00305\ \ \ \ \ \}\ \textcolor{keywordflow}{else}\ \textcolor{keywordflow}{if}(stracmp(cmd,\ 2,\ (\textcolor{keywordtype}{char}*\ [])\{\textcolor{stringliteral}{"{}l"{}},\ \textcolor{stringliteral}{"{}load"{}}\}))\ \{}
\DoxyCodeLine{00306\ \ \ \ \ \ \ \ \ execptr-\/>end\ =\ loadassemble(args-\/>argv[0],\ nh2word(args-\/>argv[1]));}
\DoxyCodeLine{00307\ \ \ \ \ \}\ \textcolor{keywordflow}{else}\ \textcolor{keywordflow}{if}(stracmp(cmd,\ 2,\ (\textcolor{keywordtype}{char}*\ [])\{\textcolor{stringliteral}{"{}n"{}},\ \textcolor{stringliteral}{"{}next"{}}\}))\ \{}
\DoxyCodeLine{00308\ \ \ \ \ \ \ \ \ execmode.step\ =\ \textcolor{keyword}{true};}
\DoxyCodeLine{00309\ \ \ \ \ \ \ \ \ cmdtype\ =\ MONNEXT;}
\DoxyCodeLine{00310\ \ \ \ \ \}\ \textcolor{keywordflow}{else}\ \textcolor{keywordflow}{if}(stracmp(cmd,\ 2,\ (\textcolor{keywordtype}{char}*\ [])\{\textcolor{stringliteral}{"{}q"{}},\ \textcolor{stringliteral}{"{}quit"{}}\}))\ \{}
\DoxyCodeLine{00311\ \ \ \ \ \ \ \ \ fprintf(stdout,\ \textcolor{stringliteral}{"{}Quit:\ COMET\ II\ monitor\(\backslash\)n"{}});}
\DoxyCodeLine{00312\ \ \ \ \ \ \ \ \ cmdtype\ =\ MONQUIT;}
\DoxyCodeLine{00313\ \ \ \ \ \}\ \textcolor{keywordflow}{else}\ \textcolor{keywordflow}{if}(stracmp(cmd,\ 2,\ (\textcolor{keywordtype}{char}*\ [])\{\textcolor{stringliteral}{"{}r"{}},\ \textcolor{stringliteral}{"{}reverse"{}}\}))\ \{}
\DoxyCodeLine{00314\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}(args-\/>argc\ ==\ 2)\ \{}
\DoxyCodeLine{00315\ \ \ \ \ \ \ \ \ \ \ \ \ disassemble\_memory(nh2word(args-\/>argv[0]),\ nh2word(args-\/>argv[1]));}
\DoxyCodeLine{00316\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00317\ \ \ \ \ \}\ \textcolor{keywordflow}{else}\ \textcolor{keywordflow}{if}(stracmp(cmd,\ 1,\ (\textcolor{keywordtype}{char}*\ [])\{\textcolor{stringliteral}{"{}reset"{}}\}))\ \{}
\DoxyCodeLine{00318\ \ \ \ \ \ \ \ \ fprintf(stdout,\ \textcolor{stringliteral}{"{}Reset\ COMET\ II.\(\backslash\)n"{}});}
\DoxyCodeLine{00319\ \ \ \ \ \ \ \ \ reset(sys-\/>memsize,\ sys-\/>clocks);\ \ \ \ \ \textcolor{comment}{/*\ COMET\ II仮想マシンのリセット\ */}}
\DoxyCodeLine{00320\ \ \ \ \ \}\ \textcolor{keywordflow}{else}\ \textcolor{keywordflow}{if}(stracmp(cmd,\ 2,\ (\textcolor{keywordtype}{char}*\ [])\{\textcolor{stringliteral}{"{}t"{}},\ \textcolor{stringliteral}{"{}trace"{}}\}))\ \{}
\DoxyCodeLine{00321\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}(args-\/>argc\ >\ 0\ \&\&\ stracmp(args-\/>argv[0],\ 2,\ (\textcolor{keywordtype}{char}*\ [])\{\textcolor{stringliteral}{"{}a"{}},\ \textcolor{stringliteral}{"{}auto"{}}\}))\ \{}
\DoxyCodeLine{00322\ \ \ \ \ \ \ \ \ \ \ \ \ execmode.logical\ =\ \textcolor{keyword}{false};}
\DoxyCodeLine{00323\ \ \ \ \ \ \ \ \ \ \ \ \ execmode.trace\ =\ \textcolor{keyword}{true};}
\DoxyCodeLine{00324\ \ \ \ \ \ \ \ \ \}\ \textcolor{keywordflow}{else}\ \textcolor{keywordflow}{if}(args-\/>argc\ >\ 0\ \&\&\ stracmp(args-\/>argv[0],\ 2,\ (\textcolor{keywordtype}{char}*\ [])\{\textcolor{stringliteral}{"{}no"{}},\ \textcolor{stringliteral}{"{}noauto"{}}\}))\ \{}
\DoxyCodeLine{00325\ \ \ \ \ \ \ \ \ \ \ \ \ execmode.trace\ =\ \textcolor{keyword}{false};}
\DoxyCodeLine{00326\ \ \ \ \ \ \ \ \ \}\ \textcolor{keywordflow}{else}\ \{}
\DoxyCodeLine{00327\ \ \ \ \ \ \ \ \ \ \ \ \ fprintf(stdout,\ \textcolor{stringliteral}{"{}\#\%04X:\ Register::::\(\backslash\)n"{}},\ sys-\/>cpu-\/>pr);}
\DoxyCodeLine{00328\ \ \ \ \ \ \ \ \ \ \ \ \ dspregister();}
\DoxyCodeLine{00329\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00330\ \ \ \ \ \}\ \textcolor{keywordflow}{else}\ \textcolor{keywordflow}{if}(stracmp(cmd,\ 2,\ (\textcolor{keywordtype}{char}*\ [])\{\textcolor{stringliteral}{"{}T"{}},\ \textcolor{stringliteral}{"{}tracelogical"{}}\}))\ \{}
\DoxyCodeLine{00331\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}(args-\/>argc\ >\ 0\ \&\&\ stracmp(args-\/>argv[0],\ 2,\ (\textcolor{keywordtype}{char}*\ [])\{\textcolor{stringliteral}{"{}a"{}},\ \textcolor{stringliteral}{"{}auto"{}}\}))\ \{}
\DoxyCodeLine{00332\ \ \ \ \ \ \ \ \ \ \ \ \ execmode.logical\ =\ \textcolor{keyword}{true};}
\DoxyCodeLine{00333\ \ \ \ \ \ \ \ \ \ \ \ \ execmode.trace\ =\ \textcolor{keyword}{true};}
\DoxyCodeLine{00334\ \ \ \ \ \ \ \ \ \}\ \textcolor{keywordflow}{else}\ \textcolor{keywordflow}{if}(args-\/>argc\ >\ 0\ \&\&\ stracmp(args-\/>argv[0],\ 2,\ (\textcolor{keywordtype}{char}*\ [])\{\textcolor{stringliteral}{"{}no"{}},\ \textcolor{stringliteral}{"{}noauto"{}}\}))\ \{}
\DoxyCodeLine{00335\ \ \ \ \ \ \ \ \ \ \ \ \ execmode.trace\ =\ \textcolor{keyword}{false};}
\DoxyCodeLine{00336\ \ \ \ \ \ \ \ \ \}\ \textcolor{keywordflow}{else}\ \{}
\DoxyCodeLine{00337\ \ \ \ \ \ \ \ \ \ \ \ \ fprintf(stdout,\ \textcolor{stringliteral}{"{}\#\%04X:\ Register::::\(\backslash\)n"{}},\ sys-\/>cpu-\/>pr);}
\DoxyCodeLine{00338\ \ \ \ \ \ \ \ \ \ \ \ \ dspregister();}
\DoxyCodeLine{00339\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00340\ \ \ \ \ \}\ \textcolor{keywordflow}{else}\ \textcolor{keywordflow}{if}(stracmp(cmd,\ 3,\ (\textcolor{keywordtype}{char}*\ [])\{\textcolor{stringliteral}{"{}?"{}},\ \textcolor{stringliteral}{"{}h"{}},\ \textcolor{stringliteral}{"{}help"{}}\}))\ \{}
\DoxyCodeLine{00341\ \ \ \ \ \ \ \ \ fprintf(stdout,\ \textcolor{stringliteral}{"{}b[reak]\ -\/-\/\ Manipulate\ Breakpoints.\ See\ details,\ \`{}b\ ?'.\(\backslash\)n"{}});}
\DoxyCodeLine{00342\ \ \ \ \ \ \ \ \ fprintf(stdout,\ \textcolor{stringliteral}{"{}c[ontinue]\ -\/-\/\ Continue\ running\ your\ program.\(\backslash\)n"{}});}
\DoxyCodeLine{00343\ \ \ \ \ \ \ \ \ fprintf(stdout,\ \textcolor{stringliteral}{"{}d[ump]\ -\/-\/\ Display\ memory\ dump.\ \`{}d[ump]\ a[uto]/n[oauto]'\ set\ auto/noauto\ display.\(\backslash\)n"{}});}
\DoxyCodeLine{00344\ \ \ \ \ \ \ \ \ fprintf(stdout,\ \textcolor{stringliteral}{"{}l[oad]\ -\/-\/\ Load\ object\ from\ a\ file\ to\ the\ memory.\ \`{}l[oad]\ <filepath>\ <address>'\ if\ address\ is\ omitted,\ load\ to\ address\ 0.\(\backslash\)n"{}});}
\DoxyCodeLine{00345\ \ \ \ \ \ \ \ \ fprintf(stdout,\ \textcolor{stringliteral}{"{}n[ext]\ -\/-\/\ Go\ next\ instruction.\(\backslash\)n"{}});}
\DoxyCodeLine{00346\ \ \ \ \ \ \ \ \ fprintf(stdout,\ \textcolor{stringliteral}{"{}q[uit]\ -\/-\/\ Quit\ running\ your\ program.\(\backslash\)n"{}});}
\DoxyCodeLine{00347\ \ \ \ \ \ \ \ \ fprintf(stdout,\ \textcolor{stringliteral}{"{}reset\ -\/-\/\ Reset\ the\ system.\(\backslash\)n"{}});}
\DoxyCodeLine{00348\ \ \ \ \ \ \ \ \ fprintf(stdout,\ \textcolor{stringliteral}{"{}r[everse]\ -\/-\/\ Disassemble\ memory.\ \`{}r[everse]\ <start\ address>\ <end\ address>.\(\backslash\)n"{}});}
\DoxyCodeLine{00349\ \ \ \ \ \ \ \ \ fprintf(stdout,\ \textcolor{stringliteral}{"{}s[ave]\ -\/-\/\ Save\ object\ from\ the\ memory\ to\ a\ file.\ \`{}s[ave]\ <filepath>\ [<start\ address1>\ [<end\ address>]]'\ if\ <start\ address>\ and\ <end\ address>\ is\ omitted,\ save\ the\ whole\ memory.\ if\ <end\ address>\ is\ omitted,\ save\ the\ memory\ after\ <start\ address>.\(\backslash\)n"{}});}
\DoxyCodeLine{00350\ \ \ \ \ \ \ \ \ fprintf(stdout,\ \textcolor{stringliteral}{"{}t[race]\ -\/-\/\ Display\ CPU\ register.\ \`{}t[race]\ a[uto]/n[oauto]'\ set\ auto/noauto\ display.\ \(\backslash\)n"{}});}
\DoxyCodeLine{00351\ \ \ \ \ \ \ \ \ fprintf(stdout,\ \textcolor{stringliteral}{"{}T[race]\ -\/-\/\ Display\ CPU\ register\ as\ logical\ value.\ \`{}t[race]\ a[uto]/n[oauto]'\ set\ auto/noauto\ display.\ \(\backslash\)n"{}});}
\DoxyCodeLine{00352\ \ \ \ \ \ \ \ \ fprintf(stdout,\ \textcolor{stringliteral}{"{}?/h[elp]\ -\/-\/\ Display\ this\ help.\(\backslash\)n"{}});}
\DoxyCodeLine{00353\ \ \ \ \ \}}
\DoxyCodeLine{00354\ \ \ \ \ \textcolor{keywordflow}{return}\ cmdtype;}
\DoxyCodeLine{00355\ \}}
\DoxyCodeLine{00356\ }
\DoxyCodeLine{00357\ \textcolor{keywordtype}{void}\ free\_moncmdline(MONCMDLINE\ *moncmdl)}
\DoxyCodeLine{00358\ \{}
\DoxyCodeLine{00359\ \ \ \ \ \textcolor{keywordtype}{int}\ i;}
\DoxyCodeLine{00360\ \ \ \ \ assert(moncmdl\ !=\ NULL);}
\DoxyCodeLine{00361\ \ \ \ \ \textcolor{keywordflow}{if}(moncmdl-\/>args\ !=\ NULL)\ \{}
\DoxyCodeLine{00362\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{for}(i\ =\ 0;\ \ i\ <\ moncmdl-\/>args-\/>argc;\ i++)\ \{}
\DoxyCodeLine{00363\ \ \ \ \ \ \ \ \ \ \ \ \ FREE(moncmdl-\/>args-\/>argv[i]);}
\DoxyCodeLine{00364\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00365\ \ \ \ \ \ \ \ \ FREE(moncmdl-\/>args);}
\DoxyCodeLine{00366\ \ \ \ \ \}}
\DoxyCodeLine{00367\ \ \ \ \ \textcolor{keywordflow}{if}(moncmdl-\/>cmd\ !=\ NULL)\ \{}
\DoxyCodeLine{00368\ \ \ \ \ \ \ \ \ FREE(moncmdl-\/>cmd);}
\DoxyCodeLine{00369\ \ \ \ \ \}}
\DoxyCodeLine{00370\ \ \ \ \ \textcolor{keywordflow}{if}(moncmdl\ !=\ NULL)\ \{}
\DoxyCodeLine{00371\ \ \ \ \ \ \ \ \ FREE(moncmdl);}
\DoxyCodeLine{00372\ \ \ \ \ \}}
\DoxyCodeLine{00373\ \}}
\DoxyCodeLine{00374\ }
\DoxyCodeLine{00375\ \textcolor{keywordtype}{int}\ monquit()}
\DoxyCodeLine{00376\ \{}
\DoxyCodeLine{00377\ \ \ \ \ \textcolor{keywordtype}{int}\ stat\ =\ 0;}
\DoxyCodeLine{00378\ \ \ \ \ shutdown();}
\DoxyCodeLine{00379\ \ \ \ \ freebps();}
\DoxyCodeLine{00380\ \ \ \ \ free\_cmdtable(HASH\_CMDTYPE);}
\DoxyCodeLine{00381\ \ \ \ \ free\_cmdtable(HASH\_CODE);}
\DoxyCodeLine{00382\ \ \ \ \ \textcolor{keywordflow}{if}(cerr-\/>num\ >\ 0)\ \{}
\DoxyCodeLine{00383\ \ \ \ \ \ \ \ \ stat\ =\ 1;}
\DoxyCodeLine{00384\ \ \ \ \ \}}
\DoxyCodeLine{00385\ \ \ \ \ freecerr();}
\DoxyCodeLine{00386\ \ \ \ \ \textcolor{keywordflow}{return}\ stat;}
\DoxyCodeLine{00387\ \}}
\DoxyCodeLine{00388\ }
\DoxyCodeLine{00389\ \textcolor{keywordtype}{void}\ monitor()}
\DoxyCodeLine{00390\ \{}
\DoxyCodeLine{00391\ \ \ \ \ \textcolor{keywordtype}{char}\ *buf\ =\ NULL;}
\DoxyCodeLine{00392\ \ \ \ \ MONCMDLINE\ *moncmdl\ =\ NULL;}
\DoxyCodeLine{00393\ \ \ \ \ MONCMDTYPE\ cmdtype\ =\ MONREPEAT;}
\DoxyCodeLine{00394\ }
\DoxyCodeLine{00395\ \ \ \ \ \textcolor{keywordflow}{do}\ \{}
\DoxyCodeLine{00396\ \ \ \ \ \ \ \ \ fprintf(stdout,\ \textcolor{stringliteral}{"{}\%s\ "{}},\ monitor\_prompt);}
\DoxyCodeLine{00397\ \ \ \ \ \ \ \ \ buf\ =\ malloc\_chk(MONINSIZE\ +\ 1,\ \textcolor{stringliteral}{"{}monitor.buf"{}});}
\DoxyCodeLine{00398\ \ \ \ \ \ \ \ \ fgets(buf,\ MONINSIZE,\ stdin);}
\DoxyCodeLine{00399\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}(!buf[0])\ \{}
\DoxyCodeLine{00400\ \ \ \ \ \ \ \ \ \ \ \ \ cmdtype\ =\ MONQUIT;}
\DoxyCodeLine{00401\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00402\ \ \ \ \ \ \ \ \ strip\_end(buf);\ \ \ \ \ \ \ \ \textcolor{comment}{/*\ 文字列末尾の改行と空白を削除\ */}}
\DoxyCodeLine{00403\ \ \ \ \ \ \ \ \ fprintf(stdout,\ \textcolor{stringliteral}{"{}\%s\(\backslash\)n"{}},\ buf);}
\DoxyCodeLine{00404\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}((moncmdl\ =\ monlinetok(buf))\ !=\ NULL)\ \{}
\DoxyCodeLine{00405\ \ \ \ \ \ \ \ \ \ \ \ \ cmdtype\ =\ monitorcmd(moncmdl-\/>cmd,\ moncmdl-\/>args);}
\DoxyCodeLine{00406\ \ \ \ \ \ \ \ \ \ \ \ \ free\_moncmdline(moncmdl);}
\DoxyCodeLine{00407\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00408\ \ \ \ \ \ \ \ \ FREE(buf);}
\DoxyCodeLine{00409\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}(cmdtype\ ==\ MONQUIT)\ \{}
\DoxyCodeLine{00410\ \ \ \ \ \ \ \ \ \ \ \ \ exit(monquit());}
\DoxyCodeLine{00411\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00412\ \ \ \ \ \}\ \textcolor{keywordflow}{while}(cmdtype\ ==\ MONREPEAT);}
\DoxyCodeLine{00413\ \}}

\end{DoxyCode}

/* [<][>][^][v][top][bottom][index][help] */