File Operations in Assembly Language - Mark's Blog
File Operations in Assembly Language - Mark's Blog
Mark's blog
The art of electronic witchcraft
C : \ > d e b u g a0 1 0 0 x x x x : 0 1 0 0m o va h , 3 9 x x x x : 0 1 0 2m o vd x , 0 1 0 c x x x x : 0 1 0 5i n t2 1 x x x x : 0 1 0 7m o va x , 4 c 0 0 x x x x : 0 1 0 Ai n t2 1 x x x x : 0 1 0 Cd b" C : \ N e w F o l d e r 1 " , 0 0 x x x x : 0 1 1 A nm a k e f . c o m rc x C X0 0 0 0 : 0 0 1 a w W r i t i n g0 0 1 Ab y t e s . q ; C r e a t ef o l d e rf u n c . ; P o i n t st op a t h n a m e ; D oi t ; A H = E x i t ,A L = E r r o r l e v e l ; D oi t ; N u l lt e r m i n a t e dp a t h n a m e
Home About
Remove Folder
Create/Truncate File
C : \ > d e b u g a0 1 0 0 x x x x : 0 1 0 0m o va h , 3 c x x x x : 0 1 0 2m o vc x , 2 x x x x : 0 1 0 5m o vd x , 0 1 0 f x x x x : 0 1 0 8i n t2 1 x x x x : 0 1 0 Am o va x , 4 c 0 0 ; C r e a t ef i l ef u n c . ; A r c h i v ef i l ea t t r i b u t e ; P o i n t st of i l e n a m e ; D oi t
jakash3.wordpress.com/2010/02/20/file-operations-in-assembly-language/
1/11
19/11/13
Note: File attributes are specified by the hex value of a bit array.
+ + + + + + + + + |?|?|?|0|0|?|0|0| + + + + + + + + +
0 Read Only 1 Hidden 2 System 3 Volume label (ignored) 4 Reserved, must be zero (directory) 5 Archive 6 Unused 7 Unused A Read-Only Archive file: 10000100 In hex that would be: 84 So 84 would be the value for CX in the 3C function of Int 21. Open File
+ + + + + + + + + |?|?|?|0|0|0|0|0| + + + + + + + + +
000 Read Only (mov cl,0) 001 Write Only (mov cl,20) 010 Read/Write (mov cl,40)
jakash3.wordpress.com/2010/02/20/file-operations-in-assembly-language/ 2/11
19/11/13
After the interrupt call, AX should contain the file handle if no errors occurred. Close File
Write to file:
x x x x : 0 1 2 Bm o vd x , 0 1 0 2; P o i n t st of i l e n a m e
jakash3.wordpress.com/2010/02/20/file-operations-in-assembly-language/
3/11
19/11/13
x x x x : 0 1 3 2m o va x , 4 0 0 0; W r i t et oF i l ef u n c t i o n x x x x : 0 1 3 5m o vd x , 0 1 1 a; P o i n t st od a t at ow r i t e x x x x : 0 1 3 8m o vc x , 0 d x x x x : 0 1 3 Ai n t2 1 x x x x : 0 1 3 Fi n t2 1 x x x x : 0 1 4 0 rc x C X0 0 0 0 : 0 0 4 0 nw f i l e . c o m w W r i t i n g0 0 4 0b y t e s . q ; N u m b e ro fb y t e st ow r i t e ; D oi t ; D oi t
x x x x : 0 1 3 Cm o va x , 4 c 0 0; E x i tf u n c t i o n
Delete file:
Facebook 7
Like
Be the first to like this.
Related Locks In "Coding" Another simple HTTP server In "C/C++" Getting file descriptor type In "C/C++"
Posted on February 20, 2010 by jakash3. This entry was posted in Assembly, Coding and tagged assembly file, cmd, cmd debug, cmd.exe debug, cmd.exe debug.exe, command prompt debug.exe, debug mode example, debug tut, debug tutorial, debug.exe, debug.exe assembler, debug.exe tutorial, file operations in assembly, jakash3. Bookmark the permalink.
Programming Software
jakash3.wordpress.com/2010/02/20/file-operations-in-assembly-language/
4/11