Motorola M68000 User's Guide Page 136

  • Download
  • Add to my manuals
  • Print
  • Page
    / 256
  • Table of contents
  • BOOKMARKS
  • Rated. / 5. Based on customer reviews
Page view 135
122 Assembly Language Programming for the 68000 Family
INSAO: MOVEA.L
A1,A2
A2 -> PREVIOUS NODE LINK
MOVE.L (Al),A1
Al -> NEXT NODE LINK
CMPA.L
#0,A1
NULL?
BEQ
INSAI
YES, END OF LIST
ADDQ.L *4,A1 Al -> NEXT NODE DATA
JSR
STRCMP
COMPARE STRINGS
BLT INSAI KEEP LOOKING
SUBQ.L
#4,A1 Al -> NEXT NODE LINK
INSAI:
SUBQ.L
#4 / AO
AO -> NEW NODE LINK
MOVE.L
Al,(AO)
SET LINK IN NEW NODE
MOVE.L
AO, (A2)
SET LINK IN PREVIOUS NODE
INSAR:
MOVEM.L
RTS
(SP)+,A0-A2
RESTORE REGISTERS
INSAI:
SUBQ.L
#4 ,A1
Al -> LINK
BRA INSAO
CONTINUE SEARCH
figure 10 Insertion at head of list
Figure 11 Insertion into middle of list
By using more registers and/or other addressing modes it may be possible
to reduce the size of this subroutine. Can you do it? Is there a way to
Page view 135
1 2 ... 131 132 133 134 135 136 137 138 139 140 141 ... 255 256

Comments to this Manuals

No comments