亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? chap06.html

?? vid寫的FASM向導
?? HTML
?? 第 1 頁 / 共 2 頁
字號:
<html>
<head>
<link href="style.css" rel="stylesheet" type="text/css">
<title>06 TAJGA FASM Tutorial</title>
</head>

<body>

<center><b>CHAPTER 6 - Bit arithmetics</b></center><br><br>


This is what most tutorials usually start with. After reading this you will be
confused, it is normal, you will get this by usage. Return to this chapter
whenever needed. So let's go.<br><br>

<b>6.1. Encoding number in bits</b><br>

You know computer uses "bits", which are variables that can contain one of two
possible values, 0 or 1. When value of bit is 0, we say it is "clear", when it
is 1, we say it is "set"<br><br>

<blockquote class="term">
terms:<br>
<b>bit</b> - variable containing 0 or 1<br>
<b>clear bit</b>  - bit containing 0<br> 
<b>set bit</b> - bit containing 1<br>
</blockquote>

Now how can we store number in such bits. It is similar to storing word in two
bytes (chapter 4.2, reread it). One bit contains value 0 or 1, so number that
consists from only one bit can contain only values 0 and 1. When we add
another bit, we can still store 0 and 1 in first bit, but we have another bit
which now can hold 2*(0 or 1). Then another bit holds 4*(0 or 1), then 8*(0 or
1) etc.<br><br>

Like i said before, byte consists of 8 bits. So it can hold value<br>
<code>1*(0 or 1)+2*(0 or 1)+4*(0 or 1)+8*(0 or 1)+16*(0 or 1)+32*(0
or 1)+64*(0 or 1)+128*(0 or 1)</code> which is value from 0 (when all bits 
are 0) to <code>1+2+4+8+16+32+64+128</code> = 255 (when all bits are
1). See it?<br><br>

It is similar for word, just with 16 bits instead of 8, check it yourself if
you wish.<br><br>

Now some terms: bit which holds 1*(0 or 1) is bit 0, next, which holds 2*(0 or
1) is bit 1, and so until bit 7 which holds 128*(0 or 1). So bits are
enumerated from 0, not from 1 as you would maybe await. bit 0 is called "low
order bit", highest bit (which holds greatest value) is "high order bit". For
example high order bit of some byte value is bit 7, and high order bit of word
value is bit 15.

<blockquote class="term">
terms: <b>low-order bit, high-order bit</b>
</blockquote>

<b>important:</b> bits are enumerated from 0, not from 1, so first bit is bit#0<br><br>

Number encoded this way (in bits) is called "binary number".<br><br><br>

<b>6.2. Binary constants</b><br>

You was using numeric constants before probably without deeper realizing you
are using them. Numeric constants were just numbers you wrote in source file
which were assembled into binary file. Numeric constants are for example "0",
"50", "-100", "123456".<br><br>

You used them here:

<blockquote class="code"><pre>
db <font color=#339933>5</font>
mov al<font color=#333399>,</font><font color=#339933>20</font>
cmp ax<font color=#333399>,</font><font color=#339933>5</font>
db <font color=#bb0000>'Some string'</font><font color=#333399>,</font><font color=#339933>0</font>
org <font color=#339933>256</font>
</pre></blockquote>

These numbers were decimal: ones which are used by (?) normal people.
Assembler then translated them to binary form. But sometimes you want to
specify directly binary numbers. Of course you dont have to hand-translate to
decimal, you can specify them directly binary. Here are some examples of
binary numbers: 0, 101011, 1101011, 11111, etc. To differ them from decimal
numbers, every binary number must end with "b" character, so "0b", "101011b",
"1101011b", "11111b" etc. Here first binary digit (first bit, first 0 or 1) is
high-order bit, last one is low-order bit. So if you write "1101", then bit 0
= 1, bit 1 = 0, bit 2 =1, bit 3 = 1.<br><br>
Example table:

<table align=center width=200 border=0 bgcolor=#7F91EC cellspacing=1 cellpadding=0 class="tut_tab">
<tr align=center><th>decimal</td><th>binary</td>
<tr align=center><td>0 </td><td>    0b</td></tr>
<tr align=center><td>1 </td><td>    1b</td></tr>
<tr align=center><td>2 </td><td>   10b</td></tr>
<tr align=center><td>3 </td><td>   11b</td></tr>
<tr align=center><td>4 </td><td>  100b</td></tr>
<tr align=center><td>5 </td><td>  101b</td></tr>
<tr align=center><td>6 </td><td>  110b</td></tr>
<tr align=center><td>7 </td><td>  111b</td></tr>
<tr align=center><td>10</td><td> 1010b</td></tr>
<tr align=center><td>15</td><td> 1111b</td></tr>
<tr align=center><td>16</td><td>10000b</td></tr>
</table><br>
I could learn you way how to translate number between decimal and binary
forms, but you wont need it now anyway, and all other tutorials are full of
such informations.<br><br>

Binary numeric constants are just another way to express some number. Writing
"5" is same as writing "101b". For example this will work too:

<blockquote class="code"><pre>
org <font color=#339933>100000000b</font>
mov ah<font color=#333399>,</font><font color=#339933>1001b</font>
mov dx<font color=#333399>,</font>string
int <font color=#339933>21h</font>
int <font color=#339933>20h</font>
string db <font color=#bb0000>'Hello world writen using binary constants'</font><font color=#333399>,</font><font color=#339933>0</font>
</pre></blockquote>

<code>org 100000000b</code> is same as <code>org 256</code>, and <code>mov ah,1001b</code>
is same as <code>mov ah,9</code>
<br><br><br>

<b>6.3. Bit operations</b><br>
Now let's think about what we can do with bit (which can hold value 0 or 1).
<br><br>

First, we can "set" it (set it's value to 1) or "clear" it (set it's value to
0). Then we can "flip" it's value (from 0 to 1, from 1 to 0). And that is
probably all. This operation is called "bit complement" too (0 is complement
of 1, 1 is complement of 0)<br><br>

(lack of english math terms here, somebody could help me)<br><br>

Now what we can do with 2 bits? If you think of bits as about boolean values,
which can be either true (1) or false (0). Now what operations can we make
with boolean values? If you programmed before you probably know this.<br><br>

First is <code>and</code> (like "a and b" where "a" and "b" are boolean values
:). When we have two boolean values, result of <code>and</code>ing them is true
only when they are both true, otherwise result if false. (Table will be below)<br><br>

Then comes <code>or</code>. You know, result of <code>or</code>ing two values is
true, when at least one of them is true. And last, least known, is <code>xor</code>,
which means "exclusive or" (the previous one was "inclusive or", but everyone calls it
just "or"). Result of <code>xor</code>ing is 1 when one operand is 1 and other is 0.
<br><br>

Here is the table:<br>
<table align=center width=320 border=0 bgcolor=#7F91EC cellspacing=1 cellpadding=0 class="tut_tab">
<tr align=center><th>A</th><th>B</th><th>A and B</th><th>A or B</th><th>A xor B</th></tr>
<tr align=center><td>0</td><td>0</td><td>   0	</td><td>   0  </td><td>   0   </td></tr>
<tr align=center><td>0</td><td>1</td><td>   0	</td><td>   1  </td><td>   1   </td></tr>
<tr align=center><td>1</td><td>0</td><td>   0	</td><td>   1  </td><td>   1   </td></tr>
<tr align=center><td>1</td><td>1</td><td>   1	</td><td>   1  </td><td>   0   </td></tr>
</table><br>
<b>NOTE:</b> There are 16 possible operations on two bits  but we wont talk
about them all.<br><br>

Now interesting (?) part: In late times, processors designers didnt like
having lot of instructions on their processors. But as you see, we defined 3
operations for single bit and 3 for two bits. So they found (obvious) way to
achieve operations on single bit by using operations on two bits. To remind:
operations on single bit were setting it to 0, setting it to 1 and flipping
it's value (0->1, 1->0). How?<br><br>

First let's talk about clearing bit (setting it's value to 0). Note that
result of <code>and</code> is 0 whenever at least one of operands is 0. So if we
<code>and</code> any bit (0 or 1) with 0 we always get 0, when we <code>and</code>
with 1 bit will reamin unchanged. And this is what we wanted. It is similar with
setting bit (to 1). Result of <code>or</code>ing is 1 when at least one of
operands is 1. So <code>or</code>ing any bit with 1 will always produce 1,
<code>or</code>ing with 0 will leave bit unchanged.<br><br>

How to flip bit? Result of <code>xor</code>ing is 1 when one of operands is 1,
other 0. So <code>xor</code>ing any value with 1 will always produce value's
complement, <code>xor</code>ing with 0 will leave bit unchanged. This one is not
so obvious, so better look at it in table.<br><br><br>

<b>6.4. Binary operation instructions</b><br>

First of all. You know smallest register we have are 8 bit (byte) registers.
Also smallest part of memory we can access is byte (8 bits). For this reason
binary operation instruction we will use will operate on two 8 bit numbers
instead on two bits. What will be result? Bit 0 of result will be result of
operation between bit 0 of first argument and bit 0 of second argument.  Bit
1 of result will be result of operation on bits 1 of argument etc. You 'll
see it.<br><br>

First operation will be "and". Example:

<blockquote class="code"><pre>
mov al<font color=#333399>,</font><font color=#339933>00010001b</font>
mov bl<font color=#333399>,</font><font color=#339933>00000001b</font>
and al<font color=#333399>,</font>bl
</pre></blockquote>

first we load <code>al</code> with 00010001b, so it's bits 0 and 4 contain 1,
other bits contain 0. Then we load <code>bl</code> with 00000001b so it's bit 0
contains 1, other contain 0. Now when we <code>and</code> <code>al</code> with
<code>bl</code> (this is how asm coder usually tells it), it works like some
<code>al = al and bl</code> would eg. result of <code>and</code>ing
<code>al</code> with <code>bl</code> is stored in <code>al</code>.<br><br>

So what is the result (in <code>al</code>)? Bit 0 of <code>al</code> contained
1 and was <code>and</code>ed with 1. "1 and 1" is 1, so bit 0 of <code>al</code>
will be 1. Bits 1 to 2 and 5 to 7 would be "0 and 0" which is 0. Bit 3 would
contain "0 and 1" which is 0 too. Bit 4 will contain "1 and 0" which is 0 again.	So result would be 00000001b.
Better way to write previus code would be

<blockquote class="code"><pre>
mov al<font color=#333399>,</font><font color=#339933>00010001b</font>
and al<font color=#333399>,</font><font color=#339933>00001001b</font>
</pre></blockquote>

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
色婷婷亚洲一区二区三区| 日韩高清中文字幕一区| 国产一区二区三区黄视频 | 国产一区不卡在线| 精品粉嫩超白一线天av| 国产在线一区观看| 中文字幕精品综合| 99久久综合精品| 一区二区三区鲁丝不卡| 欧美日韩高清一区二区三区| 蜜臀av性久久久久蜜臀aⅴ流畅 | 欧美xxxx老人做受| 国产一区二三区好的| 国产女主播在线一区二区| 成人av动漫网站| 亚洲第一精品在线| 日韩你懂的电影在线观看| 国产精品123| 一区二区三区四区av| 5566中文字幕一区二区电影| 国产在线不卡视频| 亚洲免费在线电影| 日韩一区二区影院| 不卡av在线免费观看| 亚洲国产一区二区a毛片| 精品久久久久久无| 91蜜桃传媒精品久久久一区二区| 亚洲国产美女搞黄色| 久久亚洲一区二区三区明星换脸 | 蜜臀久久久99精品久久久久久| 久久综合999| 91福利资源站| 精品一区二区三区在线观看国产| 成人欧美一区二区三区1314| 欧美男人的天堂一二区| 国产精品一线二线三线| 亚洲综合激情另类小说区| 久久亚洲一区二区三区四区| 在线免费观看成人短视频| 国产一区激情在线| 午夜视频在线观看一区二区 | 一区免费观看视频| 4438x亚洲最大成人网| 99在线视频精品| 麻豆91精品视频| 一区二区欧美精品| 中文字幕乱码日本亚洲一区二区| 337p亚洲精品色噜噜| 色综合天天综合狠狠| 国产在线不卡视频| 日韩中文字幕亚洲一区二区va在线 | 久久五月婷婷丁香社区| 欧美亚洲一区二区三区四区| 粉嫩av一区二区三区粉嫩| 日本sm残虐另类| 一区二区欧美国产| 最新日韩在线视频| 国产日产亚洲精品系列| 日韩欧美激情四射| 欧美精品在欧美一区二区少妇| 不卡影院免费观看| 国产传媒久久文化传媒| 久久99精品一区二区三区三区| 亚洲二区视频在线| 一区二区三区波多野结衣在线观看| 国产精品私人自拍| 久久精品免费在线观看| 精品国产欧美一区二区| 日韩视频永久免费| 欧美一级片免费看| 欧美一区二区三区在线看| 欧美三级电影一区| 欧美网站一区二区| 欧美三级在线看| 在线观看日韩高清av| 91久久香蕉国产日韩欧美9色| 91免费在线播放| 91在线免费看| 在线观看日产精品| 欧美性一级生活| 欧美精品日韩一区| 91精品国产手机| 日韩一级片网站| 精品久久久久久无| 欧美激情一区在线| 中文字幕在线不卡一区 | 亚洲欧洲国产日本综合| 国产精品美女视频| 亚洲欧洲综合另类在线| 久久久综合精品| 91久久精品午夜一区二区| 成人动漫中文字幕| 97精品久久久午夜一区二区三区 | 亚洲一区二区三区四区中文字幕| 亚洲免费观看高清完整版在线| 一区二区三区精密机械公司| 亚洲国产美女搞黄色| 免费三级欧美电影| 国产又黄又大久久| av成人免费在线| 欧美中文字幕久久| 欧美一二三四区在线| wwwwww.欧美系列| 中文字幕中文在线不卡住| 亚洲视频网在线直播| 亚洲va在线va天堂| 日韩和的一区二区| 国产成人精品三级| 日本韩国欧美国产| 欧美mv日韩mv国产| 奇米在线7777在线精品| 国产精品一区二区你懂的| 不卡在线观看av| 欧美一区二区三区视频在线观看| 久久亚洲免费视频| 亚洲综合免费观看高清完整版在线| 午夜视黄欧洲亚洲| 国产激情偷乱视频一区二区三区| 色婷婷综合久色| 欧美成人一级视频| 亚洲美女视频在线| 麻豆91在线播放免费| 99国产精品国产精品毛片| 91.xcao| 国产精品久久久久久久午夜片| 亚洲成人动漫在线免费观看| 国产精品一区二区三区网站| 色天天综合久久久久综合片| www一区二区| 婷婷综合久久一区二区三区| 成人午夜电影网站| 日韩欧美在线1卡| 一区二区三区四区在线播放| 国产精品99久久久久久宅男| 欧美人xxxx| 亚洲人成精品久久久久久| 国产一区二区影院| 777午夜精品免费视频| 亚洲欧美另类图片小说| 国产一区二区免费视频| 欧美丰满嫩嫩电影| 一区二区三区在线观看动漫| 成人一区在线看| 欧美大肚乱孕交hd孕妇| 亚洲r级在线视频| 91美女片黄在线观看91美女| 国产欧美一区二区精品性色超碰| 日本成人中文字幕在线视频| 欧美怡红院视频| 国产精品动漫网站| 国产一区二区中文字幕| 777色狠狠一区二区三区| 国产精品无圣光一区二区| 国产一区二区精品久久| 欧美日韩mp4| 中文字幕一区二区视频| 亚洲永久精品国产| 91在线视频免费观看| 久久久久久久久久久黄色| 婷婷丁香久久五月婷婷| 一本大道久久a久久精品综合| 精品国产乱码久久久久久久久| 一区二区三区日本| 国产不卡免费视频| 日韩天堂在线观看| 亚洲一区二区三区四区五区中文 | 国产婷婷精品av在线| 精品在线一区二区三区| 欧美丰满少妇xxxxx高潮对白| 一片黄亚洲嫩模| 成人激情电影免费在线观看| 欧美高清一级片在线观看| 天堂一区二区在线| 在线免费观看日本一区| 一区二区三区欧美在线观看| 在线观看免费视频综合| 中文字幕一区二区三区不卡| 成人午夜视频免费看| 久久精品人人做人人综合 | 国产亚洲欧美中文| 精品系列免费在线观看| 日韩欧美国产一区二区在线播放| 麻豆国产精品一区二区三区 | 国产毛片精品视频| 2023国产精品| 99久久精品国产毛片| 亚洲欧美精品午睡沙发| 99re热这里只有精品免费视频| 成人免费小视频| 97久久精品人人澡人人爽| 亚洲天堂网中文字| 一本高清dvd不卡在线观看| 婷婷六月综合网| 欧美一级免费观看| 久久超级碰视频| 欧美日韩亚洲综合在线 欧美亚洲特黄一级 | 亚洲成av人片一区二区三区| 在线不卡免费欧美| 久久精品国产**网站演员| 日韩免费高清视频|