comparison lib/alib/b09strlen.as @ 2783:03f26e88b809 lwtools-port

Renamed files and setup for lwasm/lwlink work
author Boisy Pitre <boisy.pitre@nuance.com>
date Sat, 26 Jan 2013 17:18:24 -0600
parents
children
comparison
equal deleted inserted replaced
2782:aaba193af04f 2783:03f26e88b809
1 **********************************
2
3 * BASIC09 String Length: find length of a BASIC09 string
4 * which can be terminated by a $ff
5 * =or= allocated storage size
6
7 * ENTRY: X=start of string
8 * D=max allocated
9
10 * EXIT: D=actual length
11 * all other regs (except cc) preserved
12
13 nam Find Basic09 String Length
14 ttl Assembler Library Module
15
16
17 section .text
18
19 B09STRLEN:
20 pshs d,x,y
21 tfr d,y max. possible size to Y
22
23 loop
24 lda ,x+ get char from string
25 inca this effects a cmpa #$ff
26 beq exit reached terminator
27 leay -1,y if string max leng, no terminator
28 bne loop no yet, check more
29
30 exit
31 puls d get max possible size
32 pshs y unused size in memory
33 subd ,s++ find actual length
34 puls x,y,pc
35
36 endsect
37