MASM can not support QWORD ?

Programming, for all ages and all languages.
User avatar
david
Member
Member
Posts: 93
Joined: Tue Aug 21, 2007 4:22 am
Location: Beijing.China
Contact:

MASM can not support QWORD ?

Post by david »

Code:
......
GDTR DQ 02000h
......
mov bx, offset cs:GDTR
lgdt qword ptr cs:[bx]
then I masm it
I:\SVN\OS\Loader>masm Loader.asm
Microsoft (R) MASM Compatibility Driver
Copyright (C) Microsoft Corp 1993. All rights reserved.

Invoking: ML.EXE /I. /Zm /c /Ta Loader.asm

Microsoft (R) Macro Assembler Version 6.11
Copyright (C) Microsoft Corp 1981-1993. All rights reserved.

Assembling: Loader.asm
Loader.asm(240): error A2024: invalid operand size for instruction
The error line is "lgdt qword ptr cs:[bx]".

I tried ml 8.0, It also has the error.

how to solve it ?
Just For Fun
User avatar
Troy Martin
Member
Member
Posts: 1686
Joined: Fri Apr 18, 2008 4:40 pm
Location: Langley, Vancouver, BC, Canada
Contact:

Re: MASM can not support QWORD ?

Post by Troy Martin »

Try MASM32. And developing OSes is against the MASM license, by the way.
Image
Image
Solar wrote:It keeps stunning me how friendly we - as a community - are towards people who start programming "their first OS" who don't even have a solid understanding of pointers, their compiler, or how a OS is structured.
I wish I could add more tex
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 »

I think each tool can develop OS.

I am also want to using GAS, but I don't use it before.

I have used MASM a year and half, I am good at it.

so..
Just For Fun
User avatar
Troy Martin
Member
Member
Posts: 1686
Joined: Fri Apr 18, 2008 4:40 pm
Location: Langley, Vancouver, BC, Canada
Contact:

Re: MASM can not support QWORD ?

Post by Troy Martin »

Against license =/= inability
MASM and MASM32 license wrote:You cannot use the MASM32 Project to write software for Non-Microsoft Operating Systems.
An operating system you wrote is not an M$ operating system. Therefore, it is against the license.
Image
Image
Solar wrote:It keeps stunning me how friendly we - as a community - are towards people who start programming "their first OS" who don't even have a solid understanding of pointers, their compiler, or how a OS is structured.
I wish I could add more tex
JohnnyTheDon
Member
Member
Posts: 524
Joined: Sun Nov 09, 2008 2:55 am
Location: Pennsylvania, USA

Re: MASM can not support QWORD ?

Post by JohnnyTheDon »

Code: Select all

lgdt qword ptr cs:[bx]
Have you tried:

Code: Select all

lgdt cs:[bx]
I'm not sure if lgdt allows explicit segments, but I'm pretty sure it doesn't allow you to say the GDTR is a qword, since it isn't. Look at the wiki for GDT, it shows that the GDTR is 6 bytes (or 10 bytes for x64). You don't need a operand size prefix.
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 »

to Troy Martin :

I don't care that.

my OS is just for fun, not for bussiness.

and my own os doesn't need to support MASM.

I just use it in windows.
Just For Fun
User avatar
Troy Martin
Member
Member
Posts: 1686
Joined: Fri Apr 18, 2008 4:40 pm
Location: Langley, Vancouver, BC, Canada
Contact:

Re: MASM can not support QWORD ?

Post by Troy Martin »

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. Get NASM, it's got a similar syntax AND is portable.

Or FASM, which is written in assembly so it's even easier to port to an asm OS.
Image
Image
Solar wrote:It keeps stunning me how friendly we - as a community - are towards people who start programming "their first OS" who don't even have a solid understanding of pointers, their compiler, or how a OS is structured.
I wish I could add more tex
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 »

to JohnnyTheDon :
I have tried it before.

Assembling: Loader.asm
Loader.asm(240): error A2023: instruction operand must have size
Just For Fun
JohnnyTheDon
Member
Member
Posts: 524
Joined: Sun Nov 09, 2008 2:55 am
Location: Pennsylvania, USA

Re: MASM can not support QWORD ?

Post by JohnnyTheDon »

try

Code: Select all

mov bx, cs
mov cx, ds
mov ds, bx
lgdt [ax]
mov ds, cx
That way you don't need cs: . lgdt implies ds, that may be your problem.

Do you really need to load the GDTR from a register? If this is start up code, why can't you just use the label of the GDT.
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 »


Assembling: Loader.asm
Loader.asm(240): error A2031: must be index or base register
you can not use [AX],

we can only use [BX] [SI] [DI] [BP].
Just For Fun
JohnnyTheDon
Member
Member
Posts: 524
Joined: Sun Nov 09, 2008 2:55 am
Location: Pennsylvania, USA

Re: MASM can not support QWORD ?

Post by JohnnyTheDon »

okay, then just switch around the registers:

Code: Select all

mov ax, cs
mov cx, ds
mov ds, ax
lgdt [bx]
mov ds, cx
Use bx to hold the address of the GDTR.
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 »

Assembling: Loader.asm
Loader.asm(240): error A2023: instruction operand must have size
Just For Fun
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 »

maybe I should read the book again.
Just For Fun
JohnnyTheDon
Member
Member
Posts: 524
Joined: Sun Nov 09, 2008 2:55 am
Location: Pennsylvania, USA

Re: MASM can not support QWORD ?

Post by JohnnyTheDon »

Just get NASM. It is easier, many tutorials use it, and it doesn't result in Microsoft taking all your money and internal organs.
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 »

I used NASM a little before, but I am familiar with MASM more than NASM.

I guess microsoft uses MASM to develop Windows, they can do, I think I can do, but a little difficult.
Just For Fun
Post Reply