Mercurial > hg > Members > kono > nitros9-code
annotate lib/alib/jsr_cmd2.as @ 2831:7c8442122235 lwtools-port
fix level 1 builds
author | lfantoniosi |
---|---|
date | Tue, 18 Jun 2013 21:41:46 -0400 |
parents | 03f26e88b809 |
children |
rev | line source |
---|---|
2474 | 1 *************************************** |
2 | |
3 * Subroutine to jsr to subroutine from 2 character command table | |
4 | |
5 * OTHER MODULES NEEDED: none | |
6 | |
7 * ENTRY: D=2 char command | |
8 * X=start of jump table | |
9 | |
10 * EXIT: CC carry set if entry not found | |
11 * all other regs can be modified by subs | |
12 * D and X always modified | |
13 | |
14 * Note format of table: each entry is four bytes | |
15 * 0..1-match characters (command) | |
16 * 2..3-offset to routine | |
17 | |
18 * It is the user's job to set commands to proper case for matching... | |
19 | |
20 * end of table=NULL | |
21 | |
22 * sample table: fcc /A1/ | |
23 * fdb routineA-* | |
24 * fcc /B1/ | |
25 * fdb routineB-* | |
26 * fcb 0 | |
27 | |
28 | |
29 nam Jsr to 2 char Command | |
30 ttl Assembler Library Module | |
31 | |
2782
aaba193af04f
Updated code to use lwasm/lwlink
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2474
diff
changeset
|
32 section .text |
2474 | 33 |
34 JSR_CMD2: | |
35 tst ,x end of table? | |
36 beq jsrerr | |
37 | |
38 cmpd ,x++ found match? | |
39 beq docmd yes, go do it | |
40 | |
41 leax 2,x next entry | |
42 bra JSR_CMD2 | |
43 | |
44 * no match found, return with carry set | |
45 | |
46 jsrerr | |
47 coma set error flag | |
48 rts | |
49 | |
50 * command found, do call and return | |
51 | |
52 docmd | |
53 ldd ,x get offset to routine | |
54 jsr d,x | |
55 andcc #%11111110 clear carry | |
56 rts | |
57 | |
58 endsect |