I've declared two spaces which i am going to use as an array. (That is what i am hoping for anyway)
WORM_X: .space 128
WORM_Y: .space 128
They will hold X and Y coordinates.
I am trying to put som values in the arrays, and then print them on on the screen using nib_put_scr thats a C-function that's using curses.h.
When i run this code i get segmentation fault. do anyone now what i am doing wrong?
(I'm a complete beginner on assembly btw)
# Sets up the WORM_Y array
mov LENGTH, %eax
add Y, %eax
mov %eax, CMP
mov $WORM_Y, %eax
mov Y, %ebx
loop_addy:
mov %ebx, 0(%eax)
add $4, %eax
inc %ebx
cmp CMP, %ebx
jne loop_addy
# Sets up the WORM_X array
mov LENGTH, %eax
add X, %eax
mov %eax, CMP
mov $WORM_X, %eax
mov X, %ebx
mov X, %ecx
loop_addx:
mov %ecx, 0(%eax)
add $4, %eax
cmp CMP, %ebx
jne loop_addx
# Prints out signs on the screen with coordinates WORM_X & WORM_Y
mov $WORM_X, %ebx
mov $WORM_Y, %edx
loop_printtest:
push $48
push (%ebx)
push (%edx)
call nib_put_scr
addl $12, %esp
add $4, %ebx
add $4, %edx
mov (%ebx), %ecx
cmp $0, %ecx
jne loop_printtest