Author Topic: data error  (Read 10202 times)

Offline zev

  • Jr. Member
  • *
  • Posts: 3
data error
« on: November 11, 2012, 08:00:15 AM »
In section.data, the line: number db 7 dup 0 gives the error message:comma expected after operand 1. But, there is no operand. Why the error message?

Offline Frank Kotler

  • NASM Developer
  • Hero Member
  • *****
  • Posts: 2667
  • Country: us
Re: data error
« Reply #1 on: November 11, 2012, 09:02:29 AM »
Nasm doesn't know "dup" - that's Masm/Tasm/Jwasm syntax. Try:
Code: [Select]
number times 7 db 0
Should give you the same effect.

Best,
Frank


Offline Gunner

  • Jr. Member
  • *
  • Posts: 74
  • Country: us
    • Gunners Software
Re: data error
« Reply #2 on: November 11, 2012, 05:08:25 PM »
you could and should put uninitialized data in the .bss section and do it this way:
Code: [Select]
section .bss
number    resb 7

Offline Bryant Keller

  • Forum Moderator
  • Full Member
  • *****
  • Posts: 360
  • Country: us
    • About Bryant Keller
Re: data error
« Reply #3 on: November 12, 2012, 01:07:15 AM »
you could and should put uninitialized data in the .bss section and do it this way:
Code: [Select]
section .bss
number    resb 7

I'm afraid I don't understand your point here. Zed did initialize the data. That's why he was using the MASM directive dup(0) instead of dup(?).

About Bryant Keller
bkeller@about.me