; ; Author: Ney Calazans ; Date: 31/05/2006 ; ; Description: This code depicts a chained list example, to help students understand ; how this kind of data structure is organized in Cleopatra Assembly Language. The ; chained list example has a head of list pointer (the contents of memory position ; start_chl) and 5 nodes, each occupying two consecutive memory words. The first ; memory word of any node is the data contents field, while the second is the link ; field, containing the address of the next node in the list. The end of the ; list is marked by a head of list pointer null (equal to 0) or a null link field ; for some node in the list, which is then, mandatorily, the last node of the list. ; Note the use of the org directive to insert nodes at random places in memory. This ; is not necessary, but makes clear the possible memory sparsity of this kind ; of data structure. ; ; .data org #60h ; Below this line is an example chained list start_chl: db #node1 node1: db #10h ; node1 contents field db #node2 ; node1 link field org #67h node2: db #0ffh ; node2 contents field db #node3 ; node2 link field org #73h node3: db #0FAh ; node3 contents field db #node4 ; node4 link field org #0C7h node4: db #0ABh ; node4 contents field db #node5 ; node4 link field org #70h node5: db #35h ; node5 contents field db #0h ; node5 link field - end of chained list .enddata