i am a complete newbie when it comes to assembly so please dont scream at me..
the objective of my project is to read from any text file copy everything and convert them to binary THEN covert that binary back to its original text and output that text into a new output file..
so this is my code
TITLE conversion and output to a file
;-----------------------------------------------------------------
;program description: read from a file then convert char to binary
;then convert back to text into output file
;author: Yao Jiang
;creation date: 12-01-09
;-----------------------------------------------------------------
include /masm32/include/masm32rt.inc
;-----------------------------------------------------------------
.data
inname db 'file1.txt',0
outname db 'file2.dat',0
inh dw ?
outh dw ?
buff db ?
;-----------------------------------------------------------------
.code
openfile:
mov dx, offset inname
mov ah, 3dh
mov al, 0 ;0 to open the file to read
int 21h
jc error ;check for error, ie file not found
;or cant be opened
mov inh, ax ;save file handle
read:
mov ah, 3fh ;read data from file
mov bx, inh
mov dx, offset buff
mov cx, 1 ;read 1 type
int 21h
jc error
cmp ax, cx ;check for end of file
jne endoffile
mov al, buff
call write
jmp read
endoffile:
mov ah, 3eh ;close file
mov bx, inh
int 21h
mov ah, 3eh
mov bx, outh
int 21h
PROC write
push ax bx cx dx
mov ah, 2
mov dl, buff
int 21h
pop ax bx cx dx
ret
ENDP
end start
;-----------------------------------------------------------------
so far nothing works, for some reason i cant open the file and im having trouble trying to do conversion before writing to the new file
PLEASE HELP!!!
by the way im using masm32 because professor told the class to