Author Topic: %define issues... Not sure what is going on  (Read 7076 times)

Offline azagaros

  • Jr. Member
  • *
  • Posts: 14
%define issues... Not sure what is going on
« on: June 05, 2018, 04:03:30 PM »
Code: [Select]
%define foo 0x0001 ;curious if this is generating a string token and not a integer...
%define boo 0x0002 ;I am expecting something similar to a c-style #define but documents are unclear..
boo equ 0x0001;  this gave the same results...

These two lines should define a symbol with an integer value.   The issue is when trying to use it in simple instructions, like:
Code: [Select]
;...
and r8, foo  ; this line gives me a syntax error..
;....
« Last Edit: June 05, 2018, 04:12:59 PM by azagaros »

Offline Frank Kotler

  • NASM Developer
  • Hero Member
  • *****
  • Posts: 2667
  • Country: us
Re: %define issues... Not sure what is going on
« Reply #1 on: June 05, 2018, 06:32:47 PM »
Hi azagaros,

Welcome to the Forum.

I can not duplicate this error. "%define" does generate text... which is duplicated where you use it. "equ" creates an integer... which is duplicated where you use it. Both work for me. Check carefully what you've done, and get back to us if you still have a problem.

Best,
Frank


Offline azagaros

  • Jr. Member
  • *
  • Posts: 14
Re: %define issues... Not sure what is going on
« Reply #2 on: June 05, 2018, 06:49:26 PM »
Thank you for the reply.  Version 2.13.03 on Fedora.  I usually have one commented out   I am using scite as my editer

Code: [Select]
section .data
foo equ 0x0001
bar equ ox0002
nFlags dw 0x0000

; theoretically from what have read
section .text
and [nflags], foo  error: operation size not specified
; or
mov r8, [nFlags]
and r8, foo  error: operation size not specified
 

this code by what you said should work.  I am trying to figure out what the syntax error is or means.  It is acting like I have type mismatch or something.  I am not sure what I am doing wrong.
« Last Edit: June 05, 2018, 07:12:55 PM by azagaros »

Offline Frank Kotler

  • NASM Developer
  • Hero Member
  • *****
  • Posts: 2667
  • Country: us
Re: %define issues... Not sure what is going on
« Reply #3 on: June 05, 2018, 07:45:54 PM »
Hmmm... Nasm (same version) has a problem with lower case 'f' in "nflags" and then complains about "size not specified". You define "nFlags" as 16 bit, which is not right but is not your problem. It does tell me that you didn't try exactly what you posted...

I'm not familiar with "scite". Possible that it's saving as something other than ascii text? This is a problem with some Windows editors - probably not here, but might be worth checking?

Nasm is case sensitive, and nFlags probably wants to be dq... but I don't think either of these is your problem. It "should" work.

Best,
Frank