annotate lib/alib/jsr_cmd.as @ 3054:22ddd48b4ec2

level1 krn: Fix scheduler bug that only affected 6309 The original 6809 binary was correct, but it was disassembled and interpreted wrongly, so that reassembly went wrong on 6309.
author Tormod Volden <debian.tormod@gmail.com>
date Sun, 25 Jan 2015 22:36:02 +0100
parents 03f26e88b809
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2474
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
1 ***************************************
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
2
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
3 * Subroutine to jsr to subroutine from 1 character command table
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
4
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
5 * OTHER MODULES NEEDED: none
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
6
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
7 * ENTRY: A=1 char command
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
8 * X=start of jump table
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
9
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
10 * EXIT: CC carry set if entry not found
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
11 * all other regs can be modified by subs
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
12
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
13 * Note format of table: each entry is three bytes
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
14 * 0-match character (command)
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
15 * 1..2-offset to routine
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
16
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
17 * It is the user's job to set commands to proper case for matching...
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
18
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
19 * end of table=NULL
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
20
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
21 * sample table: fcc /A/
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
22 * fdb routineA-*
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
23 * fcc /B/
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
24 * fdb routineB-*
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
25 * fcb 0
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
26
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
27
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
28 nam Jsr to 1 char Command
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
29 ttl Assembler Library Module
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
30
2782
aaba193af04f Updated code to use lwasm/lwlink
Boisy Pitre <boisy.pitre@nuance.com>
parents: 2474
diff changeset
31 section .text
2474
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
32
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
33 JSR_CMD:
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
34 tst ,x end of table?
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
35 beq jsrerr
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
36
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
37 cmpa ,x+ found match?
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
38 beq docmd yes, go do it
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
39
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
40 leax 2,x next entry
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
41 bra JSR_CMD
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
42
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
43 * no match found, return with carry set
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
44
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
45 jsrerr
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
46 coma set error flag
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
47 rts
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
48
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
49 * command found, do call and return
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
50
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
51 docmd
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
52 ldd ,x get offset to routine
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
53 jsr d,x
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
54 andcc #%11111110 clear carry
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
55 rts
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
56
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
57 endsect