001package jmri.jmrix.nce;
002
003/**
004 * Contains the map for the command station and memory parts
005 * The default values are for the older serial command station.
006 *
007 * @author Bob Jacobsen Copyright (C) 2001
008 * @author Ken Cameron Copyright (C) 2013, 2023
009 * 
010 */
011public class NceCmdStationMemory {
012    
013    /*
014     * give addr for cab data base
015     */
016    public int getCabAddr() {
017        return 0x8800;
018    }
019    
020    /*
021     * give cab data size
022     */
023    public int getCabSize() {
024        return 0x100;
025    }
026    /*
027     * give min cab id
028     */
029    public int getCabMin() {
030        return 1;    // min number for cab memory slot
031    }
032    
033    /*
034     * give max cab id
035     */
036    public int getCabMax() {
037        return 63;    // max number for cab memory slot
038    }
039    
040    /*
041     * give addr computer cab
042     */
043    public int getCompCabAddr() {
044        return 0xED00; // start of computer cab context page, PowerPro/CS2
045    }
046    
047    /*
048     * give addr consist head
049     */
050    public int getConsistHeadAddr() {
051        return 0xF500;  // start of NCE CS Consist Head memory
052    }
053
054    /*
055     * give addr consist tail
056     */
057    public int getConsistTailAddr() {
058        return 0xF600;  // start of NCE CS Consist Tail memory
059    }
060    
061    /*
062     * give addr consist middle
063     */
064    public int getConsistMidAddr() {
065        return 0xF700;  // start of NCE CS Consist memory
066    }
067    
068    /*
069     * give size of consist mid table
070     */
071    public int getConsistMidSize() {
072        return 0x0600;  // size of NCE CS Consist memory
073    }
074    
075    /*
076     * give minimum consist number
077     */
078    public int getConsistMin() {
079        return 1;
080    }
081    
082    /*
083     * give maximum consist number
084     */
085    public int getConsistMax() {
086        return 127;
087    }
088
089    /*
090     * give consist num lines
091     */
092    public int getConsistNumLines() {
093        return 96;   // number of lines in the file
094    }
095
096    /*
097     * give addr macro table
098     */
099    public int getMacroAddr() {
100        return 0xC800; // start of NCE CS Macro memory 
101    }
102    
103    /*
104     * give number of macro limit
105     */
106    public int getMacroLimit() {
107        return 256; // there are 256 possible macros
108    }
109    
110    /*
111     * give size of macro entry
112     */
113    public int getMacroSize() {
114        return 20;  // 20 bytes per macro
115    }
116
117    /*
118     * give accessory memory address (AIU status)
119     */
120    public int getAccyMemAddr() {
121        return 0xEC00;
122    }
123
124    /*
125     * give accessory memory size (AIU status)
126     */
127    public int getAccyMemSize() {
128        return 0x100;
129    }
130    
131    /*
132     * give the AIU flag address
133     */
134    public int getAiuFlagAddr() {
135        return 0xDC15;
136    }
137    
138    /*
139     * give base addr for clock operations
140     */
141    public int getClockAddr() {
142        return 0xDC00;
143    }
144
145    public static int CAB_LINE_1 = 0;  // start of first line for cab display
146    public static int CAB_LINE_2 = 16;  // start of second line for cab display
147    //public static int CAB_SIZE = 256;  // Each cab has 256 bytes
148    public static int CAB_CURR_SPEED = 32; // NCE cab speed
149    public static int CAB_ADDR_H = 33;   // loco address, high byte
150    public static int CAB_ADDR_L = 34;   // loco address, low byte
151    public static int CAB_FLAGS = 35;  // FLAGS
152    public static int CAB_FUNC_L = 36;  // Function keys low
153    public static int CAB_FUNC_H = 37;  // Function keys high
154    public static int CAB_ALIAS = 38;  // Consist address
155    
156    /*
157     * give cab index functions 13-20
158     */
159    public int getCabIdxFunct13_20() {
160        return 82; // Function keys 13 - 30
161    }
162    
163    /*
164     * give cab index functions 21-28
165     */
166    public int getCabIdxFunct21_28() {
167        return 83; // Function keys 21 - 28
168    }
169    
170    /*
171     * give cab index for cab status
172     */
173    public int getCabIdxFlag1() {
174        return 101;  // NCE flag 1
175    }
176
177    public static int FLAGS_MASK_CONSIST_REAR = 0x80;      // bit 7 set if CAB_ADDR_x is rear loco
178    public static int FLAGS1_CABTYPE_DISPLAY = 0x00; // bit 0=0, bit 7=0;
179    public static int FLAGS1_CABTYPE_NODISP = 0x01; // bit 0=1, bit 7=0;
180    public static int FLAGS1_CABTYPE_USB = 0x80;  // bit 0=0, bit 7=1;
181    public static int FLAGS1_CABTYPE_AIU = 0x81;  // bit 0=1, bit 7=1;
182    public static int FLAGS1_CABISACTIVE = 0x02;          // if cab is active
183    public static int FLAGS1_MASK_CABTYPE = 0x81;         // Only bits 0 and 7.
184    public static int FLAGS1_MASK_CABISACTIVE = 0x02; // if cab is active
185
186    public static final int FUNC_L_F0 = 0x10;  // F0 or headlight
187    public static final int FUNC_L_F1 = 0x01;  // F1
188    public static final int FUNC_L_F2 = 0x02;  // F2
189    public static final int FUNC_L_F3 = 0x04;  // F3
190    public static final int FUNC_L_F4 = 0x08;  // F4
191
192    public static final int FUNC_H_F5 = 0x01;  // F5
193    public static final int FUNC_H_F6 = 0x02;  // F6
194    public static final int FUNC_H_F7 = 0x04;  // F7
195    public static final int FUNC_H_F8 = 0x08;  // F8
196    public static final int FUNC_H_F9 = 0x10;  // F9
197    public static final int FUNC_H_F10 = 0x20;  // F10
198    public static final int FUNC_H_F11 = 0x40;  // F11
199    public static final int FUNC_H_F12 = 0x80;  // F12
200
201    public static final int FUNC_H_F13 = 0x01;  // F13
202    public static final int FUNC_H_F14 = 0x02;  // F14
203    public static final int FUNC_H_F15 = 0x04;  // F15
204    public static final int FUNC_H_F16 = 0x08;  // F16
205    public static final int FUNC_H_F17 = 0x10;  // F17
206    public static final int FUNC_H_F18 = 0x20;  // F18
207    public static final int FUNC_H_F19 = 0x40;  // F10
208    public static final int FUNC_H_F20 = 0x80;  // F20
209
210    public static final int FUNC_H_F21 = 0x01;  // F21
211    public static final int FUNC_H_F22 = 0x02;  // F22
212    public static final int FUNC_H_F23 = 0x04;  // F23
213    public static final int FUNC_H_F24 = 0x08;  // F24
214    public static final int FUNC_H_F25 = 0x10;  // F25
215    public static final int FUNC_H_F26 = 0x20;  // F26
216    public static final int FUNC_H_F27 = 0x40;  // F27
217    public static final int FUNC_H_F28 = 0x80;  // F28
218
219    public static final int FUNC_H_F29 = 0x01;  // F29
220    public static final int FUNC_H_F30 = 0x02;  // F30
221    public static final int FUNC_H_F31 = 0x04;  // F31
222    public static final int FUNC_H_F32 = 0x08;  // F32
223    public static final int FUNC_H_F33 = 0x10;  // F33
224    public static final int FUNC_H_F34 = 0x20;  // F34
225    public static final int FUNC_H_F35 = 0x40;  // F35
226    public static final int FUNC_H_F36 = 0x80;  // F36
227
228    public static final int FUNC_H_F37 = 0x01;  // F37
229    public static final int FUNC_H_F38 = 0x02;  // F38
230    public static final int FUNC_H_F39 = 0x04;  // F39
231    public static final int FUNC_H_F40 = 0x08;  // F40
232    public static final int FUNC_H_F41 = 0x10;  // F41
233    public static final int FUNC_H_F42 = 0x20;  // F42
234    public static final int FUNC_H_F43 = 0x40;  // F43
235    public static final int FUNC_H_F44 = 0x80;  // F44
236
237    public static final int FUNC_H_F45 = 0x01;  // F45
238    public static final int FUNC_H_F46 = 0x02;  // F46
239    public static final int FUNC_H_F47 = 0x04;  // F47
240    public static final int FUNC_H_F48 = 0x08;  // F48
241    public static final int FUNC_H_F49 = 0x10;  // F49
242    public static final int FUNC_H_F50 = 0x20;  // F50
243    public static final int FUNC_H_F51 = 0x40;  // F51
244    public static final int FUNC_H_F52 = 0x80;  // F52
245
246    public static final int FUNC_H_F53 = 0x01;  // F53
247    public static final int FUNC_H_F54 = 0x02;  // F54
248    public static final int FUNC_H_F55 = 0x04;  // F55
249    public static final int FUNC_H_F56 = 0x08;  // F56
250    public static final int FUNC_H_F57 = 0x10;  // F57
251    public static final int FUNC_H_F58 = 0x20;  // F58
252    public static final int FUNC_H_F59 = 0x40;  // F59
253    public static final int FUNC_H_F60 = 0x80;  // F60
254
255    public static final int FUNC_H_F61 = 0x01;  // F61
256    public static final int FUNC_H_F62 = 0x02;  // F62
257    public static final int FUNC_H_F63 = 0x04;  // F63
258    public static final int FUNC_H_F64 = 0x08;  // F64
259    public static final int FUNC_H_F65 = 0x10;  // F65
260    public static final int FUNC_H_F66 = 0x20;  // F66
261    public static final int FUNC_H_F67 = 0x40;  // F67
262    public static final int FUNC_H_F68 = 0x80;  // F68
263}
264
265