\doxysection{dump.\+c}
\label{dump_8c_source}\index{src/dump.c@{src/dump.c}}
\textbf{ Go to the documentation of this file.}
\begin{DoxyCode}{0}
\DoxyCodeLine{00001\ \textcolor{preprocessor}{\#include\ "{}exec.h"{}}}
\DoxyCodeLine{00002\ }
\DoxyCodeLine{00003\ \textcolor{comment}{/*\ exec.hに定義された関数群\ */}}
\DoxyCodeLine{00004\ \textcolor{keywordtype}{void}\ dumpmemory(WORD\ start,\ WORD\ end)}
\DoxyCodeLine{00005\ \{}
\DoxyCodeLine{00006\ \ \ \ \ \textcolor{keyword}{const}\ WORD\ col\ =\ 0x10;}
\DoxyCodeLine{00007\ \ \ \ \ WORD\ mod\ =\ 0;}
\DoxyCodeLine{00008\ \ \ \ \ \textcolor{comment}{/*\ Header\ */}}
\DoxyCodeLine{00009\ \ \ \ \ fprintf(stdout,\ \textcolor{stringliteral}{"{}\#\%04X:\ adr\ :"{}},\ sys-\/>cpu-\/>pr);}
\DoxyCodeLine{00010\ \ \ \ \ \textcolor{keywordflow}{if}(end\ >\ sys-\/>memsize)\ \{}
\DoxyCodeLine{00011\ \ \ \ \ \ \ \ \ end\ =\ sys-\/>memsize;}
\DoxyCodeLine{00012\ \ \ \ \ \}}
\DoxyCodeLine{00013\ \ \ \ \ \textcolor{keywordflow}{for}(\textcolor{keywordtype}{int}\ i\ =\ 0;\ i\ <\ sys-\/>memsize\ \&\&\ i\ <\ col;\ i++)\ \{}
\DoxyCodeLine{00014\ \ \ \ \ \ \ \ \ fprintf(stdout,\ \textcolor{stringliteral}{"{}\ \%04X"{}},\ i);}
\DoxyCodeLine{00015\ \ \ \ \ \}}
\DoxyCodeLine{00016\ \ \ \ \ fprintf(stdout,\ \textcolor{stringliteral}{"{}\(\backslash\)n"{}});}
\DoxyCodeLine{00017\ \ \ \ \ fprintf(stdout,\ \textcolor{stringliteral}{"{}\ \ \ \ \ \ \ -\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/\(\backslash\)n"{}});}
\DoxyCodeLine{00018\ \ \ \ \ \textcolor{comment}{/*\ Memory\ */}}
\DoxyCodeLine{00019\ \ \ \ \ \textcolor{keywordflow}{for}(\textcolor{keywordtype}{int}\ i\ =\ start;\ i\ <\ end;\ i++)\ \{}
\DoxyCodeLine{00020\ \ \ \ \ \ \ \ \ mod\ =\ i\ \%\ col;}
\DoxyCodeLine{00021\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}(mod\ ==\ 0\ ||\ i\ ==\ start)\ \{}
\DoxyCodeLine{00022\ \ \ \ \ \ \ \ \ \ \ \ \ fprintf(stdout,\ \textcolor{stringliteral}{"{}\#\%04X:\ \%04X:\ "{}},\ sys-\/>cpu-\/>pr,\ i);}
\DoxyCodeLine{00023\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00024\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}(i\ ==\ start)\ \{}
\DoxyCodeLine{00025\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{for}(\textcolor{keywordtype}{int}\ j\ =\ 0;\ j\ <\ mod;\ j++)\ \{}
\DoxyCodeLine{00026\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ fprintf(stdout,\ \textcolor{stringliteral}{"{}\ \ \ \ \ "{}});}
\DoxyCodeLine{00027\ \ \ \ \ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00028\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00029\ \ \ \ \ \ \ \ \ fprintf(stdout,\ \textcolor{stringliteral}{"{}\%04X"{}},\ sys-\/>memory[i]);}
\DoxyCodeLine{00030\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}((i\ >\ 0\ \&\&\ (i\ +\ 1)\ \%\ col\ ==\ 0)\ ||\ (i\ +\ 1)\ ==\ end)\ \{}
\DoxyCodeLine{00031\ \ \ \ \ \ \ \ \ \ \ \ \ fprintf(stdout,\ \textcolor{stringliteral}{"{}\(\backslash\)n"{}});}
\DoxyCodeLine{00032\ \ \ \ \ \ \ \ \ \}\ \textcolor{keywordflow}{else}\ \{}
\DoxyCodeLine{00033\ \ \ \ \ \ \ \ \ \ \ \ \ fprintf(stdout,\ \textcolor{stringliteral}{"{}\ "{}});}
\DoxyCodeLine{00034\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00035\ \ \ \ \ \}}
\DoxyCodeLine{00036\ \}}
\DoxyCodeLine{00037\ }
\DoxyCodeLine{00038\ \textcolor{keywordtype}{void}\ dspregister()}
\DoxyCodeLine{00039\ \{}
\DoxyCodeLine{00040\ \ \ \ \ \textcolor{keywordtype}{char}\ *sp\ =\ word2bit(sys-\/>cpu-\/>sp);}
\DoxyCodeLine{00041\ \ \ \ \ \textcolor{keywordtype}{char}\ *pr\ =\ word2bit(sys-\/>cpu-\/>pr);}
\DoxyCodeLine{00042\ \ \ \ \ \textcolor{keywordtype}{char}\ *fr\ =\ word2bit(sys-\/>cpu-\/>fr);}
\DoxyCodeLine{00043\ \ \ \ \ \textcolor{keyword}{enum}\ \{}
\DoxyCodeLine{00044\ \ \ \ \ \ \ \ \ L3BIT\ =\ 16\ -\/\ 3,\ \ \ \ \ \textcolor{comment}{/*\ WORD値16ビットのうち、下位3ビットの開始位置\ */}}
\DoxyCodeLine{00045\ \ \ \ \ \};}
\DoxyCodeLine{00046\ \ \ \ \ \textcolor{keywordflow}{for}(\textcolor{keywordtype}{int}\ i\ =\ 0;\ i\ <\ GRSIZE;\ i++\ )\ \{}
\DoxyCodeLine{00047\ \ \ \ \ \ \ \ \ fprintf(stdout,\ \textcolor{stringliteral}{"{}\#\%04X:\ GR\%d:\ "{}},\ sys-\/>cpu-\/>pr,\ i);}
\DoxyCodeLine{00048\ \ \ \ \ \ \ \ \ print\_dumpword(sys-\/>cpu-\/>gr[i],\ execmode.logical);}
\DoxyCodeLine{00049\ \ \ \ \ \ \ \ \ fprintf(stdout,\ \textcolor{stringliteral}{"{}\(\backslash\)n"{}});}
\DoxyCodeLine{00050\ \ \ \ \ \}}
\DoxyCodeLine{00051\ \ \ \ \ fprintf(stdout,\ \textcolor{stringliteral}{"{}\#\%04X:\ SP:\ \ \%6d\ =\ \#\%04X\ =\ \%s\(\backslash\)n"{}},\ sys-\/>cpu-\/>pr,\ sys-\/>cpu-\/>sp,\ sys-\/>cpu-\/>sp,\ sp);}
\DoxyCodeLine{00052\ \ \ \ \ fprintf(stdout,\ \textcolor{stringliteral}{"{}\#\%04X:\ PR:\ \ \%6d\ =\ \#\%04X\ =\ \%s\(\backslash\)n"{}},\ sys-\/>cpu-\/>pr,\ sys-\/>cpu-\/>pr,\ sys-\/>cpu-\/>pr,\ pr);}
\DoxyCodeLine{00053\ \ \ \ \ fprintf(stdout,\ \textcolor{stringliteral}{"{}\#\%04X:\ FR\ (OF\ SF\ ZF):\ \%s\(\backslash\)n"{}},\ sys-\/>cpu-\/>pr,\ fr\ +\ L3BIT);\ \textcolor{comment}{/*\ FRは下位3けたを表示\ */}}
\DoxyCodeLine{00054\ \ \ \ \ FREE(sp);}
\DoxyCodeLine{00055\ \ \ \ \ FREE(pr);}
\DoxyCodeLine{00056\ \ \ \ \ FREE(fr);}
\DoxyCodeLine{00057\ \}}
\end{DoxyCode}