3 Replies - 4093 Views - Last Post: 23 October 2011 - 03:20 PM

#1 TechDee   User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 70
  • Joined: 21-May 10

How to use a symbolic constants and an array that uses the constants

Posted 22 October 2011 - 01:22 PM

How to use a symbolic constants and an array that uses the constants as initializer to display the symbol expression

mon equ 1 ; this is my symbolic constant mon

.data

array1 byte ?  ; initialize array

.code
main PROC
mov eax,0

mov eax,array1


Is This A Good Question/Topic? 0
  • +

Replies To: How to use a symbolic constants and an array that uses the constants

#2 GunnerInc   User is offline

  • "Hurry up and wait"
  • member icon




Reputation: 917
  • View blog
  • Posts: 2,358
  • Joined: 28-March 11

Re: How to use a symbolic constants and an array that uses the constants

Posted 22 October 2011 - 03:08 PM

Seriously? Do you read any tuts/docs/books/listen to professor? This is covered in probably the 1st few pages of any introduction to assembly.

Take your pick:
    mov		eax, offset array1
    mov		byte ptr [eax], mon


    xor		eax, eax
    mov		eax, offset array1
    mov		al, mon


you could also use
	lea		eax, array1

instead of
    mov		eax, offset array1

This post has been edited by GunnerInc: 22 October 2011 - 03:09 PM

Was This Post Helpful? 0
  • +
  • -

#3 TechDee   User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 70
  • Joined: 21-May 10

Re: How to use a symbolic constants and an array that uses the constants

Posted 23 October 2011 - 02:45 PM

View PostGunnerInc, on 22 October 2011 - 03:08 PM, said:

Seriously? Do you read any tuts/docs/books/listen to professor? This is covered in probably the 1st few pages of any introduction to assembly.

Take your pick:
    mov		eax, offset array1
    mov		byte ptr [eax], mon


    xor		eax, eax
    mov		eax, offset array1
    mov		al, mon


you could also use
	lea		eax, array1

instead of
    mov		eax, offset array1

thanks for the tips... but listen yes... but the language is bad
Was This Post Helpful? 0
  • +
  • -

#4 GunnerInc   User is offline

  • "Hurry up and wait"
  • member icon




Reputation: 917
  • View blog
  • Posts: 2,358
  • Joined: 28-March 11

Re: How to use a symbolic constants and an array that uses the constants

Posted 23 October 2011 - 03:20 PM

The language is not bad, it is simple. You are dealing directly with the cpu, so if you want something done, it might take a few "instructions" to do it.

You have to tell the cpu the address of the array you want to work with hence, offset and lea (load effective address)
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1