国产一级a片免费看高清,亚洲熟女中文字幕在线视频,黄三级高清在线播放,免费黄色视频在线看

打開APP
userphoto
未登錄

開通VIP,暢享免費電子書等14項超值服

開通VIP
Help with memory/addresses in Assembly (Intel x86 + NASM)?

Help with memory/addresses in Assembly (Intel x86 + NASM)?

  • asked 2 months ago  last updated 2 months ago
I'm taking my first Assembly class and the memory addresses/contents stuff is really confusing me. I was hoping someone who knows this stuff well could check my answers for these problems I need to know, and explain how to correct the wrong ones? (My answers will have *** in front of them)

1.) Suppose
si contains 0100h
ax contains 4142h
df = 0
byte 100h contains 10h
byte 101h contains 15h
byte 200h contains 20h
byte 201h contains 25h

Give the source, destination, and value moved for each of the following instructions:


a.) movsb
ANSWERS:
source = ***0100h
dest = ***200h
val moved = ***10h
si = ***15h
di = ***10h

b.) movsb
ANSWERS:
source = ***0100h
dest = ***200h
val moved = ***0010h
si = ***20h
di = ***30h

c.) stosb
ANSWERS:
source = ***al
dest = ***200h
val moved = ***42h
si = ***0100h
di = ***25h

d.) lodsb
ANSWERS:
source = ***0100h
dest = ***al
val moved = ***10h
si = ***15h
di = ***200h

c.) lodsw
ANSWERS:
source = ***0100h
dest = ***ax
val moved = ***0010h
si = ***20h
di = ***200h

:

2.) For each of the following instructions show what happens if:
ax contains 0500h
bx contains 1000h
si contains 1500h
di contains 2000h
[1000h] = 0100h
[1500h] = 0300h
[2000h] = 0600h
[3000h] = 0200h
[4000h] = 0400h
kats is a word variable whose offset address is 1000h

ANSWERS:
a.) mov di, si
***di now = 1500h

b.) mov ax, [si]
***ax now = 0300h

c.) lea si, [bx+kats]
***si now = 1100h (?)

d.) mov [si], [di]
***Illegal: Cannot perform memory to memory moves

e.) mov ah, [bx]
***Illegal: Cannot move 16 bits into 8 bits

f.) mov dh, [si]
***Illegal: Cannot move 16 bits into 8 bits

g.) mov cx, [bx+di+kats]
***cx now = 0800h (?)

Thanks for your time, I really appreciate it.
Answer
Follow
Watchlist





Best AnswerAsker's Choice

1. The value of di is missing. Is it 200h?

a) movsb
src = 100h
dst = 200h
value = 10h

c) stosb
src = al
dst = 200h
value = 42h

d)
src = 100h
dst = al
value = 10h

e) lodsw
src = 100h
dst = ax
value = 1510h

2.
a) correct
b) correct
c) nope. lea computes the effective address in the source operand but instead of reading the value from it assigns it to the destination register. The address of [bx + kats] is 2000h.
d) correct.
e) Nope. The size of the address (bx) is not related to the size of the value. mov ah, cx would be illegal because ah is 8-bit and cx is 16-bit.
f) Same here.
g) bx + di + kats = 1000h + 2000h + 1000h = 4000h, [4000h] is 400h therefore cx would be 0800h.

Asker's rating & comment

Thank you so much for your response! You helped me out a lot, I did have a few follow up questions, if you don't mind?
(And yes, di = 200h)

For each of question 1.), it asks for the new contents of di and si, I get those wrong as well?

I didn't see b.) in the response, accidental overlook?
  • 1
  • Comment

Other Answers (1)

Alex answered 2 months ago
You should try with debug.exe

It is not included anymore (MSDOS), but you can use FreeDOS from a USB drive or in a virtual machine. Some Windows versions can run it in command line.

Assembler is really hard and pain to do this exercize. I would not know correctly and I wrote assembler complete programs some kilobytes

Really actually using it is the only way to know correctly.

It is irrelevant if
***Illegal: Cannot move 16 bits into 8 bits

is illegal because it is a limit of x86 and not something worth to memorize. Download the AMD reference manuals or the IA32 Intel manuals as PDF and look at the MMX data shuffling- this is where it ends. Would you like to memorize it?

I tell you because I spent too much time with assembler on microcontrollers and now I regret it. You should learn C language as soon as possible.

Maybe if you have or can get an old laptop, install MSDOS or FreeDOS on it if you plan to learn assembler. I'd not recommend it for a start, maybe later if you mastered C.

C is also very close to assembler, but one remarkable thing, it gets rid of the particular limits of the instruction set- can't do this, can't do that, must shuffle registers all the time and stuff.
  • Rate
  • Comment
本站僅提供存儲服務(wù),所有內(nèi)容均由用戶發(fā)布,如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請點擊舉報
打開APP,閱讀全文并永久保存 查看更多類似文章
猜你喜歡
類似文章
計算機(jī)等級考試三級PC上級題精選41-50
Dwing寫的471字節(jié)俄羅斯方塊(teris)匯編程序源代碼
七種尋址方式(立即尋址、寄存器尋址)
80X86匯編語言程序設(shè)計教程(楊季文)習(xí)題答案二
匯編語言實現(xiàn)在80*25彩色字符模式下顯示字符串
學(xué)習(xí)之道 【分享】匯編學(xué)習(xí)筆記 [論壇存檔] - 看雪軟件安全論壇
更多類似文章 >>
生活服務(wù)
分享 收藏 導(dǎo)長圖 關(guān)注 下載文章
綁定賬號成功
后續(xù)可登錄賬號暢享VIP特權(quán)!
如果VIP功能使用有故障,
可點擊這里聯(lián)系客服!

聯(lián)系客服