flat assembler
Message board for the users of flat assembler.
Index
> DOS > Read / Write to file |
Author |
|
revolution 27 Feb 2010, 03:56
|
|||
27 Feb 2010, 03:56 |
|
adroit 27 Feb 2010, 20:48
Sort of!
Thanks! |
|||
27 Feb 2010, 20:48 |
|
cthug 28 Feb 2010, 11:03
This is more complete and includes other Interrupts: Interrupt Jump Table.
|
|||
28 Feb 2010, 11:03 |
|
edfed 28 Feb 2010, 13:14
to read data from DOS files, i recommend to use this code:
Code: fptr: .off=0 .seg=2 .size=4 DOSread: .call=0 .ptr=4 .name=8 .handle=12 push eax ebx ecx edx edi esi ds mov edi,[esi+.ptr] mov edx,[esi+.name] ; load the asciiz filename pointer mov edx,[edx] mov ax,3d00h ; DOS open file int 21h jc .error ; carry, then error mov [esi+.handle],ax mov bx,ax mov ax,[edi+fptr.seg] mov ds,ax mov dx,[edi+fptr.off] ; at [ds:dx] mov ah,3fh ; will we load mov cx,0ffffh ; ffffh bytes int 21h ; from the file. jc .error ; carry then error pop ds ; restore ds mov [edi+fptr.size],eax ; how long is the file, in bytes mov bx,[esi+.handle] mov ah,3eh ; DOS close file int 21h jc .error @@: pop esi edi edx ecx ebx eax ret .error: mov word[esi+.handle],0 mov eax,0 jmp @b it will open file withhandle, read from handle, and close file. then, multiple file openings/ reopening are possible with a minimal effort. |
|||
28 Feb 2010, 13:14 |
|
adroit 01 Mar 2010, 02:59
Ok. Thanks. I'll test it out and post
|
|||
01 Mar 2010, 02:59 |
|
typedef 17 Aug 2010, 19:56
Just a question. I see people doing this. What does it do, whats its purpose ?
Quote:
|
|||
17 Aug 2010, 19:56 |
|
edfed 17 Aug 2010, 20:34
it is because every registers can be modified in the function.
and it is writen one by one because sometimes, pushes are added or deleted during modifications. and to avoid particular precautions in user code, everything is saved. i hope people answered your question. |
|||
17 Aug 2010, 20:34 |
|
typedef 17 Aug 2010, 20:48
yeah, thanks people.
*thought* Man, people are peoplelish *thought* |
|||
17 Aug 2010, 20:48 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.