Author Topic: label in section .data  (Read 10723 times)

Offline jdubya

  • Jr. Member
  • *
  • Posts: 7
label in section .data
« on: November 22, 2013, 06:13:12 PM »
Can someone explain this label to me?  It's in an example and I've never seen one declared like this.  Thanks.

var:  dd 2D,1

Offline Frank Kotler

  • NASM Developer
  • Hero Member
  • *****
  • Posts: 2667
  • Country: us
Re: label in section .data
« Reply #1 on: November 22, 2013, 06:26:17 PM »
I don't think I've seen one quite like that, either. It defines two dwords, 2 (decimal) and 1 (also decimal). Seems like "overkill" to me.

Best,
Frank


Offline encryptor256

  • Full Member
  • **
  • Posts: 250
  • Country: lv
  • Win64 .
    • On Youtube: encryptor256
Re: label in section .data
« Reply #2 on: November 22, 2013, 06:54:26 PM »
Hi!

Confirm, it works:

Code: [Select]

      cmp dword [var],dword 2
      je .equal
; was equal

It makes sense, define vars by numerical system:
Code: [Select]
var1: dd 10o; Octal 10 equals 8 Decimal
var2: dd 08h; Hex
var3: dd 08d; Decimal
var4: dd 1000b; Binary

Compare:
Code: [Select]

      cmp dword [var1],dword 8
      je .equal
; was equal

Bye, Encryptor!
Encryptor256's Investigation \ Research Department.

Offline Frank Kotler

  • NASM Developer
  • Hero Member
  • *****
  • Posts: 2667
  • Country: us
Re: label in section .data
« Reply #3 on: November 22, 2013, 07:02:10 PM »
Yeah... we can also use uppercase 'O' to indicate octal. Anyone who does so deserves the confusion they will get!

Best,
Frank


Offline encryptor256

  • Full Member
  • **
  • Posts: 250
  • Country: lv
  • Win64 .
    • On Youtube: encryptor256
Re: label in section .data
« Reply #4 on: November 22, 2013, 07:04:59 PM »
Yeah... we can also use uppercase 'O' to indicate octal. Anyone who does so deserves the confusion they will get!

Best,
Frank

No tag:
var1: dd 10O; Octal 10 equals 8 Decimal

Code tag:
Code: [Select]
var1: dd 10O; Octal 10 equals 8 Decimal

Yeah, Frank! :D
Encryptor256's Investigation \ Research Department.