root/doc_inner/doxygen/latex/assemble_8c_source.tex

/* [<][>][^][v][top][bottom][index][help] */
\doxysection{assemble.\+c}
\label{assemble_8c_source}\index{src/assemble.c@{src/assemble.c}}
\textbf{ Go to the documentation of this file.}
\begin{DoxyCode}{0}
\DoxyCodeLine{00001\ \textcolor{preprocessor}{\#include\ "{}assemble.h"{}}}
\DoxyCodeLine{00002\ }
\DoxyCodeLine{00011\ \textcolor{keywordtype}{void}\ printline(FILE\ *stream,\ \textcolor{keyword}{const}\ \textcolor{keywordtype}{char}\ *filename,\ \textcolor{keywordtype}{int}\ lineno,\ \textcolor{keywordtype}{char}\ *line);}
\DoxyCodeLine{00012\ }
\DoxyCodeLine{00024\ WORD\ getadr(\textcolor{keyword}{const}\ \textcolor{keywordtype}{char}\ *prog,\ \textcolor{keyword}{const}\ \textcolor{keywordtype}{char}\ *str,\ PASS\ pass);}
\DoxyCodeLine{00025\ }
\DoxyCodeLine{00038\ WORD\ grword(\textcolor{keyword}{const}\ \textcolor{keywordtype}{char}\ *str,\ \textcolor{keywordtype}{bool}\ is\_x);}
\DoxyCodeLine{00039\ }
\DoxyCodeLine{00048\ WORD\ getliteral(\textcolor{keyword}{const}\ \textcolor{keywordtype}{char}\ *str,\ PASS\ pass);}
\DoxyCodeLine{00049\ }
\DoxyCodeLine{00057\ \textcolor{keywordtype}{void}\ writememory(WORD\ word,\ WORD\ adr,\ PASS\ pass);}
\DoxyCodeLine{00058\ }
\DoxyCodeLine{00066\ \textcolor{keywordtype}{void}\ writestr(\textcolor{keyword}{const}\ \textcolor{keywordtype}{char}\ *str,\ \textcolor{keywordtype}{bool}\ literal,\ PASS\ pass);}
\DoxyCodeLine{00067\ }
\DoxyCodeLine{00074\ \textcolor{keywordtype}{void}\ writedc(\textcolor{keyword}{const}\ \textcolor{keywordtype}{char}\ *str,\ PASS\ pass);}
\DoxyCodeLine{00075\ }
\DoxyCodeLine{00083\ \textcolor{keywordtype}{void}\ assemble\_start(\textcolor{keyword}{const}\ CMDLINE\ *cmdl,\ PASS\ pass);}
\DoxyCodeLine{00084\ }
\DoxyCodeLine{00092\ \textcolor{keywordtype}{void}\ assemble\_ds(\textcolor{keyword}{const}\ CMDLINE\ *cmdl,\ PASS\ pass);}
\DoxyCodeLine{00093\ }
\DoxyCodeLine{00101\ \textcolor{keywordtype}{void}\ assemble\_end(\textcolor{keyword}{const}\ CMDLINE\ *cmdl,\ PASS\ pass);}
\DoxyCodeLine{00102\ }
\DoxyCodeLine{00110\ \textcolor{keywordtype}{void}\ assemble\_dc(\textcolor{keyword}{const}\ CMDLINE\ *cmdl,\ PASS\ pass);}
\DoxyCodeLine{00111\ }
\DoxyCodeLine{00130\ \textcolor{keywordtype}{void}\ assemble\_in(\textcolor{keyword}{const}\ CMDLINE\ *cmdl,\ PASS\ pass);}
\DoxyCodeLine{00131\ }
\DoxyCodeLine{00152\ \textcolor{keywordtype}{void}\ assemble\_out(\textcolor{keyword}{const}\ CMDLINE\ *cmdl,\ PASS\ pass);}
\DoxyCodeLine{00153\ }
\DoxyCodeLine{00171\ \textcolor{keywordtype}{void}\ assemble\_rpush(\textcolor{keyword}{const}\ CMDLINE\ *cmdl,\ PASS\ pass);}
\DoxyCodeLine{00172\ }
\DoxyCodeLine{00191\ \textcolor{keywordtype}{void}\ assemble\_rpop(\textcolor{keyword}{const}\ CMDLINE\ *cmdl,\ PASS\ pass);}
\DoxyCodeLine{00192\ }
\DoxyCodeLine{00197\ }
\DoxyCodeLine{00211\ \textcolor{keywordtype}{bool}\ casl2cmd(CMD\ *cmdtbl,\ \textcolor{keyword}{const}\ CMDLINE\ *cmdl,\ PASS\ pass);}
\DoxyCodeLine{00212\ }
\DoxyCodeLine{00221\ \textcolor{keywordtype}{bool}\ assemble\_comet2cmd(\textcolor{keyword}{const}\ CMDLINE\ *cmdl,\ PASS\ pass);}
\DoxyCodeLine{00222\ }
\DoxyCodeLine{00231\ \textcolor{keywordtype}{bool}\ assembletok(\textcolor{keyword}{const}\ CMDLINE\ *cmdl,\ PASS\ pass);}
\DoxyCodeLine{00232\ }
\DoxyCodeLine{00243\ \textcolor{keywordtype}{bool}\ assembleline(\textcolor{keyword}{const}\ \textcolor{keywordtype}{char}\ *line,\ PASS\ pass);}
\DoxyCodeLine{00244\ }
\DoxyCodeLine{00248\ \textcolor{keyword}{static}\ CERR\ cerr\_assemble[]\ =\ \{}
\DoxyCodeLine{00249\ \ \ \ \ \{\ 106,\ \textcolor{stringliteral}{"{}operand\ mismatch\ in\ CASL\ II\ command"{}}\ \},}
\DoxyCodeLine{00250\ \ \ \ \ \{\ 107,\ \textcolor{stringliteral}{"{}no\ label\ in\ START"{}}\ \},}
\DoxyCodeLine{00251\ \ \ \ \ \{\ 108,\ \textcolor{stringliteral}{"{}not\ command\ of\ operand\ \(\backslash\)"{}r\(\backslash\)"{}"{}}\ \},}
\DoxyCodeLine{00252\ \ \ \ \ \{\ 109,\ \textcolor{stringliteral}{"{}not\ command\ of\ operand\ \(\backslash\)"{}r1,r2\(\backslash\)"{}"{}}\ \},}
\DoxyCodeLine{00253\ \ \ \ \ \{\ 110,\ \textcolor{stringliteral}{"{}not\ command\ of\ operand\ \(\backslash\)"{}r,adr[,x]\(\backslash\)"{}"{}}\ \},}
\DoxyCodeLine{00254\ \ \ \ \ \{\ 111,\ \textcolor{stringliteral}{"{}not\ command\ of\ operand\ \(\backslash\)"{}adr[,x]\(\backslash\)"{}"{}}\ \},}
\DoxyCodeLine{00255\ \ \ \ \ \{\ 112,\ \textcolor{stringliteral}{"{}not\ command\ of\ no\ operand"{}}\ \},}
\DoxyCodeLine{00256\ \ \ \ \ \{\ 113,\ \textcolor{stringliteral}{"{}operand\ too\ many\ in\ COMET\ II\ command"{}}\ \},}
\DoxyCodeLine{00257\ \ \ \ \ \{\ 119,\ \textcolor{stringliteral}{"{}out\ of\ COMET\ II\ memory"{}}\ \},}
\DoxyCodeLine{00258\ \ \ \ \ \{\ 120,\ \textcolor{stringliteral}{"{}GR0\ in\ operand\ x"{}}\ \},}
\DoxyCodeLine{00259\ \ \ \ \ \{\ 122,\ \textcolor{stringliteral}{"{}cannot\ create\ hash\ table"{}}\ \},}
\DoxyCodeLine{00260\ \ \ \ \ \{\ 124,\ \textcolor{stringliteral}{"{}more\ than\ one\ character\ in\ literal"{}}\ \},}
\DoxyCodeLine{00261\ \ \ \ \ \{\ 125,\ \textcolor{stringliteral}{"{}not\ GR\ in\ operand\ x"{}}\ \},}
\DoxyCodeLine{00262\ \};}
\DoxyCodeLine{00263\ }
\DoxyCodeLine{00267\ \textcolor{keyword}{static}\ CMD\ ascmd[]\ =\ \{}
\DoxyCodeLine{00268\ \ \ \ \ \{\ \textcolor{stringliteral}{"{}START"{}},\ assemble\_start\ \},}
\DoxyCodeLine{00269\ \ \ \ \ \{\ \textcolor{stringliteral}{"{}END"{}},\ assemble\_end\ \},}
\DoxyCodeLine{00270\ \ \ \ \ \{\ \textcolor{stringliteral}{"{}DS"{}},\ assemble\_ds\ \},}
\DoxyCodeLine{00271\ \ \ \ \ \{\ \textcolor{stringliteral}{"{}DC"{}},\ assemble\_dc\ \},}
\DoxyCodeLine{00272\ \ \ \ \ \{\ \textcolor{stringliteral}{"{}"{}},\ NULL\ \}}
\DoxyCodeLine{00273\ \};}
\DoxyCodeLine{00274\ }
\DoxyCodeLine{00278\ \textcolor{keyword}{static}\ CMD\ macrocmd[]\ =\ \{}
\DoxyCodeLine{00279\ \ \ \ \ \{\ \textcolor{stringliteral}{"{}OUT"{}},\ assemble\_out\ \},}
\DoxyCodeLine{00280\ \ \ \ \ \{\ \textcolor{stringliteral}{"{}IN"{}},\ assemble\_in\ \},}
\DoxyCodeLine{00281\ \ \ \ \ \{\ \textcolor{stringliteral}{"{}RPUSH"{}},\ assemble\_rpush\ \},}
\DoxyCodeLine{00282\ \ \ \ \ \{\ \textcolor{stringliteral}{"{}RPOP"{}},\ assemble\_rpop\ \},}
\DoxyCodeLine{00283\ \ \ \ \ \{\ \textcolor{stringliteral}{"{}"{}},\ NULL\ \}}
\DoxyCodeLine{00284\ \};}
\DoxyCodeLine{00285\ }
\DoxyCodeLine{00286\ ASPTR\ *asptr\ =\ NULL;}
\DoxyCodeLine{00287\ }
\DoxyCodeLine{00288\ ASMODE\ asmode\ =\ \{\textcolor{keyword}{false},\ \textcolor{keyword}{false},\ \textcolor{keyword}{false},\ \textcolor{keyword}{false},\ \textcolor{keyword}{false}\};}
\DoxyCodeLine{00289\ }
\DoxyCodeLine{00290\ \textcolor{keywordtype}{void}\ printline(FILE\ *stream,\ \textcolor{keyword}{const}\ \textcolor{keywordtype}{char}\ *filename,\ \textcolor{keywordtype}{int}\ lineno,\ \textcolor{keywordtype}{char}\ *line)}
\DoxyCodeLine{00291\ \{}
\DoxyCodeLine{00292\ \ \ \ \ fprintf(stream,\ \textcolor{stringliteral}{"{}\%s:\%5d:\%s"{}},\ filename,\ lineno,\ line);}
\DoxyCodeLine{00293\ \}}
\DoxyCodeLine{00294\ }
\DoxyCodeLine{00295\ WORD\ getadr(\textcolor{keyword}{const}\ \textcolor{keywordtype}{char}\ *prog,\ \textcolor{keyword}{const}\ \textcolor{keywordtype}{char}\ *str,\ PASS\ pass)}
\DoxyCodeLine{00296\ \{}
\DoxyCodeLine{00297\ \ \ \ \ WORD\ adr\ =\ 0;}
\DoxyCodeLine{00298\ }
\DoxyCodeLine{00299\ \ \ \ \ \textcolor{keywordflow}{if}(str[0]\ ==\ \textcolor{charliteral}{'='})\ \{}
\DoxyCodeLine{00300\ \ \ \ \ \ \ \ \ adr\ =\ getliteral(str,\ pass);}
\DoxyCodeLine{00301\ \ \ \ \ \}\ \textcolor{keywordflow}{else}\ \textcolor{keywordflow}{if}(isdigit(str[0])\ ||\ str[0]\ ==\ \textcolor{charliteral}{'-\/'}\ ||\ str[0]\ ==\ \textcolor{charliteral}{'\#'})\ \{}
\DoxyCodeLine{00302\ \ \ \ \ \ \ \ \ adr\ =\ nh2word(str);}
\DoxyCodeLine{00303\ \ \ \ \ \}\ \textcolor{keywordflow}{else}\ \{}
\DoxyCodeLine{00304\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}(pass\ ==\ SECOND)\ \{}
\DoxyCodeLine{00305\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}((adr\ =\ getlabel(prog,\ str))\ ==\ 0xFFFF)\ \{}
\DoxyCodeLine{00306\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ setcerr(103,\ str);\ \ \ \ \textcolor{comment}{/*\ label\ not\ found\ */}}
\DoxyCodeLine{00307\ \ \ \ \ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00308\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00309\ \ \ \ \ \}}
\DoxyCodeLine{00310\ \ \ \ \ \textcolor{keywordflow}{return}\ adr;}
\DoxyCodeLine{00311\ \}}
\DoxyCodeLine{00312\ }
\DoxyCodeLine{00313\ WORD\ grword(\textcolor{keyword}{const}\ \textcolor{keywordtype}{char}\ *str,\ \textcolor{keywordtype}{bool}\ is\_x)}
\DoxyCodeLine{00314\ \{}
\DoxyCodeLine{00315\ \ \ \ \ WORD\ r\ =\ 0;}
\DoxyCodeLine{00316\ }
\DoxyCodeLine{00317\ \ \ \ \ \textcolor{comment}{/*\ \ "{}GR[0-\/7]"{}\ 以外の文字列では、0xFFFFを返して終了\ */}}
\DoxyCodeLine{00318\ \ \ \ \ \textcolor{keywordflow}{if}(strlen(str)\ !=\ 3\ ||}
\DoxyCodeLine{00319\ \ \ \ \ \ \ \ strncmp(str,\ \textcolor{stringliteral}{"{}GR"{}},\ 2)\ !=\ 0\ ||}
\DoxyCodeLine{00320\ \ \ \ \ \ \ \ str[2]\ <\ \textcolor{charliteral}{'0'}\ ||\ str[2]\ >\ \textcolor{charliteral}{'0'}\ +\ (GRSIZE\ -\/\ 1))}
\DoxyCodeLine{00321\ \ \ \ \ \{}
\DoxyCodeLine{00322\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ 0xFFFF;}
\DoxyCodeLine{00323\ \ \ \ \ \}}
\DoxyCodeLine{00324\ \ \ \ \ r\ =\ (WORD)(str[2]\ -\/\ \textcolor{charliteral}{'0'});}
\DoxyCodeLine{00325\ \ \ \ \ \textcolor{comment}{/*\ GR0は指標レジスタとして用いることができない\ */}}
\DoxyCodeLine{00326\ \ \ \ \ \textcolor{keywordflow}{if}(is\_x\ ==\ \textcolor{keyword}{true}\ \&\&\ r\ ==\ 0x0)\ \{}
\DoxyCodeLine{00327\ \ \ \ \ \ \ \ \ setcerr(120,\ \textcolor{stringliteral}{"{}"{}});\ \ \ \ \textcolor{comment}{/*\ GR0\ in\ operand\ x\ */}}
\DoxyCodeLine{00328\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ 0;}
\DoxyCodeLine{00329\ \ \ \ \ \}}
\DoxyCodeLine{00330\ \ \ \ \ \textcolor{keywordflow}{return}\ r;}
\DoxyCodeLine{00331\ \}}
\DoxyCodeLine{00332\ }
\DoxyCodeLine{00333\ WORD\ getliteral(\textcolor{keyword}{const}\ \textcolor{keywordtype}{char}\ *str,\ PASS\ pass)}
\DoxyCodeLine{00334\ \{}
\DoxyCodeLine{00335\ \ \ \ \ assert(str[0]\ ==\ \textcolor{charliteral}{'='});}
\DoxyCodeLine{00336\ \ \ \ \ WORD\ adr\ =\ asptr-\/>lptr;}
\DoxyCodeLine{00337\ }
\DoxyCodeLine{00338\ \ \ \ \ str++;}
\DoxyCodeLine{00339\ \ \ \ \ \textcolor{keywordflow}{if}(str[0]\ ==\ \textcolor{charliteral}{'\(\backslash\)''})\ \{\ \ \ \ \textcolor{comment}{/*\ 文字定数\ */}}
\DoxyCodeLine{00340\ \ \ \ \ \ \ \ \ writestr(str,\ \textcolor{keyword}{true},\ pass);}
\DoxyCodeLine{00341\ \ \ \ \ \}\ \textcolor{keywordflow}{else}\ \{}
\DoxyCodeLine{00342\ \ \ \ \ \ \ \ \ writememory(nh2word(str),\ (asptr-\/>lptr)++,\ pass);}
\DoxyCodeLine{00343\ \ \ \ \ \}}
\DoxyCodeLine{00344\ \ \ \ \ \textcolor{keywordflow}{return}\ adr;}
\DoxyCodeLine{00345\ \}}
\DoxyCodeLine{00346\ }
\DoxyCodeLine{00347\ \textcolor{keywordtype}{void}\ writememory(WORD\ word,\ WORD\ adr,\ PASS\ pass)}
\DoxyCodeLine{00348\ \{}
\DoxyCodeLine{00349\ \ \ \ \ \textcolor{keywordtype}{char}\ *n\ =\ NULL;}
\DoxyCodeLine{00350\ }
\DoxyCodeLine{00351\ \ \ \ \ \textcolor{comment}{/*\ メモリオーバーの場合、エラー発生\ */}}
\DoxyCodeLine{00352\ \ \ \ \ \textcolor{keywordflow}{if}(adr\ >=\ sys-\/>memsize)\ \{}
\DoxyCodeLine{00353\ \ \ \ \ \ \ \ \ setcerr(119,\ (n\ =\ word2n(adr)));\ \ \ \ \textcolor{comment}{/*\ out\ of\ COMET\ II\ memory\ */}}
\DoxyCodeLine{00354\ \ \ \ \ \ \ \ \ FREE(n)}
\DoxyCodeLine{00355\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return};}
\DoxyCodeLine{00356\ \ \ \ \ \}}
\DoxyCodeLine{00357\ \ \ \ \ (sys-\/>memory)[adr]\ =\ word;}
\DoxyCodeLine{00358\ \ \ \ \ \textcolor{keywordflow}{if}(pass\ ==\ SECOND\ \&\&\ asmode.asdetail\ ==\ \textcolor{keyword}{true})\ \{}
\DoxyCodeLine{00359\ \ \ \ \ \ \ \ \ fprintf(stdout,\ \textcolor{stringliteral}{"{}\(\backslash\)t\#\%04X\(\backslash\)t\#\%04X\(\backslash\)n"{}},\ adr,\ word);}
\DoxyCodeLine{00360\ \ \ \ \ \}}
\DoxyCodeLine{00361\ \}}
\DoxyCodeLine{00362\ }
\DoxyCodeLine{00363\ \textcolor{keywordtype}{void}\ writestr(\textcolor{keyword}{const}\ \textcolor{keywordtype}{char}\ *str,\ \textcolor{keywordtype}{bool}\ literal,\ PASS\ pass)}
\DoxyCodeLine{00364\ \{}
\DoxyCodeLine{00365\ \ \ \ \ assert(str[0]\ ==\ \textcolor{charliteral}{'\(\backslash\)''});}
\DoxyCodeLine{00366\ \ \ \ \ \textcolor{keywordtype}{bool}\ lw\ =\ \textcolor{keyword}{false};}
\DoxyCodeLine{00367\ }
\DoxyCodeLine{00368\ \ \ \ \ \textcolor{comment}{/*\ 「'」の場合、1文字スキップし、次の文字が「'」でなければ正常終了\ */}}
\DoxyCodeLine{00369\ \ \ \ \ \textcolor{keywordflow}{for}(\textcolor{keywordtype}{int}\ i\ =\ 1;\ str[i]\ !=\ \textcolor{charliteral}{'\(\backslash\)''}\ ||\ str[++i]\ ==\ \textcolor{charliteral}{'\(\backslash\)''};\ i++)\ \{}
\DoxyCodeLine{00370\ \ \ \ \ \ \ \ \ \textcolor{comment}{/*\ 「'」が閉じないまま文字列が終了した場合はエラー\ */}}
\DoxyCodeLine{00371\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}(!str[i])\ \{}
\DoxyCodeLine{00372\ \ \ \ \ \ \ \ \ \ \ \ \ setcerr(123,\ str);\ \ \ \ \textcolor{comment}{/*\ unclosed\ quote\ */}}
\DoxyCodeLine{00373\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{break};}
\DoxyCodeLine{00374\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00375\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}(literal\ ==\ \textcolor{keyword}{true}\ \&\&\ lw\ ==\ \textcolor{keyword}{true})\ \{}
\DoxyCodeLine{00376\ \ \ \ \ \ \ \ \ \ \ \ \ setcerr(124,\ str);\ \ \ \ \textcolor{comment}{/*\ more\ than\ one\ character\ in\ literal\ */}}
\DoxyCodeLine{00377\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{break};}
\DoxyCodeLine{00378\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00379\ \ \ \ \ \ \ \ \ \textcolor{comment}{/*リテラルの場合はリテラル領域に書込\ */}}
\DoxyCodeLine{00380\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}(literal\ ==\ \textcolor{keyword}{true})\ \{}
\DoxyCodeLine{00381\ \ \ \ \ \ \ \ \ \ \ \ \ writememory(str[i],\ (asptr-\/>lptr)++,\ pass);}
\DoxyCodeLine{00382\ \ \ \ \ \ \ \ \ \ \ \ \ lw\ =\ \textcolor{keyword}{true};}
\DoxyCodeLine{00383\ \ \ \ \ \ \ \ \ \}\ \textcolor{keywordflow}{else}\ \{}
\DoxyCodeLine{00384\ \ \ \ \ \ \ \ \ \ \ \ \ writememory(str[i],\ (asptr-\/>ptr)++,\ pass);}
\DoxyCodeLine{00385\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00386\ \ \ \ \ \}}
\DoxyCodeLine{00387\ \}}
\DoxyCodeLine{00388\ }
\DoxyCodeLine{00389\ \textcolor{keywordtype}{void}\ writedc(\textcolor{keyword}{const}\ \textcolor{keywordtype}{char}\ *str,\ PASS\ pass)}
\DoxyCodeLine{00390\ \{}
\DoxyCodeLine{00391\ \ \ \ \ WORD\ adr\ =\ 0;}
\DoxyCodeLine{00392\ }
\DoxyCodeLine{00393\ \ \ \ \ \textcolor{keywordflow}{if}(*str\ ==\ \textcolor{charliteral}{'\(\backslash\)''})\ \{}
\DoxyCodeLine{00394\ \ \ \ \ \ \ \ \ writestr(str,\ \textcolor{keyword}{false},\ pass);}
\DoxyCodeLine{00395\ \ \ \ \ \}\ \textcolor{keywordflow}{else}\ \{}
\DoxyCodeLine{00396\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}(str[0]\ ==\ \textcolor{charliteral}{'\#'}\ ||\ isdigit(str[0])\ ||\ str[0]\ ==\ \textcolor{charliteral}{'-\/'})\ \{}
\DoxyCodeLine{00397\ \ \ \ \ \ \ \ \ \ \ \ \ adr\ =\ nh2word(str);}
\DoxyCodeLine{00398\ \ \ \ \ \ \ \ \ \}\ \textcolor{keywordflow}{else}\ \{}
\DoxyCodeLine{00399\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}(pass\ ==\ SECOND\ \&\&\ (adr\ =\ getlabel(asptr-\/>prog,\ str))\ ==\ 0xFFFF)\ \{}
\DoxyCodeLine{00400\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ setcerr(103,\ str);\ \ \ \ \textcolor{comment}{/*\ label\ not\ found\ */}}
\DoxyCodeLine{00401\ \ \ \ \ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00402\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00403\ \ \ \ \ \ \ \ \ writememory(adr,\ (asptr-\/>ptr)++,\ pass);}
\DoxyCodeLine{00404\ \ \ \ \ \}}
\DoxyCodeLine{00405\ \}}
\DoxyCodeLine{00406\ }
\DoxyCodeLine{00407\ \textcolor{keywordtype}{void}\ assemble\_start(\textcolor{keyword}{const}\ CMDLINE\ *cmdl,\ PASS\ pass)}
\DoxyCodeLine{00408\ \{}
\DoxyCodeLine{00409\ \ \ \ \ \textcolor{keywordflow}{if}(cmdl-\/>opd-\/>opdc\ >\ 1)\ \{}
\DoxyCodeLine{00410\ \ \ \ \ \ \ \ \ setcerr(106,\ \textcolor{stringliteral}{"{}"{}});\ \ \ \ \textcolor{comment}{/*\ operand\ count\ mismatch\ */}}
\DoxyCodeLine{00411\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return};}
\DoxyCodeLine{00412\ \ \ \ \ \}}
\DoxyCodeLine{00413\ \ \ \ \ \textcolor{keywordflow}{if}(!cmdl-\/>label[0])\ \{}
\DoxyCodeLine{00414\ \ \ \ \ \ \ \ \ setcerr(107,\ \textcolor{stringliteral}{"{}"{}});\ \ \ \ \textcolor{comment}{/*\ no\ label\ in\ START\ */}}
\DoxyCodeLine{00415\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return};}
\DoxyCodeLine{00416\ \ \ \ \ \}}
\DoxyCodeLine{00417\ \ \ \ \ \textcolor{comment}{/*\ プログラム名の設定\ */}}
\DoxyCodeLine{00418\ \ \ \ \ strcpy(asptr-\/>prog,\ cmdl-\/>label);}
\DoxyCodeLine{00419\ \ \ \ \ \textcolor{comment}{/*\ オペランドがある場合、書き込みと実行の開始アドレスを設定\ */}}
\DoxyCodeLine{00420\ \ \ \ \ \textcolor{keywordflow}{if}(cmdl-\/>opd-\/>opdv[0]\ !=\ NULL)\ \{}
\DoxyCodeLine{00421\ \ \ \ \ \ \ \ \ asptr-\/>ptr\ =\ execptr-\/>start\ =\ getadr(asptr-\/>prog,\ cmdl-\/>opd-\/>opdv[0],\ pass);}
\DoxyCodeLine{00422\ \ \ \ \ \}}
\DoxyCodeLine{00423\ \}}
\DoxyCodeLine{00424\ }
\DoxyCodeLine{00425\ \textcolor{keywordtype}{void}\ assemble\_end(\textcolor{keyword}{const}\ CMDLINE\ *cmdl,\ PASS\ pass)}
\DoxyCodeLine{00426\ \{}
\DoxyCodeLine{00427\ \ \ \ \ \textcolor{keywordflow}{if}(cmdl-\/>opd-\/>opdc\ >\ 0)\ \{}
\DoxyCodeLine{00428\ \ \ \ \ \ \ \ \ setcerr(106,\ \textcolor{stringliteral}{"{}"{}});\ \ \ \ \textcolor{comment}{/*\ operand\ count\ mismatch\ */}}
\DoxyCodeLine{00429\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return};}
\DoxyCodeLine{00430\ \ \ \ \ \}}
\DoxyCodeLine{00431\ \ \ \ \ \textcolor{comment}{/*\ 1回目のアセンブルの場合は、リテラル領域開始アドレスを設定\ */}}
\DoxyCodeLine{00432\ \ \ \ \ \textcolor{keywordflow}{if}(pass\ ==\ FIRST)\ \{}
\DoxyCodeLine{00433\ \ \ \ \ \ \ \ \ asptr-\/>lptr\ =\ asptr-\/>ptr;}
\DoxyCodeLine{00434\ \ \ \ \ \}}
\DoxyCodeLine{00435\ \ \ \ \ \textcolor{comment}{/*\ 2回目のアセンブルの場合は、リテラル領域終了アドレスを実行終了アドレスとして設定\ */}}
\DoxyCodeLine{00436\ \ \ \ \ \textcolor{keywordflow}{else}\ \textcolor{keywordflow}{if}(pass\ ==\ SECOND)\ \{}
\DoxyCodeLine{00437\ \ \ \ \ \ \ \ \ execptr-\/>end\ =\ asptr-\/>lptr;}
\DoxyCodeLine{00438\ \ \ \ \ \}}
\DoxyCodeLine{00439\ \ \ \ \ strcpy(asptr-\/>prog,\ \textcolor{stringliteral}{"{}"{}});}
\DoxyCodeLine{00440\ \}}
\DoxyCodeLine{00441\ }
\DoxyCodeLine{00442\ \textcolor{keywordtype}{void}\ assemble\_ds(\textcolor{keyword}{const}\ CMDLINE\ *cmdl,\ PASS\ pass)}
\DoxyCodeLine{00443\ \{}
\DoxyCodeLine{00444\ \ \ \ \ \textcolor{keywordflow}{if}(cmdl-\/>opd-\/>opdc\ !=\ 1)\ \{}
\DoxyCodeLine{00445\ \ \ \ \ \ \ \ \ setcerr(106,\ \textcolor{stringliteral}{"{}"{}});\ \ \ \ \textcolor{comment}{/*\ operand\ count\ mismatch\ */}}
\DoxyCodeLine{00446\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return};}
\DoxyCodeLine{00447\ \ \ \ \ \}}
\DoxyCodeLine{00448\ \ \ \ \ \textcolor{keywordflow}{for}(\textcolor{keywordtype}{int}\ i\ =\ 0;\ i\ <\ atoi(cmdl-\/>opd-\/>opdv[0]);\ i++)\ \{}
\DoxyCodeLine{00449\ \ \ \ \ \ \ \ \ writememory(0x0,\ (asptr-\/>ptr)++,\ pass);}
\DoxyCodeLine{00450\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}(cerr-\/>num\ >\ 0)\ \{}
\DoxyCodeLine{00451\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{break};}
\DoxyCodeLine{00452\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00453\ \ \ \ \ \}}
\DoxyCodeLine{00454\ \}}
\DoxyCodeLine{00455\ }
\DoxyCodeLine{00456\ \textcolor{keywordtype}{void}\ assemble\_dc(\textcolor{keyword}{const}\ CMDLINE\ *cmdl,\ PASS\ pass)}
\DoxyCodeLine{00457\ \{}
\DoxyCodeLine{00458\ \ \ \ \ \textcolor{keywordflow}{if}(cmdl-\/>opd-\/>opdc\ ==\ 0\ ||\ cmdl-\/>opd-\/>opdc\ >=\ OPDSIZE)\ \{}
\DoxyCodeLine{00459\ \ \ \ \ \ \ \ \ setcerr(106,\ \textcolor{stringliteral}{"{}"{}});\ \ \ \ \textcolor{comment}{/*\ operand\ count\ mismatch\ */}}
\DoxyCodeLine{00460\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return};}
\DoxyCodeLine{00461\ \ \ \ \ \}}
\DoxyCodeLine{00462\ \ \ \ \ \textcolor{keywordflow}{for}(\textcolor{keywordtype}{int}\ i\ =\ 0;\ i\ <\ cmdl-\/>opd-\/>opdc;\ i++)\ \{}
\DoxyCodeLine{00463\ \ \ \ \ \ \ \ \ writedc(cmdl-\/>opd-\/>opdv[i],\ pass);}
\DoxyCodeLine{00464\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}(cerr-\/>num\ >\ 0)\ \{}
\DoxyCodeLine{00465\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{break};}
\DoxyCodeLine{00466\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00467\ \ \ \ \ \}}
\DoxyCodeLine{00468\ \}}
\DoxyCodeLine{00469\ }
\DoxyCodeLine{00470\ \textcolor{keywordtype}{void}\ assemble\_in(\textcolor{keyword}{const}\ CMDLINE\ *cmdl,\ PASS\ pass)}
\DoxyCodeLine{00471\ \{}
\DoxyCodeLine{00472\ \ \ \ \ \textcolor{keywordtype}{char}\ *line\ =\ malloc\_chk(LINESIZE\ +\ 1,\ \textcolor{stringliteral}{"{}assemble\_in.line"{}});}
\DoxyCodeLine{00473\ }
\DoxyCodeLine{00474\ \ \ \ \ \textcolor{keywordflow}{if}(cmdl-\/>opd-\/>opdc\ ==\ 0\ ||\ cmdl-\/>opd-\/>opdc\ >\ 2)\ \{}
\DoxyCodeLine{00475\ \ \ \ \ \ \ \ \ setcerr(106,\ \textcolor{stringliteral}{"{}"{}});\ \ \ \ \textcolor{comment}{/*\ operand\ count\ mismatch\ */}}
\DoxyCodeLine{00476\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return};}
\DoxyCodeLine{00477\ \ \ \ \ \}}
\DoxyCodeLine{00478\ \ \ \ \ assembleline(\textcolor{stringliteral}{"{}\ \ \ \ PUSH\ 0,GR1"{}},\ pass);}
\DoxyCodeLine{00479\ \ \ \ \ assembleline(\textcolor{stringliteral}{"{}\ \ \ \ PUSH\ 0,GR2"{}},\ pass);}
\DoxyCodeLine{00480\ \ \ \ \ sprintf(line,\ \textcolor{stringliteral}{"{}\ \ \ \ LAD\ GR1,\%s"{}},\ cmdl-\/>opd-\/>opdv[0]);}
\DoxyCodeLine{00481\ \ \ \ \ assembleline(line,\ pass);}
\DoxyCodeLine{00482\ \ \ \ \ sprintf(line,\ \textcolor{stringliteral}{"{}\ \ \ \ LAD\ GR2,\%s"{}},\ cmdl-\/>opd-\/>opdv[1]);}
\DoxyCodeLine{00483\ \ \ \ \ assembleline(line,\ pass);}
\DoxyCodeLine{00484\ \ \ \ \ assembleline(\textcolor{stringliteral}{"{}\ \ \ \ SVC\ 1"{}},\ pass);}
\DoxyCodeLine{00485\ \ \ \ \ assembleline(\textcolor{stringliteral}{"{}\ \ \ \ POP\ GR2"{}},\ pass);}
\DoxyCodeLine{00486\ \ \ \ \ assembleline(\textcolor{stringliteral}{"{}\ \ \ \ POP\ GR1"{}},\ pass);}
\DoxyCodeLine{00487\ \ \ \ \ FREE(line);}
\DoxyCodeLine{00488\ \}}
\DoxyCodeLine{00489\ }
\DoxyCodeLine{00490\ \textcolor{keywordtype}{void}\ assemble\_out(\textcolor{keyword}{const}\ CMDLINE\ *cmdl,\ PASS\ pass)}
\DoxyCodeLine{00491\ \{}
\DoxyCodeLine{00492\ \ \ \ \ \textcolor{keywordtype}{char}\ *line\ =\ malloc\_chk(LINESIZE\ +\ 1,\ \textcolor{stringliteral}{"{}assemble\_out.line"{}});}
\DoxyCodeLine{00493\ }
\DoxyCodeLine{00494\ \ \ \ \ \textcolor{keywordflow}{if}(cmdl-\/>opd-\/>opdc\ ==\ 0\ ||\ cmdl-\/>opd-\/>opdc\ >\ 2)\ \{}
\DoxyCodeLine{00495\ \ \ \ \ \ \ \ \ setcerr(106,\ \textcolor{stringliteral}{"{}"{}});\ \ \ \ \textcolor{comment}{/*\ operand\ count\ mismatch\ */}}
\DoxyCodeLine{00496\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return};}
\DoxyCodeLine{00497\ \ \ \ \ \}}
\DoxyCodeLine{00498\ \ \ \ \ assembleline(\textcolor{stringliteral}{"{}\ \ \ \ PUSH\ 0,GR1"{}},\ pass);}
\DoxyCodeLine{00499\ \ \ \ \ assembleline(\textcolor{stringliteral}{"{}\ \ \ \ PUSH\ 0,GR2"{}},\ pass);}
\DoxyCodeLine{00500\ \ \ \ \ sprintf(line,\ \textcolor{stringliteral}{"{}\ \ \ \ LAD\ GR1,\%s"{}},\ cmdl-\/>opd-\/>opdv[0]);}
\DoxyCodeLine{00501\ \ \ \ \ assembleline(line,\ pass);}
\DoxyCodeLine{00502\ \ \ \ \ sprintf(line,\ \textcolor{stringliteral}{"{}\ \ \ \ LAD\ GR2,\%s"{}},\ cmdl-\/>opd-\/>opdv[1]);}
\DoxyCodeLine{00503\ \ \ \ \ assembleline(line,\ pass);}
\DoxyCodeLine{00504\ \ \ \ \ assembleline(\textcolor{stringliteral}{"{}\ \ \ \ SVC\ 2"{}},\ pass);}
\DoxyCodeLine{00505\ \ \ \ \ assembleline(\textcolor{stringliteral}{"{}\ \ \ \ LAD\ GR1,=\#A"{}},\ pass);}
\DoxyCodeLine{00506\ \ \ \ \ assembleline(\textcolor{stringliteral}{"{}\ \ \ \ LAD\ GR2,=1"{}},\ pass);}
\DoxyCodeLine{00507\ \ \ \ \ assembleline(\textcolor{stringliteral}{"{}\ \ \ \ SVC\ 2"{}},\ pass);}
\DoxyCodeLine{00508\ \ \ \ \ assembleline(\textcolor{stringliteral}{"{}\ \ \ \ POP\ GR2"{}},\ pass);}
\DoxyCodeLine{00509\ \ \ \ \ assembleline(\textcolor{stringliteral}{"{}\ \ \ \ POP\ GR1"{}},\ pass);}
\DoxyCodeLine{00510\ \ \ \ \ FREE(line);}
\DoxyCodeLine{00511\ \}}
\DoxyCodeLine{00512\ }
\DoxyCodeLine{00513\ \textcolor{keywordtype}{void}\ assemble\_rpush(\textcolor{keyword}{const}\ CMDLINE\ *cmdl,\ PASS\ pass)}
\DoxyCodeLine{00514\ \{}
\DoxyCodeLine{00515\ \ \ \ \ \textcolor{keywordtype}{char}\ *line\ =\ malloc\_chk(LINESIZE\ +\ 1,\ \textcolor{stringliteral}{"{}assemble\_rpush.line"{}});}
\DoxyCodeLine{00516\ }
\DoxyCodeLine{00517\ \ \ \ \ \textcolor{keywordflow}{if}(cmdl-\/>opd-\/>opdc\ >\ 0)\ \{}
\DoxyCodeLine{00518\ \ \ \ \ \ \ \ \ setcerr(106,\ \textcolor{stringliteral}{"{}"{}});\ \ \ \ \textcolor{comment}{/*\ operand\ count\ mismatch\ */}}
\DoxyCodeLine{00519\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return};}
\DoxyCodeLine{00520\ \ \ \ \ \}}
\DoxyCodeLine{00521\ \ \ \ \ \textcolor{keywordflow}{for}(\textcolor{keywordtype}{int}\ i\ =\ 1;\ i\ <=\ GRSIZE-\/1;\ i++)\ \{}
\DoxyCodeLine{00522\ \ \ \ \ \ \ \ \ sprintf(line,\ \textcolor{stringliteral}{"{}\ \ \ \ PUSH\ 0,GR\%d"{}},\ i);}
\DoxyCodeLine{00523\ \ \ \ \ \ \ \ \ assembleline(line,\ pass);}
\DoxyCodeLine{00524\ \ \ \ \ \}}
\DoxyCodeLine{00525\ \ \ \ \ FREE(line);}
\DoxyCodeLine{00526\ \}}
\DoxyCodeLine{00527\ }
\DoxyCodeLine{00528\ \textcolor{keywordtype}{void}\ assemble\_rpop(\textcolor{keyword}{const}\ CMDLINE\ *cmdl,\ PASS\ pass)}
\DoxyCodeLine{00529\ \{}
\DoxyCodeLine{00530\ \ \ \ \ \textcolor{keywordtype}{char}\ *line\ =\ malloc\_chk(LINESIZE\ +\ 1,\ \textcolor{stringliteral}{"{}assemble\_rpop.line"{}});}
\DoxyCodeLine{00531\ }
\DoxyCodeLine{00532\ \ \ \ \ \textcolor{keywordflow}{if}(cmdl-\/>opd-\/>opdc\ >\ 0)\ \{}
\DoxyCodeLine{00533\ \ \ \ \ \ \ \ \ setcerr(106,\ \textcolor{stringliteral}{"{}"{}});\ \ \ \ \textcolor{comment}{/*\ operand\ count\ mismatch\ */}}
\DoxyCodeLine{00534\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return};}
\DoxyCodeLine{00535\ \ \ \ \ \}}
\DoxyCodeLine{00536\ \ \ \ \ \textcolor{keywordflow}{for}(\textcolor{keywordtype}{int}\ i\ =\ GRSIZE-\/1;\ i\ >=\ 1;\ i-\/-\/)\ \{}
\DoxyCodeLine{00537\ \ \ \ \ \ \ \ \ sprintf(line,\ \textcolor{stringliteral}{"{}\ \ \ \ POP\ GR\%d"{}},\ i);}
\DoxyCodeLine{00538\ \ \ \ \ \ \ \ \ assembleline(line,\ pass);}
\DoxyCodeLine{00539\ \ \ \ \ \}}
\DoxyCodeLine{00540\ \ \ \ \ FREE(line);}
\DoxyCodeLine{00541\ \}}
\DoxyCodeLine{00542\ }
\DoxyCodeLine{00543\ \textcolor{keywordtype}{bool}\ casl2cmd(CMD\ *cmdtbl,\ \textcolor{keyword}{const}\ CMDLINE\ *cmdl,\ PASS\ pass)}
\DoxyCodeLine{00544\ \{}
\DoxyCodeLine{00545\ \ \ \ \ void\ (*cmdptr)(\textcolor{keyword}{const}\ CMDLINE\ *,\ PASS)\ =\ NULL;}
\DoxyCodeLine{00546\ }
\DoxyCodeLine{00547\ \ \ \ \ \textcolor{keywordflow}{for}(\textcolor{keywordtype}{int}\ i\ =\ 0;\ cmdtbl[i].name[0];\ i++)\ \{}
\DoxyCodeLine{00548\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}(strcmp(cmdl-\/>cmd,\ cmdtbl[i].name)\ ==\ 0)\ \{}
\DoxyCodeLine{00549\ \ \ \ \ \ \ \ \ \ \ \ \ cmdptr\ =\ cmdtbl[i].ptr;}
\DoxyCodeLine{00550\ \ \ \ \ \ \ \ \ \ \ \ \ (*cmdptr)(cmdl,\ pass);}
\DoxyCodeLine{00551\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{true};}
\DoxyCodeLine{00552\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00553\ \ \ \ \ \}}
\DoxyCodeLine{00554\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{00555\ \}}
\DoxyCodeLine{00556\ }
\DoxyCodeLine{00557\ \textcolor{keywordtype}{bool}\ assemble\_comet2cmd(\textcolor{keyword}{const}\ CMDLINE\ *cmdl,\ PASS\ pass)}
\DoxyCodeLine{00558\ \{}
\DoxyCodeLine{00559\ \ \ \ \ WORD\ cmd\ =\ 0;}
\DoxyCodeLine{00560\ \ \ \ \ WORD\ r\_r1\ =\ 0;}
\DoxyCodeLine{00561\ \ \ \ \ WORD\ x\_r2\ =\ 0;}
\DoxyCodeLine{00562\ \ \ \ \ WORD\ adr\ =\ 0;}
\DoxyCodeLine{00563\ }
\DoxyCodeLine{00564\ \ \ \ \ \textcolor{comment}{/*\ オペランドなし\ */}}
\DoxyCodeLine{00565\ \ \ \ \ \textcolor{keywordflow}{if}(cmdl-\/>opd-\/>opdc\ ==\ 0)\ \{}
\DoxyCodeLine{00566\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}((cmd\ =\ getcmdcode(cmdl-\/>cmd,\ NONE))\ ==\ 0xFFFF)\ \{}
\DoxyCodeLine{00567\ \ \ \ \ \ \ \ \ \ \ \ \ setcerr(112,\ cmdl-\/>cmd);\ \ \ \ \textcolor{comment}{/*\ not\ command\ of\ no\ operand\ */}}
\DoxyCodeLine{00568\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{00569\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00570\ \ \ \ \ \ \ \ \ writememory(cmd,\ (asptr-\/>ptr)++,\ pass);}
\DoxyCodeLine{00571\ \ \ \ \ \}}
\DoxyCodeLine{00572\ \ \ \ \ \textcolor{comment}{/*\ 第1オペランドは汎用レジスタ\ */}}
\DoxyCodeLine{00573\ \ \ \ \ \textcolor{keywordflow}{else}\ \textcolor{keywordflow}{if}((r\_r1\ =\ grword(cmdl-\/>opd-\/>opdv[0],\ \textcolor{keyword}{false}))\ !=\ 0xFFFF)\ \{}
\DoxyCodeLine{00574\ \ \ \ \ \ \ \ \ \textcolor{comment}{/*\ オペランド数1\ */}}
\DoxyCodeLine{00575\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}(cmdl-\/>opd-\/>opdc\ ==\ 1)\ \{}
\DoxyCodeLine{00576\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}((cmd\ =\ getcmdcode(cmdl-\/>cmd,\ R\_))\ ==\ 0xFFFF)\ \{}
\DoxyCodeLine{00577\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ setcerr(108,\ cmdl-\/>cmd);\ \ \ \ \textcolor{comment}{/*\ not\ command\ of\ operand\ "{}r"{}\ */}}
\DoxyCodeLine{00578\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{00579\ \ \ \ \ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00580\ \ \ \ \ \ \ \ \ \ \ \ \ cmd\ |=\ (r\_r1\ <<\ 4);}
\DoxyCodeLine{00581\ \ \ \ \ \ \ \ \ \ \ \ \ writememory(cmd,\ (asptr-\/>ptr)++,\ pass);}
\DoxyCodeLine{00582\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00583\ \ \ \ \ \ \ \ \ \textcolor{comment}{/*\ オペランド数2。第2オペランドは汎用レジスタ\ */}}
\DoxyCodeLine{00584\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{else}\ \textcolor{keywordflow}{if}(cmdl-\/>opd-\/>opdc\ ==\ 2\ \&\&\ (x\_r2\ =\ grword(cmdl-\/>opd-\/>opdv[1],\ \textcolor{keyword}{false}))\ !=\ 0xFFFF)\ \{}
\DoxyCodeLine{00585\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}((cmd\ =\ getcmdcode(cmdl-\/>cmd,\ R1\_R2))\ ==\ 0xFFFF)\ \{}
\DoxyCodeLine{00586\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ setcerr(109,\ cmdl-\/>cmd);\ \ \ \ \textcolor{comment}{/*\ not\ command\ of\ operand\ "{}r1,r2"{}\ */}}
\DoxyCodeLine{00587\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{00588\ \ \ \ \ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00589\ \ \ \ \ \ \ \ \ \ \ \ \ cmd\ |=\ ((r\_r1\ <<\ 4)\ |\ x\_r2);\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{comment}{/*\ 第1オペランド、第2オペランドともに汎用レジスタ\ */}}
\DoxyCodeLine{00590\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{comment}{/*\ メモリへの書き込み\ */}}
\DoxyCodeLine{00591\ \ \ \ \ \ \ \ \ \ \ \ \ writememory(cmd,\ (asptr-\/>ptr)++,\ pass);}
\DoxyCodeLine{00592\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00593\ \ \ \ \ \ \ \ \ \textcolor{comment}{/*\ オペランド数2または3\ */}}
\DoxyCodeLine{00594\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{else}\ \textcolor{keywordflow}{if}(cmdl-\/>opd-\/>opdc\ ==\ 2\ ||\ cmdl-\/>opd-\/>opdc\ ==\ 3)\ \{}
\DoxyCodeLine{00595\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}((cmd\ =\ getcmdcode(cmdl-\/>cmd,\ R\_ADR\_X))\ ==\ 0xFFFF)\ \{}
\DoxyCodeLine{00596\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ setcerr(110,\ cmdl-\/>cmd);\ \ \ \ \textcolor{comment}{/*\ not\ command\ of\ operand\ "{}r,adr[,x]"{}\ */}}
\DoxyCodeLine{00597\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{00598\ \ \ \ \ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00599\ \ \ \ \ \ \ \ \ \ \ \ \ cmd\ |=\ (r\_r1\ <<\ 4);\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{comment}{/*\ 第1オペランドは汎用レジスタ\ */}}
\DoxyCodeLine{00600\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{comment}{/*\ オペランド数3の場合\ */}}
\DoxyCodeLine{00601\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}(cmdl-\/>opd-\/>opdc\ ==\ 3)\ \{\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{comment}{/*\ 第3オペランドは指標レジスタとして用いる汎用レジスタ\ */}}
\DoxyCodeLine{00602\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}((x\_r2\ =\ grword(cmdl-\/>opd-\/>opdv[2],\ \textcolor{keyword}{true}))\ ==\ 0xFFFF)\ \{}
\DoxyCodeLine{00603\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ setcerr(125,\ cmdl-\/>cmd);\ \ \ \ \textcolor{comment}{/*\ not\ GR\ in\ operand\ x\ */}}
\DoxyCodeLine{00604\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{00605\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00606\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ cmd\ |=\ x\_r2;}
\DoxyCodeLine{00607\ \ \ \ \ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00608\ \ \ \ \ \ \ \ \ \ \ \ \ adr\ =\ getadr(asptr-\/>prog,\ cmdl-\/>opd-\/>opdv[1],\ pass);\ \textcolor{comment}{/*\ 第2オペランドはアドレス\ */}}
\DoxyCodeLine{00609\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{comment}{/*\ メモリへの書き込み\ */}}
\DoxyCodeLine{00610\ \ \ \ \ \ \ \ \ \ \ \ \ writememory(cmd,\ (asptr-\/>ptr)++,\ pass);}
\DoxyCodeLine{00611\ \ \ \ \ \ \ \ \ \ \ \ \ writememory(adr,\ (asptr-\/>ptr)++,\ pass);}
\DoxyCodeLine{00612\ \ \ \ \ \ \ \ \ \}\ \textcolor{keywordflow}{else}\ \{}
\DoxyCodeLine{00613\ \ \ \ \ \ \ \ \ \ \ \ \ setcerr(113,\ cmdl-\/>cmd);\ \ \ \ \textcolor{comment}{/*\ operand\ too\ many\ in\ COMET\ II\ command\ */}}
\DoxyCodeLine{00614\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{00615\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00616\ \ \ \ \ \}}
\DoxyCodeLine{00617\ \ \ \ \ \textcolor{comment}{/*\ オペランド数1または2。第1オペランドはアドレス\ */}}
\DoxyCodeLine{00618\ \ \ \ \ \textcolor{keywordflow}{else}\ \textcolor{keywordflow}{if}(cmdl-\/>opd-\/>opdc\ ==\ 1\ ||\ cmdl-\/>opd-\/>opdc\ ==\ 2)\ \{}
\DoxyCodeLine{00619\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}((cmd\ =\ getcmdcode(cmdl-\/>cmd,\ ADR\_X))\ ==\ 0xFFFF)\ \{}
\DoxyCodeLine{00620\ \ \ \ \ \ \ \ \ \ \ \ \ setcerr(111,\ cmdl-\/>cmd);\ \ \ \ \textcolor{comment}{/*\ not\ command\ of\ operand\ "{}adr[,x]"{}\ */}}
\DoxyCodeLine{00621\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{00622\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00623\ \ \ \ \ \ \ \ \ \textcolor{comment}{/*\ オペランド数2の場合\ */}}
\DoxyCodeLine{00624\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}(cmdl-\/>opd-\/>opdc\ ==\ 2)\ \{\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{comment}{/*\ 第2オペランドは指標レジスタとして用いる汎用レジスタ\ */}}
\DoxyCodeLine{00625\ \ \ \ \ \ \ \ \ \ \ \ \ x\_r2\ =\ grword(cmdl-\/>opd-\/>opdv[1],\ \textcolor{keyword}{true});}
\DoxyCodeLine{00626\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}(cerr-\/>num\ >\ 0)\ \{}
\DoxyCodeLine{00627\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{00628\ \ \ \ \ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00629\ \ \ \ \ \ \ \ \ \ \ \ \ cmd\ |=\ x\_r2;}
\DoxyCodeLine{00630\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00631\ \ \ \ \ \ \ \ \ \textcolor{comment}{/*\ CALLの場合はプログラムの入口名を表すラベルを取得\ */}}
\DoxyCodeLine{00632\ \ \ \ \ \ \ \ \ \textcolor{comment}{/*\ CALL以外の命令の場合と、プログラムの入口名を取得できない場合は、\ */}}
\DoxyCodeLine{00633\ \ \ \ \ \ \ \ \ \textcolor{comment}{/*\ 同一プログラム内のラベルを取得\ */}}
\DoxyCodeLine{00634\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}(pass\ ==\ SECOND\ \&\&\ cmd\ ==\ 0x8000)\ \{\ \ \ \ \ \ \ \ \textcolor{comment}{/*\ CALL命令\ */}}
\DoxyCodeLine{00635\ \ \ \ \ \ \ \ \ \ \ \ \ adr\ =\ getlabel(\textcolor{stringliteral}{"{}"{}},\ cmdl-\/>opd-\/>opdv[0]);}
\DoxyCodeLine{00636\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00637\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}(cmd\ !=\ 0x8000\ ||\ (pass\ ==\ SECOND\ \&\&\ adr\ ==\ 0xFFFF))\ \{}
\DoxyCodeLine{00638\ \ \ \ \ \ \ \ \ \ \ \ \ adr\ =\ getadr(asptr-\/>prog,\ cmdl-\/>opd-\/>opdv[0],\ pass);}
\DoxyCodeLine{00639\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00640\ \ \ \ \ \ \ \ \ \textcolor{comment}{/*\ メモリへの書込\ */}}
\DoxyCodeLine{00641\ \ \ \ \ \ \ \ \ writememory(cmd,\ (asptr-\/>ptr)++,\ pass);}
\DoxyCodeLine{00642\ \ \ \ \ \ \ \ \ writememory(adr,\ (asptr-\/>ptr)++,\ pass);}
\DoxyCodeLine{00643\ \ \ \ \ \}}
\DoxyCodeLine{00644\ \ \ \ \ \textcolor{keywordflow}{return}\ (cerr-\/>num\ ==\ 0)\ ?\ true\ :\ \textcolor{keyword}{false};}
\DoxyCodeLine{00645\ \}}
\DoxyCodeLine{00646\ }
\DoxyCodeLine{00647\ \textcolor{keywordtype}{bool}\ assembletok(\textcolor{keyword}{const}\ CMDLINE\ *cmdl,\ PASS\ pass)}
\DoxyCodeLine{00648\ \{}
\DoxyCodeLine{00649\ \ \ \ \ \textcolor{comment}{/*\ 命令がない場合\ */}}
\DoxyCodeLine{00650\ \ \ \ \ \textcolor{keywordflow}{if}(!cmdl-\/>cmd[0])\ \{}
\DoxyCodeLine{00651\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{true};}
\DoxyCodeLine{00652\ \ \ \ \ \}}
\DoxyCodeLine{00653\ \ \ \ \ \textcolor{comment}{/*\ アセンブラ命令またはマクロ命令の書込\ */}}
\DoxyCodeLine{00654\ \ \ \ \ \textcolor{keywordflow}{if}(casl2cmd(ascmd,\ cmdl,\ pass)\ ==\ \textcolor{keyword}{false}\ \&\&\ casl2cmd(macrocmd,\ cmdl,\ pass)\ ==\ \textcolor{keyword}{false})\ \{}
\DoxyCodeLine{00655\ \ \ \ \ \ \ \ \ \textcolor{comment}{/*\ 機械語命令の書込\ */}}
\DoxyCodeLine{00656\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}(assemble\_comet2cmd(cmdl,\ pass)\ ==\ \textcolor{keyword}{false})\ \{}
\DoxyCodeLine{00657\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}(cerr-\/>num\ ==\ 0)\ \{}
\DoxyCodeLine{00658\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ setcerr(113,\ cmdl-\/>cmd);\ \ \ \ \textcolor{comment}{/*\ operand\ too\ many\ in\ COMET\ II\ command\ */}}
\DoxyCodeLine{00659\ \ \ \ \ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00660\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00661\ \ \ \ \ \}}
\DoxyCodeLine{00662\ \ \ \ \ \textcolor{keywordflow}{return}\ (cerr-\/>num\ ==\ 0)\ ?\ true\ :\ \textcolor{keyword}{false};}
\DoxyCodeLine{00663\ \}}
\DoxyCodeLine{00664\ }
\DoxyCodeLine{00665\ \textcolor{keywordtype}{bool}\ assembleline(\textcolor{keyword}{const}\ \textcolor{keywordtype}{char}\ *line,\ PASS\ pass)}
\DoxyCodeLine{00666\ \{}
\DoxyCodeLine{00667\ \ \ \ \ CMDLINE\ *cmdl\ =\ NULL;}
\DoxyCodeLine{00668\ \ \ \ \ \textcolor{keywordtype}{bool}\ stat\ =\ \textcolor{keyword}{true};}
\DoxyCodeLine{00669\ }
\DoxyCodeLine{00670\ \ \ \ \ cmdl\ =\ linetok(line);}
\DoxyCodeLine{00671\ \ \ \ \ stat\ =\ (cerr-\/>num\ ==\ 0)\ ?\ \textcolor{keyword}{true}\ :\ \textcolor{keyword}{false};}
\DoxyCodeLine{00672\ \ \ \ \ \textcolor{keywordflow}{if}(cmdl\ !=\ NULL)\ \{}
\DoxyCodeLine{00673\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}(stat\ ==\ \textcolor{keyword}{true})\ \{}
\DoxyCodeLine{00674\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}(pass\ ==\ FIRST\ \&\&\ cmdl-\/>label[0])\ \{}
\DoxyCodeLine{00675\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ stat\ =\ addlabel(asptr-\/>prog,\ cmdl-\/>label,\ asptr-\/>ptr);}
\DoxyCodeLine{00676\ \ \ \ \ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00677\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00678\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}(stat\ ==\ \textcolor{keyword}{true})\ \{}
\DoxyCodeLine{00679\ \ \ \ \ \ \ \ \ \ \ \ \ stat\ =\ assembletok(cmdl,\ pass);}
\DoxyCodeLine{00680\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00681\ \ \ \ \ \ \ \ \ FREE(cmdl-\/>label);}
\DoxyCodeLine{00682\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}(cmdl-\/>opd\ !=\ NULL)\ \{}
\DoxyCodeLine{00683\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{for}(\textcolor{keywordtype}{int}\ i\ =\ 0;\ i\ <\ cmdl-\/>opd-\/>opdc;\ i++)\ \{}
\DoxyCodeLine{00684\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ FREE(cmdl-\/>opd-\/>opdv[i]);}
\DoxyCodeLine{00685\ \ \ \ \ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00686\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00687\ \ \ \ \ \ \ \ \ FREE(cmdl-\/>opd);}
\DoxyCodeLine{00688\ \ \ \ \ \ \ \ \ FREE(cmdl-\/>cmd);}
\DoxyCodeLine{00689\ \ \ \ \ \}}
\DoxyCodeLine{00690\ \ \ \ \ FREE(cmdl);}
\DoxyCodeLine{00691\ \ \ \ \ \textcolor{keywordflow}{return}\ stat;}
\DoxyCodeLine{00692\ \}}
\DoxyCodeLine{00693\ }
\DoxyCodeLine{00699\ \textcolor{keywordtype}{bool}\ assemblefile(\textcolor{keyword}{const}\ \textcolor{keywordtype}{char}\ *file,\ PASS\ pass)}
\DoxyCodeLine{00700\ \{}
\DoxyCodeLine{00701\ \ \ \ \ \textcolor{keywordtype}{int}\ lineno\ =\ 1;}
\DoxyCodeLine{00702\ \ \ \ \ \textcolor{keywordtype}{char}\ *line\ =\ NULL;}
\DoxyCodeLine{00703\ \ \ \ \ FILE\ *fp\ =\ NULL;}
\DoxyCodeLine{00704\ }
\DoxyCodeLine{00705\ \ \ \ \ \textcolor{keywordflow}{if}((fp\ =\ fopen(file,\ \textcolor{stringliteral}{"{}r"{}}))\ ==\ NULL)\ \{}
\DoxyCodeLine{00706\ \ \ \ \ \ \ \ \ cerr-\/>num\ =\ errno;}
\DoxyCodeLine{00707\ \ \ \ \ \ \ \ \ perror(file);}
\DoxyCodeLine{00708\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{00709\ \ \ \ \ \}}
\DoxyCodeLine{00710\ \ \ \ \ \textcolor{keywordflow}{for}(line\ =\ malloc\_chk(LINESIZE\ +\ 1,\ \textcolor{stringliteral}{"{}assemble.line"{}});\ fgets(line,\ LINESIZE,\ fp);\ lineno++)\ \{}
\DoxyCodeLine{00711\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}((pass\ ==\ FIRST\ \&\&\ asmode.src\ ==\ \textcolor{keyword}{true})\ ||\ (pass\ ==\ SECOND\ \&\&\ asmode.asdetail\ ==\ \textcolor{keyword}{true}))\ \{}
\DoxyCodeLine{00712\ \ \ \ \ \ \ \ \ \ \ \ \ printline(stdout,\ file,\ lineno,\ line);}
\DoxyCodeLine{00713\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00714\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}(assembleline(line,\ pass)\ ==\ \textcolor{keyword}{false})\ \{}
\DoxyCodeLine{00715\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{break};}
\DoxyCodeLine{00716\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00717\ \ \ \ \ \}}
\DoxyCodeLine{00718\ \ \ \ \ \textcolor{keywordflow}{if}(cerr-\/>num\ >\ 0)\ \{}
\DoxyCodeLine{00719\ \ \ \ \ \ \ \ \ fprintf(stderr,\ \textcolor{stringliteral}{"{}Assemble\ error\ -\/\ \%d:\ \%s\(\backslash\)n"{}},\ cerr-\/>num,\ cerr-\/>msg);}
\DoxyCodeLine{00720\ \ \ \ \ \ \ \ \ printline(stderr,\ file,\ lineno,\ line);}
\DoxyCodeLine{00721\ \ \ \ \ \}}
\DoxyCodeLine{00722\ \ \ \ \ FREE(line);}
\DoxyCodeLine{00723\ \ \ \ \ fclose(fp);}
\DoxyCodeLine{00724\ \ \ \ \ \textcolor{keywordflow}{return}\ (cerr-\/>num\ ==\ 0)\ ?\ true\ :\ \textcolor{keyword}{false};}
\DoxyCodeLine{00725\ \}}
\DoxyCodeLine{00726\ }
\DoxyCodeLine{00727\ \textcolor{keywordtype}{bool}\ assemble(\textcolor{keywordtype}{int}\ filec,\ \textcolor{keywordtype}{char}\ *filev[],\ WORD\ adr)}
\DoxyCodeLine{00728\ \{}
\DoxyCodeLine{00729\ \ \ \ \ \textcolor{keywordtype}{int}\ i;}
\DoxyCodeLine{00730\ \ \ \ \ PASS\ pass;}
\DoxyCodeLine{00731\ \ \ \ \ WORD\ bp[filec];}
\DoxyCodeLine{00732\ \ \ \ \ \textcolor{keywordtype}{bool}\ stat\ =\ \textcolor{keyword}{false};}
\DoxyCodeLine{00733\ }
\DoxyCodeLine{00734\ \ \ \ \ asptr\ =\ malloc\_chk(\textcolor{keyword}{sizeof}(ASPTR),\ \textcolor{stringliteral}{"{}asptr"{}});\ \ \ \ \textcolor{comment}{/*\ アセンブル時のプロパティ用の領域確保\ */}}
\DoxyCodeLine{00735\ \ \ \ \ asptr-\/>prog\ =\ malloc\_chk(LABELSIZE\ +\ 1,\ \textcolor{stringliteral}{"{}asptr.prog"{}});}
\DoxyCodeLine{00736\ \ \ \ \ asptr-\/>ptr\ =\ adr;}
\DoxyCodeLine{00737\ \ \ \ \ \textcolor{comment}{/*\ アセンブル。ラベル表作成のため、2回行う\ */}}
\DoxyCodeLine{00738\ \ \ \ \ \textcolor{keywordflow}{for}(pass\ =\ FIRST;\ pass\ <=\ SECOND;\ pass++)\ \{}
\DoxyCodeLine{00739\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{for}(i\ =\ 0;\ i\ <\ filec;\ i++)\ \{}
\DoxyCodeLine{00740\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{comment}{/*\ データの格納開始位置\ */}}
\DoxyCodeLine{00741\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}(pass\ ==\ FIRST)\ \{}
\DoxyCodeLine{00742\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ bp[i]\ =\ asptr-\/>ptr;}
\DoxyCodeLine{00743\ \ \ \ \ \ \ \ \ \ \ \ \ \}\ \textcolor{keywordflow}{else}\ \textcolor{keywordflow}{if}(pass\ ==\ SECOND)\ \{}
\DoxyCodeLine{00744\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ asptr-\/>ptr\ =\ bp[i];}
\DoxyCodeLine{00745\ \ \ \ \ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00746\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}(execmode.trace\ ==\ \textcolor{keyword}{true}\ ||\ execmode.dump\ ==\ \textcolor{keyword}{true}\ ||}
\DoxyCodeLine{00747\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ asmode.src\ ==\ \textcolor{keyword}{true}\ ||\ asmode.label\ ==\ \textcolor{keyword}{true}\ ||\ asmode.asdetail\ ==\ \textcolor{keyword}{true})}
\DoxyCodeLine{00748\ \ \ \ \ \ \ \ \ \ \ \ \ \{}
\DoxyCodeLine{00749\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ fprintf(stdout,\ \textcolor{stringliteral}{"{}\(\backslash\)nAssemble\ \%s\ (\%d)\(\backslash\)n"{}},\ filev[i],\ pass);}
\DoxyCodeLine{00750\ \ \ \ \ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00751\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{comment}{/*\ ファイルをアセンブル\ */}}
\DoxyCodeLine{00752\ \ \ \ \ \ \ \ \ \ \ \ \ stat\ =\ assemblefile(filev[i],\ pass);}
\DoxyCodeLine{00753\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}(stat\ ==\ \textcolor{keyword}{false})\ \{}
\DoxyCodeLine{00754\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{goto}\ asfin;}
\DoxyCodeLine{00755\ \ \ \ \ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00756\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00757\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}(pass\ ==\ FIRST\ \&\&\ asmode.label\ ==\ \textcolor{keyword}{true})\ \{}
\DoxyCodeLine{00758\ \ \ \ \ \ \ \ \ \ \ \ \ fprintf(stdout,\ \textcolor{stringliteral}{"{}\(\backslash\)nLabel::::\(\backslash\)n"{}});}
\DoxyCodeLine{00759\ \ \ \ \ \ \ \ \ \ \ \ \ printlabel();}
\DoxyCodeLine{00760\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}(asmode.onlylabel\ ==\ \textcolor{keyword}{true})\ \{}
\DoxyCodeLine{00761\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{break};}
\DoxyCodeLine{00762\ \ \ \ \ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00763\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00764\ \ \ \ \ \}}
\DoxyCodeLine{00765\ asfin:}
\DoxyCodeLine{00766\ \ \ \ \ freelabel();\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{comment}{/*\ ラベルハッシュ表を解放\ */}}
\DoxyCodeLine{00767\ \ \ \ \ FREE(asptr-\/>prog);\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{comment}{/*\ アセンブル時のプロパティを解放\ */}}
\DoxyCodeLine{00768\ \ \ \ \ FREE(asptr);}
\DoxyCodeLine{00769\ \ \ \ \ \textcolor{keywordflow}{return}\ stat;}
\DoxyCodeLine{00770\ \}}
\DoxyCodeLine{00771\ }
\DoxyCodeLine{00772\ \textcolor{comment}{/*\ assemble.hで定義された関数群\ */}}
\DoxyCodeLine{00773\ \textcolor{keywordtype}{void}\ addcerrlist\_assemble()}
\DoxyCodeLine{00774\ \{}
\DoxyCodeLine{00775\ \ \ \ \ addcerrlist\_tok();}
\DoxyCodeLine{00776\ \ \ \ \ addcerrlist\_word();}
\DoxyCodeLine{00777\ \ \ \ \ addcerrlist\_label();}
\DoxyCodeLine{00778\ \ \ \ \ addcerrlist(ARRAYSIZE(cerr\_assemble),\ cerr\_assemble);}
\DoxyCodeLine{00779\ \}}
\DoxyCodeLine{00780\ }
\DoxyCodeLine{00781\ \textcolor{keywordtype}{void}\ outassemble(\textcolor{keyword}{const}\ \textcolor{keywordtype}{char}\ *file)}
\DoxyCodeLine{00782\ \{}
\DoxyCodeLine{00783\ \ \ \ \ FILE\ *fp\ =\ NULL;}
\DoxyCodeLine{00784\ }
\DoxyCodeLine{00785\ \ \ \ \ \textcolor{keywordflow}{if}((fp\ =\ fopen(file,\ \textcolor{stringliteral}{"{}w"{}}))\ ==\ NULL)\ \{}
\DoxyCodeLine{00786\ \ \ \ \ \ \ \ \ perror(file);}
\DoxyCodeLine{00787\ \ \ \ \ \ \ \ \ exit(1);}
\DoxyCodeLine{00788\ \ \ \ \ \}}
\DoxyCodeLine{00789\ \ \ \ \ fwrite(sys-\/>memory,\ \textcolor{keyword}{sizeof}(WORD),\ execptr-\/>end,\ fp);}
\DoxyCodeLine{00790\ \ \ \ \ fclose(fp);}
\DoxyCodeLine{00791\ \}}

\end{DoxyCode}

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