Confused about Y86 assembly code memory storage

0

I've been using an online compiler but I'm not sure why the memory is being split the way it is

It's coming out as:

00a8 0000001d

00ac 01000000

when 00a8 should just hold the whole hex value as 0000011d.

.pos 0
    irmovl $1, %eax   # int i = 1
    irmovl $1, %ebx   # int j = 0
    irmovl $0, %ecx   # int ans = 0
    irmovl $139, %esp # set bas of array
    irmovl $1, %ebp
    
    
initloop:
    
    
    addl %ebp, %ecx # ans = ans + j
    irmovl $1, %edi # set esi to one to increment
    addl %edi, %eax
    
    rrmovl %ebp, %ebx
    irmovl $1, %edi # set esi to one to increment
    subl %edi, %ebx
    
    rrmovl %eax, %esi
    subl %eax, %ebx
    jge initloop
    
    rmmovl %ecx, (%esp) # arr[i] = ans
    
    irmovl $0, %eax # make (i)eax 0 after i == j
    #irmovl $0, %ecx # make (ans)ecx 0 after i == j
    
    irmovl $4, %edi     # get ready to compute next addr in arr
    addl   %edi, %esp
    
    irmovl $1, %edi # set esp to one to increment
    addl %edi, %ebp
    
    rrmovl %ebp, %ebx
    
    irmovl $10, %edi
    subl %ebp, %edi
    jge initloop
    
.pos 0x100
arr:

Could anyone run this and tell me if the memory matches?

Changes to memory:
0x008c: 0x00000000  0x00000001
0x0090: 0x00000000  0x00000005
0x0094: 0x00000000  0x0000000e
0x0098: 0x00000000  0x0000001e
0x009c: 0x00000000  0x00000037
0x00a0: 0x00000000  0x0000005b
0x00a4: 0x00000000  0x0000008c
0x00a8: 0x00000000  0x000000cc
0x00ac: 0x00000000  0x0000011d
0x00b0: 0x00000000  0x00000181
memory
y86
asked on Stack Overflow Oct 16, 2020 by zaserman

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0