flat assembler
Message board for the users of flat assembler.
 Home   FAQ   Search   Register 
 Profile   Log in to check your private messages   Log in 
flat assembler > Main > help me is about fasm public command error.

Author
Thread Post new topic Reply to topic
kerr



Joined: 24 Feb 2016
Posts: 124
help me is about fasm public command error.

Code:

main:
           public data
data label byte




use fasm compile to public data show error.

public data

processed:public data
error:illegal instruction

i see to fasm.pdf books , public command use is public main .

_________________
I hope we will be good friends.
Post 09 May 2017, 03:55
View user's profile Send private message Reply with quote
kerr



Joined: 24 Feb 2016
Posts: 124
no friends help me ?
Post 10 May 2017, 07:41
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 15233
Location: 1I/ʻOumuamua
'data' is a reserved word. And 'public' is only available with linkable formats.
Post 10 May 2017, 10:44
View user's profile Send private message Visit poster's website Reply with quote
kerr



Joined: 24 Feb 2016
Posts: 124

revolution wrote:
'data' is a reserved word. And 'public' is only available with linkable formats.



I don't know.if 'data' is a reserved word.
But I use udata or datas label show error.



Code:

public udata
label udata byte 





this code is error.
I don't know is why.

_________________
I hope we will be good friends.
Post 11 May 2017, 01:36
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 15233
Location: 1I/ʻOumuamua
'public' is only available with linkable formats. You have to define a format that is linkable.

Code:
format ELF ;or COFF, or something that is linkable.

Post 11 May 2017, 02:10
View user's profile Send private message Visit poster's website Reply with quote
kerr



Joined: 24 Feb 2016
Posts: 124

revolution wrote:
'public' is only available with linkable formats. You have to define a format that is linkable.

Code:
format ELF ;or COFF, or something that is linkable.




oh
friend but I use is error.
this is masm syntax.

Code:

        PUBLIC uData
uData   LABEL   BYTE
                                                
                                                
Sec9            EQU     BYTE PTR uData+0        
BiosLow         EQU     WORD PTR uData+11
BiosHigh        EQU     WORD PTR uData+13
CurTrk          EQU     WORD PTR uData+15
CurSec          EQU     BYTE PTR uData+17
DirLow          EQU     WORD PTR uData+18
DirHigh         EQU     WORD PTR uData+20




I want with fasm to compile it . But fasm compile to show error.

_________________
I hope we will be good friends.
Post 11 May 2017, 03:01
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 15233
Location: 1I/ʻOumuamua
You have to use 'format'. Without it you just get the default binary format which doesn't support 'public'.
Post 11 May 2017, 03:16
View user's profile Send private message Visit poster's website Reply with quote
kerr



Joined: 24 Feb 2016
Posts: 124

revolution wrote:
You have to use 'format'. Without it you just get the default binary format which doesn't support 'public'.



how to do ?

I use format binary .
Sec9 EQU BYTE uData+0
mov di,Sec9

display error: operand sizes do not match.

_________________
I hope we will be good friends.
Post 11 May 2017, 04:17
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 15233
Location: 1I/ʻOumuamua
DI is a 16-bit register. You can't load a byte into DI. fasm is showing you the correct error.

Are you trying to load the address or the value?

Code:
mov di,[address;load the value stored at address
mov di,address ;load the address

Post 11 May 2017, 04:21
View user's profile Send private message Visit poster's website Reply with quote
kerr



Joined: 24 Feb 2016
Posts: 124

revolution wrote:
DI is a 16-bit register. You can't load a byte into DI. fasm is showing you the correct error.

Are you trying to load the address or the value?

Code:
mov di,[address;load the value stored at address
mov di,address ;load the address




No friend.
Your understand error.

code is sec9 equ byte uData+0.

mov di,[sec9] is mov di,[ byte uData+0] this is error.

sec9 = 0x0000+0

mov di, sec9 is move offset address sec9 to di.


i want load the address

_________________
I hope we will be good friends.
Post 11 May 2017, 05:12
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 15233
Location: 1I/ʻOumuamua
You shouldn't have the 'byte ptr"

Code:
Sec9            EQU     uData+0

You,might also consider using a structure.

Code:
struc uData {
        .Sec9           rb 11
        .BiosLow        rw 1
        .BiosHigh       rw 1
        .CurTrk         rw 1
        .CurSec         rb 1
        .DirLow         rw 1
        .DirHigh        rw 1
}
uData uData

mov di,uData
mov al,[di+uData.Sec9]

Post 11 May 2017, 07:08
View user's profile Send private message Visit poster's website Reply with quote
kerr



Joined: 24 Feb 2016
Posts: 124

revolution wrote:
You shouldn't have the 'byte ptr"

Code:
Sec9            EQU     uData+0

You,might also consider using a structure.

Code:
struc uData {
        .Sec9           rb 11
        .BiosLow        rw 1
        .BiosHigh       rw 1
        .CurTrk         rw 1
        .CurSec         rb 1
        .DirLow         rw 1
        .DirHigh        rw 1
}
uData uData

mov di,uData
mov al,[di+uData.Sec9]




useing a structure?
the structure can't do data.
Because 'label udata byte' defined void udata label , so useing structure I don't know data Whether right?

_________________
I hope we will be good friends.
Post 11 May 2017, 08:16
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 15233
Location: 1I/ʻOumuamua
Try this with the structure:

Code:
mov ax,[di+uData.Sec9]

You will get an error: operand sizes do not match.
Post 11 May 2017, 08:59
View user's profile Send private message Visit poster's website Reply with quote
kerr



Joined: 24 Feb 2016
Posts: 124

revolution wrote:
Try this with the structure:

Code:
mov ax,[di+uData.Sec9]

You will get an error: operand sizes do not match.



Ok .

thank you!

_________________
I hope we will be good friends.
Post 12 May 2017, 04:35
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


Powered by phpBB © 2001-2005 phpBB Group.

Main index   Download   Documentation   Examples   Message board
Copyright © 2004-2016, Tomasz Grysztar.