Dear Frank,
I am trying to solve the problem from last night. As I am a newbie in NASM, some concepts are lacking within me. I asked my classmates about it. But they also seem baffled. Thank you, very much.
Yet, I don't understand how to deal with "mov byte[ecx+eax -1],0". For your convenience I am inserting my MODIFIED version of the code. Can you please review the code?
section .data
msg: dd "%d",10,0
msg1: db "cat>",0
length: equ $-msg1
section .bss
a resb 100
len1 equ $-a
b resd 1
c resb 100
len2 equ $-c
section .txt
global main
main:
mov eax,4
mov ebx,1
mov ecx,msg1
mov edx,length
int 80h
start:
mov eax,3
mov ebx,0
mov ecx,a
mov edx,len1
int 80h
mov byte[ecx+eax -1],0 ;;I put your code here after taking the file name as input
mov eax,5
mov ebx,a
mov ecx,0100q
mov edx,1c0h
int 80h
cmp eax,0
jge inputAndWrite
jmp errorSegment
inputAndWrite:
mov [b],eax
mov eax,3
mov ebx,0
mov ecx,c
mov edx,len2
int 80h
mov edx,eax
mov eax,4
mov ebx,[b]
mov ecx,c
int 80h
jmp done
errorSegment:
jmp done
done:
mov eax, 1
xor ebx, ebx
int 80h
this also shows the same problem. File is created but the input lines are nor shown inside the file. I think ,I misplaced the "mov byte[ecx+eax -1],0".