a2-memory-map 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,19 @@
1
+ {
2
+ // Use IntelliSense to learn about possible attributes.
3
+ // Hover to view descriptions of existing attributes.
4
+ // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5
+ "version": "0.2.0",
6
+ "configurations": [
7
+ {
8
+ "type": "node",
9
+ "request": "launch",
10
+ "name": "Launch Program",
11
+ "outFiles": [
12
+ "${workspaceFolder}/build/*.js"
13
+ ],
14
+ "runtimeExecutable": "node",
15
+ "args": ["./build/index.js"],
16
+ "preLaunchTask": "tsc: build - tsconfig.json"
17
+ }
18
+ ]
19
+ }
@@ -0,0 +1,14 @@
1
+ {
2
+ "version": "2.0.0",
3
+ "tasks": [
4
+ {
5
+ "type": "typescript",
6
+ "tsconfig": "tsconfig.json",
7
+ "problemMatcher": [
8
+ "$tsc"
9
+ ],
10
+ "group": "build",
11
+ "label": "tsc: build - tsconfig.json"
12
+ }
13
+ ]
14
+ }
package/README.md ADDED
@@ -0,0 +1,64 @@
1
+ # Apple II Memory Map
2
+
3
+ This is a database of Apple II special addresses intended to be used with language servers. The central element is the file `map.json` which maps addresses to a set of descriptive strings.
4
+
5
+ ## TypeScript Interface
6
+
7
+ The project includes a Node package that can be used to access the data. The map records correspond to the interface
8
+
9
+ ```ts
10
+ interface AddressInfo {
11
+ brief: string | undefined,
12
+ ctx: string | undefined,
13
+ desc: string,
14
+ label: string | undefined,
15
+ note: string | undefined,
16
+ subctx: string | undefined,
17
+ type: string
18
+ }
19
+ ```
20
+
21
+ Records are retrieved using
22
+
23
+ ```ts
24
+ get_all() : Map<string,AddressInfo>
25
+ ```
26
+
27
+ to get the whole database as a `Map`, or
28
+
29
+ ```ts
30
+ get_one(addr: number): AddressInfo | undefined
31
+ ```
32
+
33
+ to get a single record. The argument `addr` can range from -32767 to 65535. As an example `get_info(0xfded)` will give
34
+
35
+ ```js
36
+ {
37
+ brief: 'Print character in A',
38
+ desc: 'Invoke output routine whose address is in (56). Usually prints character in A.',
39
+ label: 'COUT',
40
+ type: 'ROM routine'
41
+ }
42
+ ```
43
+
44
+ ## AddressInfo Fields
45
+
46
+ * `brief`: short description suitable for display in a selection box
47
+ * `ctx`: notes on limiting context, such as hardware requirements, applicability to given language, etc.
48
+ * `desc`: long description suitable for hovers
49
+ * `label`: suggested assembler label
50
+ * `note`: any other notes
51
+ * `subctx`: notes on sub context, e.g., specific aspect of a language
52
+ * `type`: data type (e.g. `word`) or operation type (e.g. `ROM routine`, `soft switch`)
53
+
54
+ ## Multiple Context Addresses
55
+
56
+ If the address has multiple contexts, the fields are still strings, i.e., they are not promoted to any other structure such as a list. As an example, if the address has a meaning for both Applesoft and Integer BASIC, we use `ctx = "Applesoft | Integer BASIC"`.
57
+
58
+ ## References
59
+
60
+ Apple's own documentation is a good starting point. The "Apple IIe Reference Manual" has low level information. The "Applesoft BASIC Programmer's Reference Manual" provides a chapter "Pokes, Peeks, and Calls" with information especially useful to BASIC programmers.
61
+
62
+ "All About Applesoft" from [Call-A.P.P.L.E.](https://www.callapple.org/) has a more in depth treatment.
63
+
64
+ Sometimes an ambiguity is best resolved by studying the relevant disassembly.
@@ -0,0 +1,11 @@
1
+ export interface AddressInfo {
2
+ brief: string | undefined;
3
+ ctx: string | undefined;
4
+ desc: string;
5
+ label: string | undefined;
6
+ note: string | undefined;
7
+ subctx: string | undefined;
8
+ type: string;
9
+ }
10
+ export declare function get_all(): Map<string, AddressInfo>;
11
+ export declare function get_one(addr: number): AddressInfo | undefined;
package/build/index.js ADDED
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.get_one = exports.get_all = void 0;
27
+ const memmap = __importStar(require("./map.json"));
28
+ function get_all() {
29
+ let m = new Map();
30
+ for (const [key, obj] of Object.entries(memmap)) {
31
+ m.set(key, {
32
+ brief: 'brief' in obj ? obj.brief : undefined,
33
+ ctx: 'ctx' in obj ? obj.ctx : undefined,
34
+ desc: obj.desc,
35
+ label: 'label' in obj ? obj.label : undefined,
36
+ note: 'note' in obj ? obj.note : undefined,
37
+ subctx: 'subctx' in obj ? obj.subctx : undefined,
38
+ type: obj.type
39
+ });
40
+ }
41
+ return m;
42
+ }
43
+ exports.get_all = get_all;
44
+ function get_one(addr) {
45
+ let pos_addr = addr < 0 ? addr + 2 ** 16 : addr;
46
+ const hex = '0x' + pos_addr.toString(16).padStart(4, '0');
47
+ return Object(memmap)[hex];
48
+ }
49
+ exports.get_one = get_one;