Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Error : Expecting scalar type

edenunicornedenunicorn Member Posts: 4
[b][red]This message was edited by edenunicorn at 2005-7-1 4:13:26[/red][/b][hr]
[b][red]This message was edited by edenunicorn at 2005-7-1 4:8:24[/red][/b][hr]
[b][red]This message was edited by edenunicorn at 2005-7-1 4:6:19[/red][/b][hr]
I understand that in the data segment the declaration of variable take place and the ecpecting type of initialize is const and not other variable why?
an example:

data segment
var1 db 5
var2 db var1
data ends

why the compiler do not let me compile this assembly code in 16 bit mode ?
my conflict is that the compiler (assembler) could asked from the operation system which can take the value of var1 and put it in the var2 value in the exe file.

i need the deepest expaination you could give.
thankS in advanced
from eden.






Comments

  • AsmGuru62AsmGuru62 Member Posts: 6,519
    [blue]If you need to have a setup-variable and then only change it and all code changes which using it - use the EQU directive:
    [code]
    VARIABLE equ 5

    .data
    something db VARIABLE
    [/code]

    [/blue]
  • edenunicornedenunicorn Member Posts: 4
    [b][red]This message was edited by edenunicorn at 2005-7-1 8:2:31[/red][/b][hr]
    first of all thank you for your answer.
    and the next thing i asked is that i need to understand why?
    in 32 bit envairment it is works,
    in the 16 bit it does not.
    why the compiler does not let me do so?

    thanks again from eden




    : [blue]If you need to have a setup-variable and then only change it and all code changes which using it - use the EQU directive:
    : [code]
    : VARIABLE equ 5
    :
    : .data
    : something db VARIABLE
    : [/code]
    :
    : [/blue]
    :



  • shaolin007shaolin007 Member Posts: 1,018
    : [b][red]This message was edited by edenunicorn at 2005-7-1 4:13:26[/red][/b][hr]
    : [b][red]This message was edited by edenunicorn at 2005-7-1 4:8:24[/red][/b][hr]
    : [b][red]This message was edited by edenunicorn at 2005-7-1 4:6:19[/red][/b][hr]
    : I understand that in the data segment the declaration of variable take place and the ecpecting type of initialize is const and not other variable why?
    : an example:
    :
    : data segment
    : var1 db 5
    : var2 db var1
    : data ends
    :
    : why the compiler do not let me compile this assembly code in 16 bit mode ?
    : my conflict is that the compiler (assembler) could asked from the operation system which can take the value of var1 and put it in the var2 value in the exe file.
    :
    : i need the deepest expaination you could give.
    : thankS in advanced
    : from eden.
    :
    :
    :
    :
    :
    :
    :
    [green]
    I don't know your assembler but you might be defining var2 to a pointer to var1 with a byte which is not possible. See if there is a define pointer type for you compiler and then define var2 to point to var1.
    [/green]

  • edenunicornedenunicorn Member Posts: 4

    thanks a lot for your answer.
    your answer helps me a lot.
    if you can help me with the following question i will thank you again.

    why in c compiler can't i compile the following code.?

    int a=5;
    int b=a;
    void main(){}

    why the compiler did not compile this code in 16 bit mode ?
    it could do so.

    thank you in advanced from eden.
    : :
    : :
    : [green]
    : I don't know your assembler but you might be defining var2 to a pointer to var1 with a byte which is not possible. See if there is a define pointer type for you compiler and then define var2 to point to var1.
    : [/green]
    :
    :

  • shaolin007shaolin007 Member Posts: 1,018
    :
    : thanks a lot for your answer.
    : your answer helps me a lot.
    : if you can help me with the following question i will thank you again.
    :
    : why in c compiler can't i compile the following code.?
    :
    : int a=5;
    : int b=a;
    : void main(){}
    :
    : why the compiler did not compile this code in 16 bit mode ?
    : it could do so.
    :
    : thank you in advanced from eden.
    : : :
    : : :
    : : [green]
    : : I don't know your assembler but you might be defining var2 to a pointer to var1 with a byte which is not possible. See if there is a define pointer type for you compiler and then define var2 to point to var1.
    : : [/green]
    : :
    : :
    :
    :
    [green]
    If it's just a 32bit compiler then it won't generate 16bit code.
    [/green]

  • edenunicornedenunicorn Member Posts: 4
    : :
    : : thanks a lot for your answer.
    : : your answer helps me a lot.
    : : if you can help me with the following question i will thank you again.
    : :
    : : why in c compiler can't i compile the following code.?
    : :
    : : int a=5;
    : : int b=a;
    : : void main(){}
    : :
    : : why the compiler did not compile this code in 16 bit mode ?
    : : it could do so.
    : :
    : : thank you in advanced from eden.
    : : : :
    : : : :
    : : : [green]
    : : : I don't know your assembler but you might be defining var2 to a pointer to var1 with a byte which is not possible. See if there is a define pointer type for you compiler and then define var2 to point to var1.
    : : : [/green]
    : : :
    : : :
    : :
    : :
    : [green]
    : If it's just a 32bit compiler then it won't generate 16bit code.
    : [/green]
    :
    :
    thank you again :)
Sign In or Register to comment.