NO

Author Topic: fatal arror: Must be used inside a section  (Read 3724 times)

jin_yeugh

  • Guest
fatal arror: Must be used inside a section
« on: December 21, 2011, 04:26:37 AM »
I am very new to programming and am trying out super-simple instructions to get my feet wet.  I wrote what I thought was fine code and received the error message "Must be used in a section."  Will you please help me solve this error?
My code is:

ORG   0000H

MOV   A, #0AFH
MOV   R3, #09H
ADD   A, R3
END

Offline Bitbeisser

  • Global Moderator
  • Member
  • *****
  • Posts: 772
Re: fatal arror: Must be used inside a section
« Reply #1 on: December 21, 2011, 07:38:35 AM »
That code snippet as you present it doesn't make any sense at all.

For one, the ORG instruction doesn't make any sense for common programs, certainly not for any thing Windows related.

The error message is due to the fact that your program has "no structure". You would need at least a ".CODE" section, if not a ".DATA" section as well.

Furthermore, A and R3 aren't any valid registers or defined memory locations.

If you are programing in assembler, you have to be very conscious about what you are doing. You have much more problems than the error message itself.

What exactly is it that you're trying to achieve?
You say that you are new to programming, well, in that case it might not be a good thing starting with assembly language in a somewhat Windows specific assembler that itself is part of a Windows centric C compiler....
Instead of "getting your feet wet", you are jumping straight into the deep end of the pool and are likely to dtown before you realize what went wrong...  ;)

Ralf
« Last Edit: December 21, 2011, 08:02:07 AM by Bitbeisser »