Wednesday, August 4, 2010

Memory addressing modes on the 8086/88


School assembly, many beginners on the PC are addressed and not understand, or even difficult to understand. Indeed, this knowledge is very abstract, and require relatively strong spatial imagination. In particular, we in the input string, that is how these characters arranged it? For this problem, I believe that many beginners is difficult to imagine how the arrangement. However, I can metaphor: memory is a lot of buildings, "buildings", "building" the proponents of "unit number", "door number" form, that "building" is equivalent to the memory address of the segment address, "Unit No." equivalent to the offset memory address, "Portal No. (home)" is equivalent to "change address", and each unit has 16 "door number (home)" and then when we find a "gateway number (home) "after entering into a" gateway number (home), "they will see that there will be a" people ", but we are talking about people that register within the meaning of" content ", I draw a diagram to show you will clear up.

D, with the DEBUG command come to this effect:




|----------> 0B1F is "building "------> segment address
|
| |------> The right is the "unit number "---> offset address
| |
| | |--------> This part is the "gateway to No. "-----> change address
| | |<------------------------------------------>|
0B1F: 0100 00 80 FF 02 75 05 C6 46-00 00 C3 E8 8C EB B4 3B
0B1F: 0110 CD 21 72 39 8B FA 33 C0-8B C8 49 26 34 00 0E 0B
''
''
''
[Omitted]

After reading this map, is not very aware of it? But smart people will have doubts, then how do we enter "the portal number (home)" mean? Good question, so the order can be entered " Portal No. (home), "appeared in called" addressing mode "concept! it plainly, is to teach you how to find this" gateway number (home). "Ha ha!

Well now understand? That you will see how I understand the PC's addressing modes (easy to understand):
In this I will only introduce more difficult to understand the:

1: register direct addressing:
You want to: in fact you have stood you are looking for a "gateway number (home)" in front of a direct knock on the door went up on the OK!
Examples: MOV AX, [2000H]
MOV AX, 2000H -> 2000H for storing the operand address unit number of symbols
The above two are not equivalent

2: Register indirect addressing mode:
You want to: you have stood you are looking for a "gateway number (home)" and "unit number", you have to find it, must know it in the current "unit number" several floor. If瀹冨湪6妤?閭d綘灏变笂鍒?妤煎氨OK浜?!娉ㄦ剰,鏈?珮鍙湁16妤?鍥犱负浠?箞鍛?閭e氨鐢―EBUG鐨凞鍛戒护鐪嬬湅鍛?鎱㈡參鏁板摝,鍛靛懙!!
渚嬪瓙: MOV AX,[BX]

璁$畻鍏紡: 鐗╃悊鍦板潃=16d*(DS)+(BX)
鐗╃悊鍦板潃=16d*(DS)+(SI)
鐗╃悊鍦板潃=16d*(DS)+(DI)
鐗╃悊鍦板潃=16d*(SS)+(BP)

3:瀵勫瓨鍣ㄧ浉瀵瑰鍧?柟寮?
浣犲氨鎯虫垚:浣犺鎵剧殑&quot;闂ㄦ埛鍙?瀹?&quot;鍏跺疄灏卞湪浣犲鐨勬ゼ涓婃垨鑰呮ゼ涓?浣犺鎵惧埌瀹?灏?蹇呴』鐭ラ亾瀹冨湪浣犳ゼ涓婂嚑妤?鎴栬?鍦ㄦゼ涓嬪嚑妤?灏監K浜?
渚嬪瓙: MOV AX,COUNT[SI]
MOV AX,[COUNT+SI]
鍏朵腑 COUNT涓轰綅绉婚噺鐨勭鍙峰湴鍧?br />

璁$畻鍏紡: 鐗╃悊鍦板潃=16d*(DS)+(BX)+8浣嶄綅绉婚噺
鎴?(SI) 鎴?16浣嶄綅鍋忕Щ閲?br />鎴?(DI)


鐗╃悊鍦板潃=16d*(SS)+(BP)+8浣嶅亸绉婚噺


4:鍩哄潃鍙樺潃瀵诲潃鏂瑰紡:
浣犲氨鎯虫垚:浣犺鎵剧殑&quot;闂ㄦ埛鍙?瀹?&quot;鏄窡浣忓湪鍚屼竴鏍嬫ゼ鐨勪笉鍚?amp;quot;鍗曞厓鍙?amp;quot;,浣犺鎵惧埌瀹?灏卞繀椤荤煡閬撳畠鏄鏍嬬殑鍝釜&quot;鍗曞厓鍙?amp;quot;,骞朵笖浣忓湪鍑犳ゼ!閭f牱浣犲氨鍙互鎵惧埌瀹冧簡 !
渚嬪瓙: MOV AX,[BX][DI]
MOV AX,[BX+DI]

璁$畻鍏紡: 鐗╃悊鍦板潃=16d*(DS)+(BX)+(SI)
鎴?(DI)
鐗╃悊鍦板潃=16d*(SS)+(BP)+(SI)
鎴?(DI)


5:鐩稿鍩哄潃鍙樺潃瀵诲潃鏂瑰紡:
浣犲氨鎯虫垚:浣犲氨鎯虫垚:浣犺鎵剧殑&quot;闂ㄦ埛鍙?瀹?&quot;鏄窡浣忓湪鍚屼竴鏍嬫ゼ鐨勪笉鍚?amp;quot;鍗曞厓鍙?amp;quot;,瀹冩瘮浣犻珮鍑犲眰妤兼垨鑰呬綆鍑犲眰妤?鐒跺悗鐢ㄧ殑浣犵洰鍓嶇殑妤兼暟+/-灏卞彲浠ュ緱鍑轰綘瑕佹壘鐨勪綇鍦ㄥ嚑妤间簡!
渚嬪瓙: MOV,AX,MASK[BX][SI]
MOV,AX,MASK[BX+SI]
MOV,AX,[MASK+BX+SI]
浠ヤ笂涓変釜渚嬪瓙鏄瓑鏁堢殑!!

璁$畻鍏紡: 鐗╃悊鍦板潃=16d*(DS)+(BX)+(SI)+8浣嶄綅绉婚噺
鎴?(DI) 鎴?16浣嶄綅鍋忕Щ閲?br />鐗╃悊鍦板潃=16d*(SS)+(BP)+(SI)+8浣嶄綅绉婚噺
鎴?(DI) 鎴?16浣嶄綅鍋忕Щ閲?br />-------------------------------------------------- -------------------
鍛靛懙,缁堜簬鍐欏畬浜嗚繖绡囨暀绋?濂界疮鍝?! 鏄笉鏄寰楁垜鐨勬?缁村緢鍙︾被鍛?瑕佸垱鏂板憖!
涔︿笂澶悊璁轰簡,鎴戝氨鍒涙柊涓?釜,涓嶇煡閬撲綘浠湅寰楁噦鍚?
鍛靛懙,鍙嶆浣犱滑涓嶈!@##)(#$*!@(@鎴戝氨琛屼簡,鎴戝緢鍔姏鍐欎簡!!!

涓嬮潰,鎴戜妇涓▼搴忎緥瀛?璁╀綘浠姞娣卞嵃璞?!!

-------------------------------------------------- --------------------
缂栫▼姝ラ:
1: 寤虹珛缂撳啿鍖?涓鸿緭鍏ュ瓧绗︿覆(鏈?鑳借緭鍏?涓?
2: 鍙栫紦鍐插尯鐨勯鍦板潃,浠ヤ究鍚庨潰杩涜&quot;瀵勫瓨鍣ㄩ棿鎺ュ鍧?柟寮?amp;quot;
3: 鍒╃敤&quot;瀵勫瓨鍣ㄩ棿鎺ュ鍧?柟寮?amp;quot;鍙栧緱瀹為檯杈撳叆瀛楃涓暟,浠ヤ究纭寰幆娆℃暟
4: 鍒╃敤&quot;瀵勫瓨鍣ㄩ棿鎺ュ鍧?柟寮?amp;quot;杈撳叆瀛楃涓茬殑鏈?悗涓?釜瀛楃
5: 鍒╃敤LOOP鎸囦护鍜?鍙锋樉绀哄姛鑳芥潵杩涜鍊掔潃鏄剧ず
-------------------------------------------------- --------------------

;绋嬪簭鍔熻兘锛氫换鎰忚緭鍏ュ嚑涓瓧绗?鏈?鑳借緭鍏?涓?锛屾寜鍥炶溅鍒欏?鐫?緭鍑猴紒

data segment
user_string db 10,0,10 dup(?)
data ends
code segment
assume cs:code,ds:data
start: mov ax,data
mov ds, ax
lea dx,user_string ;寤虹珛杈撳叆瀛楃涓茬紦鍐插尯
mov ah,0ah
int 21h
xor si,si
xor bx, bx
mov bx,dx
mov cx,[bx+si+1] ;鐪嬭繖涓氨鏄?amp;quot;瀵勫瓨鍣ㄩ棿鎺ュ鍧?柟寮?amp;quot;
xor ch,ch ;鍏剁洰鐨勫氨鏄彇瀹為檯杈撳叆瀛楃涓暟
mov di,cx
lop: mov ah,2
mov dx,[bx+di+1];鐪嬭繖鍙堟槸&quot;瀵勫瓨鍣ㄩ棿鎺ュ鍧?柟寮?amp;quot;
int 21h ;鍏剁洰鐨勫氨鏄彇杈撳叆瀛楃涓茬殑鏈?悗涓?釜瀛楃
dec di
loop lop ;渚濇寰幆鍊掔潃杈撳嚭瀛楃
mov ah, 4ch
int 21h
code ends
end start

-----------------------------------------------------------------------
5~~~~~~~~~~杩欐鐪熺殑瀹屽伐浜?浣犱滑鏈変粈涔堟剰瑙佸悧?缁欐垜瑙佹剰瑙佸憖!!鎴戝啓寰楀彲鑳戒笉鏄緢濂?!!!!
涓嶈繃,鎴戣繕鏄笇鏈涘緱鍒颁綘浠殑鏀寔浜?!!!!!!






相关链接:



avc-free



Experts advise: The Dragon Boat Festival computers do, "prevention" work



mov video



Contract should pay ATTENTION to what



Clean up your css



Directory Cartoons - Screen Savers



Converter Avi To 3gp



Lists People - Screen Savers



News about Web Or Video Cams



"Torch Light," the game features seven new



National Social Security card can break the ice in the Yangtze River Delta region



Evaluate Calculators And Converters



What is mkv file



C language library function (K class letters)



Charles Zhang: Sohu is looking for the next opponent



No comments:

Post a Comment