To AGS:
Some suggestions:
I've seen numerous instances of the following kind of code in your code:
Code:
cmp.l #bla.a1,d0
bne .l1
move.l d1,bla.a1(a0)
.l1
cmp.l #bla.a2,d0
bne .l2
move.l d1,bla.a2(a0)
.l2
cmp.l #bla.a3,d0
bne .l3
move.l d1,bla.a3(a0)
.l3
It's better to try and write it like this, because it's faster, shorter and far less prone to errors:
Code:
move.l d1,(a0,d0.w*4) ; for long words
move.w d1,(a0,d0.w*2) ; for words
move.b d1,(a0,d0.w) ; for bytes
I've also seen multiple instances of inlined linked list code and what appears to be code that traverses a whole list to get the last node in the list. A better approach would be to do something like this (excuse the use of
rs.l, I haven't looked at the types include
):
Code:
rsreset
list.first rs.l 1 ; pointer to first node in list
list.last rs.l 1 ; pointer to last node in list
struct_list rs.l 1 ; size of structure
rsreset
node.prev rs.l 1 ; pointer to previous node
node.next rs.l 1 ; pointer to next node
struct_node rs.l 1 ; size of structure
list.add ; add node to list
list.insert ; insert node between two nodes
list.delete ; delete node from list
In the case of the methods (add, insert and delete) you simply keep
list.last pointing to the last node. No slow loops required.
Using only one set of linked list routines is far easier and less error prone than inlining the code wherever it's needed.