1 Replies - 684 Views - Last Post: 06 May 2013 - 08:05 AM

#1 domenico  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 89
  • Joined: 21-July 12

[8086] "Define Word" instruction...

Posted 04 May 2013 - 12:54 PM

Hey guys,
I'm just starting to play a little bit with assembly so excuse me if my questions are dumb.

My questions are about this (I'm trying to divide 100 by 5, playing with memory and variables of course!)
Posted Image

Why does the DW (Define Word) instruction is executed like that?
I mean, I understand all of the others line but that in particular is a dark one for me..

Also, can you explain to me why var is instantiated at the address 0010Ah ?
I think it's because the 4 istructions before the instantiation occupy 4*16bits=4*2bytes=8bytes,
and so var is filed on the stack right after.
But shouldn't the instruction be elsewhere? Are they loaded on the stack once the program starts to run?

Bonus question: How can I check the what's on stack in emu8086?

This post has been edited by domenico: 04 May 2013 - 12:59 PM


Is This A Good Question/Topic? 0
  • +

Replies To: [8086] "Define Word" instruction...

#2 skaa  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 3
  • Joined: 28-February 11

Re: [8086] "Define Word" instruction...

Posted 06 May 2013 - 08:05 AM

You declared data inside your source code (that is NOT prohibited). Then compiler converted your source code into executable sequence of bytes.
After this, debugger converted these bytes into commands. It does not know if you used code or data on line 06, so it is trying to convert everything into codes. If it cannot do this, it shows question marks... In your case, var dw 2 and add al,[bx+si] both have the same sequence of bytes in the executable file.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1