flat assembler
Message board for the users of flat assembler.

flat assembler > Main > structures

Author
Thread Post new topic Reply to topic
Ralph



Joined: 04 Oct 2003
Posts: 86
Hey,
This is possibly a dumb question to ask, but I haven't been able to find an answer myself. I'm trying to use structures in my code, but I keep getting errors. For example, right now I'm struggling with this:
Code:
STRUC InterruptDscr ID1,ID2,ID3,ID4 {
      .Offset0_15   DW ID1  ;low word of int offset
      .Selector0_15 DW ID2  ;segment selector
      .NullByte     DB      ;unused
      .Flags        DB ID3  ;flags
      .Offset16_31  DW ID4  ;high word of int offset
}

IDTInt00 InterruptDscr 10000,8,0F1h,1
    

When I try to assemble that I get:
IDTInt00 InterruptDscr 10000,8,0F1h,1
error: illegal instruction.

I've been able to use other structures in the same manner, so I really have no idea what I'm doing wrong.
Post 08 Oct 2003, 20:57
View user's profile Send private message Reply with quote
Dunduk



Joined: 08 Sep 2003
Posts: 38
Location: Russia
Hi
Ralph wrote:

Code:
When I try to assemble that I get:
       IDTInt00 InterruptDscr 10000,8,0F1h,1
error: illegal instruction.
    


Hmmm, and I get:
Code:
    .NullByte     DB   ;unused
error: invalid argument.
    

I think you have to define so many arguments as many structure members. It works. Or maybe you have to write your own macro struc. How do do this I don't know... But wizard Privalov do, I believe Wink
Post 09 Oct 2003, 02:55
View user's profile Send private message Reply with quote
Ralph



Joined: 04 Oct 2003
Posts: 86
Thanks, that worked. Now I have a second question though. Does fasm have a HIGH/LOW directive similar to tasm? To be more specific, I need to store the high word of a dword address using DW, as in:
Code:
Label:
;code

Blah DW Label HIGH16
Blah DW Label LOW16
    

Any ideas?
Post 09 Oct 2003, 03:41
View user's profile Send private message Reply with quote
Dunduk



Joined: 08 Sep 2003
Posts: 38
Location: Russia
Ralph wrote:
Thanks, that worked. Now I have a second question though. Does fasm have a HIGH/LOW directive similar to tasm? To be more specific, I need to store the high word of a dword address using DW, as in:
Code:
Label:
;code

Blah DW Label HIGH16
Blah DW Label LOW16
    

Any ideas?

Maybe you should use "virtual"?
Try this:
Code:
Blah dd ?
virtual at Blah
  LOW16  dw ?
  HIDH16 dw ?
end virtual
    

Something like this if I understand right. It would work I think. It is from fasm documentation... And I didn't work with tasm (shame on me Embarassed )
Post 09 Oct 2003, 04:43
View user's profile Send private message Reply with quote
scientica
Retired moderator


Joined: 16 Jun 2003
Posts: 689
Location: Linköping, Sweden
Dunduk wrote:
Hmmm, and I get:
Code:
    .NullByte     DB   ;unused
error: invalid argument.
    

Put a ? after the db, and that error should be killing the error.

Code:
STRUC InterruptDscr ID1,ID2,ID3,ID4 {
      .Offset0_15   DW ID1  ;low word of int offset
      .Selector0_15 DW ID2  ;segment selector
      .NullByte     DB ?    ;unused
      .Flags        DB ID3  ;flags
      .Offset16_31  DW ID4  ;high word of int offset
}
IDTInt00 InterruptDscr 10000,8,0F1h,1 
    

_________________
... a professor saying: "use this proprietary software to learn computer science" is the same as English professor handing you a copy of Shakespeare and saying: "use this book to learn Shakespeare without opening the book itself.
- Bradley Kuhn
Post 09 Oct 2003, 06:20
View user's profile Send private message Visit poster's website MSN Messenger ICQ Number Reply with quote
Dunduk



Joined: 08 Sep 2003
Posts: 38
Location: Russia
scientica wrote:

Put a ? after the db, and that error should be killing the error.

Oh, sure! I must upgrade my brains again...
Post 09 Oct 2003, 08:09
View user's profile Send private message Reply with quote
Ralph



Joined: 04 Oct 2003
Posts: 86
Thanks for the responses. I got working.
Post 09 Oct 2003, 23:31
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2019, Tomasz Grysztar.

Powered by rwasa.