OpenCores
URL https://opencores.org/ocsvn/open8_urisc/open8_urisc/trunk

Subversion Repositories open8_urisc

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /
    from Rev 240 to Rev 241
    Reverse comparison

Rev 240 → Rev 241

/open8_urisc/trunk/Documents/CPU Instruction Set.htm
0,0 → 1,330
<html xmlns:v="urn:schemas-microsoft-com:vml"
xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:x="urn:schemas-microsoft-com:office:excel"
xmlns="http://www.w3.org/TR/REC-html40">
 
<head>
<meta name="Excel Workbook Frameset">
<meta http-equiv=Content-Type content="text/html; charset=windows-1252">
<meta name=ProgId content=Excel.Sheet>
<meta name=Generator content="Microsoft Excel 12">
<link rel=File-List href="CPU%20Instruction%20Set_files/filelist.xml">
<![if !supportTabStrip]>
<link id="shLink" href="CPU%20Instruction%20Set_files/sheet001.htm">
<link id="shLink" href="CPU%20Instruction%20Set_files/sheet002.htm">
 
<link id="shLink">
 
<script language="JavaScript">
<!--
var c_lTabs=2;
 
var c_rgszSh=new Array(c_lTabs);
 
 
 
 
 
var c_rgszClr=new Array(8);
c_rgszClr[0]="window";
c_rgszClr[1]="buttonface";
c_rgszClr[2]="windowframe";
c_rgszClr[3]="windowtext";
c_rgszClr[4]="threedlightshadow";
c_rgszClr[5]="threedhighlight";
c_rgszClr[6]="threeddarkshadow";
c_rgszClr[7]="threedshadow";
 
var g_iShCur;
var g_rglTabX=new Array(c_lTabs);
 
function fnGetIEVer()
{
var ua=window.navigator.userAgent
var msie=ua.indexOf("MSIE")
if (msie>0 && window.navigator.platform=="Win32")
return parseInt(ua.substring(msie+5,ua.indexOf(".", msie)));
else
return 0;
}
 
function fnBuildFrameset()
{
var szHTML="<frameset rows=\"*,18\" border=0 width=0 frameborder=no framespacing=0>"+
"<frame src=\""+document.all.item("shLink")[0].href+"\" name=\"frSheet\" noresize>"+
"<frameset cols=\"54,*\" border=0 width=0 frameborder=no framespacing=0>"+
"<frame src=\"\" name=\"frScroll\" marginwidth=0 marginheight=0 scrolling=no>"+
"<frame src=\"\" name=\"frTabs\" marginwidth=0 marginheight=0 scrolling=no>"+
"</frameset></frameset><plaintext>";
 
with (document) {
open("text/html","replace");
write(szHTML);
close();
}
 
fnBuildTabStrip();
}
 
function fnBuildTabStrip()
{
var szHTML=
"<html><head><style>.clScroll {font:8pt Courier New;color:"+c_rgszClr[6]+";cursor:default;line-height:10pt;}"+
".clScroll2 {font:10pt Arial;color:"+c_rgszClr[6]+";cursor:default;line-height:11pt;}</style></head>"+
"<body onclick=\"event.returnValue=false;\" ondragstart=\"event.returnValue=false;\" onselectstart=\"event.returnValue=false;\" bgcolor="+c_rgszClr[4]+" topmargin=0 leftmargin=0><table cellpadding=0 cellspacing=0 width=100%>"+
"<tr><td colspan=6 height=1 bgcolor="+c_rgszClr[2]+"></td></tr>"+
"<tr><td style=\"font:1pt\">&nbsp;<td>"+
"<td valign=top id=tdScroll class=\"clScroll\" onclick=\"parent.fnFastScrollTabs(0);\" onmouseover=\"parent.fnMouseOverScroll(0);\" onmouseout=\"parent.fnMouseOutScroll(0);\"><a>&#171;</a></td>"+
"<td valign=top id=tdScroll class=\"clScroll2\" onclick=\"parent.fnScrollTabs(0);\" ondblclick=\"parent.fnScrollTabs(0);\" onmouseover=\"parent.fnMouseOverScroll(1);\" onmouseout=\"parent.fnMouseOutScroll(1);\"><a>&lt</a></td>"+
"<td valign=top id=tdScroll class=\"clScroll2\" onclick=\"parent.fnScrollTabs(1);\" ondblclick=\"parent.fnScrollTabs(1);\" onmouseover=\"parent.fnMouseOverScroll(2);\" onmouseout=\"parent.fnMouseOutScroll(2);\"><a>&gt</a></td>"+
"<td valign=top id=tdScroll class=\"clScroll\" onclick=\"parent.fnFastScrollTabs(1);\" onmouseover=\"parent.fnMouseOverScroll(3);\" onmouseout=\"parent.fnMouseOutScroll(3);\"><a>&#187;</a></td>"+
"<td style=\"font:1pt\">&nbsp;<td></tr></table></body></html>";
 
with (frames['frScroll'].document) {
open("text/html","replace");
write(szHTML);
close();
}
 
szHTML =
"<html><head>"+
"<style>A:link,A:visited,A:active {text-decoration:none;"+"color:"+c_rgszClr[3]+";}"+
".clTab {cursor:hand;background:"+c_rgszClr[1]+";font:9pt Arial;padding-left:3px;padding-right:3px;text-align:center;}"+
".clBorder {background:"+c_rgszClr[2]+";font:1pt;}"+
"</style></head><body onload=\"parent.fnInit();\" onselectstart=\"event.returnValue=false;\" ondragstart=\"event.returnValue=false;\" bgcolor="+c_rgszClr[4]+
" topmargin=0 leftmargin=0><table id=tbTabs cellpadding=0 cellspacing=0>";
 
var iCellCount=(c_lTabs+1)*2;
 
var i;
for (i=0;i<iCellCount;i+=2)
szHTML+="<col width=1><col>";
 
var iRow;
for (iRow=0;iRow<6;iRow++) {
 
szHTML+="<tr>";
 
if (iRow==5)
szHTML+="<td colspan="+iCellCount+"></td>";
else {
if (iRow==0) {
for(i=0;i<iCellCount;i++)
szHTML+="<td height=1 class=\"clBorder\"></td>";
} else if (iRow==1) {
for(i=0;i<c_lTabs;i++) {
szHTML+="<td height=1 nowrap class=\"clBorder\">&nbsp;</td>";
szHTML+=
"<td id=tdTab height=1 nowrap class=\"clTab\" onmouseover=\"parent.fnMouseOverTab("+i+");\" onmouseout=\"parent.fnMouseOutTab("+i+");\">"+
"<a href=\""+document.all.item("shLink")[i].href+"\" target=\"frSheet\" id=aTab>&nbsp;"+c_rgszSh[i]+"&nbsp;</a></td>";
}
szHTML+="<td id=tdTab height=1 nowrap class=\"clBorder\"><a id=aTab>&nbsp;</a></td><td width=100%></td>";
} else if (iRow==2) {
for (i=0;i<c_lTabs;i++)
szHTML+="<td height=1></td><td height=1 class=\"clBorder\"></td>";
szHTML+="<td height=1></td><td height=1></td>";
} else if (iRow==3) {
for (i=0;i<iCellCount;i++)
szHTML+="<td height=1></td>";
} else if (iRow==4) {
for (i=0;i<c_lTabs;i++)
szHTML+="<td height=1 width=1></td><td height=1></td>";
szHTML+="<td height=1 width=1></td><td></td>";
}
}
szHTML+="</tr>";
}
 
szHTML+="</table></body></html>";
with (frames['frTabs'].document) {
open("text/html","replace");
charset=document.charset;
write(szHTML);
close();
}
}
 
function fnInit()
{
g_rglTabX[0]=0;
var i;
for (i=1;i<=c_lTabs;i++)
with (frames['frTabs'].document.all.tbTabs.rows[1].cells[fnTabToCol(i-1)])
g_rglTabX[i]=offsetLeft+offsetWidth-6;
}
 
function fnTabToCol(iTab)
{
return 2*iTab+1;
}
 
function fnNextTab(fDir)
{
var iNextTab=-1;
var i;
 
with (frames['frTabs'].document.body) {
if (fDir==0) {
if (scrollLeft>0) {
for (i=0;i<c_lTabs&&g_rglTabX[i]<scrollLeft;i++);
if (i<c_lTabs)
iNextTab=i-1;
}
} else {
if (g_rglTabX[c_lTabs]+6>offsetWidth+scrollLeft) {
for (i=0;i<c_lTabs&&g_rglTabX[i]<=scrollLeft;i++);
if (i<c_lTabs)
iNextTab=i;
}
}
}
return iNextTab;
}
 
function fnScrollTabs(fDir)
{
var iNextTab=fnNextTab(fDir);
 
if (iNextTab>=0) {
frames['frTabs'].scroll(g_rglTabX[iNextTab],0);
return true;
} else
return false;
}
 
function fnFastScrollTabs(fDir)
{
if (c_lTabs>16)
frames['frTabs'].scroll(g_rglTabX[fDir?c_lTabs-1:0],0);
else
if (fnScrollTabs(fDir)>0) window.setTimeout("fnFastScrollTabs("+fDir+");",5);
}
 
function fnSetTabProps(iTab,fActive)
{
var iCol=fnTabToCol(iTab);
var i;
 
if (iTab>=0) {
with (frames['frTabs'].document.all) {
with (tbTabs) {
for (i=0;i<=4;i++) {
with (rows[i]) {
if (i==0)
cells[iCol].style.background=c_rgszClr[fActive?0:2];
else if (i>0 && i<4) {
if (fActive) {
cells[iCol-1].style.background=c_rgszClr[2];
cells[iCol].style.background=c_rgszClr[0];
cells[iCol+1].style.background=c_rgszClr[2];
} else {
if (i==1) {
cells[iCol-1].style.background=c_rgszClr[2];
cells[iCol].style.background=c_rgszClr[1];
cells[iCol+1].style.background=c_rgszClr[2];
} else {
cells[iCol-1].style.background=c_rgszClr[4];
cells[iCol].style.background=c_rgszClr[(i==2)?2:4];
cells[iCol+1].style.background=c_rgszClr[4];
}
}
} else
cells[iCol].style.background=c_rgszClr[fActive?2:4];
}
}
}
with (aTab[iTab].style) {
cursor=(fActive?"default":"hand");
color=c_rgszClr[3];
}
}
}
}
 
function fnMouseOverScroll(iCtl)
{
frames['frScroll'].document.all.tdScroll[iCtl].style.color=c_rgszClr[7];
}
 
function fnMouseOutScroll(iCtl)
{
frames['frScroll'].document.all.tdScroll[iCtl].style.color=c_rgszClr[6];
}
 
function fnMouseOverTab(iTab)
{
if (iTab!=g_iShCur) {
var iCol=fnTabToCol(iTab);
with (frames['frTabs'].document.all) {
tdTab[iTab].style.background=c_rgszClr[5];
}
}
}
 
function fnMouseOutTab(iTab)
{
if (iTab>=0) {
var elFrom=frames['frTabs'].event.srcElement;
var elTo=frames['frTabs'].event.toElement;
 
if ((!elTo) ||
(elFrom.tagName==elTo.tagName) ||
(elTo.tagName=="A" && elTo.parentElement!=elFrom) ||
(elFrom.tagName=="A" && elFrom.parentElement!=elTo)) {
 
if (iTab!=g_iShCur) {
with (frames['frTabs'].document.all) {
tdTab[iTab].style.background=c_rgszClr[1];
}
}
}
}
}
 
function fnSetActiveSheet(iSh)
{
if (iSh!=g_iShCur) {
fnSetTabProps(g_iShCur,false);
fnSetTabProps(iSh,true);
g_iShCur=iSh;
}
}
 
window.g_iIEVer=fnGetIEVer();
if (window.g_iIEVer>=4)
fnBuildFrameset();
//-->
</script>
<![endif]><!--[if gte mso 9]><xml>
<x:ExcelWorkbook>
<x:ExcelWorksheets>
<x:ExcelWorksheet>
<x:Name>Instruction Set</x:Name>
<x:WorksheetSource HRef="CPU%20Instruction%20Set_files/sheet001.htm"/>
</x:ExcelWorksheet>
<x:ExcelWorksheet>
<x:Name>CPU Options</x:Name>
<x:WorksheetSource HRef="CPU%20Instruction%20Set_files/sheet002.htm"/>
</x:ExcelWorksheet>
</x:ExcelWorksheets>
<x:Stylesheet HRef="CPU%20Instruction%20Set_files/stylesheet.css"/>
<x:WindowHeight>8010</x:WindowHeight>
<x:WindowWidth>14805</x:WindowWidth>
<x:WindowTopX>240</x:WindowTopX>
<x:WindowTopY>105</x:WindowTopY>
<x:ProtectStructure>False</x:ProtectStructure>
<x:ProtectWindows>False</x:ProtectWindows>
</x:ExcelWorkbook>
</xml><![endif]-->
</head>
 
<frameset rows="*,39" border=0 width=0 frameborder=no framespacing=0>
<frame src="CPU%20Instruction%20Set_files/sheet001.htm" name="frSheet">
<frame src="CPU%20Instruction%20Set_files/tabstrip.htm" name="frTabs" marginwidth=0 marginheight=0>
<noframes>
<body>
<p>This page uses frames, but your browser doesn't support them.</p>
</body>
</noframes>
</frameset>
</html>
/open8_urisc/trunk/Documents/CPU Instruction Set_files/filelist.xml
0,0 → 1,8
<xml xmlns:o="urn:schemas-microsoft-com:office:office">
<o:MainFile HRef="../CPU%20Instruction%20Set.htm"/>
<o:File HRef="stylesheet.css"/>
<o:File HRef="tabstrip.htm"/>
<o:File HRef="sheet001.htm"/>
<o:File HRef="sheet002.htm"/>
<o:File HRef="filelist.xml"/>
</xml>
/open8_urisc/trunk/Documents/CPU Instruction Set_files/sheet001.htm
0,0 → 1,820
<html xmlns:v="urn:schemas-microsoft-com:vml"
xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:x="urn:schemas-microsoft-com:office:excel"
xmlns="http://www.w3.org/TR/REC-html40">
 
<head>
<meta http-equiv=Content-Type content="text/html; charset=windows-1252">
<meta name=ProgId content=Excel.Sheet>
<meta name=Generator content="Microsoft Excel 12">
<link id=Main-File rel=Main-File href="../CPU%20Instruction%20Set.htm">
<link rel=File-List href=filelist.xml>
<link rel=Stylesheet href=stylesheet.css>
<style>
<!--table
{mso-displayed-decimal-separator:"\.";
mso-displayed-thousand-separator:"\,";}
@page
{margin:.75in .7in .75in .7in;
mso-header-margin:.3in;
mso-footer-margin:.3in;}
-->
</style>
<![if !supportTabStrip]><script language="JavaScript">
<!--
function fnUpdateTabs()
{
if (parent.window.g_iIEVer>=4) {
if (parent.document.readyState=="complete"
&& parent.frames['frTabs'].document.readyState=="complete")
parent.fnSetActiveSheet(0);
else
window.setTimeout("fnUpdateTabs();",150);
}
}
 
if (window.name!="frSheet")
window.location.replace("../CPU%20Instruction%20Set.htm");
else
fnUpdateTabs();
//-->
</script>
<![endif]>
</head>
 
<body link=blue vlink=purple>
 
<table border=0 cellpadding=0 cellspacing=0 width=1180 style='border-collapse:
collapse;table-layout:fixed;width:887pt'>
<col width=86 style='mso-width-source:userset;mso-width-alt:3145;width:65pt'>
<col class=xl67 width=74 style='mso-width-source:userset;mso-width-alt:2706;
width:56pt'>
<col class=xl67 width=61 style='mso-width-source:userset;mso-width-alt:2230;
width:46pt'>
<col class=xl66 width=64 style='width:48pt'>
<col class=xl68 width=670 style='mso-width-source:userset;mso-width-alt:24502;
width:503pt'>
<col width=64 style='width:48pt'>
<col width=97 style='mso-width-source:userset;mso-width-alt:3547;width:73pt'>
<col class=xl65 width=64 style='width:48pt'>
<tr height=20 style='height:15.0pt'>
<td height=20 width=86 style='height:15.0pt;width:65pt'></td>
<td class=xl67 width=74 style='width:56pt'></td>
<td class=xl67 width=61 style='width:46pt'></td>
<td class=xl107 colspan=2 width=734 style='mso-ignore:colspan;width:551pt'>Open8
Instruction Set</td>
<td width=64 style='width:48pt'></td>
<td width=97 style='width:73pt'></td>
<td class=xl65 width=64 style='width:48pt'></td>
</tr>
<tr height=20 style='height:15.0pt'>
<td height=20 style='height:15.0pt'></td>
<td colspan=2 class=xl67 style='mso-ignore:colspan'></td>
<td class=xl66></td>
<td class=xl68></td>
<td colspan=2 style='mso-ignore:colspan'></td>
<td class=xl65></td>
</tr>
<tr height=20 style='height:15.0pt'>
<td height=20 class=xl69 style='height:15.0pt'>Instruction</td>
<td class=xl70>Opcode</td>
<td class=xl70>Operand</td>
<td class=xl71>Flags</td>
<td class=xl72 width=670 style='width:503pt'>Description</td>
<td></td>
<td class=xl105>Legend</td>
<td class=xl65></td>
</tr>
<tr height=20 style='height:15.0pt'>
<td height=20 class=xl76 style='height:15.0pt;border-top:none'>INC R0-07</td>
<td class=xl77 style='border-top:none;border-left:none'>00000</td>
<td class=xl77 style='border-top:none;border-left:none'>xxx</td>
<td class=xl77 style='border-top:none;border-left:none'>N,C,Z</td>
<td class=xl78 width=670 style='border-top:none;border-left:none;width:503pt'>Increment
Register (Rn + 1 -&gt; Rn)</td>
<td></td>
<td class=xl76>ALU/MATH</td>
<td class=xl65></td>
</tr>
<tr height=20 style='height:15.0pt'>
<td height=20 class=xl76 style='height:15.0pt;border-top:none'>ADC R0-07</td>
<td class=xl77 style='border-top:none;border-left:none'>00001</td>
<td class=xl77 style='border-top:none;border-left:none'>xxx</td>
<td class=xl77 style='border-top:none;border-left:none'>N,C,Z</td>
<td class=xl78 width=670 style='border-top:none;border-left:none;width:503pt'>Add
with Carry (Rn + R0 + C -&gt; R0)</td>
<td></td>
<td class=xl79 style='border-top:none'>LOAD/STORE</td>
<td class=xl65></td>
</tr>
<tr height=20 style='height:15.0pt'>
<td height=20 class=xl76 style='height:15.0pt;border-top:none'>TX0 R0-R7</td>
<td class=xl77 style='border-top:none;border-left:none'>00010</td>
<td class=xl77 style='border-top:none;border-left:none'>xxx</td>
<td class=xl77 style='border-top:none;border-left:none'>N,Z</td>
<td class=xl78 width=670 style='border-top:none;border-left:none;width:503pt'>Transfer
Rn to R0 (Rn -&gt; R0)</td>
<td></td>
<td class=xl82 style='border-top:none'>BRANCH</td>
<td class=xl65></td>
</tr>
<tr height=20 style='height:15.0pt'>
<td height=20 class=xl76 style='height:15.0pt;border-top:none'>OR<span
 
<td class=xl77 style='border-top:none;border-left:none'>00011</td>
<td class=xl77 style='border-top:none;border-left:none'>xxx</td>
<td class=xl77 style='border-top:none;border-left:none'>N,Z</td>
<td class=xl78 width=670 style='border-top:none;border-left:none;width:503pt'>Logical
OR of Rn and R0 (Rn | R0 -&gt; R0)</td>
<td></td>
<td class=xl94 style='border-top:none'>STACK/FLOW</td>
<td class=xl65></td>
</tr>
<tr height=20 style='height:15.0pt'>
<td height=20 class=xl76 style='height:15.0pt;border-top:none'>AND R0-R7</td>
<td class=xl77 style='border-top:none;border-left:none'>00100</td>
<td class=xl77 style='border-top:none;border-left:none'>xxx</td>
<td class=xl77 style='border-top:none;border-left:none'>N,Z</td>
<td class=xl78 width=670 style='border-top:none;border-left:none;width:503pt'>Logical
AND of Rn and R0 (Rn &amp; R0 -&gt; R0)</td>
<td></td>
<td class=xl104 style='border-top:none'>SOFT INTS</td>
<td class=xl65></td>
</tr>
<tr height=20 style='height:15.0pt'>
<td height=20 class=xl76 style='height:15.0pt;border-top:none'>CLR R0</td>
<td class=xl77 style='border-top:none;border-left:none'>00101</td>
<td class=xl77 style='border-top:none;border-left:none'>000</td>
<td class=xl77 style='border-top:none;border-left:none'>N,Z</td>
<td class=xl78 width=670 style='border-top:none;border-left:none;width:503pt'>Special
case of XOR (R0^R0 -&gt; R0)</td>
<td colspan=2 style='mso-ignore:colspan'></td>
<td class=xl65></td>
</tr>
<tr height=20 style='height:15.0pt'>
<td height=20 class=xl76 style='height:15.0pt;border-top:none'>XOR R0-R7</td>
<td class=xl77 style='border-top:none;border-left:none'>00101</td>
<td class=xl77 style='border-top:none;border-left:none'>xxx</td>
<td class=xl77 style='border-top:none;border-left:none'>N,Z</td>
<td class=xl78 width=670 style='border-top:none;border-left:none;width:503pt'>Logical
XOR or Rn and R0 (Rn ^ R0 -&gt; R0)</td>
<td colspan=2 style='mso-ignore:colspan'></td>
<td class=xl65></td>
</tr>
<tr height=20 style='height:15.0pt'>
<td height=20 class=xl76 style='height:15.0pt;border-top:none'>ROL R0-R7</td>
<td class=xl77 style='border-top:none;border-left:none'>00110</td>
<td class=xl77 style='border-top:none;border-left:none'>xxx</td>
<td class=xl77 style='border-top:none;border-left:none'>N,C,Z</td>
<td class=xl78 width=670 style='border-top:none;border-left:none;width:503pt'>Rotate
Rn Left (Rn&lt;&lt;1 -&gt; Rn) (Note the carry is included in the
 
Rn(7) -&gt; C</td>
<td colspan=2 style='mso-ignore:colspan'></td>
<td class=xl65></td>
</tr>
<tr height=20 style='height:15.0pt'>
<td height=20 class=xl76 style='height:15.0pt;border-top:none'>ROR R0-R7</td>
<td class=xl77 style='border-top:none;border-left:none'>00111</td>
<td class=xl77 style='border-top:none;border-left:none'>xxx</td>
<td class=xl77 style='border-top:none;border-left:none'>N,C,Z</td>
<td class=xl78 width=670 style='border-top:none;border-left:none;width:503pt'>Rotate
Rn Right (Rn&gt;&gt;1 -&gt; Rn) (Note the carry is included in the
 
Rn(0) -&gt; C</td>
<td colspan=2 style='mso-ignore:colspan'></td>
<td class=xl65></td>
</tr>
<tr height=20 style='height:15.0pt'>
<td height=20 class=xl76 style='height:15.0pt;border-top:none'>DEC R0-R7</td>
<td class=xl77 style='border-top:none;border-left:none'>01000</td>
<td class=xl77 style='border-top:none;border-left:none'>xxx</td>
<td class=xl77 style='border-top:none;border-left:none'>N,C,Z</td>
<td class=xl78 width=670 style='border-top:none;border-left:none;width:503pt'>Decrement
Rn (Rn - 1 -&gt; Rn)</td>
<td colspan=2 style='mso-ignore:colspan'></td>
<td class=xl65></td>
</tr>
<tr height=20 style='height:15.0pt'>
<td height=20 class=xl76 style='height:15.0pt;border-top:none'>SBC R0-R7</td>
<td class=xl77 style='border-top:none;border-left:none'>01001</td>
<td class=xl77 style='border-top:none;border-left:none'>xxx</td>
<td class=xl77 style='border-top:none;border-left:none'>N,C,Z</td>
<td class=xl78 width=670 style='border-top:none;border-left:none;width:503pt'>Subtract
Rn from R0 with carry (R0 - Rn - C -&gt; R0)</td>
<td colspan=2 style='mso-ignore:colspan'></td>
<td class=xl65></td>
</tr>
<tr height=20 style='height:15.0pt'>
<td height=20 class=xl76 style='height:15.0pt;border-top:none'>ADD R0-R7</td>
<td class=xl77 style='border-top:none;border-left:none'>01010</td>
<td class=xl77 style='border-top:none;border-left:none'>xxx</td>
<td class=xl77 style='border-top:none;border-left:none'>N,C,Z</td>
<td class=xl78 width=670 style='border-top:none;border-left:none;width:503pt'>Add
Rn and R0 (R0 + Rn -&gt; R0)</td>
<td colspan=2 style='mso-ignore:colspan'></td>
<td class=xl65></td>
</tr>
<tr height=20 style='height:15.0pt'>
<td height=20 class=xl88 style='height:15.0pt;border-top:none'>STP PSR_Z</td>
<td class=xl89 style='border-top:none;border-left:none'>01011</td>
<td class=xl89 style='border-top:none;border-left:none'>000</td>
<td class=xl89 style='border-top:none;border-left:none'>Z</td>
<td class=xl90 width=670 style='border-top:none;border-left:none;width:503pt'>Set
the ZERO flag in the status register</td>
<td colspan=2 style='mso-ignore:colspan'></td>
<td class=xl65></td>
</tr>
<tr height=20 style='height:15.0pt'>
<td height=20 class=xl88 style='height:15.0pt;border-top:none'>STP PSR_C</td>
<td class=xl89 style='border-top:none;border-left:none'>01011</td>
<td class=xl89 style='border-top:none;border-left:none'>001</td>
<td class=xl89 style='border-top:none;border-left:none'>C</td>
<td class=xl90 width=670 style='border-top:none;border-left:none;width:503pt'>Set
the CARRY flag in the status register</td>
<td colspan=2 style='mso-ignore:colspan'></td>
<td class=xl65></td>
</tr>
<tr height=20 style='height:15.0pt'>
<td height=20 class=xl88 style='height:15.0pt;border-top:none'>STP PSR_N</td>
<td class=xl89 style='border-top:none;border-left:none'>01011</td>
<td class=xl89 style='border-top:none;border-left:none'>010</td>
<td class=xl89 style='border-top:none;border-left:none'>N</td>
<td class=xl90 width=670 style='border-top:none;border-left:none;width:503pt'>Set
the NEGATIVE bit in the status register</td>
<td colspan=2 style='mso-ignore:colspan'></td>
<td class=xl65></td>
</tr>
<tr height=20 style='height:15.0pt'>
<td height=20 class=xl88 style='height:15.0pt;border-top:none'>STP PSR_I</td>
<td class=xl89 style='border-top:none;border-left:none'>01011</td>
<td class=xl89 style='border-top:none;border-left:none'>011</td>
<td class=xl89 style='border-top:none;border-left:none'>I</td>
<td class=xl90 width=670 style='border-top:none;border-left:none;width:503pt'>set
the INTERRUPT bit in the status register</td>
<td colspan=2 style='mso-ignore:colspan'></td>
<td class=xl65></td>
</tr>
<tr height=20 style='height:15.0pt'>
<td height=20 class=xl88 style='height:15.0pt;border-top:none'>STP PSR_GP4</td>
<td class=xl89 style='border-top:none;border-left:none'>01011</td>
<td class=xl89 style='border-top:none;border-left:none'>100</td>
<td class=xl89 style='border-top:none;border-left:none'>4</td>
<td class=xl90 width=670 style='border-top:none;border-left:none;width:503pt'>Set
General Purpose Flag 1 in the status register</td>
<td colspan=2 style='mso-ignore:colspan'></td>
<td class=xl65></td>
</tr>
<tr height=20 style='height:15.0pt'>
<td height=20 class=xl88 style='height:15.0pt;border-top:none'>STP PSR_GP5</td>
<td class=xl89 style='border-top:none;border-left:none'>01011</td>
<td class=xl89 style='border-top:none;border-left:none'>101</td>
<td class=xl89 style='border-top:none;border-left:none'>5</td>
<td class=xl90 width=670 style='border-top:none;border-left:none;width:503pt'>Set
General Purpose Flag 2 in the status register</td>
<td colspan=2 style='mso-ignore:colspan'></td>
<td class=xl65></td>
</tr>
<tr height=20 style='height:15.0pt'>
<td height=20 class=xl88 style='height:15.0pt;border-top:none'>STP PSR_GP6</td>
<td class=xl89 style='border-top:none;border-left:none'>01011</td>
<td class=xl89 style='border-top:none;border-left:none'>110</td>
<td class=xl89 style='border-top:none;border-left:none'>6</td>
<td class=xl90 width=670 style='border-top:none;border-left:none;width:503pt'>Set
General Purpose Flag 3 in the status register</td>
<td colspan=2 style='mso-ignore:colspan'></td>
<td class=xl65></td>
</tr>
<tr height=20 style='height:15.0pt'>
<td height=20 class=xl88 style='height:15.0pt;border-top:none'>STP PSR_GP7</td>
<td class=xl89 style='border-top:none;border-left:none'>01011</td>
<td class=xl89 style='border-top:none;border-left:none'>111</td>
<td class=xl89 style='border-top:none;border-left:none'>7</td>
<td class=xl90 width=670 style='border-top:none;border-left:none;width:503pt'>Set
General Purpose Flag 4 in the status register</td>
<td colspan=2 style='mso-ignore:colspan'></td>
<td class=xl65></td>
</tr>
<tr height=20 style='height:15.0pt'>
<td height=20 class=xl76 style='height:15.0pt;border-top:none'>BTT 0-7</td>
<td class=xl77 style='border-top:none;border-left:none'>01100</td>
<td class=xl77 style='border-top:none;border-left:none'>xxx</td>
<td class=xl77 style='border-top:none;border-left:none'>N,Z</td>
<td class=xl78 width=670 style='border-top:none;border-left:none;width:503pt'>Test
the nth bit in R0 (!R0(n) -&gt; Z, R0(7) -&gt; N)</td>
<td colspan=2 style='mso-ignore:colspan'></td>
<td class=xl65></td>
</tr>
<tr height=20 style='height:15.0pt'>
<td height=20 class=xl88 style='height:15.0pt;border-top:none'>CLP PSR_Z</td>
<td class=xl89 style='border-top:none;border-left:none'>01101</td>
<td class=xl89 style='border-top:none;border-left:none'>000</td>
<td class=xl89 style='border-top:none;border-left:none'>Z</td>
<td class=xl90 width=670 style='border-top:none;border-left:none;width:503pt'>Clear
the ZERO flag in the status register</td>
<td colspan=2 style='mso-ignore:colspan'></td>
<td class=xl65></td>
</tr>
<tr height=20 style='height:15.0pt'>
<td height=20 class=xl88 style='height:15.0pt;border-top:none'>CLP PSR_C</td>
<td class=xl89 style='border-top:none;border-left:none'>01101</td>
<td class=xl89 style='border-top:none;border-left:none'>001</td>
<td class=xl89 style='border-top:none;border-left:none'>C</td>
<td class=xl90 width=670 style='border-top:none;border-left:none;width:503pt'>Clear
the CARRY flag in the status register</td>
<td colspan=2 style='mso-ignore:colspan'></td>
<td class=xl65></td>
</tr>
<tr height=20 style='height:15.0pt'>
<td height=20 class=xl88 style='height:15.0pt;border-top:none'>CLP PSR_N</td>
<td class=xl89 style='border-top:none;border-left:none'>01101</td>
<td class=xl89 style='border-top:none;border-left:none'>010</td>
<td class=xl89 style='border-top:none;border-left:none'>N</td>
<td class=xl90 width=670 style='border-top:none;border-left:none;width:503pt'>Clear
the NEGATIVE bit in the status register</td>
<td colspan=2 style='mso-ignore:colspan'></td>
<td class=xl65></td>
</tr>
<tr height=20 style='height:15.0pt'>
<td height=20 class=xl88 style='height:15.0pt;border-top:none'>CLP PSR_I</td>
<td class=xl89 style='border-top:none;border-left:none'>01101</td>
<td class=xl89 style='border-top:none;border-left:none'>011</td>
<td class=xl89 style='border-top:none;border-left:none'>I</td>
<td class=xl90 width=670 style='border-top:none;border-left:none;width:503pt'>Clear
the INTERRUPT bit in the status register</td>
<td colspan=2 style='mso-ignore:colspan'></td>
<td class=xl65></td>
</tr>
<tr height=20 style='height:15.0pt'>
<td height=20 class=xl88 style='height:15.0pt;border-top:none'>CLP PSR_GP4</td>
<td class=xl89 style='border-top:none;border-left:none'>01101</td>
<td class=xl89 style='border-top:none;border-left:none'>100</td>
<td class=xl89 style='border-top:none;border-left:none'>4</td>
<td class=xl90 width=670 style='border-top:none;border-left:none;width:503pt'>Clear
General Purpose Flag 1 in the status register</td>
<td colspan=2 style='mso-ignore:colspan'></td>
<td class=xl65></td>
</tr>
<tr height=20 style='height:15.0pt'>
<td height=20 class=xl88 style='height:15.0pt;border-top:none'>CLP PSR_GP5</td>
<td class=xl89 style='border-top:none;border-left:none'>01101</td>
<td class=xl89 style='border-top:none;border-left:none'>101</td>
<td class=xl89 style='border-top:none;border-left:none'>5</td>
<td class=xl90 width=670 style='border-top:none;border-left:none;width:503pt'>Clear
General Purpose Flag 2 in the status register</td>
<td colspan=2 style='mso-ignore:colspan'></td>
<td class=xl65></td>
</tr>
<tr height=20 style='height:15.0pt'>
<td height=20 class=xl88 style='height:15.0pt;border-top:none'>CLP PSR_GP6</td>
<td class=xl89 style='border-top:none;border-left:none'>01101</td>
<td class=xl89 style='border-top:none;border-left:none'>110</td>
<td class=xl89 style='border-top:none;border-left:none'>6</td>
<td class=xl90 width=670 style='border-top:none;border-left:none;width:503pt'>Clear
General Purpose Flag 3 in the status register</td>
<td colspan=2 style='mso-ignore:colspan'></td>
<td class=xl65></td>
</tr>
<tr height=20 style='height:15.0pt'>
<td height=20 class=xl88 style='height:15.0pt;border-top:none'>CLP PSR_GP7</td>
<td class=xl89 style='border-top:none;border-left:none'>01101</td>
<td class=xl89 style='border-top:none;border-left:none'>111</td>
<td class=xl89 style='border-top:none;border-left:none'>7</td>
<td class=xl90 width=670 style='border-top:none;border-left:none;width:503pt'>Clear
General Purpose Flag 4 in the status register</td>
<td colspan=2 style='mso-ignore:colspan'></td>
<td class=xl65></td>
</tr>
<tr height=20 style='height:15.0pt'>
<td height=20 class=xl76 style='height:15.0pt;border-top:none'>T0X R0-R7</td>
<td class=xl77 style='border-top:none;border-left:none'>01110</td>
<td class=xl77 style='border-top:none;border-left:none'>xxx</td>
<td class=xl77 style='border-top:none;border-left:none'>N,Z</td>
<td class=xl78 width=670 style='border-top:none;border-left:none;width:503pt'>Transfer
R0 to Rn (R0 -&gt; Rn)</td>
<td colspan=2 style='mso-ignore:colspan'></td>
<td class=xl65></td>
</tr>
<tr height=20 style='height:15.0pt'>
<td height=20 class=xl76 style='height:15.0pt;border-top:none'>CMP R0-R7</td>
<td class=xl77 style='border-top:none;border-left:none'>01111</td>
<td class=xl77 style='border-top:none;border-left:none'>xxx</td>
<td class=xl77 style='border-top:none;border-left:none'>N,C,Z</td>
<td class=xl78 width=670 style='border-top:none;border-left:none;width:503pt'>Compare
R0 to Rn (Performs R0 - Rn, but only sets flags)</td>
<td colspan=2 style='mso-ignore:colspan'></td>
<td class=xl65></td>
</tr>
<tr height=20 style='height:15.0pt'>
<td height=20 class=xl91 style='height:15.0pt;border-top:none'>PSH R0-R7</td>
<td class=xl92 style='border-top:none;border-left:none'>10000</td>
<td class=xl92 style='border-top:none;border-left:none'>xxx</td>
<td class=xl92 style='border-top:none;border-left:none'>-</td>
<td class=xl93 width=670 style='border-top:none;border-left:none;width:503pt'>Push
Rn to the stack</td>
<td colspan=2 style='mso-ignore:colspan'></td>
<td class=xl65></td>
</tr>
<tr height=20 style='height:15.0pt'>
<td height=20 class=xl91 style='height:15.0pt;border-top:none'>POP R0-R7</td>
<td class=xl92 style='border-top:none;border-left:none'>10001</td>
<td class=xl92 style='border-top:none;border-left:none'>xxx</td>
<td class=xl92 style='border-top:none;border-left:none'>N,Z</td>
<td class=xl93 width=670 style='border-top:none;border-left:none;width:503pt'>Pop
Rn from the stack</td>
<td colspan=2 style='mso-ignore:colspan'></td>
<td class=xl65></td>
</tr>
<tr height=20 style='height:15.0pt'>
<td height=20 class=xl85 style='height:15.0pt;border-top:none'>BNZ</td>
<td class=xl86 style='border-top:none;border-left:none'>10010</td>
<td class=xl86 style='border-top:none;border-left:none'>000</td>
<td class=xl86 style='border-top:none;border-left:none'>-</td>
<td class=xl87 width=670 style='border-top:none;border-left:none;width:503pt'>Branch
if the ZERO flag is NOT set (Branch on Not Zero)</td>
<td colspan=2 style='mso-ignore:colspan'></td>
<td class=xl65></td>
</tr>
<tr height=20 style='height:15.0pt'>
<td height=20 class=xl85 style='height:15.0pt;border-top:none'>BNC</td>
<td class=xl86 style='border-top:none;border-left:none'>10010</td>
<td class=xl86 style='border-top:none;border-left:none'>001</td>
<td class=xl86 style='border-top:none;border-left:none'>-</td>
<td class=xl87 width=670 style='border-top:none;border-left:none;width:503pt'>Branch
if the CARRY flag is NOT set (Branch on Not Carry)</td>
<td colspan=2 style='mso-ignore:colspan'></td>
<td class=xl65></td>
</tr>
<tr height=20 style='height:15.0pt'>
<td height=20 class=xl85 style='height:15.0pt;border-top:none'>BNN</td>
<td class=xl86 style='border-top:none;border-left:none'>10010</td>
<td class=xl86 style='border-top:none;border-left:none'>010</td>
<td class=xl86 style='border-top:none;border-left:none'>-</td>
<td class=xl87 width=670 style='border-top:none;border-left:none;width:503pt'>Branch
if the NEGATIVE flag is NOT set (Branch on Not Negative)</td>
<td colspan=2 style='mso-ignore:colspan'></td>
<td class=xl65></td>
</tr>
<tr height=20 style='height:15.0pt'>
<td height=20 class=xl85 style='height:15.0pt;border-top:none'>BNI</td>
<td class=xl86 style='border-top:none;border-left:none'>10010</td>
<td class=xl86 style='border-top:none;border-left:none'>011</td>
<td class=xl86 style='border-top:none;border-left:none'>-</td>
<td class=xl87 width=670 style='border-top:none;border-left:none;width:503pt'>Branch
if the INTERRUPT flag is NOT set (Branch on Not Interrupt)</td>
<td colspan=2 style='mso-ignore:colspan'></td>
<td class=xl65></td>
</tr>
<tr height=20 style='height:15.0pt'>
<td height=20 class=xl85 style='height:15.0pt;border-top:none'>BNGP4</td>
<td class=xl86 style='border-top:none;border-left:none'>10010</td>
<td class=xl86 style='border-top:none;border-left:none'>100</td>
<td class=xl86 style='border-top:none;border-left:none'>-</td>
<td class=xl87 width=670 style='border-top:none;border-left:none;width:503pt'>Branch
if General Purpose Flag 4 is NOT set</td>
<td colspan=2 style='mso-ignore:colspan'></td>
<td class=xl65></td>
</tr>
<tr height=20 style='height:15.0pt'>
<td height=20 class=xl85 style='height:15.0pt;border-top:none'>BNGP5</td>
<td class=xl86 style='border-top:none;border-left:none'>10010</td>
<td class=xl86 style='border-top:none;border-left:none'>101</td>
<td class=xl86 style='border-top:none;border-left:none'>-</td>
<td class=xl87 width=670 style='border-top:none;border-left:none;width:503pt'>Branch
if General Purpose Flag 5 is NOT set</td>
<td colspan=2 style='mso-ignore:colspan'></td>
<td class=xl65></td>
</tr>
<tr height=20 style='height:15.0pt'>
<td height=20 class=xl85 style='height:15.0pt;border-top:none'>BNGP6</td>
<td class=xl86 style='border-top:none;border-left:none'>10010</td>
<td class=xl86 style='border-top:none;border-left:none'>110</td>
<td class=xl86 style='border-top:none;border-left:none'>-</td>
<td class=xl87 width=670 style='border-top:none;border-left:none;width:503pt'>Branch
if General Purpose Flag 6 is NOT set</td>
<td colspan=2 style='mso-ignore:colspan'></td>
<td class=xl65></td>
</tr>
<tr height=20 style='height:15.0pt'>
<td height=20 class=xl85 style='height:15.0pt;border-top:none'>BNGP7</td>
<td class=xl86 style='border-top:none;border-left:none'>10010</td>
<td class=xl86 style='border-top:none;border-left:none'>111</td>
<td class=xl86 style='border-top:none;border-left:none'>-</td>
<td class=xl87 width=670 style='border-top:none;border-left:none;width:503pt'>Branch
if General Purpose Flag 7 is NOT set</td>
<td colspan=2 style='mso-ignore:colspan'></td>
<td class=xl65></td>
</tr>
<tr height=20 style='height:15.0pt'>
<td height=20 class=xl82 style='height:15.0pt;border-top:none'>BRZ</td>
<td class=xl83 style='border-top:none;border-left:none'>10011</td>
<td class=xl83 style='border-top:none;border-left:none'>000</td>
<td class=xl83 style='border-top:none;border-left:none'>-</td>
<td class=xl84 width=670 style='border-top:none;border-left:none;width:503pt'>Branch
if the ZERO flag is set (Branch on Zero)</td>
<td colspan=2 style='mso-ignore:colspan'></td>
<td class=xl65></td>
</tr>
<tr height=20 style='height:15.0pt'>
<td height=20 class=xl82 style='height:15.0pt;border-top:none'>BRC</td>
<td class=xl83 style='border-top:none;border-left:none'>10011</td>
<td class=xl83 style='border-top:none;border-left:none'>001</td>
<td class=xl83 style='border-top:none;border-left:none'>-</td>
<td class=xl84 width=670 style='border-top:none;border-left:none;width:503pt'>Branch
if the CARRY flag is set (Branch on Carry)</td>
<td colspan=2 style='mso-ignore:colspan'></td>
<td class=xl65></td>
</tr>
<tr height=20 style='height:15.0pt'>
<td height=20 class=xl82 style='height:15.0pt;border-top:none'>BRN</td>
<td class=xl83 style='border-top:none;border-left:none'>10011</td>
<td class=xl83 style='border-top:none;border-left:none'>010</td>
<td class=xl83 style='border-top:none;border-left:none'>-</td>
<td class=xl84 width=670 style='border-top:none;border-left:none;width:503pt'>Branch
if the NEGATIVE flag is set (Branch on Negative)</td>
<td colspan=2 style='mso-ignore:colspan'></td>
<td class=xl65></td>
</tr>
<tr height=20 style='height:15.0pt'>
<td height=20 class=xl82 style='height:15.0pt;border-top:none'>BRI</td>
<td class=xl83 style='border-top:none;border-left:none'>10011</td>
<td class=xl83 style='border-top:none;border-left:none'>011</td>
<td class=xl83 style='border-top:none;border-left:none'>-</td>
<td class=xl84 width=670 style='border-top:none;border-left:none;width:503pt'>Branch
if the INTERRUPT flag is set (Branch on Interrupt)</td>
<td colspan=2 style='mso-ignore:colspan'></td>
<td class=xl65></td>
</tr>
<tr height=20 style='height:15.0pt'>
<td height=20 class=xl82 style='height:15.0pt;border-top:none'>BRGP4</td>
<td class=xl83 style='border-top:none;border-left:none'>10011</td>
<td class=xl83 style='border-top:none;border-left:none'>100</td>
<td class=xl83 style='border-top:none;border-left:none'>-</td>
<td class=xl84 width=670 style='border-top:none;border-left:none;width:503pt'>Branch
if General Purpose Flag 4 is set</td>
<td colspan=2 style='mso-ignore:colspan'></td>
<td class=xl65></td>
</tr>
<tr height=20 style='height:15.0pt'>
<td height=20 class=xl82 style='height:15.0pt;border-top:none'>BRGP5</td>
<td class=xl83 style='border-top:none;border-left:none'>10011</td>
<td class=xl83 style='border-top:none;border-left:none'>101</td>
<td class=xl83 style='border-top:none;border-left:none'>-</td>
<td class=xl84 width=670 style='border-top:none;border-left:none;width:503pt'>Branch
if General Purpose Flag 5 is set</td>
<td colspan=2 style='mso-ignore:colspan'></td>
<td class=xl65></td>
</tr>
<tr height=20 style='height:15.0pt'>
<td height=20 class=xl82 style='height:15.0pt;border-top:none'>BRGP6</td>
<td class=xl83 style='border-top:none;border-left:none'>10011</td>
<td class=xl83 style='border-top:none;border-left:none'>110</td>
<td class=xl83 style='border-top:none;border-left:none'>-</td>
<td class=xl84 width=670 style='border-top:none;border-left:none;width:503pt'>Branch
if General Purpose Flag 6 is set</td>
<td colspan=2 style='mso-ignore:colspan'></td>
<td class=xl65></td>
</tr>
<tr height=20 style='height:15.0pt'>
<td height=20 class=xl82 style='height:15.0pt;border-top:none'>BRGP7</td>
<td class=xl83 style='border-top:none;border-left:none'>10011</td>
<td class=xl83 style='border-top:none;border-left:none'>111</td>
<td class=xl83 style='border-top:none;border-left:none'>-</td>
<td class=xl84 width=670 style='border-top:none;border-left:none;width:503pt'>Branch
if General Purpose Flag 7 is set</td>
<td colspan=2 style='mso-ignore:colspan'></td>
<td class=xl65></td>
</tr>
<tr height=20 style='height:15.0pt'>
<td height=20 class=xl97 style='height:15.0pt;border-top:none'>DBNZ R0-R7</td>
<td class=xl98 style='border-top:none;border-left:none'>10100</td>
<td class=xl98 style='border-top:none;border-left:none'>xxx</td>
<td class=xl98 style='border-top:none;border-left:none'>N,C,Z</td>
<td class=xl99 width=670 style='border-top:none;border-left:none;width:503pt'>Decrement
and Branch if Not Zero (Rn - 1 -&gt; Rn)</td>
<td colspan=2 style='mso-ignore:colspan'></td>
<td class=xl65></td>
</tr>
<tr height=20 style='height:15.0pt'>
<td height=20 class=xl100 style='height:15.0pt;border-top:none'>INT 0-7</td>
<td class=xl101 style='border-top:none;border-left:none'>10101</td>
<td class=xl101 style='border-top:none;border-left:none'>xxx</td>
<td class=xl101 style='border-top:none;border-left:none'>-</td>
<td class=xl102 width=670 style='border-top:none;border-left:none;width:503pt'>Trigger
Interrupt n (Triggers the specified interrupt, then pauses the processor
until the ISR executes)</td>
<td colspan=2 style='mso-ignore:colspan'></td>
<td class=xl65></td>
</tr>
<tr height=20 style='height:15.0pt'>
<td height=20 class=xl76 style='height:15.0pt;border-top:none'>MUL R0-R7</td>
<td class=xl77 style='border-top:none;border-left:none'>10110</td>
<td class=xl103 style='border-top:none;border-left:none'>xxx</td>
<td class=xl77 style='border-top:none;border-left:none'>Z</td>
<td class=xl78 width=670 style='border-top:none;border-left:none;width:503pt'>Multiply
Rn by R0 with results stored in R1:R0 (Rn * R0 -&gt; R1:R0)</td>
<td colspan=2 style='mso-ignore:colspan'></td>
<td class=xl65></td>
</tr>
<tr height=20 style='height:15.0pt'>
<td height=20 class=xl94 style='height:15.0pt;border-top:none'>RSP</td>
<td class=xl95 style='border-top:none;border-left:none'>10111</td>
<td class=xl95 style='border-top:none;border-left:none'>000</td>
<td class=xl95 style='border-top:none;border-left:none'>-</td>
<td class=xl96 width=670 style='border-top:none;border-left:none;width:503pt'>Reset
(or Retrieve/Relocate) the Stack Pointer <font class="font5">(See CPU options
for exact behavior)</font></td>
<td colspan=2 style='mso-ignore:colspan'></td>
<td class=xl65></td>
</tr>
<tr height=20 style='height:15.0pt'>
<td height=20 class=xl94 style='height:15.0pt;border-top:none'>RTS</td>
<td class=xl95 style='border-top:none;border-left:none'>10111</td>
<td class=xl95 style='border-top:none;border-left:none'>001</td>
<td class=xl95 style='border-top:none;border-left:none'>-</td>
<td class=xl96 width=670 style='border-top:none;border-left:none;width:503pt'>Return
from Subroutine (only pops the return address and jumps - does not affect
flags)</td>
<td colspan=2 style='mso-ignore:colspan'></td>
<td class=xl65></td>
</tr>
<tr height=20 style='height:15.0pt'>
<td height=20 class=xl94 style='height:15.0pt;border-top:none'>RTI</td>
<td class=xl95 style='border-top:none;border-left:none'>10111</td>
<td class=xl95 style='border-top:none;border-left:none'>010</td>
<td class=xl95 style='border-top:none;border-left:none'>-</td>
<td class=xl96 width=670 style='border-top:none;border-left:none;width:503pt'>Return
from Interrupt (restores both the address and the status register)</td>
<td colspan=2 style='mso-ignore:colspan'></td>
<td class=xl65></td>
</tr>
<tr height=20 style='height:15.0pt'>
<td height=20 class=xl94 style='height:15.0pt;border-top:none'>BRK/WAI</td>
<td class=xl95 style='border-top:none;border-left:none'>10111</td>
<td class=xl95 style='border-top:none;border-left:none'>011</td>
<td class=xl95 style='border-top:none;border-left:none'>-</td>
<td class=xl96 width=670 style='border-top:none;border-left:none;width:503pt'>Break
or Wait for Interrupt (See CPU options for exact behavior)</td>
<td colspan=2 style='mso-ignore:colspan'></td>
<td class=xl65></td>
</tr>
<tr height=20 style='height:15.0pt'>
<td height=20 class=xl94 style='height:15.0pt;border-top:none'>JMP</td>
<td class=xl95 style='border-top:none;border-left:none'>10111</td>
<td class=xl95 style='border-top:none;border-left:none'>100</td>
<td class=xl95 style='border-top:none;border-left:none'>-</td>
<td class=xl96 width=670 style='border-top:none;border-left:none;width:503pt'>Jump
to Address (Address is assumed to be stored after the instruction)</td>
<td colspan=2 style='mso-ignore:colspan'></td>
<td class=xl65></td>
</tr>
<tr height=20 style='height:15.0pt'>
<td height=20 class=xl94 style='height:15.0pt;border-top:none'>SMSK</td>
<td class=xl95 style='border-top:none;border-left:none'>10111</td>
<td class=xl95 style='border-top:none;border-left:none'>101</td>
<td class=xl95 style='border-top:none;border-left:none'>-</td>
<td class=xl96 width=670 style='border-top:none;border-left:none;width:503pt'>Set
the Interrupt Mask to the contents of R0 (R0 -&gt; MASK)</td>
<td colspan=2 style='mso-ignore:colspan'></td>
<td class=xl65></td>
</tr>
<tr height=20 style='height:15.0pt'>
<td height=20 class=xl94 style='height:15.0pt;border-top:none'>GMSK</td>
<td class=xl95 style='border-top:none;border-left:none'>10111</td>
<td class=xl95 style='border-top:none;border-left:none'>110</td>
<td class=xl95 style='border-top:none;border-left:none'>-</td>
<td class=xl96 width=670 style='border-top:none;border-left:none;width:503pt'>Get
the Interrupt Mask and store to R0 (MASK -&gt; R0)</td>
<td colspan=2 style='mso-ignore:colspan'></td>
<td class=xl65></td>
</tr>
<tr height=21 style='mso-height-source:userset;height:15.75pt'>
<td height=21 class=xl94 style='height:15.75pt;border-top:none'>JSR</td>
<td class=xl95 style='border-top:none;border-left:none'>10111</td>
<td class=xl95 style='border-top:none;border-left:none'>111</td>
<td class=xl95 style='border-top:none;border-left:none'>-</td>
<td class=xl96 width=670 style='border-top:none;border-left:none;width:503pt'>Jump
to Subroutine (pushes the return address, then jumps to the address specified
in subsequent bytes)</td>
<td colspan=2 style='mso-ignore:colspan'></td>
<td class=xl65></td>
</tr>
<tr height=20 style='height:15.0pt'>
<td height=20 class=xl76 style='height:15.0pt;border-top:none'>UPP R0-R7</td>
<td class=xl77 style='border-top:none;border-left:none'>11000</td>
<td class=xl77 style='border-top:none;border-left:none'>xxx</td>
<td class=xl77 style='border-top:none;border-left:none'>N,C,Z</td>
<td class=xl78 width=670 style='border-top:none;border-left:none;width:503pt'>Increment
Register Pair (Rn+1:Rn + 1 -&gt; Rn+1:Rn)</td>
<td colspan=2 style='mso-ignore:colspan'></td>
<td class=xl65></td>
</tr>
<tr height=20 style='height:15.0pt'>
<td height=20 class=xl79 style='height:15.0pt;border-top:none'>STA R0-R7</td>
<td class=xl80 style='border-top:none;border-left:none'>11001</td>
<td class=xl80 style='border-top:none;border-left:none'>xxx</td>
<td class=xl80 style='border-top:none;border-left:none'>-</td>
<td class=xl81 width=670 style='border-top:none;border-left:none;width:503pt'>Store
Rn to Fixed Address (Address follows instruction)</td>
<td colspan=2 style='mso-ignore:colspan'></td>
<td class=xl65></td>
</tr>
<tr height=20 style='height:15.0pt'>
<td height=20 class=xl79 style='height:15.0pt;border-top:none'>STX R0-R7(+)</td>
<td class=xl80 style='border-top:none;border-left:none'>11010</td>
<td class=xl80 style='border-top:none;border-left:none'>xxx</td>
<td class=xl80 style='border-top:none;border-left:none'>N,C,Z</td>
<td class=xl81 width=670 style='border-top:none;border-left:none;width:503pt'>Store
R0 to Address referenced by Rn+1:Rn (See CPU options for exact behavior)</td>
<td colspan=2 style='mso-ignore:colspan'></td>
<td class=xl65></td>
</tr>
<tr height=20 style='height:15.0pt'>
<td height=20 class=xl79 style='height:15.0pt;border-top:none'>STO R0-R7(+)</td>
<td class=xl80 style='border-top:none;border-left:none'>11011</td>
<td class=xl80 style='border-top:none;border-left:none'>xxx</td>
<td class=xl80 style='border-top:none;border-left:none'>N,C,Z</td>
<td class=xl81 width=670 style='border-top:none;border-left:none;width:503pt'>Store
R0 to Rn+1:Rn + Offset (Offset is stored in subsequent byte) (See CPU options
for exact behavior)</td>
<td colspan=2 style='mso-ignore:colspan'></td>
<td class=xl65></td>
</tr>
<tr height=20 style='height:15.0pt'>
<td height=20 class=xl91 style='height:15.0pt;border-top:none'>LDI R0-R7</td>
<td class=xl92 style='border-top:none;border-left:none'>11100</td>
<td class=xl92 style='border-top:none;border-left:none'>xxx</td>
<td class=xl92 style='border-top:none;border-left:none'>N,Z</td>
<td class=xl93 width=670 style='border-top:none;border-left:none;width:503pt'>Load
Rn with Immediate Data (IMM -&gt; Rn) (Data is stored in subsequent byte)</td>
<td colspan=2 style='mso-ignore:colspan'></td>
<td class=xl65></td>
</tr>
<tr height=20 style='height:15.0pt'>
<td height=20 class=xl91 style='height:15.0pt;border-top:none'>LDA R0-R7</td>
<td class=xl92 style='border-top:none;border-left:none'>11101</td>
<td class=xl92 style='border-top:none;border-left:none'>xxx</td>
<td class=xl92 style='border-top:none;border-left:none'>N,Z</td>
<td class=xl93 width=670 style='border-top:none;border-left:none;width:503pt'>Load
Rn from Fixed Address (Address follows instruction)</td>
<td colspan=2 style='mso-ignore:colspan'></td>
<td class=xl65></td>
</tr>
<tr height=20 style='height:15.0pt'>
<td height=20 class=xl91 style='height:15.0pt;border-top:none'>LDX R0-R7(+)</td>
<td class=xl92 style='border-top:none;border-left:none'>11110</td>
<td class=xl92 style='border-top:none;border-left:none'>xxx</td>
<td class=xl92 style='border-top:none;border-left:none'>N,C,Z</td>
<td class=xl93 width=670 style='border-top:none;border-left:none;width:503pt'>Load
R0 from Address referenced by Rn+1:Rn (See CPU options for exact behavior)</td>
<td colspan=2 style='mso-ignore:colspan'></td>
<td class=xl65></td>
</tr>
<tr height=40 style='height:30.0pt'>
<td height=40 class=xl91 style='height:30.0pt;border-top:none'>LDO R0-R7(+)</td>
<td class=xl92 style='border-top:none;border-left:none'>11111</td>
<td class=xl92 style='border-top:none;border-left:none'>xxx</td>
<td class=xl92 style='border-top:none;border-left:none'>N,C,Z</td>
<td class=xl93 width=670 style='border-top:none;border-left:none;width:503pt'>Load
R0 from Address referenced by Rn+1:Rn plus an offset<span
 
CPU options for exact behavior)</td>
<td colspan=2 style='mso-ignore:colspan'></td>
<td class=xl65></td>
</tr>
<tr height=20 style='height:15.0pt'>
<td height=20 style='height:15.0pt'></td>
<td colspan=2 class=xl67 style='mso-ignore:colspan'></td>
<td class=xl66></td>
<td class=xl68></td>
<td colspan=2 style='mso-ignore:colspan'></td>
<td class=xl65></td>
</tr>
<tr height=60 style='height:45.0pt'>
<td height=60 style='height:45.0pt'></td>
<td colspan=2 class=xl67 style='mso-ignore:colspan'></td>
<td class=xl66></td>
<td class=xl68 width=670 style='width:503pt'>Note - Indexed instructions with
(+) after the operand optionally allow for auto-incrementing of the register
pair. For example, LDX R4++ is equivalent to LDX R5 when auto-incrementing is
turned on) See CPU options for exact behavior)</td>
<td colspan=2 style='mso-ignore:colspan'></td>
<td class=xl65></td>
</tr>
<![if supportMisalignedColumns]>
<tr height=0 style='display:none'>
<td width=86 style='width:65pt'></td>
<td width=74 style='width:56pt'></td>
<td width=61 style='width:46pt'></td>
<td width=64 style='width:48pt'></td>
<td width=670 style='width:503pt'></td>
<td width=64 style='width:48pt'></td>
<td width=97 style='width:73pt'></td>
<td width=64 style='width:48pt'></td>
</tr>
<![endif]>
</table>
 
</body>
 
</html>
/open8_urisc/trunk/Documents/CPU Instruction Set_files/sheet002.htm
0,0 → 1,191
<html xmlns:v="urn:schemas-microsoft-com:vml"
xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:x="urn:schemas-microsoft-com:office:excel"
xmlns="http://www.w3.org/TR/REC-html40">
 
<head>
<meta http-equiv=Content-Type content="text/html; charset=windows-1252">
<meta name=ProgId content=Excel.Sheet>
<meta name=Generator content="Microsoft Excel 12">
<link id=Main-File rel=Main-File href="../CPU%20Instruction%20Set.htm">
<link rel=File-List href=filelist.xml>
<link rel=Stylesheet href=stylesheet.css>
<style>
<!--table
{mso-displayed-decimal-separator:"\.";
mso-displayed-thousand-separator:"\,";}
@page
{margin:.75in .7in .75in .7in;
mso-header-margin:.3in;
mso-footer-margin:.3in;}
-->
</style>
<![if !supportTabStrip]><script language="JavaScript">
<!--
function fnUpdateTabs()
{
if (parent.window.g_iIEVer>=4) {
if (parent.document.readyState=="complete"
&& parent.frames['frTabs'].document.readyState=="complete")
parent.fnSetActiveSheet(1);
else
window.setTimeout("fnUpdateTabs();",150);
}
}
 
if (window.name!="frSheet")
window.location.replace("../CPU%20Instruction%20Set.htm");
else
fnUpdateTabs();
//-->
</script>
<![endif]>
</head>
 
<body link=blue vlink=purple>
 
<table border=0 cellpadding=0 cellspacing=0 width=1242 style='border-collapse:
collapse;table-layout:fixed;width:932pt'>
<col width=185 style='mso-width-source:userset;mso-width-alt:6765;width:139pt'>
<col width=103 style='mso-width-source:userset;mso-width-alt:3766;width:77pt'>
<col class=xl67 width=61 style='mso-width-source:userset;mso-width-alt:2230;
width:46pt'>
<col class=xl68 width=893 style='mso-width-source:userset;mso-width-alt:32658;
width:670pt'>
<tr height=20 style='height:15.0pt'>
<td height=20 width=185 style='height:15.0pt;width:139pt'></td>
<td width=103 style='width:77pt'></td>
<td class=xl106 colspan=2 width=954 style='mso-ignore:colspan;width:716pt'>Open8
CPU Core Generics</td>
</tr>
<tr height=20 style='height:15.0pt'>
<td height=20 colspan=2 style='height:15.0pt;mso-ignore:colspan'></td>
<td class=xl67></td>
<td class=xl68></td>
</tr>
<tr height=20 style='height:15.0pt'>
<td height=20 class=xl69 style='height:15.0pt'>Option</td>
<td class=xl69>Argument Type</td>
<td class=xl70>Default</td>
<td class=xl72 width=893 style='width:670pt'>Description</td>
</tr>
<tr height=20 style='height:15.0pt'>
<td height=20 class=xl76 style='height:15.0pt;border-top:none'>Program_Start_Addr</td>
<td class=xl76 style='border-top:none;border-left:none'>16-bit Address</td>
<td class=xl103 style='border-top:none;border-left:none'>x&quot;0000&quot;</td>
<td class=xl78 width=893 style='border-top:none;border-left:none;width:670pt'>Initial
program counter location</td>
</tr>
<tr height=20 style='height:15.0pt'>
<td height=20 class=xl73 style='height:15.0pt;border-top:none'>ISR_Start_Addr</td>
<td class=xl73 style='border-top:none;border-left:none'>16-bit Address</td>
<td class=xl74 style='border-top:none;border-left:none'>x&quot;FFF0&quot;</td>
<td class=xl75 width=893 style='border-top:none;border-left:none;width:670pt'>Sets
the initial location of the interrupt vector table</td>
</tr>
<tr height=20 style='height:15.0pt'>
<td height=20 class=xl76 style='height:15.0pt;border-top:none'>Stack_Start_Addr</td>
<td class=xl76 style='border-top:none;border-left:none'>16-bit Address</td>
<td class=xl103 style='border-top:none;border-left:none'>x&quot;03FF&quot;</td>
<td class=xl78 width=893 style='border-top:none;border-left:none;width:670pt'>Initial
location of the CPU Stack - Must be located in accessible RAM</td>
</tr>
<tr height=40 style='height:30.0pt'>
<td height=40 class=xl73 style='height:30.0pt;border-top:none'>Allow_Stack_Address_Move</td>
<td class=xl73 style='border-top:none;border-left:none'>Boolean</td>
<td class=xl74 style='border-top:none;border-left:none'>FALSE</td>
<td class=xl75 width=893 style='border-top:none;border-left:none;width:670pt'>If
false, the RSP instruction will reset the stack pointer to
&quot;Stack_Start_Addr&quot; by default. If true, the RSP instruction will
either allow the stack pointer to be loaded from R1:R0 or copied to R1:R0
depending on the status of the specified ALU flag bit.</td>
</tr>
<tr height=80 style='height:60.0pt'>
<td height=80 class=xl76 style='height:60.0pt;border-top:none'>Stack_Xfer_Flag</td>
<td class=xl76 style='border-top:none;border-left:none'>Integer 0-7</td>
<td class=xl103 style='border-top:none;border-left:none'>PSR_GP4</td>
<td class=xl78 width=893 style='border-top:none;border-left:none;width:670pt'>Specifies
which processor flag controls the behavior of RSP when
'Allow_Stack_Address_move' is true. If the specified bit is clear ('0'), the
RSP instruction will transfer the stack pointer to R1:R0 (SP -&gt; R1:R0),
otherwise, if it is true ('1'), the RSP instruction will set the stack
pointer from R1:R0 ( R1:R0 -&gt; SP ). Any of the 8 CPU flags may be
specified, but the intent was to use FL_GP[1-4], as these are purely under
software control and are not otherwise modified by the ALU.</td>
</tr>
<tr height=80 style='height:60.0pt'>
<td height=80 class=xl73 style='height:60.0pt;border-top:none'>Enable_Auto_Increment</td>
<td class=xl73 style='border-top:none;border-left:none'>Boolean</td>
<td class=xl74 style='border-top:none;border-left:none'>FALSE</td>
<td class=xl75 width=893 style='border-top:none;border-left:none;width:670pt'>If
true, indexed instructions such as LDX, LDO, STX, STO will automatically
increment if an odd register is specified. The effect is similar to a normal
indexed instruction followed by an UPP instruction on the same register pair.
For example, LDX R5 (or LDX R4++) will result in R0 getting the data stored
at the address specified by R5:R4. Afterwards, the register pair R5:R4 will
be incremented by 1. If false, specifying either register in a register pair
will result in normal behavior.</td>
</tr>
<tr height=40 style='height:30.0pt'>
<td height=40 class=xl76 style='height:30.0pt;border-top:none'>BRK_Implements_WAI</td>
<td class=xl76 style='border-top:none;border-left:none'>Boolean</td>
<td class=xl103 style='border-top:none;border-left:none'>FALSE</td>
<td class=xl78 width=893 style='border-top:none;border-left:none;width:670pt'>If
true, the BRK instruction will cause the processor to halt as if an INT
instruction was executed, but without triggering an interrupt. This is useful
for pausing the CPU until an interrupt occurs. If false, the BRK instruction
simply causes the CPU to execute 5 NOP cycles.</td>
</tr>
<tr height=20 style='height:15.0pt'>
<td height=20 class=xl73 style='height:15.0pt;border-top:none'>Enable_NMI</td>
<td class=xl73 style='border-top:none;border-left:none'>Boolean</td>
<td class=xl74 style='border-top:none;border-left:none'>TRUE</td>
<td class=xl75 width=893 style='border-top:none;border-left:none;width:670pt'>Forces
bit 0 of the Interrupt Mask to 1, causing Interrupt 0 to be non-maskable.</td>
</tr>
<tr height=40 style='height:30.0pt'>
<td height=40 class=xl76 style='height:30.0pt;border-top:none'>Sequential_Interrupts</td>
<td class=xl76 style='border-top:none;border-left:none'>Boolean</td>
<td class=xl103 style='border-top:none;border-left:none'>FALSE</td>
<td class=xl78 width=893 style='border-top:none;border-left:none;width:670pt'>Prohibits
interrupts from initiating an ISR if the I-bit is set, making ISRs
sequential. This potentially blocks interrupt priority by allowing a lower
level interrupt to block a higher level interrupt. This can be fixed by
clearing the I-bit in interruptable ISRs.</td>
</tr>
<tr height=40 style='height:30.0pt'>
<td height=40 class=xl73 style='height:30.0pt;border-top:none'>RTI_Ignores_GP_Flags</td>
<td class=xl73 style='border-top:none;border-left:none'>Boolean</td>
<td class=xl74 style='border-top:none;border-left:none'>FALSE</td>
<td class=xl75 width=893 style='border-top:none;border-left:none;width:670pt'>If
set, preserves the general purpose flags GP_PSR4 to GP_PSR7 on ISR exit,
allowing them to be persistently set by interrupts. The lower four flag bits
are always restored.</td>
</tr>
<tr height=20 style='height:15.0pt'>
<td height=20 class=xl76 style='height:15.0pt;border-top:none'>Default_Interrupt_Mask</td>
<td class=xl76 style='border-top:none;border-left:none'>8-bit Data</td>
<td class=xl103 style='border-top:none;border-left:none'>x&quot;FF&quot;</td>
<td class=xl78 width=893 style='border-top:none;border-left:none;width:670pt'>Sets
the initial interrupt mask (note that bit 0 is ignored, as this is the NMI)</td>
</tr>
<tr height=20 style='height:15.0pt'>
<td height=20 class=xl73 style='height:15.0pt;border-top:none'>Clock_Frequency</td>
<td class=xl73 style='border-top:none;border-left:none'>Real</td>
<td class=xl74 style='border-top:none;border-left:none'>-</td>
<td class=xl75 width=893 style='border-top:none;border-left:none;width:670pt'>Clock
frequency in Hz of the CPU clock. Used to configure the 1Mhz/1uSec tick pulse</td>
</tr>
<![if supportMisalignedColumns]>
<tr height=0 style='display:none'>
<td width=185 style='width:139pt'></td>
<td width=103 style='width:77pt'></td>
<td width=61 style='width:46pt'></td>
<td width=893 style='width:670pt'></td>
</tr>
<![endif]>
</table>
 
</body>
 
</html>
/open8_urisc/trunk/Documents/CPU Instruction Set_files/stylesheet.css
0,0 → 1,294
tr
{mso-height-source:auto;}
col
{mso-width-source:auto;}
br
{mso-data-placement:same-cell;}
.style0
{mso-number-format:General;
text-align:general;
vertical-align:bottom;
white-space:nowrap;
mso-rotate:0;
mso-background-source:auto;
mso-pattern:auto;
color:black;
font-size:11.0pt;
font-weight:400;
font-style:normal;
text-decoration:none;
font-family:Calibri, sans-serif;
mso-font-charset:0;
border:none;
mso-protection:locked visible;
mso-style-name:Normal;
mso-style-id:0;}
.font5
{color:black;
font-size:11.0pt;
font-weight:400;
font-style:italic;
text-decoration:none;
font-family:Calibri, sans-serif;
mso-font-charset:0;}
td
{mso-style-parent:style0;
padding-top:1px;
padding-right:1px;
padding-left:1px;
mso-ignore:padding;
color:black;
font-size:11.0pt;
font-weight:400;
font-style:normal;
text-decoration:none;
font-family:Calibri, sans-serif;
mso-font-charset:0;
mso-number-format:General;
text-align:general;
vertical-align:bottom;
border:none;
mso-background-source:auto;
mso-pattern:auto;
mso-protection:locked visible;
white-space:nowrap;
mso-rotate:0;}
.xl65
{mso-style-parent:style0;
mso-number-format:"\@";}
.xl66
{mso-style-parent:style0;
mso-number-format:"\@";
text-align:center;}
.xl67
{mso-style-parent:style0;
text-align:center;}
.xl68
{mso-style-parent:style0;
white-space:normal;}
.xl69
{mso-style-parent:style0;
font-weight:700;
border-top:none;
border-right:none;
border-bottom:.5pt solid windowtext;
border-left:none;}
.xl70
{mso-style-parent:style0;
font-weight:700;
text-align:center;
border-top:none;
border-right:none;
border-bottom:.5pt solid windowtext;
border-left:none;}
.xl71
{mso-style-parent:style0;
font-weight:700;
mso-number-format:"\@";
text-align:center;
border-top:none;
border-right:none;
border-bottom:.5pt solid windowtext;
border-left:none;}
.xl72
{mso-style-parent:style0;
font-weight:700;
border-top:none;
border-right:none;
border-bottom:.5pt solid windowtext;
border-left:none;
white-space:normal;}
.xl73
{mso-style-parent:style0;
border:.5pt solid windowtext;}
.xl74
{mso-style-parent:style0;
text-align:center;
border:.5pt solid windowtext;}
.xl75
{mso-style-parent:style0;
border:.5pt solid windowtext;
white-space:normal;}
.xl76
{mso-style-parent:style0;
border:.5pt solid windowtext;
background:#EAF1DD;
mso-pattern:black none;}
.xl77
{mso-style-parent:style0;
mso-number-format:"\@";
text-align:center;
border:.5pt solid windowtext;
background:#EAF1DD;
mso-pattern:black none;}
.xl78
{mso-style-parent:style0;
border:.5pt solid windowtext;
background:#EAF1DD;
mso-pattern:black none;
white-space:normal;}
.xl79
{mso-style-parent:style0;
border:.5pt solid windowtext;
background:#F2DDDC;
mso-pattern:black none;}
.xl80
{mso-style-parent:style0;
mso-number-format:"\@";
text-align:center;
border:.5pt solid windowtext;
background:#F2DDDC;
mso-pattern:black none;}
.xl81
{mso-style-parent:style0;
border:.5pt solid windowtext;
background:#F2DDDC;
mso-pattern:black none;
white-space:normal;}
.xl82
{mso-style-parent:style0;
border:.5pt solid windowtext;
background:#DBEEF3;
mso-pattern:black none;}
.xl83
{mso-style-parent:style0;
mso-number-format:"\@";
text-align:center;
border:.5pt solid windowtext;
background:#DBEEF3;
mso-pattern:black none;}
.xl84
{mso-style-parent:style0;
border:.5pt solid windowtext;
background:#DBEEF3;
mso-pattern:black none;
white-space:normal;}
.xl85
{mso-style-parent:style0;
border:.5pt solid windowtext;
background:#B6DDE8;
mso-pattern:black none;}
.xl86
{mso-style-parent:style0;
mso-number-format:"\@";
text-align:center;
border:.5pt solid windowtext;
background:#B6DDE8;
mso-pattern:black none;}
.xl87
{mso-style-parent:style0;
border:.5pt solid windowtext;
background:#B6DDE8;
mso-pattern:black none;
white-space:normal;}
.xl88
{mso-style-parent:style0;
border:.5pt solid windowtext;
background:#D7E4BC;
mso-pattern:black none;}
.xl89
{mso-style-parent:style0;
mso-number-format:"\@";
text-align:center;
border:.5pt solid windowtext;
background:#D7E4BC;
mso-pattern:black none;}
.xl90
{mso-style-parent:style0;
border:.5pt solid windowtext;
background:#D7E4BC;
mso-pattern:black none;
white-space:normal;}
.xl91
{mso-style-parent:style0;
border:.5pt solid windowtext;
background:#E6B9B8;
mso-pattern:black none;}
.xl92
{mso-style-parent:style0;
mso-number-format:"\@";
text-align:center;
border:.5pt solid windowtext;
background:#E6B9B8;
mso-pattern:black none;}
.xl93
{mso-style-parent:style0;
border:.5pt solid windowtext;
background:#E6B9B8;
mso-pattern:black none;
white-space:normal;}
.xl94
{mso-style-parent:style0;
border:.5pt solid windowtext;
background:#CCC0DA;
mso-pattern:black none;}
.xl95
{mso-style-parent:style0;
mso-number-format:"\@";
text-align:center;
border:.5pt solid windowtext;
background:#CCC0DA;
mso-pattern:black none;}
.xl96
{mso-style-parent:style0;
border:.5pt solid windowtext;
background:#CCC0DA;
mso-pattern:black none;
white-space:normal;}
.xl97
{mso-style-parent:style0;
border:.5pt solid windowtext;
background:#93CDDD;
mso-pattern:black none;}
.xl98
{mso-style-parent:style0;
mso-number-format:"\@";
text-align:center;
border:.5pt solid windowtext;
background:#93CDDD;
mso-pattern:black none;}
.xl99
{mso-style-parent:style0;
border:.5pt solid windowtext;
background:#93CDDD;
mso-pattern:black none;
white-space:normal;}
.xl100
{mso-style-parent:style0;
border:.5pt solid windowtext;
background:#FAC090;
mso-pattern:black none;}
.xl101
{mso-style-parent:style0;
mso-number-format:"\@";
text-align:center;
border:.5pt solid windowtext;
background:#FAC090;
mso-pattern:black none;}
.xl102
{mso-style-parent:style0;
border:.5pt solid windowtext;
background:#FAC090;
mso-pattern:black none;
white-space:normal;}
.xl103
{mso-style-parent:style0;
text-align:center;
border:.5pt solid windowtext;
background:#EAF1DD;
mso-pattern:black none;}
.xl104
{mso-style-parent:style0;
border:.5pt solid windowtext;
background:#FCD5B4;
mso-pattern:black none;}
.xl105
{mso-style-parent:style0;
font-weight:700;}
.xl106
{mso-style-parent:style0;
text-align:left;}
.xl107
{mso-style-parent:style0;
mso-number-format:"\@";
text-align:left;}
/open8_urisc/trunk/Documents/CPU Instruction Set_files/tabstrip.htm
0,0 → 1,33
<html>
<head>
<meta http-equiv=Content-Type content="text/html; charset=windows-1252">
<meta name=ProgId content=Excel.Sheet>
<meta name=Generator content="Microsoft Excel 12">
<link id=Main-File rel=Main-File href="../CPU%20Instruction%20Set.htm">
 
<script language="JavaScript">
<!--
if (window.name!="frTabs")
window.location.replace(document.all.item("Main-File").href);
//-->
</script>
<style>
<!--
A {
text-decoration:none;
color:#000000;
font-size:9pt;
}
-->
</style>
</head>
<body topmargin=0 leftmargin=0 bgcolor="#808080">
<table border=0 cellspacing=1>
<tr>
<td bgcolor="#FFFFFF" nowrap><b><small><small>&nbsp;<a href="sheet001.htm" target="frSheet"><font face="Arial" color="#000000">Instruction Set</font></a>&nbsp;</small></small></b></td>
<td bgcolor="#FFFFFF" nowrap><b><small><small>&nbsp;<a href="sheet002.htm" target="frSheet"><font face="Arial" color="#000000">CPU Options</font></a>&nbsp;</small></small></b></td>
 
</tr>
</table>
</body>
</html>
/open8_urisc/trunk/Documents/Open8_as README.txt
0,0 → 1,1677
----------------------------------------------
Open8_assembler Documentation - Index
----------------------------------------------
 
1..... Introduction
2..... Assembler Directives
3..... Assembler Syntax
3.1.. Case Sensitivity
3.2.. Comments
3.3.. Labels
3.4.. Number Types
3.5.. Strings
3.6.. Mnemonics
4..... Error Messages
5..... Bugs
6..... Temporary Files
7..... Compiling
7.1.. Compiling Object Files
7.2.. Compiling Library Files
8..... Linking
9..... Arithmetics
10.... Open8_as Flags
11.... Good things to know about Open8_as
12.... Legal Note
 
 
----------------------------------------------
1.... Introduction
----------------------------------------------
 
This assembler was originally based on the WLA Assembler. The original
WLA assembler can be found at
 
http://www.iki.fi/~vhelin/wla.html
 
Please don't bother Ville Helin if Open8_as does something wrong. No doubt I've
introduced a bug or two when I modified it for Open8 uRISC code.
 
Note that the original assembler was targetted for other architectures, and
intended for use by game designers, so some of the samples aren't proper
Open8 uRISC code.
 
----------------------------------------------
2.... Assembler Directives
----------------------------------------------
 
Here are the supported directives (with examples) in Open8_as:
 
.ASC "HELLO WORLD!"
.ASCTABLE
.ASCIITABLE
.ASM
.BR
.BREAKPOINT
.BYT 100, $30, %1000, "HELLO WORLD!"
.DB 100, $30, %1000, "HELLO WORLD!"
.DBCOS 0.2, 10, 3.2, 120, 1.3
.DBRND 20, 0, 10
.DBSIN 0.2, 10, 3.2, 120, 1.3
.DEFINE IF $FF0F
.DEF IF $FF0F
.DS 256, $10
.DSB 256, $10
.DSTRUCT waterdrop INSTANCEOF water DATA "tingle", 40, 120
.DSW 128, 20
.DW 16000, 10, 255
.DWCOS 0.2, 10, 3.2, 1024, 1.3
.DWRND 20, 0, 10
.DWSIN 0.2, 10, 3.2, 1024, 1.3
.ELSE
.EMPTYFILL $C9
.ENDASM
.ENDB
.ENDE
.ENDIF
.ENDM
.ENDME
.ENDR
.ENDRO
.ENDS
.ENDST
.ENUM $C000
.EQU IF $FF0F
.FAIL
.FCLOSE FP_DATABIN
.FOPEN "data.bin" FP_DATABIN
.FREAD FP_DATABIN DATA
.FSIZE FP_DATABIN SIZE
.IF DEBUG == 2
.IFDEF IF
.IFDEFM \2
.IFEQ DEBUG 2
.IFEXISTS "main.s"
.IFGR DEBUG 2
.IFGREQ DEBUG 1
.IFLE DEBUG 2
.IFLEEQ DEBUG 1
.IFNDEF IF
.IFNDEFM \2
.IFNEQ DEBUG 2
.INCBIN "sorority.bin"
.INCDIR "/usr/programming/gb/include/"
.INCLUDE "cgb_hardware.i"
.INPUT NAME
.MACRO TEST
.ORG $150
.OUTNAME "other.o"
.PRINTT "Here we are...\n"
.PRINTV DEC DEBUG+1
.REDEFINE IF $F
.REDEF IF $F
.REPEAT 6
.REPT 6
.SEED 123
.SECTION "Init" FORCE
.SHIFT
.STRUCT enemy_object
.SYM SAUSAGE
.SYMBOL SAUSAGE
.UNDEFINE DEBUG
.UNDEF DEBUG
.WORD 16000, 10, 255
 
 
Descriptions:
 
----
.ASM
----
 
Tells Open8_as to start assembling. Use .ASM to continue the work which has been
disabled with .ENDASM. .ASM and .ENDASM can be used to mask away big blocks
of code. This is analogous to the ANSI C -comments (/*...*/), but .ASM and
.ENDASM can be nested, unlike the ANSI C -counterpart.
 
This is not a compulsory directive.
 
-------
.ENDASM
-------
 
Tells Open8_as to stop assembling. Use .ASM to continue the work.
 
This is not a compulsory directive.
 
----------------
.DBRND 20, 0, 10
----------------
 
Defines bytes, just like .DSB does, only this time they are filled with
(pseudo) random numbers. We use stdlib's rand() to generate the random
numbers. If you want to seed the random number generator, use .SEED.
 
The first parameter (20 in the example) defines the amount of numbers
we want to generate. The next two tell the range of the random numbers,
i.e. min and max.
 
Here's how it works:
 
.DBRND A, B, C
 
for (i = 0; i < A; i++)
output_data((rand() % (C-B+1)) + B);
 
This is not a compulsory directive.
 
----------------
.DWRND 20, 0, 10
----------------
 
Analogous to .DBRND (but defines words).
 
This is not a compulsory directive.
 
-----------------------------
.DBCOS 0.2, 10, 3.2, 120, 1.3
-----------------------------
 
Defines bytes just like .DSB does, only this time they are filled with
cosine data. .DBCOS takes five arguments.
 
The first argument is the starting angle. Angle value ranges from 0 to
359.999..., but you can supply Open8_as with values that are out of the range -
Open8_as fixes them ok. The value can be integer or float.
 
The second one descibes the amount of additional angles. The example
will define 11 angles.
 
The third one is the adder value which is added to the angle value when
next angle is calculated. The value can be integer or float.
 
The fourth and fifth ones can be seen from the pseudo code below, which
also describes how .DBCOS works. The values can be integer or float.
 
Remember that cos (and sin) here returns values ranging from -1 to 1.
 
.DBCOS A, B, C, D, E
 
for (B++; B > 0; B--) {
output_data((D * cos(A)) + E)
A = keep_in_range(A + C)
}
 
This is not a compulsory directive.
 
-----------------------------
.DBSIN 0.2, 10, 3.2, 120, 1.3
-----------------------------
 
Analogous to .DBCOS, but does sin() instead of cos().
 
This is not a compulsory directive.
 
------------------------------
.DWCOS 0.2, 10, 3.2, 1024, 1.3
------------------------------
 
Analogous to .DBCOS (but defines words).
 
This is not a compulsory directive.
 
------------------------------
.DWSIN 0.2, 10, 3.2, 1024, 1.3
------------------------------
 
Analogous to .DBCOS (but defines words and does sin() instead of cos()).
 
This is not a compulsory directive.
 
--------------
.EMPTYFILL $C9
--------------
 
This byte is used in filling the unused areas of memory. EMPTYFILL
defaults to $00.
 
This is not a compulsory directive.
 
--------------------------------------
.INCDIR "/usr/programming/Open8/include/"
--------------------------------------
 
Changes the current include root directory. Use this to specify main
directory for the following .INCLUDE and .INCBIN directives.
If you want to change to the current working directory (Open8_as also defaults
to this), use
 
.INCDIR ""
 
This is not a compulsory directive.
 
-------------------------
.INCLUDE "cgb_hardware.i"
-------------------------
 
Includes the specified file to the source file. If the file's not found
in the .INCDIR directory, Open8_as tries to find it in the current working
directory.
 
This is not a compulsory directive.
 
----------------------
.INCBIN "sorority.bin"
----------------------
 
Includes the specified data file into the source file. .INCBIN caches
all files into memory, so you can .INCBIN any data file millions of
times, but it is loaded from hard drive only once.
 
You can optionally use SWAP after the file name, e.g.,
 
.INCBIN "kitten.bin" SWAP
 
.INCBIN data is divided into blocks of two bytes, and inside every block
the bytes are exchanged (like "SWAP r" does to nibbles). This requires that
the size of the file is even.
 
You can also force Open8_as to skip n bytes from the beginning of the file
by writing for example:
 
.INCBIN "kitten.bin" SKIP 4
 
Four bytes are skipped from the beginning of kitten.bin and the rest
is incbinned.
 
It is also possible to incbin only n bytes from a file:
 
.INCBIN "kitten.bin" READ 10
 
Will read ten bytes from the beginning of kitten.bin.
 
You can also force Open8_as to create a definition holding the size
of the file:
 
.INCBIN "kitten.bin" FSIZE size_of_kitten
 
And you can combine all these four commands:
 
.INCBIN "kitten.bin" SKIP 10 READ 8 SWAP FSIZE size_of_kitten
 
This example shows how to incbin eight bytes (swapped) after skipping
10 bytes from the beginning of file "kitten.bin", and how to get the
size of the file into a definition label "size_of_kitten". Note that the
order of the extra commands is important.
 
If the file's not found in the .INCDIR directory, Open8_as tries to find it
in the current working directory.
 
This is not a compulsory directive.
 
-----------
.INPUT NAME
-----------
 
.INPUT is much like any Basic-language input: .INPUT asks the user
for a value or string. After .INPUT is the variable name used to store
the data.
 
.INPUT works like .REDEFINE, but the user gets to type in the data.
 
Here are few examples how to use input:
 
.PRINTT "The name of the TFT pic? "
.INPUT NAME
.NAME NAME
 
...
 
.PRINTT "Give the .DB amount.\n"
.INPUT S
.PRINTT "Give .DB data one at a time.\n"
.REPEAT S
.INPUT B
.DB B
.ENDR
 
...
 
This is not a compulsory directive.
 
-----
.FAIL
-----
 
Terminates the compiling process.
 
This is not a compulsory directive.
 
------------------
.FCLOSE FP_DATABIN
------------------
 
Closes the filehandle FP_DATABIN.
 
This is not a compulsory directive.
 
----------------------------
.FOPEN "data.bin" FP_DATABIN
----------------------------
 
Opens the file "data.bin" for reading and associates the filehandle with
name "FP_DATABIN".
 
This is not a compulsory directive.
 
----------------------
.FREAD FP_DATABIN DATA
----------------------
 
Reads one byte from "FP_DATABIN" and creates a definition called "DATA"
to hold it. "DATA" is an ordinary definition label, so you can .UNDEFINE it.
 
Here's an example on how to use .FREAD:
 
.fopen "data.bin" fp
.fsize fp t
.repeat t
.fread fp d
.db d+26
.endr
.undefine t, d
 
This is not a compulsory directive.
 
----------------------
.FSIZE FP_DATABIN SIZE
----------------------
 
Creates a definition called "SIZE", which holds the size of the file
associated with the filehandle "FP_DATABIN". "SIZE" is an ordinary
definition label, so you can .UNDEFINE it.
 
This is not a compulsory directive.
 
-----------
.MACRO TEST
-----------
 
Begins a macro called 'TEST'.
 
You can use '\@' inside a macro to e.g., separate a label from the other
macro 'TEST' occurrences. '\@' is replaced with an integer number
indicating the amount of times the macro has been called previously so
it is unique to every macro call. '\@' can also be used inside strings
inside a macro or just as a plain value. Look at the following examples
for more information.
 
Also, if you want to use macro arguments in e.g., calculation, you can
type '\X' where X is the number of the argument. Another way to refer
to the arguments is to use their names given in the definition of the
macro (see the examples for this).
 
Remember to use .ENDM to finish the macro definition. Note that you
cannot use .INCLUDE inside a macro. Note that Open8_as' macros are in fact
more like procedures than real macros, because Open8_as doesn't substitute
macro calls with macro data. Instead Open8_as jumps to the macro when it
encounters a macro call at compile time.
 
You can call macros from inside a macro. Note that the preprocessor
does not expand the macros. Open8_as traverses through the code according to
the macro calls, so macros really define a very simple programming
language.
 
Here are some examples:
 
.MACRO NOPMONSTER
.REPT 32 ; it's just an example...
NOP
.ENDR
.ENDM
 
.MACRO LOAD_ABCD
LD A, \1
LD B, \2
LD C, \3
LD D, \4
NOPMONSTER
LD HL, 1<<\1
.INCBIN \5
.ENDM
 
.MACRO QUEEN
 
QUEEN\@:
LD A, \1
LD B, \1
CALL QUEEN\@
 
.DB "\@", 0 ; will translate into a zero terminated string
; holding the amount of macro QUEEN calls.
.DB "\\@", 0 ; will translate into a string containing
; \@.
.DB \@ ; will translate into a number indicating
; the amount of macro QUEEN calls.
 
.ENDM
 
.MACRO LOAD_ABCD_2 ARGS ONE, TWO, THREE, FOUR, FIVE
LD A, ONE
LD B, TWO
LD C, THREE
LD D, FOUR
NOPMONSTER
LD HL, 1< \2, etc.).
.SHIFT can thus only be used inside a .MACRO.
 
This is not a compulsory directive.
 
---------
.ORG $150
---------
 
Defines the starting address. The default starting address is $0
 
This is not a compulsory directive.
 
------------
.DS 256, $10
------------
 
.DS is an alias for .DSB.
 
This is not a compulsory directive.
 
-------------
.DSB 256, $10
-------------
 
Defines 256 bytes of $10.
 
This is not a compulsory directive.
 
----------------------------------------------------------
.DSTRUCT waterdrop INSTANCEOF water DATA "tingle", 40, 120
----------------------------------------------------------
 
Defines an instance of struct water, called waterdrop, and fills
it with the given data. Before calling .DSTRUCT we must have defined
the structure, and in this example it could be like:
 
.STRUCT water
name ds 8
age db
weight dw
.ENDST
 
Note that the keywords INSTANCEOF and DATA are optional, so
 
.DSTRUCT waterdrop, water, "tingle", 40, 120
 
also works. Also note that Open8_as fills the missing bytes with the data
defined with .EMPTYFILL, or $00 if no .EMPTYFILL has been issued.
 
In this example you would also get the following labels:
 
waterdrop
waterdrop.name
waterdrop.age
waterdrop.weight
 
This is not a compulsory directive.
 
------------
.DSW 128, 20
------------
 
Defines 128 words (two bytes) of 20.
 
This is not a compulsory directive.
 
-----------------------------------
.DB 100, $30, %1000, "HELLO WORLD!"
-----------------------------------
 
Defines bytes.
 
This is not a compulsory directive.
 
------------------------------------
.BYT 100, $30, %1000, "HELLO WORLD!"
------------------------------------
 
.BYT is an alias for .DB.
 
This is not a compulsory directive.
 
------------
.SYM SAUSAGE
------------
 
Open8_as treats symbols ("SAUSAGE" in this example) like labels, but they
only appear in the symbol files Open8_link outputs. Useful for finding out
the location where Open8_link puts data.
 
This is not a compulsory directive.
 
---------------
.SYMBOL SAUSAGE
---------------
 
.SYMBOL is an alias for .SYM.
 
This is not a compulsory directive.
 
---
.BR
---
 
Inserts a breakpoint that behaves like a .SYM without a name. Breakpoints
can only be seen in Open8_link's symbol file.
 
This is not a compulsory directive.
 
-----------
.BREAKPOINT
-----------
 
.BREAKPOINT is an alias for .BR.
 
This is not a compulsory directive.
 
-----------
.ASCIITABLE
-----------
 
.ASCIITABLE's only purpose is to provide character mapping for .ASC.
Take a look at the example:
 
.ASCIITABLE
MAP "A" TO "Z" = 0
MAP "!" = 90
.ENDA
 
Here we set such a mapping that character 'A' is equal to 0, 'B'
is equal to 1, 'C' is equal to 2, and so on, and '!' is equal to 90.
 
After you've given the .ASCIITABLE, use .ASC to define bytes using
this mapping (.ASC is an alias for .DB, but with .ASCIITABLE mapping).
For example, .ASC "AB!" would define bytes 0, 1 and 90.
 
Note that the following works as well:
 
.ASCIITABLE
MAP 'A' TO 'Z' = 0
MAP 65 = 90
.ENDA
 
Also note that the characters that are not given any mapping in
.ASCIITABLE map to themselves (i.e., 'A' maps to 'A', etc.).
 
This is not a compulsory directive.
 
---------
.ASCTABLE
---------
 
.ASCTABLE is an alias for .ASCIITABLE.
 
This is not a compulsory directive.
 
-------------------
.ASC "HELLO WORLD!"
-------------------
 
.ASC is an alias for .DB, but if you use .ASC it will remap
the characters using the mapping given via .ASCIITABLE.
 
This is not a compulsory directive.
 
------------------
.DW 16000, 10, 255
------------------
 
Defines words (two bytes each). .DW takes only numbers and
characters as input, not strings.
 
This is not a compulsory directive.
 
--------------------
.WORD 16000, 10, 255
--------------------
 
.WORD is an alias for .DW.
 
This is not a compulsory directive.
 
----------------
.DEFINE IF $FF0F
----------------
 
Assigns a number or a string to a definition label.
 
By default all defines are local to the file where they are
presented. If you want to make the definition visible to all the
files in the project, use .EXPORT.
 
Here are some examples:
 
.DEFINE X 1000
.DEFINE FILE "PD-03.TFT"
.DEFINE TXT1 "hello and welcome", 1, "to the Open8", 0
.DEFINE BYTES 1, 2, 3, 4, 5
.DEFINE COMPUTATION X+1
.DEFINE DEFAULTV
 
All definitions with multiple values are marked as data strings,
and .DB is about the only place where you can later on use them.
 
.DEFINE BYTES 1, 2, 3, 4, 5
.DB 0, BYTES, 6
 
is the same as
 
.DB 0, 1, 2, 3, 4, 5, 6
 
If you omit the definition value (in our example "DEFAULTV"), Open8_as
will default to 0.
 
Note that you must do your definition before you use it, otherwise
Open8_as will use the final value of the definition. Here's an example
of this:
 
.DEFINE AAA 10
.DB AAA ; will be 10.
.REDEFINE AAA 11
 
but
 
.DB AAA ; will be 11.
.DEFINE AAA 10
.REDEFINE AAA 11
 
You can also create definitions on the command line. Here's an
example of this:
 
Open8_as AS -vl -DMOON -DNAME=john -DPRICE=100 -DADDRESS=$100 math.s
 
MOON's value will be 0, NAME is a string definition with value "john",
PRICE's value will be 100, and ADDRESS's value will be $100.
 
Note that
 
.DEFINE AAA = 10 ; the same as ".DEFINE AAA 10".
 
works as well.
 
This is not a compulsory directive.
 
-------------
.DEF IF $FF0F
-------------
 
.DEF is an alias for .DEFINE.
 
This is not a compulsory directive.
 
-------------
.EQU IF $FF0F
-------------
 
.EQU is an alias for .DEFINE.
 
This is not a compulsory directive.
 
----------------
.REDEFINE IF $0F
----------------
 
Assigns a new value or a string to an old definition. If the
definition doesn't exist, .REDEFINE performs .DEFINE's work.
 
When used with .REPT REDEFINE helps creating tables:
 
.DEFINE CNT 0
 
.REPT 256
.DB CNT
.REDEFINE CNT CNT+1
.ENDR
 
This is not a compulsory directive.
 
-------------
.REDEF IF $0F
-------------
 
.REDEF is an alias for .REDEFINE.
 
This is not a compulsory directive.
 
--------------
.IF DEBUG == 2
--------------
 
If the condition is fulfilled the following piece of code is
acknowledged until .ENDIF/.ELSE occurs in the text, otherwise
it is skipped. Operands must be immediate values or strings.
 
The following operators are supported:
< - less than
<= - less or equal to
> - greater than
>= - greater or equal to
== - equals to
!= - doesn't equal to
 
All IF (yes, including .IFDEF, .IFNDEF, etc) directives can be
nested.
 
This is not a compulsory directive.
 
---------
.IFDEF IF
---------
 
If "IF" is defined, then the following piece of code is acknowledged
until .ENDIF/.ELSE occurs in the text, otherwise it is skipped.
 
This is not a compulsory directive.
 
------------------
.IFEXISTS "main.s"
------------------
 
If "main.s" file can be found, then the following piece of code is
acknowledged until .ENDIF/.LESE occurs in the text, otherwise it is
skipped.
 
By writing the following few lines you can include a file if it exists
without breaking the compiling loop if it doesn't exist.
 
.IFEXISTS FILE
.INCLUDE FILE
.ENDIF
 
This is not a compulsory directive.
 
---------------
.UNDEFINE DEBUG
---------------
 
Removes the supplied definition label from system. If there is no
such label as given no error is displayed as the result would be the
same.
 
You can undefine as many definitions as you wish with one .UNDEFINE:
 
.UNDEFINE NUMBER, NAME, ADDRESS, COUNTRY
.UNDEFINE NAME, AGE
 
This is not a compulsory directive.
 
------------
.UNDEF DEBUG
------------
 
.UNDEF is an alias for .UNDEFINE.
 
This is not a compulsory directive.
 
----------
.IFNDEF IF
----------
 
If "IF" is not defined, then the following piece of code is acknowledged
until .ENDIF/.ELSE occurs in the text, otherwise it is skipped.
 
This is not a compulsory directive.
 
----------
.IFDEFM \2
----------
 
If the specified argument is defined (argument number two, in the example),
then the following piece of code is acknowledged until .ENDIF/.ELSE occurs
in the macro, otherwise it is skipped.
 
This is not a compulsory directive. .IFDEFM works only inside a macro.
 
-----------
.IFNDEFM \2
-----------
 
If the specified argument is not defined, then the following piece of
code is acknowledged until .ENDIF/.ELSE occurs in the macro, otherwise
it is skipped.
 
This is not a compulsory directive. .IFNDEFM works only inside a macro.
 
-------------
.IFEQ DEBUG 2
-------------
 
If the value of DEBUG equals to 2, then the following piece of code is
acknowledged until .ENDIF/.ELSE occurs in the text, otherwise it is skipped.
Both arguments can be computations, defines or immediate values.
 
This is not a compulsory directive.
 
--------------
.IFNEQ DEBUG 2
--------------
 
If the value of DEBUG doesn't equal to 2, then the following piece of
code is acknowledged until .ENDIF/.ELSE occurs in the text, otherwise it is
skipped. Both arguments can be computations, defines or immediate
values.
 
This is not a compulsory directive.
 
-------------
.IFLE DEBUG 2
-------------
 
If the value of DEBUG is less than 2, then the following piece of code is
acknowledged until .ENDIF/.ELSE occurs in the text, otherwise it is skipped.
Both arguments can be computations, defines or immediate values.
 
This is not a compulsory directive.
 
---------------
.IFLEEQ DEBUG 2
---------------
 
If the value of DEBUG is less or equal to 2, then the following piece of code is
acknowledged until .ENDIF/.ELSE occurs in the text, otherwise it is skipped.
Both arguments can be computations, defines or immediate values.
 
This is not a compulsory directive.
 
-------------
.IFGR DEBUG 2
-------------
 
If the value of DEBUG is greater than 2, then the following piece of code is
acknowledged until .ENDIF/.ELSE occurs in the text, otherwise it is skipped.
Both arguments can be computations, defines or immediate values.
 
This is not a compulsory directive.
 
---------------
.IFGREQ DEBUG 2
---------------
 
If the value of DEBUG is greater or equal to 2, then the following piece of code is
acknowledged until .ENDIF/.ELSE occurs in the text, otherwise it is skipped.
Both arguments can be computations, defines or immediate values.
 
This is not a compulsory directive.
 
-----
.ELSE
-----
 
If the previous .IFxxx failed then the following text until
.ENDIF is acknowledged.
 
This is not a compulsory directive.
 
------
.ENDIF
------
 
This terminates any .IFxxx directive.
 
This is not a compulsory directive, but if you use any .IFxxx then
you need also to apply this.
 
---------
.REPEAT 6
---------
 
Repeats the text enclosed between ".REPEAT x" and ".ENDR" x times (6 in
this example). You can use .REPEATs inside .REPEATs. 'x' must be >= 0.
 
This is not a compulsory directive.
 
-------
.REPT 6
-------
 
.REPT is an alias for .REPEAT.
 
This is not a compulsory directive.
 
-----
.ENDR
-----
 
Ends the repetition.
 
This is not a compulsory directive, but when .REPEAT is used this one is
required to terminate it.
 
-----------
.ENUM $C000
-----------
 
Starts enumeration from $C000. Very useful for defining variables.
 
To start a descending enumeration, put "DESC" after the starting
address. Open8_as defaults to "ASC" (ascending enumeration).
 
You can also add "EXPORT" after these if you want to export all
the generated definitions automatically.
 
Here's an example of .ENUM:
 
...
.STRUCT mon ; check out the documentation on
name ds 2 ; .STRUCT
age db
.ENDST
 
.ENUM $A000
_scroll_x DB ; db - define byte (byt and byte work also)
_scroll_y DB
player_x: DW ; dw - define word (word works also)
player_y: DW
map_01: DS 16 ; ds - define size (bytes)
map_02 DSB 16 ; dsb - define size (bytes)
map_03 DSW 8 ; dsw - define size (words)
monster INSTANCEOF mon 3 ; three instances of structure mon
dragon INSTANCEOF mon ; one mon
.ENDE
...
 
Previous example transforms into following definitions:
 
.DEFINE _scroll_x $A000
.DEFINE _scroll_y $A001
.DEFINE player_x $A002
.DEFINE player_y $A004
.DEFINE map_01 $A006
.DEFINE map_02 $A016
.DEFINE map_03 $A026
.DEFINE monster $A036
.DEFINE monster.name $A036
.DEFINE monster.age $A038
.DEFINE monster.1 $A036
.DEFINE monster.1.name $A036
.DEFINE monster.1.age $A038
.DEFINE monster.2 $A039
.DEFINE monster.2.name $A039
.DEFINE monster.2.age $A03B
.DEFINE monster.3 $A03C
.DEFINE monster.3.name $A03C
.DEFINE monster.3.age $A03E
.DEFINE dragon $A03F
.DEFINE dragon.name $A03F
.DEFINE dragon.age $A041
 
DB, DW, DS, DSB, DSW and INSTANCEOF can also be in lowercase. You
can also use a dotted version of the symbols, but it doesn't advance
the memory address. Here's an exmple:
 
.ENUM $C000 DESC EXPORT
bigapple_h db
bigapple_l db
bigapple: .dw
.ENDE
 
And this is what is generated:
 
.DEFINE bigapple_h $BFFF
.DEFINE bigapple_l $BFFE
.DEFINE bigapple $BFFE
.EXPORT bigapple, bigapple_l, bigapple_h
 
This way you can generate a 16bit variable address along with pointers
to its parts.
 
If you want more flexible variable positioning, take a look at
.RAMSECTIONs.
 
This is not a compulsory directive.
 
-----
.ENDE
-----
 
Ends the enumeration.
 
This is not a compulsory directive, but when .ENUM is used this one is
required to terminate it.
 
--------------------
.STRUCT enemy_object
--------------------
 
Begins the definition of a structure. These structures can be placed
inside RAMSECTIONs and ENUMs. Here's an example:
 
.STRUCT enemy_object
id dw ; the insides of a .STRUCT are 1:1 like in .ENUM
x db ; except that no structs inside structs are
y db ; allowed.
data ds 10
info dsb 16
stats dsw 4
.ENDST
 
This also creates a definition "_sizeof_[struct name]", in our example
this would be "_sizeof_enemy_object", and the value of this definition
is the size of the object, in bytes (2+1+1+10+16+4*2 = 38 in the example).
 
You'll get the following definitions as well:
 
enemy_object.id (== 0)
enemy_object.x (== 2)
enemy_object.y (== 3)
enemy_object.data (== 4)
enemy_object.info (== 14)
enemy_object.stats (== 30)
 
After defining a .STRUCT you can create an instance of it in a .RAMSECTION /
.ENUM by typing
 
INSTANCEOF [optional, the number of structures]
 
Here's an example:
 
.RAMSECTION "enemies" BANK 4 SLOT 4
enemies INSTANCEOF enemy_object 4
enemyman INSTANCEOF enemy_object
enemyboss INSTANCEOF enemy_object
.ENDS
 
This will create labels like "enemies", "enemies.id", "enemies.x", "enemies.y"
and so on. Label "enemies" is followed by four "enemy_object" structures,
and only the first one is labeled. After there four come "enemyman" and
"enemyboss" instances.
 
Take a look at the documentation on .RAMSECTION & .ENUM, they have more
examples of how you can use .STRUCTs.
 
A WORD OF WARNING: Don't use labels b, B, w and W inside a struct as e.g.,
Open8_as sees enemy.b as a byte sized reference to enemy. All other labels should
be safe.
 
lda enemy1.b ; load a byte from zeropage address enemy1 or from the address
; of enemy1.b??? i can't tell you, and Open8_as can't tell you...
 
This is not a compulsory directive.
 
------
.ENDST
------
 
Ends the structure definition.
 
This is not a compulsory directive, but when .STRUCT is used this one is
required to terminate it.
 
---------
.SEED 123
---------
 
Seeds the random number generator.
 
This is not a compulsory directive. The random number generator is
initially seeded with the output of time(), which is, according to
the manual, "the time since the Epoch (00:00:00 UTC, January 1, 1970),
measured in seconds". So if you don't .SEED the random number generator
yourself with a constant value, .DBRND and .DWRND give you different
values every time you run Open8_as.
 
---------------------
.SECTION "Init" FORCE
---------------------
 
Section is a continuous area of data which is placed into the output
file according to the section type and .ORG directive
values.
 
The example begins a section called "Init". Before a section can be
declared, .ORG must be used unless Open8_as is in library file
output mode. Library file's sections must all be FREE ones. .BANK tells
the bank number where this section will be later relocated into. .ORG
tells the offset for the relocation from the beginning of .BANK.
 
You can supply the preferred section size (bytes) inside the section
name string. Here's an example:
 
.SECTION "Init_100" FREE
 
will create a section ("Init") with size of 100 bytes, unless the actual
data overflows from the section, in which case the section size is
enlarged to contain all the data. Note that the syntax for explicit
section size defining is: "NAME_X", where "NAME" is the name of the
section and "X" is the size (decimal or hexadecimal value).
 
You can also give the size of the section the following way:
 
.SECTION "Init" SIZE 100 FREE
 
It's possible to force Open8_link to align the FREE, SEMIFREE and SUPERFREE
sections by giving the alignment as follows:
 
.SECTION "Init" SIZE 100 ALIGN 4 FREE
 
And if you want that Open8_as returns the ORG to what it was before issuing
the section, put RETURNORG at the end of the parameter list:
 
.SECTION "Init" SIZE 100 ALIGN 4 FREE RETURNORG
 
By default Open8_as advances the ORG, so, for example, if your ORG was $0 before
a section of 16 bytes, then the ORG will be 16 after the section.
 
Note also that if your section name begins with double underlines (e.g.,
"__UNIQUE_SECTION!!!") the section will be unique in the sense that
when Open8_link recieves files containing sections which share the same
name, Open8_link will save only the first of them for further processing,
all others are deleted from memory with corresponding labels, references
and calculations.
 
If a section name begins with an exclamation mark ('!') it tells
Open8_link to not to drop it, even if you use Open8_link's ability to discard
all unreferenced sections and there are no references to the section.
 
FORCE after the name of the section tells Open8_as that the section _must_ be
inserted so it starts at .ORG. FORCE can be replaced with FREE which
means that the section can be inserted somewhere in the defined bank,
where there is room. You can also use OVERWRITE to insert the section
into the memory regardless of data collisions. Using OVERWRITE you can
easily patch an existing ROM image just by .BACKGROUND'ing the ROM image and
inserting OVERWRITE sections into it. SEMIFREE sections are also
possible and they behave much like FREE sections. The only difference
is that they are positioned somewhere in the bank starting from .ORG.
SUPERFREE sections are also available, and they will be positioned into
the first suitable place inside the first suitable bank (candidates
for these suitable banks have the same size with the slot of the section,
no other banks are considered). You can also leave away the type
specifier as the default type for the section is FREE.
 
You can name the sections as you wish, but there is one special name.
A section called "BANKHEADER" is placed in the front of the bank
where it is defined. These sections contain data that is not in the
memory map of the machine, so you can't refer to the data of a
BANKHEADER section, but you can write references to outside. So no
labels inside BANKHEADER sections. These special sections are useful
when writing e.g., MSX programs. Note that library files don't take
BANKHEADER sections.
 
Here's an example of a "BANKHEADER" section:
 
.BANK 0
.ORG 0
.SECTION "BANKHEADER"
.DW MAIN
.DW VBI
.ENDS
 
.SECTION "Program"
MAIN: CALL MONTY_ON_THE_RUN
VBI: PUSH HL
...
POP HL
RETI
.ENDS
 
Here's an example of an ordinary section:
 
.BANK 0
.ORG $150
.SECTION "Init" FREE
DI
LD SP, $FFFE
SUB A
LD ($FF00+R_IE), A
.ENDS
 
This tells Open8_as that a FREE section called "Init" must be located somewhere
in bank 0. If you replace FREE with SEMIFREE the section will be inserted
somewhere in the bank 0, but not in the $0-$14F area. If you replace FREE
with SUPERFREE the section will be inserted somewhere in the
 
Here's the order in which Open8_as writes the sections:
1. FORCE
2. SEMIFREE & FREE
3. SUPERFREE
4. OVERWRITE
 
Before the sections are inserted into the output file, they are sorted by
size, so that the biggest section gets processed first and the smallest
last.
 
You can also create a RAM section. For more information about them, please
read the .RAMSECTION directive explanation.
 
This is not a compulsory directive.
 
--------------
.EXPORT work_x
--------------
 
Exports the definition "work_x" to outside world. Exported definitions are
visible to all object files and libraries in the linking procedure. Note
that you can only export value definitions, not string definitions.
 
You can export as many definitions as you wish with one .EXPORT:
 
.EXPORT NUMBER, NAME, ADDRESS, COUNTRY
.EXPORT NAME, AGE
 
This is not a compulsory directive.
 
--------------------------
.PRINTT "Here we are...\n"
--------------------------
 
Prints the given text into stdout. Good for debugging stuff. PRINTT takes
only a string as argument, and the only supported formatting symbol is '\n'
(line feed).
 
This is not a compulsory directive.
 
-------------------
.PRINTV DEC DEBUG+1
-------------------
 
Prints the value of the supplied definition or computation into stdout.
Computation must be solvable at the time of printing (just like definitions
values). PRINTV takes two parameters. The first describes the type of the
print output. "DEC" means decimal, "HEX" means hexadecimal.
 
Use PRINTV with PRINTT as PRINTV doesn't print linefeeds, only the result.
Here's an example:
 
.PRINTT "Value of \"DEBUG\" = $"
.PRINTV HEX DEBUG
.PRINTT "\n"
 
This is not a compulsory directive.
 
------------------
.OUTNAME "other.o"
------------------
 
Changes the name of the output file. Here's and example:
 
Open8_as -o test.s
 
would normally output "test.o", but if you had written
 
.OUTNAME "new.o"
 
somewhere in the code Open8_as would write the output to new.o instead.
 
This is not a compulsory directive.
 
 
----------------------------------------------
3.... Assembler Syntax
----------------------------------------------
 
 
3.1. Case Sensitivity
 
Open8_as is case sensitive, so be careful.
 
 
3.2. Comments
 
Comments begin with ';' or '*' and end along with the line. ';' can be
used anywhere, but '*' can be placed only at the beginning of a new line.
 
Open8_as also has ANSI-C -like commenting. This means you can start a
multiline comment with "/*" and end it with "*/". Additionally, it has
.ASM and .ENDASM directives. These function much like ANSI-C comments, but
unlike the ANSI-C comments these can be nested.
 
 
3.3. Labels
 
Labels are ordinary strings (which can also end to a ':'). Labels starting
with "_" are considered to be local labels and do not show outside sections
where they were defined, or outside object files, if they were not defined
inside a section.
 
Here are few examples of different labels:
 
VBI_IRQ:
VBI_IRQ2
_VBI_LOOP:
main:
 
3.4. Number Types
 
1000 - decimal
$100 - hexadecimal
100h - hexadecimal
%100 - binary
'x' - character
 
Remember that if you use the suffix 'h' to give a hexadecimal value,
and the value begins with an alphabet, you must place a zero in front of it
so Open8_as knows it's not a label (e.g., "0ah" instead of "ah").
 
 
3.5. Strings
 
Strings begin with and end to '"'. Note that no 0 is inserted to indicate
the termination of the string like in e.g., ANSI C. You'll have to do it
yourself. You can place quotation marks inside strings the way C
preprocessors accept them.
 
Here are some examples of strings:
 
"Hello world!"
"He said: \"Please, kiss me honey.\""
 
 
----------------------------------------------
4.... Error Messages
----------------------------------------------
 
 
There are quite a few of them in Open8_as, but most of them are not very
informative. Coder beware.
 
 
----------------------------------------------
5.... Bugs
----------------------------------------------
 
 
Report bugs to jeremy.s.henry.ctr@mail.mil
 
 
----------------------------------------------
6.... Temporary Files
----------------------------------------------
 
 
Note that Open8 will generate two temporary files while it works. Both files
are placed into the current working directory.
 
The filenames are ".wla%PID%a" and ".wla%PID%b" (%PID% is the process id).
 
When Open8 finishes its work these two files are deleted as they serve
of no further use.
 
 
----------------------------------------------
7.... Compiling
----------------------------------------------
 
 
7.1. Compiling Object Files
 
To compile an object file use:
 
"Open8_as -[itvx]o [DEFINITIONS] [OUTPUT FILE]"
 
These object files can be linked together (or with library files) later
with "Open8_link".
 
Name object files so that they can be recognized as object files. Normal
suffix is ".o" (Open8 default). This can also be changed with .OUTNAME.
 
With object files you can reduce the amount of compiling when editing
small parts of the program. Note also the possibility of using local
labels (starting with "_").
 
Note! When you compile objects, group 1 directives are saved for linking
time, when they are all compared and if they differ, an error message is
shown. It is advisable to use something like an include file to hold all
the group 1 directives for that particular project and include it to every
object file.
 
Here are some examples of definitions:
 
-DIEXIST
-DDAY=10
-DBASE=$10
-DNAME=elvis
 
And here's an Open8 example creating definitions on the command line:
 
Open8_as -o -DDEBUG -DVERBOSE=5 -DNAME="math v1.0" math.s
 
DEBUG's value will be 0, VERBOSE's 5 and NAME is a string definition
with value "math v1.0".
 
 
7.2. Compiling Library Files
 
To compile a library file use:
"Open8_as -[itvx]l [DEFINITIONS] [OUTPUT FILE]"
 
Name object files so that they can be recognized as library files. Normal
suffix is ".lib" (Open8 default).
 
With library files you can reduce the amount of compiling. Library files
are meant to hold general functions that can be used in different projects.
Note also the possibility of using local labels (starting with "_").
Library files consist only of FREE sections.
 
 
----------------------------------------------
8... Linking
----------------------------------------------
 
 
After you have produced one or more object files and perhaps some library
files, you might want to link them together to produce a ROM image / program
file. "Open8_link" is the program you use for that. Here's how you use it:
 
"Open8_link [-divsS]{b/r} "
 
Choose 'b' for program file or 'r' for ROM image linking.
 
Link file is a text file that contains information about the files you want
to link together. Here's the format:
 
1. You must define the group for the files. Put the name of the group
inside brackets. Valid group definitions are
 
[objects]
[libraries]
[header]
[footer]
[definitions]
 
2. Start to list the file names.
 
[objects]
main.o
vbi.o
level_01.o
...
 
3. Give parameters to the library files:
 
[libraries]
bank 0 slot 1 speed.lib
bank 4 slot 2 map_data.lib
...
 
Here you can also use "base" to define the 65816 CPU bank number
(like .BASE works in Open8_as):
 
[libraries]
bank 0 slot 1 base $80 speed.lib
bank 4 slot 2 base $80 map_data.lib
...
 
You must tell Open8_link the bank and the slot for the library files.
 
4. If you want to use header and/or footer in your project,
you can type the following:
 
[header]
header.dat
[footer]
footer.dat
 
5. If you want to make value definitions, here's your chance:
 
[definitions]
debug 1
max_str_len 128
start $150
...
 
If flag 'v' is used, Open8_link displays information about ROM file after a
succesful linking.
 
If flag 'd' is used, Open8_link discards all unreferenced FREE and SEMIFREE
sections. This way you can link big libraries to your project and Open8_link
will choose only the used sections, so you won't be linking any dead code/data.
 
If flag 's' is used, a symbol information file is created.
If flag 'S' is used, a symbol information file with breakpoints is created.
 
If flag 'i' is given, Open8_link will write list files. Note that you must
compile the object and library files with -i flag as well. Otherwise Open8_link
has no extra information it needs to build list files. Here is an example of
a list file: Let's assume you've compiled a source file called "main.s" using
the 'i' flag. After you've linked the result also with the 'i' flag Open8_link
has created a list file called "main.lst". This file contains the source
text and the result data the source compiled into. List files are good for
debugging.
 
Make sure you don't create duplicate labels in different places in the
memory map as they break the linking loop. Duplicate labels are allowed when
they overlap each other in the destination machine's memory. Look at the
following example:
 
...
.BANK 0
.ORG $150
 
...
LD A, 1
CALL LOAD_LEVEL
...
 
LOAD_LEVEL:
LD HL, $2000
LD (HL), A
CALL INIT_LEVEL
RET
 
.BANK 1
.ORG 0
 
INIT_LEVEL:
...
RET
 
.BANK 2
.ORG $0
 
INIT_LEVEL:
...
RET
...
 
 
Here duplicate INIT_LEVEL labels are accepted as they both point to the
same memory address (in the program's point of view).
 
 
----------------------------------------------
9... Arithmetics
----------------------------------------------
 
 
Open8_as is able to solve really complex calculations like
 
-((HELLO / 2) | 3)
skeletor_end-skeletor
10/2.5
 
so you can write something like
 
LD HL, data_end-data
LD A, (pointer + 1)
CP (TEST + %100) & %10101010
 
Open8_link also has this ability so it can compute the pending calculations
Open8_as wasn't able to solve.
 
The following operators are valid:
 
(, ), | (or), & (and), ^ (power), << (shift left), >> (shift right), +, -,
# (modulo), ~ (xor), *, /, < (get the low byte) and > (get the high byte).
 
Note that you can do NOT using XOR:
 
VALUE_A ~ $FF = 8bit NOT
VALUE_B ~ $FFFF = 16bit NOT
 
Open8_as computes internally with real numbers so (5/2)*2 produces 5, not 4.
 
 
 
----------------------------------------------
10... Open8_as Flags
----------------------------------------------
 
 
Here are short descriptions for the flags you can give to Open8_as:
 
You can supply Open8_as with some (or all or none) of the following option flags.
 
i - Add list file information. Adds extra information to the output so
Open8_link can produce list files.
M - Open8 generates makefile rules describing the dependencies of the main
source file. Use only with flags 'o' and 'l'.
q - Quiet mode. .PRINT* -directives output nothing.
t - Test compile. Doesn't output any files.
v - Verbose mode. Shows a lot of information about the compiling process.
x - Extra compile time definitions. Open8_as does extra work by creating
few helpful definitions on the fly.
 
One (and only one) of the following command flags must be defined.
 
l - Output a library file.
o - Output an object file.
 
Examples:
 
[seravy@localhost tbp]# Open8_as -voi testa.s
[seravy@localhost tbp]# Open8_as -oM testa.s
[seravy@localhost tbp]# Open8_as -l testb.s testb.lib
 
Note that the first example produces file named "testa.o".
 
 
----------------------------------------------
11... Good things to know about Open8_as
----------------------------------------------
 
 
- Is 64 bytes too little for a string (file names, labels, definition labels,
etc)? Check out "MAX_NAME_LENGTH" in defines.h.
- Open8_as preprocessor doesn't expand macros and repetitions. Those are actually
traversed in the assembling phase.
- Open8_as's source code is mainly a huge mess, but Open8_link is quite well
structured and written. So beware!
- Do not write ".E" into your sources as Open8_as uses it internally to mark
the end of a file.
 
 
----------------------------------------------
12... Legal Note
----------------------------------------------
 
Open8_as and Open8_link is licensed as GPL software, as are any helper programs.
 
Code in the examples section is licensed under the BSD license.
 
 
/open8_urisc/trunk/Documents/Open8_link README.txt
0,0 → 1,26
----------------------------------------------
Open8 Linker Documentation
----------------------------------------------
 
Open8_link takes object modules created by the Open8 Assembler and
creates the final Open8 binary programs.
 
-------------
Open8_link Usage
-------------
 
To link, you should create a text file containing the names
of the object files in your project, like the following
example, which we'll name "linkfile"...
 
[objects]
main.o
library.o
 
...then call the linker program, instructing it to make a
binary format output file.
 
> open8_link -vb linkfile myprog.pv2
 
...at which point you'll have a program that is ready to
upload/integrate
/open8_urisc/trunk/VHDL/o8_7seg.vhd
0,0 → 1,259
-- Copyright (c)2020 Jeremy Seth Henry
-- All rights reserved.
--
-- Redistribution and use in source and binary forms, with or without
-- modification, are permitted provided that the following conditions are met:
-- * Redistributions of source code must retain the above copyright
-- notice, this list of conditions and the following disclaimer.
-- * Redistributions in binary form must reproduce the above copyright
-- notice, this list of conditions and the following disclaimer in the
-- documentation and/or other materials provided with the distribution,
-- where applicable (as part of a user interface, debugging port, etc.)
--
-- THIS SOFTWARE IS PROVIDED BY JEREMY SETH HENRY ``AS IS'' AND ANY
-- EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-- WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-- DISCLAIMED. IN NO EVENT SHALL JEREMY SETH HENRY BE LIABLE FOR ANY
-- DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-- (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-- ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-- THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--
-- VHDL Units : o8_register
-- Description: Provides a single addressible 8-bit output register
--
-- Register Map:
-- Offset Bitfield Description Read/Write
-- 0x00 ---AAAAA Display 1 value (RW)
-- 0x01 ---AAAAA Display 2 value (RW)
-- 0x02 AAAAAAAA Display 1 brightness (RW)
-- 0x03 AAAAAAAA Display 2 brightness (RW)
--
-- Revision History
-- Author Date Change
------------------ -------- ---------------------------------------------------
-- Seth Henry 05/08/19 Design Start
 
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
use ieee.std_logic_arith.all;
use ieee.std_logic_misc.all;
 
library work;
use work.open8_pkg.all;
 
entity o8_7seg is
generic(
Default_LED1_Value : std_logic_vector(4 downto 0);
Default_LED1_Bright : DATA_TYPE := x"FF";
Default_LED2_Value : std_logic_vector(4 downto 0);
Default_LED2_Bright : DATA_TYPE := x"FF";
Common_Cathode : boolean := TRUE;
Address : ADDRESS_TYPE
);
port(
Open8_Bus : in OPEN8_BUS_TYPE;
Rd_Data : out DATA_TYPE;
--
SegLED1 : out std_logic_vector(6 downto 0);
SegLED2 : out std_logic_vector(6 downto 0)
);
end entity;
 
architecture behave of o8_7seg is
 
alias Clock is Open8_Bus.Clock;
alias Reset is Open8_Bus.Reset;
 
constant User_Addr : std_logic_vector(15 downto 2)
:= Address(15 downto 2);
alias Comp_Addr is Open8_Bus.Address(15 downto 2);
signal Addr_Match : std_logic;
alias Reg_Addr is Open8_Bus.Address(1 downto 0);
signal Reg_Sel : std_logic_vector(1 downto 0);
signal Wr_En : std_logic;
signal Wr_Data_q : DATA_TYPE;
signal Rd_En : std_logic;
 
signal LED1_Reg : std_logic_vector(4 downto 0);
signal LED1_Brt : DATA_TYPE;
signal LED2_Reg : std_logic_vector(4 downto 0);
signal LED2_Brt : DATA_TYPE;
 
 
signal LED1_PDM : std_logic;
signal LED1_Ext : std_logic_vector(6 downto 0);
 
signal LED2_PDM : std_logic;
signal LED2_Ext : std_logic_vector(6 downto 0);
 
signal SegLED1_Full : std_logic_vector(6 downto 0);
signal SegLED2_Full : std_logic_vector(6 downto 0);
 
-- Standard 7-Segment Numeric Display
--
-- -A-
-- | |
-- F B
-- | |
-- -G-
-- | |
-- E C
-- | |
-- -D- (DP)
 
type LED_DEFS_TYPE is array(0 to 31) of std_logic_vector(6 downto 0);
constant CHAR_DEFINITIONS : LED_DEFS_TYPE := (
-- GFEDCBA
"0111111", -- 00 -> 0
"0000110", -- 01 -> 1
"1011011", -- 02 -> 2
"1001111", -- 03 -> 3
"1100110", -- 04 -> 4
"1101101", -- 05 -> 5
"1111101", -- 06 -> 6
"0000111", -- 07 -> 7
"1111111", -- 08 -> 8
"1101111", -- 09 -> 9
"1110111", -- 10 -> A
"1111100", -- 11 -> B
"1011000", -- 12 -> C
"1011110", -- 13 -> D
"1111001", -- 14 -> E
"1110001", -- 15 -> F
"0111101", -- 16 -> G
"1110110", -- 17 -> H
"0000100", -- 18 -> i
"0001110", -- 19 -> J
"0111000", -- 20 -> L
"1010100", -- 21 -> n
"1011100", -- 22 -> o
"1110011", -- 23 -> P
"1010000", -- 24 -> r
"0011100", -- 25 -> u
"1101110", -- 26 -> y
"1000000", -- 27 -> -
"1001000", -- 28 -> =
"1100011", -- 29 -> DEG
"0000010", -- 30 -> '
"0000000" -- 31 -> " "
);
 
begin
 
Addr_Match <= '1' when Comp_Addr = User_Addr else '0';
 
io_reg: process( Clock, Reset )
begin
if( Reset = Reset_Level )then
Reg_Sel <= "00";
Wr_En <= '0';
Wr_Data_q <= x"00";
LED1_Reg <= Default_LED1_Value;
LED2_Reg <= Default_LED2_Value;
LED1_Brt <= Default_LED1_Bright;
LED2_Brt <= Default_LED2_Bright;
Rd_En <= '0';
Rd_Data <= OPEN8_NULLBUS;
elsif( rising_edge( Clock ) )then
Reg_Sel <= Reg_Addr;
 
Wr_En <= Addr_Match and Open8_Bus.Wr_En;
Wr_Data_q <= Open8_Bus.Wr_Data;
if( Wr_En = '1' )then
case( Reg_Sel )is
when "00" =>
LED1_Reg <= Wr_Data_q(4 downto 0);
when "01" =>
LED2_Reg <= Wr_Data_q(4 downto 0);
when "10" =>
LED1_Brt <= Wr_Data_q;
when "11" =>
LED2_Brt <= Wr_Data_q;
when others =>
null;
end case;
end if;
 
Rd_Data <= OPEN8_NULLBUS;
Rd_En <= Addr_Match and Open8_Bus.Rd_En;
if( Rd_En = '1' )then
case( Reg_Sel )is
when "00" =>
Rd_Data <= "000" & LED1_Reg;
when "01" =>
Rd_Data <= "000" & LED2_Reg;
when "10" =>
Rd_Data <= LED1_Brt;
when "11" =>
Rd_Data <= LED2_Brt;
when others =>
null;
end case;
end if;
end if;
end process;
 
U_LED1_PWM : entity work.vdsm8
generic map(
Reset_Level => Reset_Level
)
port map(
Clock => Clock,
Reset => Reset,
DACin => LED1_Brt,
DACout => LED1_PDM
);
 
U_LED2_PWM : entity work.vdsm8
generic map(
Reset_Level => Reset_Level
)
port map(
Clock => Clock,
Reset => Reset,
DACin => LED2_Brt,
DACout => LED2_PDM
);
 
LED1_Ext <= (others => LED1_PDM);
LED2_Ext <= (others => LED2_PDM);
 
SegLED1_Full <= CHAR_DEFINITIONS(conv_integer(LED1_Reg));
SegLED2_Full <= CHAR_DEFINITIONS(conv_integer(LED2_Reg));
 
Common_Cathode_Mode : if( Common_Cathode )generate
 
LUT_proc: process( Clock, Reset )
begin
if( Reset = Reset_Level )then
SegLED1 <= (others => '0');
SegLED2 <= (others => '0');
elsif( rising_edge(Clock) )then
SegLED1 <= (SegLED1_Full and LED1_Ext) xor "1111111";
SegLED2 <= (SegLED2_Full and LED2_Ext) xor "1111111";
end if;
end process;
 
end generate;
 
Common_Anode_Mode : if( not Common_Cathode )generate
 
LUT_proc: process( Clock, Reset )
begin
if( Reset = Reset_Level )then
SegLED1 <= (others => '1');
SegLED2 <= (others => '1');
elsif( rising_edge(Clock) )then
SegLED1 <= (SegLED1_Full and LED1_Ext);
SegLED2 <= (SegLED2_Full and LED2_Ext);
end if;
end process;
 
 
end generate;
 
end architecture;
/open8_urisc/trunk/VHDL/o8_pwm_adc.vhd
0,0 → 1,119
-- Copyright (c)2020 Jeremy Seth Henry
-- All rights reserved.
--
-- Redistribution and use in source and binary forms, with or without
-- modification, are permitted provided that the following conditions are met:
-- * Redistributions of source code must retain the above copyright
-- notice, this list of conditions and the following disclaimer.
-- * Redistributions in binary form must reproduce the above copyright
-- notice, this list of conditions and the following disclaimer in the
-- documentation and/or other materials provided with the distribution,
-- where applicable (as part of a user interface, debugging port, etc.)
--
-- THIS SOFTWARE IS PROVIDED BY JEREMY SETH HENRY ``AS IS'' AND ANY
-- EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-- WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-- DISCLAIMED. IN NO EVENT SHALL JEREMY SETH HENRY BE LIABLE FOR ANY
-- DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-- (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-- ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--
-- VHDL Entity: pwm_adc
-- Description: Integrates a PWM input to return the approximate duty cycle
-- Uses a 1kB block ram as storage for a rolling integrator that
-- acts as a simple successive-approximation ADC.
--
-- Revision History
-- Author Date Change
------------------ -------- ---------------------------------------------------
-- Seth Henry 05/07/20 Design Start
 
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
 
library work;
use work.open8_pkg.all;
 
entity o8_pwm_adc is
generic(
Address : ADDRESS_TYPE
);
port(
Open8_Bus : in OPEN8_BUS_TYPE;
Rd_Data : out DATA_TYPE;
--
PWM_In : in std_logic
);
end entity;
 
architecture behave of o8_pwm_adc is
 
alias Clock is Open8_Bus.Clock;
alias Reset is Open8_Bus.Reset;
alias uSec_Tick is Open8_Bus.uSec_Tick;
 
constant User_Addr : std_logic_vector(15 downto 0) := Address(15 downto 0);
alias Comp_Addr is Open8_Bus.Address(15 downto 0);
 
signal Addr_Match : std_logic := '0';
signal Rd_En : std_logic := '0';
 
signal Sample : DATA_TYPE := x"00";
signal RAM_Addr : std_logic_vector(9 downto 0) := (others => '0');
signal RAM_Data : DATA_TYPE := x"00";
signal Accumulator : std_logic_vector(17 downto 0) := (others => '0');
signal Average : DATA_TYPE := x"00";
begin
 
Addr_Match <= Open8_Bus.Rd_En when Comp_Addr = User_Addr else '0';
 
io_reg: process( Clock, Reset )
begin
if( Reset = Reset_Level )then
Rd_En <= '0';
Rd_Data <= OPEN8_NULLBUS;
 
elsif( rising_edge( Clock ) )then
 
Rd_En <= Addr_Match and Open8_Bus.Rd_En;
Rd_Data <= OPEN8_NULLBUS;
 
if( Rd_En = '1' )then
Rd_Data <= Average;
end if;
end if;
end process;
 
-- PWM input is binary, so the sample swings between 0x00 and 0xFF
Sample <= (others => PWM_In);
 
U_DP : entity work.o8_pwm_adc_ram
port map(
address => RAM_Addr,
clock => Clock,
data => Sample,
wren => '1',
q => RAM_Data
);
 
ADC_proc: process( Clock, Reset )
begin
if( Reset = Reset_Level )then
RAM_Addr <= (others => '0');
Accumulator <= (others => '0');
Average <= (others => '0');
elsif( rising_edge(Clock) )then
RAM_Addr <= RAM_Addr + 1;
Accumulator <= Accumulator + ("0000000000" & RAM_Data);
if( RAM_Addr = 0 )then
Accumulator <= (others => '0');
Average <= Accumulator(17 downto 10);
end if;
end if;
end process;
 
end architecture;
/open8_urisc/trunk/VHDL/o8_pwm_adc_ram.vhd
0,0 → 1,158
-- megafunction wizard: %RAM: 1-PORT%
-- GENERATION: STANDARD
-- VERSION: WM1.0
-- MODULE: altsyncram
 
-- ============================================================
-- File Name: o8_pwm_adc_ram.vhd
-- Megafunction Name(s):
-- altsyncram
--
-- Simulation Library Files(s):
-- altera_mf
-- ============================================================
-- ************************************************************
-- THIS IS A WIZARD-GENERATED FILE. DO NOT EDIT THIS FILE!
--
-- 13.1.0 Build 162 10/23/2013 SJ Web Edition
-- ************************************************************
 
 
--Copyright (C) 1991-2013 Altera Corporation
--Your use of Altera Corporation's design tools, logic functions
--and other software and tools, and its AMPP partner logic
--functions, and any output files from any of the foregoing
--(including device programming or simulation files), and any
--associated documentation or information are expressly subject
--to the terms and conditions of the Altera Program License
--Subscription Agreement, Altera MegaCore Function License
--Agreement, or other applicable license agreement, including,
--without limitation, that your use is for the sole purpose of
--programming logic devices manufactured by Altera and sold by
--Altera or its authorized distributors. Please refer to the
--applicable agreement for further details.
 
 
LIBRARY ieee;
USE ieee.std_logic_1164.all;
 
LIBRARY altera_mf;
USE altera_mf.altera_mf_components.all;
 
ENTITY o8_pwm_adc_ram IS
PORT
(
address : IN STD_LOGIC_VECTOR (9 DOWNTO 0);
clock : IN STD_LOGIC := '1';
data : IN STD_LOGIC_VECTOR (7 DOWNTO 0);
wren : IN STD_LOGIC ;
q : OUT STD_LOGIC_VECTOR (7 DOWNTO 0)
);
END o8_pwm_adc_ram;
 
 
ARCHITECTURE SYN OF o8_pwm_adc_ram IS
 
SIGNAL sub_wire0 : STD_LOGIC_VECTOR (7 DOWNTO 0);
 
BEGIN
q <= sub_wire0(7 DOWNTO 0);
 
altsyncram_component : altsyncram
GENERIC MAP (
clock_enable_input_a => "BYPASS",
clock_enable_output_a => "BYPASS",
intended_device_family => "Cyclone III",
lpm_hint => "ENABLE_RUNTIME_MOD=NO",
lpm_type => "altsyncram",
numwords_a => 1024,
operation_mode => "SINGLE_PORT",
outdata_aclr_a => "NONE",
outdata_reg_a => "UNREGISTERED",
power_up_uninitialized => "FALSE",
read_during_write_mode_port_a => "NEW_DATA_NO_NBE_READ",
widthad_a => 10,
width_a => 8,
width_byteena_a => 1
)
PORT MAP (
address_a => address,
clock0 => clock,
data_a => data,
wren_a => wren,
q_a => sub_wire0
);
 
 
 
END SYN;
 
-- ============================================================
-- CNX file retrieval info
-- ============================================================
-- Retrieval info: PRIVATE: ADDRESSSTALL_A NUMERIC "0"
-- Retrieval info: PRIVATE: AclrAddr NUMERIC "0"
-- Retrieval info: PRIVATE: AclrByte NUMERIC "0"
-- Retrieval info: PRIVATE: AclrData NUMERIC "0"
-- Retrieval info: PRIVATE: AclrOutput NUMERIC "0"
-- Retrieval info: PRIVATE: BYTE_ENABLE NUMERIC "0"
-- Retrieval info: PRIVATE: BYTE_SIZE NUMERIC "8"
-- Retrieval info: PRIVATE: BlankMemory NUMERIC "1"
-- Retrieval info: PRIVATE: CLOCK_ENABLE_INPUT_A NUMERIC "0"
-- Retrieval info: PRIVATE: CLOCK_ENABLE_OUTPUT_A NUMERIC "0"
-- Retrieval info: PRIVATE: Clken NUMERIC "0"
-- Retrieval info: PRIVATE: DataBusSeparated NUMERIC "1"
-- Retrieval info: PRIVATE: IMPLEMENT_IN_LES NUMERIC "0"
-- Retrieval info: PRIVATE: INIT_FILE_LAYOUT STRING "PORT_A"
-- Retrieval info: PRIVATE: INIT_TO_SIM_X NUMERIC "0"
-- Retrieval info: PRIVATE: INTENDED_DEVICE_FAMILY STRING "Cyclone III"
-- Retrieval info: PRIVATE: JTAG_ENABLED NUMERIC "0"
-- Retrieval info: PRIVATE: JTAG_ID STRING "LRAM"
-- Retrieval info: PRIVATE: MAXIMUM_DEPTH NUMERIC "0"
-- Retrieval info: PRIVATE: MIFfilename STRING ""
-- Retrieval info: PRIVATE: NUMWORDS_A NUMERIC "1024"
-- Retrieval info: PRIVATE: RAM_BLOCK_TYPE NUMERIC "0"
-- Retrieval info: PRIVATE: READ_DURING_WRITE_MODE_PORT_A NUMERIC "3"
-- Retrieval info: PRIVATE: RegAddr NUMERIC "1"
-- Retrieval info: PRIVATE: RegData NUMERIC "1"
-- Retrieval info: PRIVATE: RegOutput NUMERIC "0"
-- Retrieval info: PRIVATE: SYNTH_WRAPPER_GEN_POSTFIX STRING "0"
-- Retrieval info: PRIVATE: SingleClock NUMERIC "1"
-- Retrieval info: PRIVATE: UseDQRAM NUMERIC "1"
-- Retrieval info: PRIVATE: WRCONTROL_ACLR_A NUMERIC "0"
-- Retrieval info: PRIVATE: WidthAddr NUMERIC "10"
-- Retrieval info: PRIVATE: WidthData NUMERIC "8"
-- Retrieval info: PRIVATE: rden NUMERIC "0"
-- Retrieval info: LIBRARY: altera_mf altera_mf.altera_mf_components.all
-- Retrieval info: CONSTANT: CLOCK_ENABLE_INPUT_A STRING "BYPASS"
-- Retrieval info: CONSTANT: CLOCK_ENABLE_OUTPUT_A STRING "BYPASS"
-- Retrieval info: CONSTANT: INTENDED_DEVICE_FAMILY STRING "Cyclone III"
-- Retrieval info: CONSTANT: LPM_HINT STRING "ENABLE_RUNTIME_MOD=NO"
-- Retrieval info: CONSTANT: LPM_TYPE STRING "altsyncram"
-- Retrieval info: CONSTANT: NUMWORDS_A NUMERIC "1024"
-- Retrieval info: CONSTANT: OPERATION_MODE STRING "SINGLE_PORT"
-- Retrieval info: CONSTANT: OUTDATA_ACLR_A STRING "NONE"
-- Retrieval info: CONSTANT: OUTDATA_REG_A STRING "UNREGISTERED"
-- Retrieval info: CONSTANT: POWER_UP_UNINITIALIZED STRING "FALSE"
-- Retrieval info: CONSTANT: READ_DURING_WRITE_MODE_PORT_A STRING "NEW_DATA_NO_NBE_READ"
-- Retrieval info: CONSTANT: WIDTHAD_A NUMERIC "10"
-- Retrieval info: CONSTANT: WIDTH_A NUMERIC "8"
-- Retrieval info: CONSTANT: WIDTH_BYTEENA_A NUMERIC "1"
-- Retrieval info: USED_PORT: address 0 0 10 0 INPUT NODEFVAL "address[9..0]"
-- Retrieval info: USED_PORT: clock 0 0 0 0 INPUT VCC "clock"
-- Retrieval info: USED_PORT: data 0 0 8 0 INPUT NODEFVAL "data[7..0]"
-- Retrieval info: USED_PORT: q 0 0 8 0 OUTPUT NODEFVAL "q[7..0]"
-- Retrieval info: USED_PORT: wren 0 0 0 0 INPUT NODEFVAL "wren"
-- Retrieval info: CONNECT: @address_a 0 0 10 0 address 0 0 10 0
-- Retrieval info: CONNECT: @clock0 0 0 0 0 clock 0 0 0 0
-- Retrieval info: CONNECT: @data_a 0 0 8 0 data 0 0 8 0
-- Retrieval info: CONNECT: @wren_a 0 0 0 0 wren 0 0 0 0
-- Retrieval info: CONNECT: q 0 0 8 0 @q_a 0 0 8 0
-- Retrieval info: GEN_FILE: TYPE_NORMAL o8_pwm_adc_ram.vhd TRUE
-- Retrieval info: GEN_FILE: TYPE_NORMAL o8_pwm_adc_ram.inc FALSE
-- Retrieval info: GEN_FILE: TYPE_NORMAL o8_pwm_adc_ram.cmp FALSE
-- Retrieval info: GEN_FILE: TYPE_NORMAL o8_pwm_adc_ram.bsf FALSE
-- Retrieval info: GEN_FILE: TYPE_NORMAL o8_pwm_adc_ram_inst.vhd FALSE
-- Retrieval info: GEN_FILE: TYPE_NORMAL o8_pwm_adc_ram_waveforms.html FALSE
-- Retrieval info: GEN_FILE: TYPE_NORMAL o8_pwm_adc_ram_wave*.jpg FALSE
-- Retrieval info: LIB_FILE: altera_mf

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.