In a message dated 11/08/2003 00:30:49 GMT Standard Time, [EMAIL PROTECTED] writes:

The code seems correct although far than optimized. I'd propose:

Lab1001E   moveq    #0,d5        Clear MS word.
      lea     Lab10076,a4     Name string address
      move.w   (a2)+,d5       Name length
      addq.l   #3,d5        | Take length word into account
      bclr    #0,d5        |  and round up to word boundary
      move.l   d5,d1        Number of bytes to reserve
      movea.l   $58(a6),a1      Arithmetic stack address.
      movea.w   $011a,a0       QA.RESRI
      jsr     (a0)         Reserve the space on the stack
      movea.l   $58(a6),a1      New stack address
      suba.l   d5,a1        Make space for the string
      move.l   a1,$58(a6)      Store the new top of stack
      movea.l   a1,a2        Copy of stack pointer
      lsr.l    #1,d5        | Number of words to transfer
      subq.l   #1,d5        |
Lab1005A   move.w   (a4)+,0(a6,a2.l)   Transfer a word.
      addq.l   #2,a2        Increment stack pointer
      dbf     d5,Lab1005A     Continue until end of name.
      moveq    #1,d4        Parameter on stack = string
      moveq    #0,d0        No error
      rts              retuns...

Lab1006E   dc.b    '<<QDRV>>'

Lab10076   dc.w    13
      dc.b    'win2_NEMESIS_'
Lab10086   ds.b    35

The above is tested and working.


OK thanks for the optimisation - however, I am suprised the above is tested and working - surely the third line should read

move.w (a4),d5

LOL

I also need to test d5 for zero length word as the characters at Lab10076 are configurable by the user !!

therefore the start becomes...

Lab1001E   moveq    #0,d5        Clear MS word.
      lea     Lab10076,a4     Name string address
      move.w   (a4),d5        Name length
      beq.s  Lab1006A        Zero length string - signify name not found error !!
      addq.l  #3,d5             Take length word into account....


etc

--
Rich Mellor
RWAP Services
35 Chantry Croft, Kinsley, Pontefract, West Yorkshire, WF9 5JH
TEL: 01977 610509
http://hometown.aol.co.uk/rwapsoftware

Reply via email to