I am taking my first assembly programming class and my instructor wants us to find out how based addressing mode works. So here is some code that I wrote to try and do that. Only problem is that I must not understand it because I keep getting a segmentation fault. I commented on the lines to try and show what I THINK they are doing. Can someone please correct my misunderstanding.
Thanks!
.text
.global _start
L0: .int 0x99999999
L1: .int 0x12345678
L2: .int 0x11111111
_start:
movl $L1, %eax #Stores the address of what L1 "pionts to" in regester eax
movb $0, 2(%eax) #Stores 0 in the location eax has in it +2 memory locations
#So 0 should be stored in the same place as L1+2
checkHere:
movl $1,%eax
movl $0,%ebx
int $0x80
.text
is readonly. Put your data in .data
and it should work.