Assembly x86 Understanding Define Word (DF) instruction -
i'm starting play little bit assembly excuse me if questions dumb.
my questions (i'm trying divide 100 5, playing memory , variables of course!)
why dw (define word) instruction executed that? mean, understand of others line in particular dark 1 me..
also, can explain me why var instantiated @ address 0010ah ? think it's because 4 istructions before instantiation occupy 4*16bits=4*2bytes=8bytes, , var filed on stack right after. shouldn't instruction elsewhere? loaded on stack once program starts run?
bonus question: how can check what's on stack in emu8086?
because using assembler, not compiler. literally translating mnemonics , data flat binary file (or more commonly, headers included ie pe).
dw
quite literally "declaring word". it's placing $0200
@ place in code. if look @ handy table, can see opcode
add r8, r/m8
while i'm not going go whole opcode structure , disassembly, you'll see [r]
meaning has modrm byte following opcode. here's handy table shows meaning of modrm byte. can see $00
[bx+si]
.
assembling whole instruction,
add ax, [ax+si]
(we ax 0 in reg2
bits - ax
first register indexed, cx
2nd, dx
3rd, bx
4th, etc). here's simple table docs in assembler:
modrm: 0 0 0 0 0 0 0 0 | | | | |___| |_| | | reg1 mod |___| (r/m) reg2
ie: op reg2, reg1
this went little in depth, understand using assembler, not compiler, , little bit instruction encoding. things may little off (i'm used 32bit).
this reason executable formats have sections data , code, or in 16bit segments "isolated" each. in flat binary can have data section @ end or in blank areas jmp on it/between called functions.
Comments
Post a Comment