The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: ninjarider on August 03, 2007, 03:07:14 PM

Title: question about org
Post by: ninjarider on August 03, 2007, 03:07:14 PM
going through the help files for masm i found that i can take and use org $+300 to add 300 bytes in a perticular section. is there any way to say that if i want a code section to be 1000 bytes to do somthing like org 1000-$. or is there anyways to do that.
Title: Re: question about org
Post by: MichaelW on August 03, 2007, 03:48:09 PM
If you had a label at the start of the section, and assuming the label was L0 and you were trying to pad the section to 1000 bytes, then you could do something like this:

org 1000+L0

And the section would be padded with nulls.
Title: Re: question about org
Post by: Vortex on August 03, 2007, 04:58:43 PM
Generally, the ORG statement is used in .COM files to specify the offset of the first instruction :

http://webster.cs.ucr.edu/Page_TechDocs/MASMDoc/ProgrammersGuide/Chap_03.htm
Title: Re: question about org
Post by: BogdanOntanu on August 03, 2007, 05:25:07 PM


You can use the ORG directive to set the location counter in the current segment.
You can move the location counter forward or backward in the current segment.

format is : ORG "expression"

Where "expression" has to be:
- an constant
- and offset from an symbol in current segment
- and offset from the current location counter

"expression" can NOT be a forward reference symbol (a symbol not yet defined at the time of ORG)