flat assembler
Message board for the users of flat assembler.

Index > OS Construction > virtual

Author
Thread Post new topic Reply to topic
GhostXoPCorp



Joined: 13 Dec 2008
Posts: 199
Location: 01F0:0100
GhostXoPCorp 03 Jan 2010, 23:39
im very sorry for disturbing everyone with a rather noob question, i haev looked at this in the manual over and over again, i guess im not getting it through to my mind to my head correctly, or i dont know what it does, with a tutorial i am looking at a great person gave me, had virtual in it, and i wud rly like it if anyone here cud be generous enough to tel me wat exactly virtual does, and maybe an example. if so thank u so very much

_________________
Oh that divide overflow. Just jumps out of the bushes every time to scare the day lights out of me.
Post 03 Jan 2010, 23:39
View user's profile Send private message Reply with quote
Coddy41



Joined: 18 Jan 2009
Posts: 384
Location: Ohio, USA
Coddy41 04 Jan 2010, 00:16
virtual? do you meen virtual8086? or do you meen this? http://en.wikipedia.org/wiki/Virtual_%28computing%29 Or something I have never heard of?

Any details? maybe copy and paste a paragraph out of manual? define "virtual" there are may terms :/

_________________
Want hosting for free for your asm project? You can PM me. (*.fasm4u.net)
Post 04 Jan 2010, 00:16
View user's profile Send private message Visit poster's website Reply with quote
GhostXoPCorp



Joined: 13 Dec 2008
Posts: 199
Location: 01F0:0100
GhostXoPCorp 04 Jan 2010, 00:17
virtual as in

virtual at bx
LDT_limit dw ?
LDT_address dd ?
end virtual
i have a feeling it defines the two variables with in bx?
Post 04 Jan 2010, 00:17
View user's profile Send private message Reply with quote
Coddy41



Joined: 18 Jan 2009
Posts: 384
Location: Ohio, USA
Coddy41 04 Jan 2010, 00:56
Well if you go here, http://flatassembler.net/docs.php?article=manual
you will find this:
Quote:

virtual defines virtual data at specified address. This data won't be
included in the output file, but labels defined there can be used in other
parts of source. This directive can be followed by at operator and the
numerical expression specifying the address for virtual data, otherwise is
uses current address, the same as virtual at $. Instructions defining data
are expected in next lines, ended with end virtual directive. The block of
virtual instructions itself is an independent addressing space, after it's
ended, the context of previous addressing space is restored.


Basicly... IF I understand it correctly... if you use something like this
Code:
virtual at bx
LDT_limit dw ?
LDT_address dd ?
end virtual 
    

Then if we use code that needs those values, They are already defined, but the code up there is not included in the binary its self.

You may want to wait for someone that knows more about in than me.

_________________
Want hosting for free for your asm project? You can PM me. (*.fasm4u.net)
Post 04 Jan 2010, 00:56
View user's profile Send private message Visit poster's website Reply with quote
GhostXoPCorp



Joined: 13 Dec 2008
Posts: 199
Location: 01F0:0100
GhostXoPCorp 04 Jan 2010, 03:03
lol no offense, but why did u post?? lol im kiddin, thanks anyway. good luck with your pmode os

_________________
Oh that divide overflow. Just jumps out of the bushes every time to scare the day lights out of me.
Post 04 Jan 2010, 03:03
View user's profile Send private message Reply with quote
dosin



Joined: 24 Aug 2007
Posts: 337
dosin 04 Jan 2010, 05:54
Quote:
with a tutorial i am looking at a great person gave me, had virtual in it


Is this tutorial writen in masm,fasm,nasm,C/C++,java,C# or any other language?


do you have an example of how they used it?

I have not used in fasm.. but according to the manual.
can be used as a union :
A Union is like a structure, except that each
element shares the same memory

or in your example the values assigned to LDT_limit dw ? and
LDT_address dd ?

will be treated as: mov ax,[bx] when its assembled..!

So when its assembled and runs across:
mov ax,[LDT_limit]
instead of pointing/fetching the value at its location in memory were the value is stored..
Fasm will assign bx the value/s every time u use [LDT_limit] in the defined virtual function...
creating a virtual address for the value/s defined...

in the case of an ldt and limit...
The address of the ldt followed by the limit are both loaded into bx


or at least thats what I get from it...


Last edited by dosin on 04 Jan 2010, 07:37; edited 2 times in total
Post 04 Jan 2010, 05:54
View user's profile Send private message Reply with quote
GhostXoPCorp



Joined: 13 Dec 2008
Posts: 199
Location: 01F0:0100
GhostXoPCorp 04 Jan 2010, 06:39
thats what i thought as well, thank u very much

_________________
Oh that divide overflow. Just jumps out of the bushes every time to scare the day lights out of me.
Post 04 Jan 2010, 06:39
View user's profile Send private message Reply with quote
sinsi



Joined: 10 Aug 2007
Posts: 790
Location: Adelaide
sinsi 04 Jan 2010, 07:07
If you use 'virtual at ebx' then fasm will assume that ebx is a valid pointer, since it gets treated as '[ebx+something]'.
Post 04 Jan 2010, 07:07
View user's profile Send private message Reply with quote
Tyler



Joined: 19 Nov 2009
Posts: 1216
Location: NC, USA
Tyler 04 Jan 2010, 23:46
I got this from one of the 512 os comps, says it's by Privalov. Anyway, it uses "virtual", I have no idea how virtual works but here it is.


Description: Whoever Privalov is, he's really good.
Download
Filename: TETROS.ASM
Filesize: 4.11 KB
Downloaded: 227 Time(s)

Post 04 Jan 2010, 23:46
View user's profile Send private message Reply with quote
LocoDelAssembly
Your code has a bug


Joined: 06 May 2005
Posts: 4624
Location: Argentina
LocoDelAssembly 05 Jan 2010, 00:03
Quote:

Whoever Privalov is, he's really good.

Indeed he is, he probably is best known as the fasm author Very Happy
Post 05 Jan 2010, 00:03
View user's profile Send private message Reply with quote
Tyler



Joined: 19 Nov 2009
Posts: 1216
Location: NC, USA
Tyler 05 Jan 2010, 00:21
Quote:

Indeed he is, he probably is best known as the fasm author

Wait, there's more than one author of Fasm(not that I would be surprised, it's a huge, complicated project)? Or, is Privalov Thomasz' alias?
Post 05 Jan 2010, 00:21
View user's profile Send private message Reply with quote
LocoDelAssembly
Your code has a bug


Joined: 06 May 2005
Posts: 4624
Location: Argentina
LocoDelAssembly 05 Jan 2010, 00:26
Its Tomasz's nick, although I'm not sure if he is still using it.
Post 05 Jan 2010, 00:26
View user's profile Send private message Reply with quote
Borsuc



Joined: 29 Dec 2005
Posts: 2465
Location: Bucharest, Romania
Borsuc 05 Jan 2010, 17:21
virtual makes an address space at the value specified by "at".
virtual is used ONLY to define FASM constants, it does NOT put any code or data in the output, that's why it's called virtual.

example:

Code:
virtual at 5
  db '6'
  somelabel:
end virtual    


somelabel would be equal to 6, since '6' takes 1 byte. The code above is equal to:

Code:
somelabel = 6    


you know how "org" works right? Virtual is the same thing except that everything inside it gets scrapped and is not output... only FASM constants survive.

i.e
Code:
org 5
db '6'
somelabel:    
would be similar except that the byte '6' will be output to the file...

it does, however, put the data you define in a temporary virtual block -- you can use "load" and "store" with it, but after 'end virtual' the data gets scrapped. and only the FASM constants survive.
Post 05 Jan 2010, 17:21
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-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.