Hi Benjamin again :)
581 bytes! I'm impressed. Maybe Java deserves more credit than I've been giving it. (although I'll bet there's some "runtime" involved)
Dr. Paul Carter's tut has an array example...
http://www.drpaulcarter.com/~pcasm(and I posted a Linux example on c.l.a.x. that might help you)
I'm not familiar with Java, but I believe "new" implies that we ought to allocate the buffer. I think all we'd have to do (in Windows) is push the size we want (10000000 * 4 - 'cause we want the size in bytes), and call... maybe GlobalAlloc, maybe VirtuallAlloc - I don't know which would be most appropriate (or maybe some other *Alloc). I suppose it's polite to free it when we're done...
extern GlobalAlloc
extern GlobalFree
extern ExitProcess
global my_entry
section .bss
bufptr resd 1
section .text
my_entry:
push 10000000 * 4
call [GlobalAlloc]
test eax, eax
jz no_damn_memory
mov [bufptr], eax
In the example I posted with the static buffer, we could refer to the array by name - "[array + ecx]" or so. We won't be able to do that with an allocated array...
mov esi, [bufptr]
xor ecx, ecx
loop_top:
mov eax, [esi + ecx + HALFSIZE]
add [esi + ecx], eax
HLLs do "pointer arithmetic" for us. If "p" points to bytes, "p++" adds one to "p". If "p" points to "int"s (assuming dwords - 32 bits - 4 bytes) "p++" adds 4 to "p". If "p" points to double precision floats, "p++" adds 8. In asm, we have to do it ourselves.
add ecx, 4
cmp ecx, HALFSIZE
jb loop_top
push dword [bufptr]
call GlobalFree ; ???
Don't forget to exit cleanly.
I don't do Windows, but "something like that"...
Your Java example doesn't seem to initiallize the array to anything, and doesn't do anything with the results, so this code doesn't either. The Linux example I posted to c.l.a.x. did (but didn't *store* the result, as you want)... but the display routine will have to be different for Windows.
For test purposes, you may want to start with a smaller array, as "x87asm" suggested in c.l.a.x.
If you post the specific problems you're having with Nasm (or Windows), we may be able to suggest something...
Best,
Frank