MASM can not support QWORD ?

Programming, for all ages and all languages.
ru2aqare
Member
Member
Posts: 342
Joined: Fri Jul 11, 2008 5:15 am
Location: Hungary

Re: MASM can not support QWORD ?

Post by ru2aqare »

david wrote:Code:

The error line is "lgdt qword ptr cs:[bx]".

I tried ml 8.0, It also has the error.

how to solve it ?
Use

Code: Select all

lgdt fword ptr cs:[bx]
The point is the fword modifier. Using qword won't work, because the GDTR is not quad-word sized, its six bytes. The x64 version of masm however doesn't need the fword modifier for lgdt, if I remember correctly.
User avatar
david
Member
Member
Posts: 93
Joined: Tue Aug 21, 2007 4:22 am
Location: Beijing.China
Contact:

Re: MASM can not support QWORD ?

Post by david »

It's OK, thank you! =D>
Microsoft Macro Assembler Reference
FWORD

Allocates and optionally initializes 6 bytes of storage for each initializer.

[[name]] FWORD initializer [[, initializer]]... Remarks
Also can be used as a type specifier anywhere a type is legal.
Microsoft Macro Assembler Reference
DF

Can be used to define data such as FWORD.
Just For Fun
tantrikwizard
Member
Member
Posts: 153
Joined: Sun Jan 07, 2007 9:40 am
Contact:

Re: MASM can not support QWORD ?

Post by tantrikwizard »

FYI, MASM cannot be used for OS development, its in the license agreement (or was last time I checked).

Check out JWASM http://www.japheth.de/JWasm.html it's a side project of the Open Watcom's assembler and I believe there are plans to integrate it into the standard OW source tree. JWASM kicks MASM's butt.
User avatar
Love4Boobies
Member
Member
Posts: 2111
Joined: Fri Mar 07, 2008 5:36 pm
Location: Bucharest, Romania

Re: MASM can not support QWORD ?

Post by Love4Boobies »

tantrikwizard wrote:FYI, MASM cannot be used for OS development, its in the license agreement (or was last time I checked).
That's what poor ol' Troy Martin was trying to explain until he finally had to quit... :P
"Computers in the future may weigh no more than 1.5 tons.", Popular Mechanics (1949)
[ Project UDI ]
User avatar
JAAman
Member
Member
Posts: 879
Joined: Wed Oct 27, 2004 11:00 pm
Location: WA

Re: MASM can not support QWORD ?

Post by JAAman »

tantrikwizard wrote:FYI, MASM cannot be used for OS development, its in the license agreement (or was last time I checked).
...

ok, i think its time to set the record straight on the oft-quoted misconseption...

it is a violation of the license to use masm32 to develop an OS (or any software for non-microsoft OSs)
it is not a violation of the license to use masm to develop an OS (or any software for non-microsoft OSs)

this comes from the fact that people think masm and masm32 are related (they arnt)

masm == the microsoft macro assembler -- since this is created by MS, it would be a major violation of policy to have any such restriction on it -- however (at least for the stand-alone version) you are not allowed to create commercial software with it or use it to disassemble itself (those are the only 2 restrictions for its use)

masm32 -- a non-microsoft masm-compatable assembler whose license doesnt permit any use other than developing win32 programs (although commercial use is allowed, OSdev and software development for non-MS OSs is explicitly forbidden)


i highly recommend the practice of looking it up before making such claims (although you admitted you didnt know for certain yourself, many others specifically claim otherwise...)
User avatar
Creature
Member
Member
Posts: 548
Joined: Sat Dec 27, 2008 2:34 pm
Location: Belgium

Re: MASM can not support QWORD ?

Post by Creature »

I guess he's just not getting the point. Even though you can write your own OS and not distribute it so nobody knows you're making it illegally with MASM, you won't be able to EVER show your OS to ANYONE on these forums or distribute it to your friends. So suppose after 5 years, you've made a Windows clone (hardly unlikely) and you want to show your friends or us the hard work you've been doing, too bad, cause that's against the license. Maybe you should try to find an assembler that supports MASM's syntax (even closer than NASM) but doesn't prevent you from writing an OS with it. If you don't want to run an external tool all the time, create your own build rule or use YASM's built-in Visual Studio plugin.
When the chance of succeeding is 99%, there is still a 50% chance of that success happening.
User avatar
JAAman
Member
Member
Posts: 879
Joined: Wed Oct 27, 2004 11:00 pm
Location: WA

Re: MASM can not support QWORD ?

Post by JAAman »

ummm...


there is nothing in the masm license which prevents its use for writing operating systems...

is that a little clearer for you??
ru2aqare
Member
Member
Posts: 342
Joined: Fri Jul 11, 2008 5:15 am
Location: Hungary

Re: MASM can not support QWORD ?

Post by ru2aqare »

JAAman wrote:ummm...


there is nothing in the masm license which prevents its use for writing operating systems...

is that a little clearer for you??
I have to agree. Most people think that the MS macro assembler is the same thing as masm32 - but they aren't. Masm32 is some additional code, libraries and whatnot bundled with the assembler. It's eared towards Win32 application programming. It's licence doesn't permit you to use it for OS development. However, my university participates in this MSDNAA program, so I got the whole VisualStudio 2003 (and later versions, 2005 and 2008) for free, and it actually comes with the MS assembler. And (as far as I can remember) there is nothing in the VS licence which forbids you to use the assembler for OS development.

As for the original question, masm (and it's 64-bit version, ml64) does support the qword qualifier. Just not with the lgdt, lidt and lldt instructions - they require fword (or I think no qualifiers in the case of ml64).
User avatar
david
Member
Member
Posts: 93
Joined: Tue Aug 21, 2007 4:22 am
Location: Beijing.China
Contact:

Re: MASM can not support QWORD ?

Post by david »

http://msdn.microsoft.com/en-us/library ... S.80).aspx
Microsoft Macro Assembler Reference
MASM for x64 (ml64.exe)

ml64.exe is the assembler that accepts x64 assembly language. For information on ml64.exe compiler options, see ML and ML64 Command-Line Reference.

Inline ASM is not supported for x64. Use MASM or compiler intrinsics (x64 Intrinsics).

The two workarounds are separate assembly with MASM (which supports x64 fully) and compiler intrinsics. We’ve added a lot of intrinsics to allow customers to make use of special-function instructions (e.g. privileged, bit scan/test, interlocked, etc…) in as close to cross-platform a manner as possible.

32-Bit Address Mode (Address Size Override)
MASM will emit the 0x67 address size override if a memory operand includes 32-bit registers. For example, the following examples cause the address size override to be emitted:

mov rax, QWORD PTR [ecx]
mov eax, DWORD PTR [ecx*2+r10d]
mov eax, DWORD PTR [ecx*2+r10d+0100h]
prefetch [eax]
movnti rax, QWORD PTR [r8d]MASM assumes that if a 32-bit displacement appears alone as a memory operand, 64-bit addressing is intended. There is currently no support for 32-bit addressing with such operands.

Finally, mixing register sizes within a memory operand, as demonstrated in the following code, will generate an error.

mov eax, DWORD PTR [rcx*2+r10d]
mov eax, DWORD PTR [ecx*2+r10+0100h]
but I don't have time to try it.
Just For Fun
exkor
Member
Member
Posts: 111
Joined: Wed May 23, 2007 9:38 pm

Re: MASM can not support QWORD ?

Post by exkor »

Troy Martin wrote:
david wrote:and my own os doesn't need to support MASM. I use it in windows.
/facepalm
That's not the point, the point is it's illegal to write an OS or stuff for another OS with MASM. .
Dont forget that if there is nobody to enforce that, then everything is legal especially for hobby OSes and as temporary solution.
User avatar
AJ
Member
Member
Posts: 2646
Joined: Sun Oct 22, 2006 7:01 am
Location: Devon, UK
Contact:

Re: MASM can not support QWORD ?

Post by AJ »

exkor wrote:if there is nobody to enforce that, then everything is legal especially for hobby OSes and as temporary solution.
I don't know about the specific MASM(32) license, but from a legal point of view, that sounds wrong to me. Just because no-one chooses to enforce something now, doesn't mean they won't in the future. It sounds like saying "murder is legal if nobody catches me" - which I hope most people here would disagree with ;)

Also, although I haven't read the MASM licence, I'm sure it won't have any clause saying "but it's alright for hobby OSes or temporary use..."

Cheers,
Adam
User avatar
JAAman
Member
Member
Posts: 879
Joined: Wed Oct 27, 2004 11:00 pm
Location: WA

Re: MASM can not support QWORD ?

Post by JAAman »

Also, although I haven't read the MASM licence, I'm sure it won't have any clause saying "but it's alright for hobby OSes or temporary use..."
your right, there is no clause saying that... but there is nothing saying you cant either... at all... for anyone

the license for the stand-alone masm (as downloaded from the MS website) is very short, and has no restrictions on use for OSdev, as long as its not commercial (and the one built into VS would be subject to the same restrictions as the rest of VS, which also has no such restrictions)
DeletedAccount
Member
Member
Posts: 566
Joined: Tue Jun 20, 2006 9:17 am

Re: MASM can not support QWORD ?

Post by DeletedAccount »

Hi,
If I am not mistaken masm32 is just an sdk and masm is the assembler [ :) ] that drives masm32 , i guess . I am not therefore really clear about the license.I am not really not sure of license , I am not a lawyer , just go to the bin folder of masm32 and type ml [ :) ] . But I seriously doubt that Microsoft will be concerned with someone doing thier hobby os in masm32 or masm .

Regards
Shrek
User avatar
david
Member
Member
Posts: 93
Joined: Tue Aug 21, 2007 4:22 am
Location: Beijing.China
Contact:

Re: MASM can not support QWORD ?

Post by david »

In fact, I don't think you will be the next microsoft even though your os is as same as windows, so I don't think microsoft cares that.
Just For Fun
User avatar
AndrewAPrice
Member
Member
Posts: 2299
Joined: Mon Jun 05, 2006 11:00 pm
Location: USA (and Australia)

Re: MASM can not support QWORD ?

Post by AndrewAPrice »

Shrek wrote:But I seriously doubt that Microsoft will be concerned with someone doing thier hobby os in masm32 or masm.
Contact them, you never know. I'm sure the masm team will be happy to help you. Don't be scared of a company by it's size, it's still split into small teams made up of programmers (and other professions) like you and me who are passionate about what they are doing.

If you find a bug in their software, have any suggestions for improvements, or you have code which does not build successfully, the masm team would love to hear from you.
My OS is Perception.
Post Reply