ZealOS/docs/Doc/Asm.DD.html

79 lines
6 KiB
HTML
Raw Normal View History

2021-07-03 05:07:57 +01:00
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=US-ASCII">
<meta name="generator" content="ZealOS V1.02">
2021-07-03 05:07:57 +01:00
<style type="text/css">
body {background-color:#1f1f1f;}
.cF0{color:#e3e3e3;background-color:#1f1f1f;}
.cF1{color:#4f84a6;background-color:#1f1f1f;}
.cF2{color:#73a255;background-color:#1f1f1f;}
.cF3{color:#297582;background-color:#1f1f1f;}
.cF4{color:#b34f4b;background-color:#1f1f1f;}
.cF5{color:#8a52c3;background-color:#1f1f1f;}
.cF6{color:#b7822f;background-color:#1f1f1f;}
.cF7{color:#444444;background-color:#1f1f1f;}
.cF8{color:#6d6d6d;background-color:#1f1f1f;}
.cF9{color:#94bfde;background-color:#1f1f1f;}
.cFA{color:#a1ce97;background-color:#1f1f1f;}
.cFB{color:#6db4be;background-color:#1f1f1f;}
.cFC{color:#e88e88;background-color:#1f1f1f;}
.cFD{color:#ca94e8;background-color:#1f1f1f;}
.cFE{color:#d4b475;background-color:#1f1f1f;}
.cFF{color:#1f1f1f;background-color:#1f1f1f;}
2021-07-03 05:07:57 +01:00
</style>
</head>
<body>
<pre style="font-family:monospace;font-size:12pt">
<a name="l1"></a><span class=cF5> Assembler</span><span class=cF0>
2021-07-03 05:07:57 +01:00
<a name="l2"></a>
<a name="l3"></a>See </span><a href="https://zeal-operating-system.github.io/ZealOS/Compiler/OpCodes.DD.html#l1"><span class=cF4>::/Compiler/OpCodes.DD</span></a><span class=cF0> for opcodes. They're not standard. Some invalid insts are not flagged and some valid insts are not
2021-07-03 05:07:57 +01:00
<a name="l4"></a>implemented. 16-bit asm support is limited.
<a name="l5"></a>
<a name="l6"></a>Here are example instruction formats:
<a name="l7"></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> * </span><span class=cFE>8</span><span class=cF0>]
<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> [DISP]
2021-07-03 05:07:57 +01:00
<a name="l9"></a>
<a name="l10"></a></span><span class=cF2>$</span><span class=cF0> Current compiler output pos (instruction pointer). Even works in CosmiC expressions.
2021-07-03 05:07:57 +01:00
<a name="l11"></a>
<a name="l12"></a></span><span class=cF2>$</span><span class=cF0> works in </span><span class=cF2>class</span><span class=cF0>es.
<a name="l13"></a> </span><span class=cF2>class MyFun
<a name="l14"></a> {
<a name="l15"></a> $ = -16;
<a name="l16"></a> I64 local1;
<a name="l17"></a> I64 local2;
<a name="l18"></a> $ = $ + 256;
<a name="l19"></a> I64 crazy;
<a name="l20"></a> };</span><span class=cF0>
2021-07-03 05:07:57 +01:00
<a name="l21"></a>
<a name="l22"></a></span><span class=cF4>LABEL</span><span class=cF2>::
<a name="l23"></a></span><span class=cF0> Defines an exported global label.
2021-07-03 05:07:57 +01:00
<a name="l24"></a>
<a name="l25"></a></span><span class=cF4>LABEL</span><span class=cF2>:
<a name="l26"></a></span><span class=cF0> Defines an non-exported global label.
2021-07-03 05:07:57 +01:00
<a name="l27"></a>
<a name="l28"></a></span><span class=cF2>@@</span><span class=cF4>LABEL</span><span class=cF2>:
<a name="l29"></a></span><span class=cF0> Defines a local label with scope valid between two global labels.
2021-07-03 05:07:57 +01:00
<a name="l30"></a>
<a name="l31"></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="l32"></a> Define BYTE, WORD, DWORD or QWORD. Can be used with </span><span class=cF2>DUP()</span><span class=cF0> and ASCII strings. For your convenience, the ASCII strings do
<a name="l33"></a>not have terminating zeros. Define cmds must end with a semicolon.
2021-07-03 05:07:57 +01:00
<a name="l34"></a>
<a name="l35"></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="l36"></a>
<a name="l37"></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="l38"></a>
<a name="l39"></a></span><span class=cF2>LIST</span><span class=cF0>, </span><span class=cF2>NOLIST</span><span class=cF0>
<a name="l40"></a>
<a name="l41"></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="l42"></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>.
2021-07-03 05:07:57 +01:00
<a name="l43"></a>
<a name="l44"></a></span><span class=cF2>ORG</span><span class=cF0> </span><span class=cF4>num</span><span class=cF0>
<a name="l45"></a> Set code address for JIT or set module </span><a href="https://zeal-operating-system.github.io/ZealOS/Kernel/KLoad.CC.html#l208"><span class=cF4>Load</span></a><span class=cF0>() address -- has 16-byte </span><a href="https://zeal-operating-system.github.io/ZealOS/Kernel/KernelA.HH.html#l452"><span class=cF4>CBinFile</span></a><span class=cF0> header and patch table trailing.
2021-07-03 05:07:57 +01:00
<a name="l46"></a>
<a name="l47"></a></span><span class=cF2>BINFILE</span><span class=cF4> &quot;FileName.BIN&quot;</span><span class=cF0>;
<a name="l48"></a>
<a name="l49"></a>See </span><a href="https://zeal-operating-system.github.io/ZealOS/Doc/GuideLines.DD.html#l129"><span class=cF4>Assembly Language</span></a><span class=cF0>, </span><a href="https://zeal-operating-system.github.io/ZealOS/Demo/Asm/AsmAndC1.CC.html#l1"><span class=cF4>::/Demo/Asm/AsmAndC1.CC</span></a><span class=cF0>, </span><a href="https://zeal-operating-system.github.io/ZealOS/Demo/Asm/AsmAndC2.CC.html#l1"><span class=cF4>::/Demo/Asm/AsmAndC2.CC</span></a><span class=cF0> and </span><a href="https://zeal-operating-system.github.io/ZealOS/Demo/Asm/AsmAndC3.CC.html#l1"><span class=cF4>::/Demo/Asm/AsmAndC3.CC</span></a><span class=cF0>.
2021-07-03 05:07:57 +01:00
</span></pre></body>
</html>