/* ======================================================================== Demo file used to teach linked list access ======================================================================== */ .global main, Stop, CodeEnd, DataStart, DataEnd .global head // "head" points to the first element in list /* ========================================================================== I have created this linked list at the end of the file (in data seg): head->[11]->[22]->[33]->[44]->[55] The List object struct is as follows: int value; // Offset = 0 List next; // Offset = 4 ========================================================================== */ main: movw r0, #:lower16:head movt r0, #:upper16:head // r0 = addr of head // Load the value in variable head.value into r10 // Load the value in variable head.next.value into r10 // Load the value in variable head.next.next.value into r10 Stop: nop CodeEnd: /* ************************************************************** Permanent variables ************************************************************** */ .data DataStart: head: .word p0 // head contains the address of the first list elem // head->[11]->[22]->[33]->[44]->[55] // list structure is: [int value, next] p0: .4byte 11, p3 // p0 contains [11, p3] p1: .4byte 33, p2 // p1 contains [33, p2] p2: .4byte 44, p4 // p2 contains [44, p2] p3: .4byte 22, p1 // p3 contains [22, p2] p4: .4byte 55, 0 // p4 contains [55, p2] DataEnd: .end