flat assembler
Message board for the users of flat assembler.

Index > Main > Files open an work with...

Author
Thread Post new topic Reply to topic
joachim_neu



Joined: 22 Dec 2003
Posts: 139
joachim_neu
hello,

how do you open a file with the name "XYZ.XYZ" and work with it, without DOS-Interrupts???

Joachim Neu
Post 30 Dec 2003, 14:44
View user's profile Send private message Visit poster's website Reply with quote
silkodyssey



Joined: 02 Oct 2003
Posts: 198
Location: St.Vincent & the Grenadines
silkodyssey
If you want to write a windows program you can use the CreateFile function to open a file and ReadFile and WriteFile to read and write to the file. You'll will find more information about these functions in your api reference.

_________________
silkodyssey
Post 30 Dec 2003, 15:19
View user's profile Send private message MSN Messenger Reply with quote
pelaillo
Missing in inaction


Joined: 19 Jun 2003
Posts: 878
Location: Colombia
pelaillo
Hi, joachim_neu
In Linux:
Code:
sys_read       = 0x3
sys_write       = 0x4
sys_open      = 0x5
sys_close      = 0x6

; section data
io_bytes dd ?
filesize   dd ?
filename db  "XYZ.XYZ",0
buffer   rb 10000h ; This must hold the readed bytes 

; section code
        mov  eax,sys_open
        mov  ebx,filename
        mov  ecx,O_RDONLY
        xor   edx,edx
        int    0x80
        mov ebx,eax
        mov  eax,sys_read
        mov  ecx,buffer
        mov  edx,[filesize]
        int    0x80
        mov  eax,sys_close
        int    0x80
    


In Windows:
Code:
        api   CreateFile,filename,GENERIC_READ,0,NULL,\
               OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL
        test  eax,eax
        jz    error_read
        mov   ebx,eax
        api   GetFileSize,ebx,NULL
        mov   [filesize],eax ; to read it all
        api   ReadFile,ebx,buffer,[filesize],io_bytes,NULL
        test  eax,eax
        jz    error_read
        api   CloseHandle,ebx
    
Post 30 Dec 2003, 16:05
View user's profile Send private message Yahoo Messenger Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
if you meant how to do it yourself, without using any kind of library, then answer is: if you don't know how better dont try it. There are too many things you need to know
Post 30 Dec 2003, 19:11
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
comrade



Joined: 16 Jun 2003
Posts: 1137
Location: Russian Federation
comrade
To do it directly, you need to know inner working of a particular filesystem and how to work directly with hard drives.

_________________
comrade (comrade64@live.com; http://comrade.ownz.com/)
Post 30 Dec 2003, 23:02
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger ICQ Number Reply with quote
joachim_neu



Joined: 22 Dec 2003
Posts: 139
joachim_neu
hello,

Oh... That's all very difficult... And I think I should lern ASM better, before I code an OS... What have you got to do without 32Bit??? And what must you do, if you want to change in 32Bit-Mode??? Without some libarys or DOS-Interrupts...

thanks for your answers...

JOACHIM NEU
Post 07 Jan 2004, 13:07
View user's profile Send private message Visit poster's website Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
you should get some protected mode specification (not DPMI spec or VCPI spec, forget about these), also few protected mode coding tutorials (learning from specification is not much fun, i know it), and of course many OS coding tutorials which will come handly when you know something about protected mode. I am not right one to point out best, but there are many who coded OS on this forum.

Also dont forget to ask people who coded MenuetOS to aid you few good tuts.
Post 07 Jan 2004, 19:21
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number 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-2020, Tomasz Grysztar.

Powered by rwasa.