@andrivet/z80-assembler 1.0.0 → 1.2.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 +18 -0
- package/README.md +54 -0
- package/index.js +249 -9
- package/index.mjs +3141 -2903
- package/lib/compiler/Assets.d.ts +25 -0
- package/lib/compiler/Ast.d.ts +77 -22
- package/lib/compiler/Compiler.d.ts +30 -5
- package/lib/compiler/Formatter.d.ts +23 -1
- package/lib/compiler/Generator.d.ts +15 -15
- package/lib/compiler/Labels.d.ts +28 -2
- package/lib/grammar/LowLevel.d.ts +47 -10
- package/lib/grammar/Parse.d.ts +47 -8
- package/lib/grammar/z80.d.ts +234 -276
- package/lib/types/Error.d.ts +35 -6
- package/lib/types/Types.d.ts +16 -1
- package/package.json +10 -2
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 1.2.0 - June 20, 2023
|
|
4
|
+
|
|
5
|
+
* Solve issue with expression starting with an open parenthesis
|
|
6
|
+
* More comment (english and french)
|
|
7
|
+
|
|
8
|
+
## 1.1.0 - June 13, 2023
|
|
9
|
+
|
|
10
|
+
* Add special handling of ZX81 device
|
|
11
|
+
* Only allow ZX81 string (ASCII string do not make sense)
|
|
12
|
+
* Publication on GitHub Pages using GitHub Actions
|
|
13
|
+
|
|
14
|
+
## 1.0.0 - June 5, 2023
|
|
15
|
+
|
|
16
|
+
* First public version
|
|
17
|
+
|
|
18
|
+
|
package/README.md
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# z80-assembler
|
|
2
|
+
|
|
3
|
+
A Z80 assembler library entirely written in Typescript and derived from a PEG grammar.
|
|
4
|
+
It optimized for the old ZX81 computer but can also be used with any other Z80 targets.
|
|
5
|
+
|
|
6
|
+
## Demo application
|
|
7
|
+
|
|
8
|
+
A demo application is available: https://andrivet.github.io/z80-assembler/.
|
|
9
|
+
|
|
10
|
+
## Quick guide to use the library
|
|
11
|
+
|
|
12
|
+
To install the library:
|
|
13
|
+
|
|
14
|
+
```
|
|
15
|
+
$ npm install @andrivet/z80-assembler
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
The main function is simply called `compile`. It takes three arguments:
|
|
19
|
+
|
|
20
|
+
* the name of the source file
|
|
21
|
+
* the Z80 source code to compile
|
|
22
|
+
* a function used to return the content of included files
|
|
23
|
+
|
|
24
|
+
It returns an object of type `CompilationInfo` with the following fields:
|
|
25
|
+
|
|
26
|
+
* `outputName`: The name of the output as set by the `output` directive.
|
|
27
|
+
* `bytes`: A array of numbers. Each element represents a byte of the generated machine code.
|
|
28
|
+
* `sld`: The Source Level Debugging data as a string. This is used in order to debug the code.
|
|
29
|
+
* `errs`: An array of errors
|
|
30
|
+
|
|
31
|
+
A typical way to use the function is:
|
|
32
|
+
|
|
33
|
+
```
|
|
34
|
+
const info = compile(filepath, code, handleGetFileCode);
|
|
35
|
+
if(info.errs.length > 0)
|
|
36
|
+
displayErrors(info.errs);
|
|
37
|
+
else
|
|
38
|
+
saveOutput(info.outputName, info.bytes);
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
You can find a complete example in the [demo application](https://github.com/andrivet/z80-assembler/), in particular in the `app.tsx` file.
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
## Source code
|
|
45
|
+
|
|
46
|
+
The source code is published on GitHub: https://github.com/andrivet/z80-assembler/.
|
|
47
|
+
|
|
48
|
+
## Licence
|
|
49
|
+
|
|
50
|
+
This library and associated application are released under GPLv3.
|
|
51
|
+
|
|
52
|
+
## Copyrights
|
|
53
|
+
|
|
54
|
+
Copyright (C) 2023 Sebastien Andrivet
|