 |
MESSAGE BOARD
|
| View previous topic :: View next topic |
| Author |
Message |
newbie Member
Joined: 02 Jan 2004 Posts: 5
|
Posted: 30/04/04 10:47 Post subject: How to I/O in ASSEMBLER |
|
|
Hello everybody,
I NEED your help. I want to translate delphi codes below to ASSEMBLY language.
1. The procedure to extract embedded files
-------
procedure ExtractFile;
var RS : TResourceStream;
begin
RS := TResourceStream.Create(HInstance, 'group', 'file');
try
RS.SaveToFile('FilePath');
finally
RS.Free;
end;
end;
2. The procedure to write a text file
------
procedure SaveFile;
var mytext : TextFile;
begin
AssignFile(mytext, 'FilePath');
Rewrite(mytext);
WriteLn(mytext, 'line1');
WriteLn(mytext, 'line2');
CloseFile(mytext);
end;
------
I'm Expecting Your Reply. Thank You In Advanced. |
|
| Back to top |
|
 |
newbie Member
Joined: 02 Jan 2004 Posts: 5
|
Posted: 30/04/04 10:52 Post subject: an example |
|
|
I have the program below but I don't know how to use it in Delphi envirnment
; The program creates a file "Test.txt" and writes "Some text"
; in it. Creation takes place in the current directory.
org 100h
start:
mov ah,3Ch ; create file
xor cx,cx ; sets the file attribute
lea dx,file ; gets the file name
int 21h
mov ax,3d02h ; open file read/write
lea dx,file ; gets the file name
int 21h
mov handle,ax
mov ah,40h ; write to file
mov bx,handle
mov cx,9 ; text len
lea dx,text ; text adress
int 21h
mov ah,3Eh ; close file
mov bx,handle
int 21h
ret
file db 'Test.txt',0 ; file name
handle dw 0
text db 'Some text' ; text to be written in the file
end |
|
| Back to top |
|
 |
Kambiz Administrator

Joined: 07 Mar 2003 Posts: 386 Location: Tehran, Iran
|
Posted: 01/05/04 07:30 Post subject: |
|
|
The assembly code above uses a DOS function (INT 21), and is obsolete.
If you are going to create a file on Windows, I do recommend to follow Delphi/Windows rules. |
|
| Back to top |
|
 |
|
|
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 2.0.6 © 2001, 2002 phpBB Group
|