News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Problem initializing a Qword.

Started by Chip, October 14, 2006, 07:12:38 AM

Previous topic - Next topic

Chip

Jeremy,

I am having problems initializing a Qword.

To see if it was my problem, I cut an example
directly out of the Goasm Manual, and pasted it
into my test program.  The results are shown below.

I also received an similar message when I tried to
   
        Mov Q[Test_Value], '00000000'
       
It does not seem critical right now, since I am
sure that I can devise a work around.


Chip


    CODE TO BE COMPILED - (Copied from GoASM Manual)
     
                ;Initialising using character values
                ;You can initialize to character values by putting characters
                ;in quotes, for example:-
               
                Letters DB 'a'
                        DW 'xy'
                Sample  DD 'form'
                ZooDay  DQ 'Saturday'



    COMPILE ERROR MESSAGE
     
                GoAsm.Exe Version 0.55.02 - Copyright Jeremy Gordon 2001/6 - JG@JGnet.co.uk
               
                Error!
                Line 137 of assembler source file (Test.ASM):-
                Quoted string not allowed for DQ/DT data declaration:-
                DQ 'Saturday'
               
                Output file: Test.lst
                OBJ file not made
   


I am on Skype under my email address!

donkey

It appears to be an error in the manual, you cannot initialize a QWORD with a string, by the way I take it you are compiling for 64 bits otherwise you cannot use the MOV instruction for a QWORD, the x86-32 has a maximum size of a DWORD for MOV. GoAsm will encode it as MOV D[label],xxxx (0C7h 005h) which means that the high order DWORD will not be affected. Jeremy, shouldn't this throw an error in 32 bit mode ?

Donkey
"Ahhh, what an awful dream. Ones and zeroes everywhere...[shudder] and I thought I saw a two." -- Bender
"It was just a dream, Bender. There's no such thing as two". -- Fry
-- Futurama

Donkey's Stable

Chip

Donkey,

I trust you are correct about initializing a Qword being
either an error in the manual, or only working in 64bit mode.
I tried the Mov Qword only after getting the compile
error on the initializztion. 

Upon a nanoseconds reflection,  your comment about it
only working in 64bit mode is blindingly obvious. 
(I then spent the remainder of that same second
wondering why I did not think of it!)

Chip    :red
I am on Skype under my email address!

donkey

Hi Chip,

A QWORD cannot be initialized with a string in 64 bit mode either, it must be a numeric value.

Donkey
"Ahhh, what an awful dream. Ones and zeroes everywhere...[shudder] and I thought I saw a two." -- Bender
"It was just a dream, Bender. There's no such thing as two". -- Fry
-- Futurama

Donkey's Stable

jorgon

Unless there are any reasonable objections from GoAsm users, I would propose that strings be permitted when declaring qwords (8 bytes) and indeed twords (10 bytes) for that matter, just like when declaring dwords (4 bytes).  I can't really think of any reason why this ought not to be permitted.

So this would allow:-

DQ 'Saturday'     ;or a shorter string
DT 'Tuesday am'   ;or a shorter string


Shorter strings would be padded with nulls.

Of course the usual way of declaring strings in data would remain

DB 'Wednesday morning'


Yes Donkey I agree there should be an error shown as you say.  I'll work on it at the same time as making the above changes.

Thanks to you both for raising these issues.
Author of the "Go" tools (GoAsm, GoLink, GoRC, GoBug)

jorgon

QuoteUnless there are any reasonable objections from GoAsm users, I would propose that strings be permitted when declaring qwords (8 bytes) and indeed twords (10 bytes) for that matter, just like when declaring dwords (4 bytes).  I can't really think of any reason why this ought not to be permitted.

This is now in GoAsm 0.55.10 available from here.
Author of the "Go" tools (GoAsm, GoLink, GoRC, GoBug)