templeos-info/public/Wb/Home/Doc/Asm.DD.HTML

85 lines
5.7 KiB
HTML
Executable File

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="generator" content="TempleOS V5.03">
<meta name="viewport" content="width=device-width">
<link rel="stylesheet" href="/style/templeos.css">
<script src="/script/templeos.js"></script>
<style type="text/css">
.cF0{color:#000000;background-color:#ffffff;}
.cF1{color:#0000aa;background-color:#ffffff;}
.cF2{color:#00aa00;background-color:#ffffff;}
.cF3{color:#00aaaa;background-color:#ffffff;}
.cF4{color:#aa0000;background-color:#ffffff;}
.cF5{color:#aa00aa;background-color:#ffffff;}
.cF6{color:#aa5500;background-color:#ffffff;}
.cF7{color:#aaaaaa;background-color:#ffffff;}
.cF8{color:#555555;background-color:#ffffff;}
.cF9{color:#5555ff;background-color:#ffffff;}
.cFA{color:#55ff55;background-color:#ffffff;}
.cFB{color:#55ffff;background-color:#ffffff;}
.cFC{color:#ff5555;background-color:#ffffff;}
.cFD{color:#ff55ff;background-color:#ffffff;}
.cFE{color:#ffff55;background-color:#ffffff;}
.cFF{color:#ffffff;background-color:#ffffff;}
</style>
</head>
<body>
<pre id="content">
<a name="l1"></a><span class=cF5> Assembler</span><span class=cF0>
<a name="l2"></a>
<a name="l3"></a>See </span><a href="/Wb/Compiler/OpCodes.DD.HTML#l1"><span class=cF4>::/Compiler/OpCodes.DD</span></a><span class=cF0> for opcodes. They're not standard. Some invalid
<a name="l4"></a>insts are not flagged and some valid insts are not implemented. 16-bit asm
<a name="l5"></a>support is limited.
<a name="l6"></a>
<a name="l7"></a>Here are example inst formats:
<a name="l8"></a> </span><span class=cF1>ADD</span><span class=cF0> </span><span class=cFC>RAX</span><span class=cF0>,</span><span class=cF9>I64</span><span class=cF0> </span><span class=cFC>FS</span><span class=cF0>:DISP[</span><span class=cFC>RSI</span><span class=cF0>+</span><span class=cFC>RDI</span><span class=cF0>*8]
<a name="l9"></a> </span><span class=cF1>ADD</span><span class=cF0> </span><span class=cFC>RAX</span><span class=cF0>,</span><span class=cF9>I64</span><span class=cF0> [DISP]
<a name="l10"></a>
<a name="l11"></a></span><span class=cF2>$</span><span class=cF0> Current compiler output pos (inst ptr). Even works in HolyC expressions.
<a name="l12"></a>
<a name="l13"></a></span><span class=cF2>$</span><span class=cF0> works in </span><span class=cF2>class</span><span class=cF0>es.
<a name="l14"></a> </span><span class=cF2>class MyFun
<a name="l15"></a> {
<a name="l16"></a> $=-16;
<a name="l17"></a> I64 local1;
<a name="l18"></a> I64 local2;
<a name="l19"></a> $=$+256;
<a name="l20"></a> I64 crazy;
<a name="l21"></a> };</span><span class=cF0>
<a name="l22"></a>
<a name="l23"></a></span><span class=cF4>LABEL</span><span class=cF2>::
<a name="l24"></a></span><span class=cF0> Defines an exported glbl label.
<a name="l25"></a>
<a name="l26"></a></span><span class=cF4>LABEL</span><span class=cF2>:
<a name="l27"></a></span><span class=cF0> Defines an non-exported glbl label.
<a name="l28"></a>
<a name="l29"></a></span><span class=cF2>@@</span><span class=cF4>LABEL</span><span class=cF2>:
<a name="l30"></a></span><span class=cF0> Defines a local label with scope valid between two global labels.
<a name="l31"></a>
<a name="l32"></a></span><span class=cF2>DU8</span><span class=cF0>, </span><span class=cF2>DU16</span><span class=cF0>, </span><span class=cF2>DU32</span><span class=cF0>, </span><span class=cF2>DU64</span><span class=cF0>
<a name="l33"></a> Define BYTE, WORD, DWORD or QWORD. Can be used with </span><span class=cF2>DUP()</span><span class=cF0> and ASCII strings.
<a name="l34"></a>For your convenience, the ASCII strings do not have terminating zeros. Define
<a name="l35"></a>cmds must end with a semicolon.
<a name="l36"></a>
<a name="l37"></a></span><span class=cF2>USE16</span><span class=cF0>, </span><span class=cF2>USE32</span><span class=cF0>, </span><span class=cF2>USE64</span><span class=cF0>
<a name="l38"></a>
<a name="l39"></a></span><span class=cF2>IMPORT</span><span class=cF0> </span><span class=cF4>sym1name</span><span class=cF0>, </span><span class=cF4>sym2name</span><span class=cF0>;
<a name="l40"></a>
<a name="l41"></a></span><span class=cF2>LIST</span><span class=cF0>, </span><span class=cF2>NOLIST</span><span class=cF0>
<a name="l42"></a>
<a name="l43"></a></span><span class=cF2>ALIGN</span><span class=cF0> </span><span class=cF4>num</span><span class=cF0>, </span><span class=cF4>fill_byte</span><span class=cF0>
<a name="l44"></a> Align to </span><span class=cF4>num</span><span class=cF0> boundary and fill with </span><span class=cF4>fill_byte</span><span class=cF0>.
<a name="l45"></a>
<a name="l46"></a></span><span class=cF2>ORG</span><span class=cF0> </span><span class=cF4>num</span><span class=cF0>
<a name="l47"></a> Set code addr for JIT or set module </span><a href="/Wb/Kernel/KLoad.HC.HTML#l181"><span class=cF4>Load</span></a><span class=cF0>() addr -- has 16-byte </span><a href="/Wb/Kernel/KernelA.HH.HTML#l384"><span class=cF4>CBinFile</span></a><span class=cF0> header
<a name="l48"></a>and patch table trailing.
<a name="l49"></a>
<a name="l50"></a></span><span class=cF2>BINFILE</span><span class=cF4> &quot;FileName.BIN&quot;</span><span class=cF0>;
<a name="l51"></a>
<a name="l52"></a>See </span><a href="/Wb/Doc/GuideLines.DD.HTML#l156"><span class=cF4>Assembly Language</span></a><span class=cF0>, </span><a href="/Wb/Demo/Asm/AsmAndC1.HC.HTML#l1"><span class=cF4>::/Demo/Asm/AsmAndC1.HC</span></a><span class=cF0>, </span><a href="/Wb/Demo/Asm/AsmAndC2.HC.HTML#l1"><span class=cF4>::/Demo/Asm/AsmAndC2.HC</span></a><span class=cF0> and </span><span class=cF4>
<a name="l53"></a></span><a href="/Wb/Demo/Asm/AsmAndC3.HC.HTML#l1"><span class=cF4>::/Demo/Asm/AsmAndC3.HC</span></a><span class=cF0>.
</span></pre></body>
</html>