/* ======================================================================== Demo file used to teach linked list access ======================================================================== */ .global main, Stop, CodeEnd, DataStart, DataEnd .global head /* ================================================================== I have created this linked list at the end of the file (in data seg): head->[111,21,31]->[222,22,32]->[333,23,33]-> ->[444,24,34]->[555,25,35] The List object structure is as follows: int value1; // Offset = 0 short value2; // Offset = 4 short value3; // Offset = 6 List next; // Offset = 8 ================================================================== */ main: movw r0, #:lower16:head movt r0, #:upper16:head // r0 = addr of head // Load the value in variable head.value1 into r10 // Load the value in variable head.value2 into r10 // Load the value in variable head.value3 into r10 // Load the value in variable head.next.value1 into r10 // Load the value in variable head.next.next.value2 into r10 Stop: nop CodeEnd: /* ************************************************************** Permanent variables ************************************************************** */ .data DataStart: head: .word p0 // head contains the address of the first list elem // head->[111,21,31]->[222,22,32]->[333,23,33]-> // ->[444,24,34]->[555,25,35] // list structure is: [int value1, short value2, short value3, next] p0: .4byte 111 // p0 contains [111,21,31,p3] .2byte 21, 31 .4byte p3 p1: .4byte 333 // p1 contains [333,23,33,p2] .2byte 23, 33 .4byte p2 p2: .4byte 444 // p2 contains [444,24,34,p4] .2byte 24, 34 .4byte p4 p3: .4byte 222 // p3 contains [222,22,23,p2] .2byte 22, 32 .4byte p1 p4: .4byte 555 // p4 contains [555,25,35,null] .2byte 25, 35 .4byte 0 DataEnd: .end