2 Replies - 994 Views - Last Post: 31 March 2018 - 10:44 PM

#1 sunshine33   User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 74
  • Joined: 15-September 17

Some questions about declaring and initializing variables .

Posted 23 September 2017 - 09:30 PM

Quote

The data stored in a memory byte are called its contents

Quote

Variable names such as count1 and count2 represent addresses


So this is actually ,

myvar1     DB 3
anothervar DW 03FAh
someval    DD 721099
repeatvar  DB 7 dup(12,28)
string1    DB 'This is a string'


initialize address called  myvar1        DB 3
initialize address called  anothervar    DW 03FAh
initialize address called  someval       DD 721099
initialize address called  repeatvar     DB 7 dup(12,28)
initialize address called  string1       DB 'This is a string'


Then , what exactly is this ?

Posted Image

memory address 0x45B0F0
memory address 0x489940

??

Is This A Good Question/Topic? 0
  • +

Replies To: Some questions about declaring and initializing variables .

#2 turboscrew   User is offline

  • D.I.C Lover
  • member icon

Reputation: 168
  • View blog
  • Posts: 1,077
  • Joined: 03-April 12

Re: Some questions about declaring and initializing variables .

Posted 04 November 2017 - 10:01 AM

Well, the first part is about assembly "variables". In assembly there are really no variables - only memory locations whose address can be thought of as a "variable name".

The picture shows initialization of higher programming language variables. In languages like C or Ada or ... the local variables are created in stack and their "addresses" are offsets from the SP. Remember that stack usually grows downwards, so adding, say, 16 to SP makes room for 4 32-bit variables: SP+0, SP+4, SP+8 and SP+12 (= SP+0x0C), or SP+4, SP+8, SP+12 and SP+16 if the stack is post-decrementing (SP points to first free) instead of pre-decrementing (SP points to the last used).
Was This Post Helpful? 0
  • +
  • -

#3 sunshine33   User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 74
  • Joined: 15-September 17

Re: Some questions about declaring and initializing variables .

Posted 31 March 2018 - 10:44 PM

Sorry for the late reply , i was busy with my exams

Anyway i collected a few notes from different places and have a little bit more understanding now

Posted Image

I even got an application called reverseme.exe from another forum

I am trying to learn the basics of disassembled code from it .

I used PE explorer and IDA pro to do the disassembly

I hope i can learn a lot from it
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1