I'm new to using Assembly (all types), so I was following tutorials from tutorialspoint.com In particular, I was on the page https://www.tutorialspoint.com/assembly_programming/assembly_addressing_modes.htm which is about Assembly Addressing. Everything was working, up until the final example where it gave the code (takes the name Zara Ali and changes it to Nuha Ali):
section .text
global _start ;must be declared for linker (ld)
_start: ;tell linker entry point
;writing the name 'Zara Ali'
mov edx,9 ;message length
mov ecx, name ;message to write
mov ebx,1 ;file descriptor (stdout)
mov eax,4 ;system call number (sys_write)
int 0x80 ;call kernel
mov [name], dword 'Nuha' ; Changed the name to Nuha Ali
;writing the name 'Nuha Ali'
mov edx,8 ;message length
mov ecx,name ;message to write
mov ebx,1 ;file descriptor (stdout)
mov eax,4 ;system call number (sys_write)
int 0x80 ;call kernel
mov eax,1 ;system call number (sys_exit)
int 0x80 ;call kernel
section .data
name db 'Zara Ali', 0xa
This code works of course, however, when modifying it slightly, I ran into problems. In line 13, I changed 'Nuha' to 'Nuhas' just to see if it would come up with 'NuhasAli' (since I'm assuming that that line is just replacing whatever bits are there with Nuhas and keeping the rest (Ali)).
When I tried this and ran the command 'nasm -f elf helloasm.asm' (helloasm.asm is the name of the file), it gave me these two messages:
helloasm.asm:13: warning: character constant too long
helloasm.asm:13: warning: dword data exceeds bounds
I couldn't find any insight into the first problem as when I looked it up, all it gave me were results regarding C and C++. However, as for the second warning, I tried to make the dword data stop exceeding the bounds by simply making it a qword instead of a dword
section .text
global _start ;must be declared for linker (ld)
_start: ;tell linker entry point
;writing the name 'Zara Ali'
mov edx,9 ;message length
mov ecx, name ;message to write
mov ebx,1 ;file descriptor (stdout)
mov eax,4 ;system call number (sys_write)
int 0x80 ;call kernel
mov [name], qword 'Nuhas' ; Changed the name to Nuha Ali
;writing the name 'Nuha Ali'
mov edx,10 ;message length
mov ecx,name ;message to write
mov ebx,1 ;file descriptor (stdout)
mov eax,4 ;system call number (sys_write)
int 0x80 ;call kernel
mov eax,1 ;system call number (sys_exit)
int 0x80 ;call kernel
section .data
name dw 'Zara Ali', 0xa
helloasm.asm:13: warning: character constant too long
helloasm.asm:13: error: operation size not specified
At this point, I was stumped. Can anyone offer any insight into why this is happening and how I should fix it? Are my fundamentals wrong? Thanks in advance for any help