summary refs log tree commit diff stats
path: root/blog/asm/1.html
diff options
context:
space:
mode:
authorCrystal <crystal@wizard.tower>2024-03-17 21:46:44 +0100
committerCrystal <crystal@wizard.tower>2024-03-17 21:46:44 +0100
commite8c190c8b2984cd562ba65890ad86213a13b9e72 (patch)
treece0b881ede4f9c8b8b49989db4dc404a0acf4850 /blog/asm/1.html
parent8347b8d1f799e38d8ce88da706460ccd8aa7f8d3 (diff)
downloadwww-e8c190c8b2984cd562ba65890ad86213a13b9e72.tar.gz
New
Diffstat (limited to 'blog/asm/1.html')
-rw-r--r--blog/asm/1.html74
1 files changed, 37 insertions, 37 deletions
diff --git a/blog/asm/1.html b/blog/asm/1.html
index d46759f..fcaae55 100644
--- a/blog/asm/1.html
+++ b/blog/asm/1.html
@@ -3,7 +3,7 @@
 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
 <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
 <head>
-<!-- 2024-03-07 Thu 20:55 -->
+<!-- 2024-03-17 Sun 21:28 -->
 <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
 <meta name="viewport" content="width=device-width, initial-scale=1" />
 <title>x86 Assembly from my understanding</title>
@@ -23,9 +23,9 @@
 <p>
 Soooo this article (or maybe even a series of articles, who knows ?) will be about x86 assembly, or rather, what I understood from it and my road from the bottom-up hopefully reaching a good level of understanding
 </p>
-<div id="outline-container-org924bef5" class="outline-2">
-<h2 id="org924bef5">Memory :</h2>
-<div class="outline-text-2" id="text-org924bef5">
+<div id="outline-container-orgd547ad6" class="outline-2">
+<h2 id="orgd547ad6">Memory :</h2>
+<div class="outline-text-2" id="text-orgd547ad6">
 <p>
 Memory is a sequence of octets (Aka 8bits) that each have a unique integer assigned to them called <b>The Effective Address (EA)</b>, in this particular CPU Architecture (the i8086), the octet is designated by a couple (A segment number, and the offset in the segment)
 </p>
@@ -40,9 +40,9 @@ Memory is a sequence of octets (Aka 8bits) that each have a unique integer assig
 The offset and segment are encoded in 16bits, so they take a value between 0 and 65535
 </p>
 </div>
-<div id="outline-container-orgdfa99d1" class="outline-4">
-<h4 id="orgdfa99d1">Important :</h4>
-<div class="outline-text-4" id="text-orgdfa99d1">
+<div id="outline-container-org024e482" class="outline-4">
+<h4 id="org024e482">Important :</h4>
+<div class="outline-text-4" id="text-org024e482">
 <p>
 The relation between the Effective Address and the Segment &amp; Offset is as follow :
 </p>
@@ -52,10 +52,10 @@ The relation between the Effective Address and the Segment &amp; Offset is as fo
 </p>
 </div>
 <ul class="org-ul">
-<li><a id="org8845f88"></a>Example :<br />
-<div class="outline-text-5" id="text-org8845f88">
+<li><a id="org6cfa3c7"></a>Example :<br />
+<div class="outline-text-5" id="text-org6cfa3c7">
 <p>
-Let the Physical address (Or Effective Address, these two terms are enterchangeable) <b>12345h</b> (the h refers to Hexadecimal, which can also be written like this <b>0x12345</b>), the register <b>DS = 1230h</b> and the register <b>SI = 0045h</b>, the CPU calculates the physical address by multiplying the content of the segment register <b>DS</b> by 10h (or 16) and adding the content of the register <b>SI</b>. so we get : <b>1230h x 10h + 45h = 12345h</b>
+Let the Physical address (Or Effective Address, these two terms are interchangeable) <b>12345h</b> (the h refers to Hexadecimal, which can also be written like this <b>0x12345</b>), the register <b>DS = 1230h</b> and the register <b>SI = 0045h</b>, the CPU calculates the physical address by multiplying the content of the segment register <b>DS</b> by 10h (or 16) and adding the content of the register <b>SI</b>. so we get : <b>1230h x 10h + 45h = 12345h</b>
 </p>
 
 
@@ -66,16 +66,16 @@ Now if you are a clever one ( I know you are, since you are reading this &lt;3 )
 </li>
 </ul>
 </div>
-<div id="outline-container-org16ce372" class="outline-3">
-<h3 id="org16ce372">Registers</h3>
-<div class="outline-text-3" id="text-org16ce372">
+<div id="outline-container-org6b34cdf" class="outline-3">
+<h3 id="org6b34cdf">Registers</h3>
+<div class="outline-text-3" id="text-org6b34cdf">
 <p>
 The 8086 CPU has 14 registers of 16bits of size. From the POV of the user, the 8086 has 3 groups of 4 registers of 16bits. One state register of 9bits and a counting program of 16bits inaccessible to the user (whatever this means).
 </p>
 </div>
-<div id="outline-container-org8d1541d" class="outline-4">
-<h4 id="org8d1541d">General Registers</h4>
-<div class="outline-text-4" id="text-org8d1541d">
+<div id="outline-container-org67926ce" class="outline-4">
+<h4 id="org67926ce">General Registers</h4>
+<div class="outline-text-4" id="text-org67926ce">
 <p>
 General registers contribute to arithmetic&rsquo;s and logic and addressing too.
 </p>
@@ -126,28 +126,28 @@ Now here are the Registers we can find in this section:
 </div>
 </div>
 </div>
-<div id="outline-container-orgd61521c" class="outline-3">
-<h3 id="orgd61521c">Addressing and registers&#x2026;again</h3>
-<div class="outline-text-3" id="text-orgd61521c">
+<div id="outline-container-org824a260" class="outline-3">
+<h3 id="org824a260">Addressing and registers&#x2026;again</h3>
+<div class="outline-text-3" id="text-org824a260">
 </div>
-<div id="outline-container-orgc573bac" class="outline-4">
-<h4 id="orgc573bac">I realized what I wrote here before was almost gibberish, sooo here we go again I guess ?</h4>
-<div class="outline-text-4" id="text-orgc573bac">
+<div id="outline-container-orgaa8f029" class="outline-4">
+<h4 id="orgaa8f029">I realized what I wrote here before was almost gibberish, sooo here we go again I guess ?</h4>
+<div class="outline-text-4" id="text-orgaa8f029">
 <p>
 Well lets take a step back to the notion of effective addresses VS relative ones.
 </p>
 </div>
 </div>
-<div id="outline-container-org83b616a" class="outline-4">
-<h4 id="org83b616a">Effective = 10h x Segment + Offset . Part1</h4>
-<div class="outline-text-4" id="text-org83b616a">
+<div id="outline-container-org85a2533" class="outline-4">
+<h4 id="org85a2533">Effective = 10h x Segment + Offset . Part1</h4>
+<div class="outline-text-4" id="text-org85a2533">
 <p>
 When trying to access a specific memory space, we use this annotation <b>[Segment:Offset]</b>, so for example, and assuming <b>DS = 0100h</b>. We want to write the value <b>0x0005</b> to the memory space defined by the physical address <b>1234h</b>, what do we do ?
 </p>
 </div>
 <ul class="org-ul">
-<li><a id="orga0fd499"></a>Answer :<br />
-<div class="outline-text-5" id="text-orga0fd499">
+<li><a id="orgae0f70c"></a>Answer :<br />
+<div class="outline-text-5" id="text-orgae0f70c">
 <div class="org-src-container">
 <pre class="src src-asm"><span style="color: #89b4fa;">MOV</span> [DS:0234h], 0x0005
 </pre>
@@ -159,7 +159,7 @@ Why ? Let&rsquo;s break it down :
 
 
 
-<div id="orge5d4a33" class="figure">
+<div id="orgd01a20f" class="figure">
 <p><img src="../../src/gifs/lain-dance.gif" alt="lain-dance.gif" />
 </p>
 </div>
@@ -177,9 +177,9 @@ Simple, right ?, now for another example
 </li>
 </ul>
 </div>
-<div id="outline-container-org93b46d0" class="outline-4">
-<h4 id="org93b46d0">Another example :</h4>
-<div class="outline-text-4" id="text-org93b46d0">
+<div id="outline-container-org811633c" class="outline-4">
+<h4 id="org811633c">Another example :</h4>
+<div class="outline-text-4" id="text-org811633c">
 <p>
 What if we now have this instruction ?
 </p>
@@ -192,9 +192,9 @@ What does it do ? You might or might not be surprised that it does the exact sam
 </p>
 </div>
 </div>
-<div id="outline-container-orgcba10b0" class="outline-4">
-<h4 id="orgcba10b0">Segment + Register &lt;3</h4>
-<div class="outline-text-4" id="text-orgcba10b0">
+<div id="outline-container-orge6219c5" class="outline-4">
+<h4 id="orge6219c5">Segment + Register &lt;3</h4>
+<div class="outline-text-4" id="text-orge6219c5">
 <p>
 Consider <b>DS = 0100h</b> and <b>BX = BP = 0234h</b> and this code snippet:
 </p>
@@ -230,8 +230,8 @@ The General rule of thumb is as follows :
 </ul>
 </div>
 <ul class="org-ul">
-<li><a id="orgf6c5f3b"></a>Note<br />
-<div class="outline-text-5" id="text-orgf6c5f3b">
+<li><a id="orga9c3a1b"></a>Note<br />
+<div class="outline-text-5" id="text-orga9c3a1b">
 <p>
 The values of the registers CS DS and SS are automatically initialized by the OS when launching the program. So these segments are implicit. AKA : If we want to access a specific data in memory, we just need to specify its offset. Also you can&rsquo;t write directly into the DS or CS segment registers, so something like
 </p>
@@ -249,7 +249,7 @@ The values of the registers CS DS and SS are automatically initialized by the OS
 </div>
 <div id="postamble" class="status">
 <p class="author">Author: Crystal</p>
-<p class="date">Created: 2024-03-07 Thu 20:55</p>
+<p class="date">Created: 2024-03-17 Sun 21:28</p>
 </div>
 </body>
 </html>