I am trying to write a program which takes the binary input from a text file and sends it as a parameter to an assembly function. That assembly function must print this binary input to the screen. The input is sent from c code to assembly code by its address.
When I try to assemble my asm file, I get an "invalid combination of opcode and operands" error on the mov msg, [esp+8] line. I want to copy my char arg from the stack to my static variable. Why isn't that a valid instruction?
The full code is:
segment .data len equ 31 segment .bss msg resb 0 segment .text global sequence_generator sequence_generator: push ebp mov ebp, esp mov msg, [esp+8] mov eax,4 mov ebx,1 mov ecx,msg mov edx,len int 80h pop ebp ret
mov msg, [esp+8]what you think this is doing? And thismsg resb 0? And havingedxequal to fixed 31 is intended? So the C code will always send 31+ characters?'.', or to print hexadecimal values instead of bytes themselves. (so from data" "(triple space) you will print"20 20 20")