@andrivet/z80-assembler 1.2.0 → 1.3.0
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.
- package/CHANGELOG.md +7 -0
- package/index.js +12 -12
- package/index.mjs +1608 -1180
- package/lib/compiler/Ast.d.ts +18 -11
- package/lib/compiler/Labels.d.ts +9 -10
- package/lib/grammar/z80.d.ts +784 -508
- package/lib/types/Error.d.ts +6 -8
- package/lib/types/Types.d.ts +9 -2
- package/package.json +1 -1
package/lib/compiler/Ast.d.ts
CHANGED
|
@@ -16,13 +16,13 @@
|
|
|
16
16
|
* License: GPLv3
|
|
17
17
|
* Copyrights: Copyright (C) 2023 Sebastien Andrivet
|
|
18
18
|
*/
|
|
19
|
-
import { bytes } from '../types/Types';
|
|
19
|
+
import { Address, bytes } from '../types/Types';
|
|
20
20
|
import { ByteValue, Expression, PosInfo, WordValue } from "../grammar/z80";
|
|
21
21
|
/**
|
|
22
|
-
* A function
|
|
22
|
+
* A function returning a number (if it is known) or null (if it is unknown).
|
|
23
23
|
* Une function qui ne prend pas d'argument et qui retourne un nombre (s'il est connu) ou null (s'il est inconnu).
|
|
24
24
|
*/
|
|
25
|
-
export type EvalFunc = () => number | null;
|
|
25
|
+
export type EvalFunc = (pc: Address, mustExist: boolean) => number | null;
|
|
26
26
|
/**
|
|
27
27
|
* An abstract element generated by the parser.
|
|
28
28
|
* Un élément abstrait générà par l'analyseur.
|
|
@@ -177,15 +177,20 @@ export declare function value16LE(pos: PosInfo, e: Expression): AstElement;
|
|
|
177
177
|
*/
|
|
178
178
|
export declare function value8(pos: PosInfo, e: Expression): AstElement;
|
|
179
179
|
/**
|
|
180
|
-
* Returns an AST element that represents an 8-bit signed
|
|
181
|
-
* Retourne un élément de l'AST qui représente
|
|
182
|
-
* @
|
|
183
|
-
*
|
|
184
|
-
*
|
|
185
|
-
*
|
|
186
|
-
*
|
|
180
|
+
* Returns an AST element that represents an 8-bit signed offset for IX or IY.
|
|
181
|
+
* Retourne un élément de l'AST qui représente un décalage 8 bits signé pour IX ou IY.
|
|
182
|
+
* @offset The offset for IX or IY with:
|
|
183
|
+
* pos The position of the element in the source.
|
|
184
|
+
* La position de l'élément dans le code source.
|
|
185
|
+
* s The sign of the value.
|
|
186
|
+
* e The 8-bit signed décalage
|
|
187
|
+
* Le décalage 8-bit signée.
|
|
187
188
|
*/
|
|
188
|
-
export declare function
|
|
189
|
+
export declare function index(offset: {
|
|
190
|
+
pos: PosInfo;
|
|
191
|
+
s: string;
|
|
192
|
+
d: Expression;
|
|
193
|
+
} | null): AstElement;
|
|
189
194
|
/**
|
|
190
195
|
* Returns an AST element that represents an offset for a JR (jump relative) opcode.
|
|
191
196
|
* Retourne un élément de l'AST qui représente un décalage pour un saut relatif JR.
|
|
@@ -253,4 +258,6 @@ export declare function dataWords(_: PosInfo, data0: WordValue, data: InnerWord[
|
|
|
253
258
|
* La valeur utilisée pour initialiser le bloc.
|
|
254
259
|
*/
|
|
255
260
|
export declare function dataBlock(pos0: PosInfo, length: Expression, pos1: PosInfo | undefined, value: Expression | undefined): AstElement;
|
|
261
|
+
export declare function labelValue(pos: PosInfo, name: string): (pc: Address, mustExist: boolean) => number | null;
|
|
262
|
+
export declare function value(nn: number): (pc: Address, mustExist: boolean) => number;
|
|
256
263
|
export {};
|
package/lib/compiler/Labels.d.ts
CHANGED
|
@@ -17,11 +17,13 @@
|
|
|
17
17
|
* Copyrights: Copyright (C) 2023 Sebastien Andrivet
|
|
18
18
|
*/
|
|
19
19
|
import { Expression, PosInfo } from "../grammar/z80";
|
|
20
|
+
import { Address, Position } from '../types/Types';
|
|
20
21
|
/**
|
|
21
22
|
* Reset the labels.
|
|
22
23
|
* Supprime toutes les étiquettes.
|
|
23
24
|
*/
|
|
24
25
|
declare function resetLabels(): void;
|
|
26
|
+
declare function resetLabelsRecursion(): void;
|
|
25
27
|
/**
|
|
26
28
|
* Add a label.
|
|
27
29
|
* Ajoute une étiquette.
|
|
@@ -32,7 +34,7 @@ declare function resetLabels(): void;
|
|
|
32
34
|
* @param value The value of the label (if known) or null (if unknown).
|
|
33
35
|
* La valeur de l'étiquette (si connue) ou null (si inconnue).
|
|
34
36
|
*/
|
|
35
|
-
declare function addLabel(pos:
|
|
37
|
+
declare function addLabel(pos: Position, name: string, value: number | null): void;
|
|
36
38
|
/**
|
|
37
39
|
* Add a label and its associated expression.
|
|
38
40
|
* Ajoute une étiquette et son expression associée.
|
|
@@ -47,14 +49,16 @@ declare function addLabelExpression(_: PosInfo, name: string, expression: Expres
|
|
|
47
49
|
/**
|
|
48
50
|
* Get the value associated with a label.
|
|
49
51
|
* Obtient la valeur associée avec une étiquette.
|
|
52
|
+
* @param pc: Current program counter (PC).
|
|
50
53
|
* @param name The name of the label.
|
|
51
54
|
* Le nom de l'étiquette.
|
|
52
|
-
* @param
|
|
53
|
-
*
|
|
55
|
+
* @param pos Where this label is used.
|
|
56
|
+
* @param setUsed If set, mark the label as used.
|
|
57
|
+
* @param mustExist If set, the value of the label has to be known (not null).
|
|
54
58
|
* @return The value associated with a label or null if it is unknown.
|
|
55
59
|
* La valeur associée avec l'étiquette ou null si elle est inconnue.
|
|
56
60
|
*/
|
|
57
|
-
declare function getLabelValue(name: string, setUsed
|
|
61
|
+
declare function getLabelValue(pc: Address, name: string, pos: Position, setUsed: boolean, mustExist: boolean): number | null;
|
|
58
62
|
/**
|
|
59
63
|
* Is a label used in the program or only declared?
|
|
60
64
|
* Est-ce qu'une étiquette a été utilisée ou seulement déclarée ?
|
|
@@ -64,9 +68,4 @@ declare function getLabelValue(name: string, setUsed?: boolean): number | null;
|
|
|
64
68
|
* true si l'étiquette a été utilisée, false sinon.
|
|
65
69
|
*/
|
|
66
70
|
declare function isLabelUsed(name: string): boolean | undefined;
|
|
67
|
-
|
|
68
|
-
* Get the list of labels with an unknown value.
|
|
69
|
-
* Retourne la liste des étiquettes avec une valeur inconnue.
|
|
70
|
-
*/
|
|
71
|
-
declare function getUnknownLabels(): string[];
|
|
72
|
-
export { resetLabels, addLabel, addLabelExpression, getLabelValue, isLabelUsed, getUnknownLabels };
|
|
71
|
+
export { resetLabels, resetLabelsRecursion, addLabel, addLabelExpression, getLabelValue, isLabelUsed };
|