view lib/alib/b09strlen.a @ 2668:07441dfebc27 lwtools-port

Make tocgen build with lwasm lwasm does not treat a trailing colon as part of the symbol name. Removed trailing colons on symbol references.
author William Astle <lost@l-w.ca>
date Sun, 10 Jun 2012 13:35:44 -0600
parents 7d70b7e1cb21
children aaba193af04f
line wrap: on
line source

**********************************

* BASIC09 String Length: find length of a BASIC09 string
*                        which can be terminated by a $ff 
*                         =or= allocated storage size

* ENTRY: X=start of string
*        D=max allocated

* EXIT: D=actual length
*       all other regs (except cc) preserved

 nam Find Basic09 String Length
 ttl Assembler Library Module


 psect B09STRLEN,0,0,0,0,0

B09STRLEN:
 pshs d,x,y
 tfr d,y max. possible size to Y

loop
 lda ,x+ get char from string
 inca this effects a cmpa #$ff
 beq exit reached terminator
 leay -1,y if string max leng, no terminator
 bne loop no yet, check more

exit
 puls d get max possible size
 pshs y unused size in memory
 subd ,s++ find actual length
 puls x,y,pc 

 endsect