I'm trying to copy the 2nd argument to an array declared as:
.bss X: resb 20
I don't know how to approach this. Here's my attempt:
The argument ends in a terminating (0x0) character.
%include "asm_io.inc"
global asm_main
section .data
section .bss
temp: resd 1
i: resd 1
X: resb 20
length: resd 1 ; length of input
section .text
asm_main:
enter 0, 0
pusha
mov ebx, dword [ebp+12]
mov esi, dword [ebx+4]
loop: lodsb
; end of string?
or al, al
jz endloop
; copy arg[1] to x ================
mov temp, X ;error; temp = address of X
add temp, dword [i] ;error; temp += i
mov byte [temp], al ; ; temp[i] = al
add dword [i], 1 ; i++
; =================================
jmp loop
endloop:
popa
leave
ret
I don't think I'm copying the array address correctly, it won't compile ^ The error is: "invalid combination of opcode and operands" for the two lines marked