@andrivet/z80-assembler 1.2.0 → 1.3.1
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 +13 -0
- package/index.d.ts +2 -2
- package/index.js +92 -29
- package/index.mjs +1789 -2190
- package/lib/compiler/Assets.d.ts +0 -9
- package/lib/compiler/Ast.d.ts +14 -60
- package/lib/compiler/Compiler.d.ts +0 -25
- package/lib/compiler/Formatter.d.ts +0 -13
- package/lib/compiler/Generator.d.ts +0 -1
- package/lib/compiler/Labels.d.ts +9 -34
- package/lib/grammar/LowLevel.d.ts +0 -37
- package/lib/grammar/Parse.d.ts +0 -29
- package/lib/grammar/z80.d.ts +258 -648
- package/lib/types/Error.d.ts +5 -35
- package/lib/types/Types.d.ts +9 -17
- package/package.json +2 -2
package/lib/compiler/Assets.d.ts
CHANGED
|
@@ -7,15 +7,6 @@
|
|
|
7
7
|
* License: GPLv3
|
|
8
8
|
* Copyrights: Copyright (C) 2023 Sebastien Andrivet
|
|
9
9
|
*/
|
|
10
|
-
/**
|
|
11
|
-
* Assembler Z80 en Typescript
|
|
12
|
-
*
|
|
13
|
-
* Fichier: Assets.ts
|
|
14
|
-
* Description: Ressources utilisées par le compilateur and emballées par Vite
|
|
15
|
-
* Author: Sebastien Andrivet
|
|
16
|
-
* License: GPLv3
|
|
17
|
-
* Copyrights: Copyright (C) 2023 Sebastien Andrivet
|
|
18
|
-
*/
|
|
19
10
|
import assetCharacters from '../assets/code/characters.zx81?raw';
|
|
20
11
|
import assetSystemVariables from '../assets/code/system-variables.zx81?raw';
|
|
21
12
|
import assetBasicLine1 from '../assets/code/basic-line1.zx81?raw';
|
package/lib/compiler/Ast.d.ts
CHANGED
|
@@ -7,37 +7,23 @@
|
|
|
7
7
|
* License: GPLv3
|
|
8
8
|
* Copyrights: Copyright (C) 2023 Sebastien Andrivet
|
|
9
9
|
*/
|
|
10
|
-
|
|
11
|
-
* Assembler Z80 en Typescript
|
|
12
|
-
*
|
|
13
|
-
* Fichier: Ast.ts
|
|
14
|
-
* Description: Types pour construire un arbre syntaxique abstrait.
|
|
15
|
-
* Author: Sebastien Andrivet
|
|
16
|
-
* License: GPLv3
|
|
17
|
-
* Copyrights: Copyright (C) 2023 Sebastien Andrivet
|
|
18
|
-
*/
|
|
19
|
-
import { bytes } from '../types/Types';
|
|
10
|
+
import { Address, bytes } from '../types/Types';
|
|
20
11
|
import { ByteValue, Expression, PosInfo, WordValue } from "../grammar/z80";
|
|
21
12
|
/**
|
|
22
|
-
* A function
|
|
23
|
-
* Une function qui ne prend pas d'argument et qui retourne un nombre (s'il est connu) ou null (s'il est inconnu).
|
|
13
|
+
* A function returning a number (if it is known) or null (if it is unknown).
|
|
24
14
|
*/
|
|
25
|
-
export type EvalFunc = () => number | null;
|
|
15
|
+
export type EvalFunc = (pc: Address, mustExist: boolean) => number | null;
|
|
26
16
|
/**
|
|
27
17
|
* An abstract element generated by the parser.
|
|
28
|
-
* Un élément abstrait générà par l'analyseur.
|
|
29
18
|
*/
|
|
30
19
|
export interface AstBase {
|
|
31
20
|
/**
|
|
32
21
|
* The number of bytes that will be generated by this element.
|
|
33
|
-
* Le nombre d'octets générés par cet élément.
|
|
34
22
|
*/
|
|
35
23
|
get size(): number;
|
|
36
24
|
/**
|
|
37
25
|
* Generate actual bytes.
|
|
38
|
-
* Génération des octets
|
|
39
26
|
* @param instructionAddress Address of the next byte to generate,
|
|
40
|
-
* Adresse du prochain octet à générer.
|
|
41
27
|
*/
|
|
42
28
|
generate(instructionAddress: number): bytes;
|
|
43
29
|
}
|
|
@@ -93,13 +79,9 @@ type BinaryOperation = (a: number, b: number) => number;
|
|
|
93
79
|
type UnaryOperation = (a: number) => number;
|
|
94
80
|
/**
|
|
95
81
|
* A Binary operation such as: 2 * 4.
|
|
96
|
-
* Une expression binaire telle que: 2 * 4.
|
|
97
82
|
* @param left Left side of the binary function.
|
|
98
|
-
* Le coté gauche de l'opération binaire.
|
|
99
83
|
* @param right Right side of the binary function.
|
|
100
|
-
* Le coté droit de l'opération binaire
|
|
101
84
|
* @param op Operation to be applied to the left and right side.
|
|
102
|
-
* L'opération à appliquer aux opérandes
|
|
103
85
|
*/
|
|
104
86
|
export declare function binaryOperation<Operation extends BinaryOperation, Inner extends Evaluable, Left extends InnerExpression<Inner>, Right extends Evaluable>(left: Left | null, right: Right, op: Operation): EvalFunc;
|
|
105
87
|
/**
|
|
@@ -122,13 +104,9 @@ interface InnerOp<E extends Evaluable> extends InnerExpression<E> {
|
|
|
122
104
|
}
|
|
123
105
|
/**
|
|
124
106
|
* A Binary operation such as: 2 * 4.
|
|
125
|
-
* Une expression binaire telle que: 2 * 4.
|
|
126
107
|
* @param left Left side of the binary function.
|
|
127
|
-
* Le coté gauche de l'opération binaire.
|
|
128
108
|
* @param right Right side of the binary function.
|
|
129
|
-
* Le coté droit de l'opération binaire
|
|
130
109
|
* @param map Map the operations to be applied to the left and right side.
|
|
131
|
-
* Une correspondance pour les opérations à appliquer aux opérandes.
|
|
132
110
|
*/
|
|
133
111
|
export declare function binaryOperations<Inner extends Evaluable, Left extends InnerOp<Inner>, Right extends Evaluable>(left: Left | null, right: Right, map: BinaryOperationsMap): EvalFunc;
|
|
134
112
|
/**
|
|
@@ -160,97 +138,73 @@ export declare const operatorInvert: (a: number) => number;
|
|
|
160
138
|
export declare const operatorIdentity: (a: number) => number;
|
|
161
139
|
/**
|
|
162
140
|
* Returns an AST element that represents the low part of a little-endian 16-bit value.
|
|
163
|
-
* Retourne un élément de l'AST qui représente la partie basse d'une valeur 16 bits en petit boutiste.
|
|
164
141
|
* @param pos The position of the element in the source.
|
|
165
|
-
* La position de l'élément dans le code source.
|
|
166
142
|
* @param e The 16-bit value.
|
|
167
|
-
* La valeur 16-bit.
|
|
168
143
|
*/
|
|
169
144
|
export declare function value16LE(pos: PosInfo, e: Expression): AstElement;
|
|
170
145
|
/**
|
|
171
146
|
* Returns an AST element that represents an 8-bit unsigned value.
|
|
172
|
-
* Retourne un élément de l'AST qui représente une valeur 8 bits.
|
|
173
147
|
* @param pos The position of the element in the source.
|
|
174
|
-
* La position de l'élément dans le code source.
|
|
175
148
|
* @param e The 8-bit unsigned value.
|
|
176
|
-
* La valeur 8-bit.
|
|
177
149
|
*/
|
|
178
150
|
export declare function value8(pos: PosInfo, e: Expression): AstElement;
|
|
179
151
|
/**
|
|
180
|
-
* Returns an AST element that represents an 8-bit signed
|
|
181
|
-
*
|
|
182
|
-
*
|
|
183
|
-
*
|
|
184
|
-
* @param s The sign of the value.
|
|
185
|
-
* @param e The 8-bit signed value
|
|
186
|
-
* La valeur 8-bit signée.
|
|
152
|
+
* Returns an AST element that represents an 8-bit signed offset for IX or IY.
|
|
153
|
+
* @offset The offset for IX or IY with:
|
|
154
|
+
* pos The position of the element in the source.
|
|
155
|
+
* s The sign of the value.
|
|
187
156
|
*/
|
|
188
|
-
export declare function
|
|
157
|
+
export declare function index(offset: {
|
|
158
|
+
pos: PosInfo;
|
|
159
|
+
s: string;
|
|
160
|
+
d: Expression;
|
|
161
|
+
} | null): AstElement;
|
|
189
162
|
/**
|
|
190
163
|
* Returns an AST element that represents an offset for a JR (jump relative) opcode.
|
|
191
|
-
* Retourne un élément de l'AST qui représente un décalage pour un saut relatif JR.
|
|
192
164
|
* @param pos The position of the element in the source.
|
|
193
|
-
* La position de l'élément dans le code source.
|
|
194
165
|
* @param e The offset value.
|
|
195
|
-
* La valeur du décalage.
|
|
196
166
|
*/
|
|
197
167
|
export declare function jrOffset(pos: PosInfo, e: Expression): AstElement;
|
|
198
168
|
/**
|
|
199
169
|
* Returns an AST element that represents an relative offset for a JR (jump relative) opcode.
|
|
200
|
-
* Retourne un élément de l'AST qui représente un décalage relatif pour un saut relatif JR.
|
|
201
170
|
* @param pos The position of the element in the source.
|
|
202
|
-
* La position de l'élément dans le code source.
|
|
203
171
|
* @param label The label that will give the offset value
|
|
204
|
-
* L'étiquette qui va donner la valeur du décalage.
|
|
205
172
|
*/
|
|
206
173
|
export declare function jrRelativeOffset(pos: PosInfo, label: string): AstElement;
|
|
207
174
|
/**
|
|
208
175
|
* An Inner Byte, i.e. it contains an inner field that is a Byte value.
|
|
209
|
-
* Un octet interne, c.-à-d. qui contient un champ inner de type ByteValue.
|
|
210
176
|
*/
|
|
211
177
|
export interface InnerByte {
|
|
212
178
|
inner: ByteValue;
|
|
213
179
|
}
|
|
214
180
|
/**
|
|
215
181
|
* An Inner Word, i.e. it contains an inner field that is a Word value.
|
|
216
|
-
* Un mot interne, c.-à-d. qui contient un champ inner de type WordValue.
|
|
217
182
|
*/
|
|
218
183
|
export interface InnerWord {
|
|
219
184
|
inner: WordValue;
|
|
220
185
|
}
|
|
221
186
|
/**
|
|
222
187
|
* The bytes of a Byte directive.
|
|
223
|
-
* Les octets d'une directive Byte.
|
|
224
188
|
* @param _ The position of the bytes in the source code.
|
|
225
|
-
* La position des octets dans le code source.
|
|
226
189
|
* @param data0 The first byte.
|
|
227
|
-
* Le premier octet.
|
|
228
190
|
* @param data The other bytes.
|
|
229
|
-
* Les autres octets.
|
|
230
191
|
*/
|
|
231
192
|
export declare function dataBytes(_: PosInfo, data0: ByteValue, data: InnerByte[]): AstElements;
|
|
232
193
|
/**
|
|
233
194
|
* The words of a Word directive.
|
|
234
|
-
* Les mots d'une directive Word.
|
|
235
195
|
* @param _ The position of the words in the source code.
|
|
236
|
-
* La position des mots dans le code source.
|
|
237
196
|
* @param data0 The first word.
|
|
238
|
-
* Le premier mot.
|
|
239
197
|
* @param data The other words.
|
|
240
|
-
* Les autres mots.
|
|
241
198
|
*/
|
|
242
199
|
export declare function dataWords(_: PosInfo, data0: WordValue, data: InnerWord[]): AstElements;
|
|
243
200
|
/**
|
|
244
201
|
* The parameters of a block of data.
|
|
245
|
-
* Les paramètres d'un bloc de données.
|
|
246
202
|
* @param pos0 The position of the length in the source code.
|
|
247
|
-
* La position de la taille dans le code source.
|
|
248
203
|
* @param length The length (in bytes) of the block
|
|
249
|
-
* La taille (en octets) du bloc.
|
|
250
204
|
* @param pos1 The position of the value in the source code.
|
|
251
|
-
* La position de la valeur dans le code source.
|
|
252
205
|
* @param value The value used to initialize the block.
|
|
253
|
-
* La valeur utilisée pour initialiser le bloc.
|
|
254
206
|
*/
|
|
255
207
|
export declare function dataBlock(pos0: PosInfo, length: Expression, pos1: PosInfo | undefined, value: Expression | undefined): AstElement;
|
|
208
|
+
export declare function labelValue(pos: PosInfo, name: string): (pc: Address, mustExist: boolean) => number | null;
|
|
209
|
+
export declare function value(nn: number): (pc: Address, mustExist: boolean) => number;
|
|
256
210
|
export {};
|
|
@@ -7,20 +7,10 @@
|
|
|
7
7
|
* License: GPLv3
|
|
8
8
|
* Copyrights: Copyright (C) 2023 Sebastien Andrivet
|
|
9
9
|
*/
|
|
10
|
-
/**
|
|
11
|
-
* Assembler Z80 en Typescript
|
|
12
|
-
*
|
|
13
|
-
* Fichier: Compiler.ts
|
|
14
|
-
* Description: Compilateur (assembleur)
|
|
15
|
-
* Author: Sebastien Andrivet
|
|
16
|
-
* License: GPLv3
|
|
17
|
-
* Copyrights: Copyright (C) 2023 Sebastien Andrivet
|
|
18
|
-
*/
|
|
19
10
|
import { PosInfo } from "../grammar/z80";
|
|
20
11
|
import { CompilationInfo, LinesInfo } from "../types/Types";
|
|
21
12
|
/**
|
|
22
13
|
* Type of the internal data.
|
|
23
|
-
* Type pour l'état interne.
|
|
24
14
|
*/
|
|
25
15
|
interface ParseDate {
|
|
26
16
|
outputName: string;
|
|
@@ -34,45 +24,30 @@ interface ParseDate {
|
|
|
34
24
|
* Internal data (i.e. globals).
|
|
35
25
|
* Unfortunately, tsPEG does not allow to declare a context for the parsing.
|
|
36
26
|
* So instead, we use this ugly global.
|
|
37
|
-
* Données internes (c.-à-d. globales).
|
|
38
|
-
* Malheureusement, tsPEG ne permet pas de déclarer un contexte pour l'analyse.
|
|
39
|
-
* Donc à la place, j'utilise ces données globales assez horribles.
|
|
40
27
|
*/
|
|
41
28
|
declare const parseData: ParseDate;
|
|
42
29
|
/**
|
|
43
30
|
* Set the outputs names (output directive).
|
|
44
|
-
* Définit les noms des fichiers de sortie (directive output).
|
|
45
31
|
* @param filename Filename for the binary.
|
|
46
|
-
* Nom de fichier pour le binaire.
|
|
47
32
|
* @param sld Filename for the SLD.
|
|
48
|
-
* Nom de fichier pour le SLD.
|
|
49
33
|
*/
|
|
50
34
|
declare function setOutputName(filename: string, sld?: string): void;
|
|
51
35
|
/**
|
|
52
36
|
* Set the name of the target (device directive)
|
|
53
|
-
* Définit le nom de la cible (directive device).
|
|
54
37
|
* @param name The name of the device
|
|
55
|
-
* Le nom de l'appareil.
|
|
56
38
|
*/
|
|
57
39
|
declare function setDevice(name: string): void;
|
|
58
40
|
/**
|
|
59
41
|
* Include an assembly file (include directive).
|
|
60
|
-
* Inclut un fichier assembleur (directive include).
|
|
61
42
|
* @param pos Position of the include directive.
|
|
62
|
-
* Position de la directive.
|
|
63
43
|
* @param filename The filename of the file to be included.
|
|
64
|
-
* Le nom du fichier à inclure.
|
|
65
44
|
*/
|
|
66
45
|
declare function includeFile(pos: PosInfo, filename: string): LinesInfo;
|
|
67
46
|
/**
|
|
68
47
|
* Compile an assembly source code.
|
|
69
|
-
* Compile un fichier source assembleur.
|
|
70
48
|
* @param filepath The file path of the source code.
|
|
71
|
-
* Le chemin du code source.
|
|
72
49
|
* @param code The assembly source code.
|
|
73
|
-
* Le code source assembleur.
|
|
74
50
|
* @param getFileCode A function to get the content of included files.
|
|
75
|
-
* Une fonction pour obtenir le contenu d'un fichier inclus.
|
|
76
51
|
*/
|
|
77
52
|
declare function compile(filepath: string, code: string, getFileCode: (filename: string) => string): CompilationInfo;
|
|
78
53
|
export { parseData, compile, includeFile, setOutputName, setDevice };
|
|
@@ -7,18 +7,8 @@
|
|
|
7
7
|
* License: GPLv3
|
|
8
8
|
* Copyrights: Copyright (C) 2023 Sebastien Andrivet
|
|
9
9
|
*/
|
|
10
|
-
/**
|
|
11
|
-
* Assembler Z80 en Typescript
|
|
12
|
-
*
|
|
13
|
-
* Fichier: Formatter.ts
|
|
14
|
-
* Description: Formattage d'octets pour les afficher facilement
|
|
15
|
-
* Author: Sebastien Andrivet
|
|
16
|
-
* License: GPLv3
|
|
17
|
-
* Copyrights: Copyright (C) 2023 Sebastien Andrivet
|
|
18
|
-
*/
|
|
19
10
|
/**
|
|
20
11
|
* Represents a chunk of data to display binary.
|
|
21
|
-
* Représente un morceau de données pour afficher un binaire.
|
|
22
12
|
*/
|
|
23
13
|
interface Chunk {
|
|
24
14
|
address: string;
|
|
@@ -26,11 +16,8 @@ interface Chunk {
|
|
|
26
16
|
}
|
|
27
17
|
/**
|
|
28
18
|
* Format bytes to display them.
|
|
29
|
-
* Formate des octets pour les afficher.
|
|
30
19
|
* @param bytes An array of bytes.
|
|
31
|
-
* Un tableau d'octets.
|
|
32
20
|
* @param perLine Number of bytes per line.
|
|
33
|
-
* Le nombre d'octets par line.
|
|
34
21
|
*/
|
|
35
22
|
declare function formatBytes(bytes: number[], perLine: number): Chunk[];
|
|
36
23
|
export { formatBytes, Chunk };
|
package/lib/compiler/Labels.d.ts
CHANGED
|
@@ -7,66 +7,41 @@
|
|
|
7
7
|
* License: GPLv3
|
|
8
8
|
* Copyrights: Copyright (C) 2023 Sebastien Andrivet
|
|
9
9
|
*/
|
|
10
|
-
/**
|
|
11
|
-
* Assembler Z80 en Typescript
|
|
12
|
-
*
|
|
13
|
-
* Fichier: Labels.ts
|
|
14
|
-
* Description: Etiquettes associées à des emplacements mémoire.
|
|
15
|
-
* Author: Sebastien Andrivet
|
|
16
|
-
* License: GPLv3
|
|
17
|
-
* Copyrights: Copyright (C) 2023 Sebastien Andrivet
|
|
18
|
-
*/
|
|
19
10
|
import { Expression, PosInfo } from "../grammar/z80";
|
|
11
|
+
import { Address, Position } from '../types/Types';
|
|
20
12
|
/**
|
|
21
13
|
* Reset the labels.
|
|
22
|
-
* Supprime toutes les étiquettes.
|
|
23
14
|
*/
|
|
24
15
|
declare function resetLabels(): void;
|
|
16
|
+
declare function resetLabelsRecursion(): void;
|
|
25
17
|
/**
|
|
26
18
|
* Add a label.
|
|
27
|
-
* Ajoute une étiquette.
|
|
28
19
|
* @param pos The position of the label in the source code.
|
|
29
|
-
* La position de l'étiquette dans le code source.
|
|
30
20
|
* @param name The name of the label.
|
|
31
|
-
* Le nom de l'étiquette.
|
|
32
21
|
* @param value The value of the label (if known) or null (if unknown).
|
|
33
|
-
* La valeur de l'étiquette (si connue) ou null (si inconnue).
|
|
34
22
|
*/
|
|
35
|
-
declare function addLabel(pos:
|
|
23
|
+
declare function addLabel(pos: Position, name: string, value: number | null): void;
|
|
36
24
|
/**
|
|
37
25
|
* Add a label and its associated expression.
|
|
38
|
-
* Ajoute une étiquette et son expression associée.
|
|
39
26
|
* @param _ The position of the label in the source code.
|
|
40
|
-
* La position de l'étiquette dans le code source.
|
|
41
27
|
* @param name The name of the label.
|
|
42
|
-
* Le nom de l'étiquette.
|
|
43
28
|
* @param expression The expression that gives that value of the label.
|
|
44
|
-
* L'expression qui donne la valeur de l'étiquette.
|
|
45
29
|
*/
|
|
46
30
|
declare function addLabelExpression(_: PosInfo, name: string, expression: Expression): void;
|
|
47
31
|
/**
|
|
48
32
|
* Get the value associated with a label.
|
|
49
|
-
*
|
|
33
|
+
* @param pc Current program counter (PC).
|
|
50
34
|
* @param name The name of the label.
|
|
51
|
-
*
|
|
52
|
-
* @param setUsed
|
|
53
|
-
*
|
|
35
|
+
* @param pos Where this label is used.
|
|
36
|
+
* @param setUsed If set, mark the label as used.
|
|
37
|
+
* @param mustExist If set, the value of the label has to be known (not null).
|
|
54
38
|
* @return The value associated with a label or null if it is unknown.
|
|
55
|
-
* La valeur associée avec l'étiquette ou null si elle est inconnue.
|
|
56
39
|
*/
|
|
57
|
-
declare function getLabelValue(name: string, setUsed
|
|
40
|
+
declare function getLabelValue(pc: Address, name: string, pos: Position, setUsed: boolean, mustExist: boolean): number | null;
|
|
58
41
|
/**
|
|
59
42
|
* Is a label used in the program or only declared?
|
|
60
|
-
* Est-ce qu'une étiquette a été utilisée ou seulement déclarée ?
|
|
61
43
|
* @param name The name of the label.
|
|
62
|
-
* Le nom de l'étiquette.
|
|
63
44
|
* @return true if the label is used, false otherwise.
|
|
64
|
-
* true si l'étiquette a été utilisée, false sinon.
|
|
65
45
|
*/
|
|
66
46
|
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 };
|
|
47
|
+
export { resetLabels, resetLabelsRecursion, addLabel, addLabelExpression, getLabelValue, isLabelUsed };
|
|
@@ -7,99 +7,62 @@
|
|
|
7
7
|
* License: GPLv3
|
|
8
8
|
* Copyrights: Copyright (C) 2023 Sebastien Andrivet
|
|
9
9
|
*/
|
|
10
|
-
/**
|
|
11
|
-
* Assembler Z80 en Typescript
|
|
12
|
-
*
|
|
13
|
-
* Fichier: LoweLevel.ts
|
|
14
|
-
* Description: Fonctions de bas niveau pour l'analyseur.
|
|
15
|
-
* Author: Sebastien Andrivet
|
|
16
|
-
* License: GPLv3
|
|
17
|
-
* Copyrights: Copyright (C) 2023 Sebastien Andrivet
|
|
18
|
-
*/
|
|
19
10
|
import { byte } from "../types/Types";
|
|
20
11
|
/**
|
|
21
12
|
* Compute the binary representation of the r argument.
|
|
22
|
-
* Calcule la représentation binaire de l'argument r.
|
|
23
13
|
* @param r The argument of the opcode.
|
|
24
|
-
* L'argument du code assembleur.
|
|
25
14
|
* @param offset The number of bits to shift to the left.
|
|
26
|
-
* Le nombre de bits à décaler vers la gauche.
|
|
27
15
|
*/
|
|
28
16
|
export declare function r_bits(r: string, offset?: number): byte;
|
|
29
17
|
/**
|
|
30
18
|
* Compute the binary representation of the dd argument.
|
|
31
|
-
* Calcule la représentation binaire de l'argument dd.
|
|
32
19
|
* @param dd The argument of the opcode.
|
|
33
|
-
* L'argument du code assembleur.
|
|
34
20
|
* @param offset The number of bits to shift to the left.
|
|
35
|
-
* Le nombre de bits à décaler vers la gauche.
|
|
36
21
|
*/
|
|
37
22
|
export declare function dd_bits(dd: string, offset?: number): byte;
|
|
38
23
|
/**
|
|
39
24
|
* Compute the binary representation of the qq argument.
|
|
40
|
-
* Calcule la représentation binaire de l'argument qq.
|
|
41
25
|
* @param qq The argument of the opcode.
|
|
42
|
-
* L'argument du code assembleur.
|
|
43
26
|
* @param offset The number of bits to shift to the left.
|
|
44
|
-
* Le nombre de bits à décaler vers la gauche.
|
|
45
27
|
*/
|
|
46
28
|
export declare function qq_bits(qq: string, offset?: number): byte;
|
|
47
29
|
/**
|
|
48
30
|
* Compute the binary representation of the ss argument.
|
|
49
|
-
* Calcule la représentation binaire de l'argument ss.
|
|
50
31
|
* @param ss The argument of the opcode.
|
|
51
|
-
* L'argument du code assembleur.
|
|
52
32
|
* @param offset The number of bits to shift to the left.
|
|
53
|
-
* Le nombre de bits à décaler vers la gauche.
|
|
54
33
|
*/
|
|
55
34
|
export declare function ss_bits(ss: string, offset?: number): byte;
|
|
56
35
|
/**
|
|
57
36
|
* Compute the binary representation of the pp argument.
|
|
58
|
-
* Calcule la représentation binaire de l'argument pp.
|
|
59
37
|
* @param pp The argument of the opcode.
|
|
60
|
-
* L'argument du code assembleur.
|
|
61
38
|
* @param offset The number of bits to shift to the left.
|
|
62
|
-
* Le nombre de bits à décaler vers la gauche.
|
|
63
39
|
*/
|
|
64
40
|
export declare function pp_bits(pp: string, offset?: number): byte;
|
|
65
41
|
/**
|
|
66
42
|
* Compute the binary representation of the rr argument.
|
|
67
|
-
* Calcule la représentation binaire de l'argument rr.
|
|
68
43
|
* @param rr The argument of the opcode.
|
|
69
|
-
* L'argument du code assembleur.
|
|
70
44
|
* @param offset The number of bits to shift to the left.
|
|
71
|
-
* Le nombre de bits à décaler vers la gauche.
|
|
72
45
|
*/
|
|
73
46
|
export declare function rr_bits(rr: string, offset?: number): byte;
|
|
74
47
|
/**
|
|
75
48
|
* Compute the binary representation of the cc argument.
|
|
76
|
-
* Calcule la représentation binaire de l'argument cc.
|
|
77
49
|
* @param cc The argument of the opcode.
|
|
78
|
-
* L'argument du code assembleur.
|
|
79
50
|
* @param offset The number of bits to shift to the left.
|
|
80
|
-
* Le nombre de bits à décaler vers la gauche.
|
|
81
51
|
*/
|
|
82
52
|
export declare function cc_bits(cc: string, offset?: number): byte;
|
|
83
53
|
/**
|
|
84
54
|
* Compute the binary representation of the jj argument.
|
|
85
|
-
* Calcule la représentation binaire de l'argument jj.
|
|
86
55
|
* @param jj The argument of the opcode.
|
|
87
|
-
* L'argument du code assembleur.
|
|
88
56
|
*/
|
|
89
57
|
export declare function jj_bits(jj?: string): byte;
|
|
90
58
|
/**
|
|
91
59
|
* Compute the binary representation of the p argument.
|
|
92
|
-
* Calcule la représentation binaire de l'argument p.
|
|
93
60
|
* @param p The argument of the opcode.
|
|
94
|
-
* L'argument du code assembleur.
|
|
95
61
|
* @param offset The number of bits to shift to the left.
|
|
96
|
-
* Le nombre de bits à décaler vers la gauche.
|
|
97
62
|
*/
|
|
98
63
|
export declare function p_bits(p: number, offset?: number): byte;
|
|
99
64
|
/**
|
|
100
65
|
* Compute the binary representation of the mode argument.
|
|
101
|
-
* Calcule la représentation binaire de l'argument mode.
|
|
102
66
|
* @param mode The argument of the opcode.
|
|
103
|
-
* L'argument du code assembleur.
|
|
104
67
|
*/
|
|
105
68
|
export declare function imode(mode: string): byte;
|
package/lib/grammar/Parse.d.ts
CHANGED
|
@@ -7,71 +7,42 @@
|
|
|
7
7
|
* License: GPLv3
|
|
8
8
|
* Copyrights: Copyright (C) 2023 Sebastien Andrivet
|
|
9
9
|
*/
|
|
10
|
-
/**
|
|
11
|
-
* Assembler Z80 en Typescript
|
|
12
|
-
*
|
|
13
|
-
* Fichier: Parse.ts
|
|
14
|
-
* Description: Fonctions de conversion de chaines de caractères pour l'analyseur.
|
|
15
|
-
* Author: Sebastien Andrivet
|
|
16
|
-
* License: GPLv3
|
|
17
|
-
* Copyrights: Copyright (C) 2023 Sebastien Andrivet
|
|
18
|
-
*/
|
|
19
10
|
import { PosInfo } from "./z80";
|
|
20
11
|
/**
|
|
21
12
|
* Parse a number.
|
|
22
|
-
* Analyse un nombre.
|
|
23
13
|
* @param pos Position of the number in the source code.
|
|
24
|
-
* Position du nombre dans le code source.
|
|
25
14
|
* @param str The characters of the number.
|
|
26
|
-
* Les caractères du nombre.
|
|
27
15
|
* @param base The base of the number.
|
|
28
|
-
* La base du nombre.
|
|
29
16
|
* @param nbBytes The number of bytes to represent this number (1 or 2)
|
|
30
|
-
* Le nombre d'octets pour représenter ce nombre (1 ou 2)
|
|
31
17
|
*/
|
|
32
18
|
export declare function parseNumber(pos: PosInfo, str: string, base: number, nbBytes: number): number;
|
|
33
19
|
/**
|
|
34
20
|
* Parse a simple escape, i.e. a backslash followed by a character.
|
|
35
|
-
* Analyse un échappement simple, c.-à-d. une barre oblique inversée suivie d'un caractère.
|
|
36
21
|
* @param pos Position of the character in the source code.
|
|
37
|
-
* Position du caractère dans le code source.
|
|
38
22
|
* @param c The character after the backslash.
|
|
39
|
-
* Le caractère après la barre oblique inversée.
|
|
40
23
|
*/
|
|
41
24
|
export declare function parseSimpleEscape(pos: PosInfo, c: string): number[];
|
|
42
25
|
/**
|
|
43
26
|
* Parse an octal value.
|
|
44
|
-
* Analyse une valeur octale.
|
|
45
27
|
* @param pos Position of the value in the source code.
|
|
46
|
-
* Position de la valeur dans le code source.
|
|
47
28
|
* @param value The characters representing the value.
|
|
48
|
-
* Les caractères représentant la valeur.
|
|
49
29
|
*/
|
|
50
30
|
export declare function parseOctalEscape(pos: PosInfo, value: string): number[];
|
|
51
31
|
/**
|
|
52
32
|
* Parse a hexadecimal value.
|
|
53
|
-
* Analyse une valeur hexadécimale.
|
|
54
33
|
* @param pos Position of the value in the source code.
|
|
55
|
-
* Position de la valeur dans le code source.
|
|
56
34
|
* @param value The characters representing the value.
|
|
57
|
-
* Les caractères représentant la valeur.
|
|
58
35
|
*/
|
|
59
36
|
export declare function parseHexadecimalEscape(pos: PosInfo, value: string): number[];
|
|
60
37
|
/**
|
|
61
38
|
* Parse a ZX81 character written in ASCII.
|
|
62
|
-
* Analyse un caractère ZX81 écrit en ASCII.
|
|
63
39
|
* @param pos Position of the character in the source code.
|
|
64
|
-
* Position du caractère dans le code source.
|
|
65
40
|
* @param c The ASCII character.
|
|
66
|
-
* Le caractère ASCII.
|
|
67
41
|
*/
|
|
68
42
|
export declare function parseZX81Char(pos: PosInfo, c: string): [number];
|
|
69
43
|
/**
|
|
70
44
|
* Parse a ZX81 string written in ASCII.
|
|
71
|
-
* Analyse un chaine ZX81 écrit en ASCII.
|
|
72
45
|
* @param pos Position of the string in the source code.
|
|
73
|
-
* Position de la chaine dans le code source.
|
|
74
46
|
* @param str The ASCII string.
|
|
75
|
-
* La chaine ASCII.
|
|
76
47
|
*/
|
|
77
48
|
export declare function parseZX81String(pos: PosInfo, str: string): number[];
|