Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Assembly Language > All is right !
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 17 Topic 4954 of 5072
Post > Topic >>

All is right !

by "almas" <almes@[EMAIL PROTECTED] > Apr 14, 2008 at 11:40 PM

Hello.
I ofen need help... but, this day, i built a COm alone.
The aim : Open a file,  modify bytes, write it in an other file.
Now, i just write 256 bytes, just for test.
Next step :  modify particular Ascii.
Then use largers files.
Below, my usefull code.
If you have betters methods, , sure i will apprecate.
Best Regards  Almas

mov ax, 3D12h
mov dx, offset input
int 21h
mov offset handle1, ax
mov bx, [offset handle1]   ; A86  need this syntax !
mov ah, 3Fh
mov cx,100h               ; read 256 Bytes
mov dx, offset address    ; buffer
int 21h
cmp ax,0                   ; End of File ?
ja continue
int 20h
continue:
mov cx,ax               ; Nbr of bytes  usefull if less than 256
mov offset size_byte, ax       ; rescue the size
mov si, offset address  ; change bytes in buffer
mloop:
add byte [si],20h
inc si                         ; modify here...
loop mloop
jmp short do_it

creat_fil:
mov ah,3Ch
mov dx,offset output
xor cx,cx                   ; attrib
int 21h
do_it:
mov ax,3D01h            ;  Open for Write
mov dx, offset output
int 21h
jb creat_fil             ; if not exist
mov offset handle2,ax
mov bx, [offset handle2]
mov ax,4202h
xor cx,cx
xor dx,dx      ; BX keeps same value
int 21h
; mov dx,ax              ;  size, give an offset
xor dx,dx          ; begin a byte 0
mov ax,4200h
xor cx,cx
int 21h
mov ah,40h
mov cx, [offset size_byte]
mov dx, offset address
int 21h
mov ah,3Eh
int 21h                 ; BX keep value Handle2

mov bx, [offset handle1]   ;  close first file
mov ah, 3Eh
int 21h
int 20h
; data -----------
size_byte db: ,0,0,0,0
input db: "FILE.IN" ,0
output db: "FILE.OUT" ,0
handle1 db: ,0,0,0,0
handle2 db: ,0,0,0,0
address:
db: ,0,0,0,0,0,0
 




 17 Posts in Topic:
All is right !
"almas" <alm  2008-04-14 23:40:35 
Re: All is right !
"almas" <alm  2008-04-15 17:15:44 
Re: All is right !
"Wolfgang Kern"  2008-04-16 17:08:30 
Re: All is right !
"almas" <alm  2008-04-16 22:07:50 
Re: All is right !
"almas" <alm  2008-04-16 23:53:23 
Re: All is right !
"almas" <alm  2008-04-16 23:28:50 
Re: All is right !
"Wolfgang Kern"  2008-04-17 12:54:06 
Re: All is right !
"almas" <alm  2008-04-17 20:52:19 
Re: All is right !
"Wolfgang Kern"  2008-04-18 23:34:34 
Re: All is right !
"Wolfgang Kern"  2008-04-19 11:10:44 
Re: All is right !
"almas" <alm  2008-04-19 16:08:24 
Re: All is right !
"almas" <alm  2008-04-19 21:00:53 
Re: All is right !
"Wolfgang Kern"  2008-04-20 09:38:04 
Re: All is right !
"almas" <alm  2008-04-20 11:11:40 
Re: All is right !
"Wolfgang Kern"  2008-04-21 09:03:12 
Re: All is right !
"almas" <alm  2008-04-21 11:19:41 
Re: All is right !
"Wolfgang Kern"  2008-04-22 12:08:32 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sun Jul 6 16:02:35 CDT 2008.