Assembler accessing array from Blitzmax code
BlitzMax Forums/BlitzMax Programming/Assembler accessing array from Blitzmax code
| ||
I have these code files: "a.bmx" Import "a.s" Global a[100] Extern Function f()="f" EndExtern f() Print a[0] "a.s" format MS COFF extrn _bb_a section "code" code Public f as "_f" f: pusha mov eax,dword 1 mov [_bb_a],eax popa ret I am trying to write or read the array 'a' from the blitzmax source file within the assembler code. It does't work... :) I get EXCEPTION_ACCESS_VIOLATION. What am I doing wrong? |
| ||
I don't know, but here are a few ideas to check: 1. Print the array base address received in your asm and compare with the one reported by Blitz. 2. Blitz arrays know their own length- are you sure you're writing to the start of the array and not some other field in the data structure? 3. Try comparing your code with a Blitz generated function that does the same. I realise you may not be able to compare exact like for like. |
| ||
Understood |
| ||
Does it work for you? |
| ||
Thanks figured it out :)format MS COFF extrn _bb_a section "code" code Public f as "_f" f: pusha mov edi,[_bb_a] mov [edi+24],dword 1 popa ret |