@andrivet/z80-assembler 1.4.0 → 1.4.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/{libs/z80-assembler/public/CHANGELOG.md → CHANGELOG.md} +8 -0
- package/README.md +27 -53
- package/{libs/z80-assembler/src/index.ts → index.d.ts} +1 -1
- package/index.js +312 -0
- package/index.mjs +6449 -0
- package/{libs/z80-assembler/src/lib/compiler/Assets.ts → lib/compiler/Assets.d.ts} +1 -6
- package/lib/compiler/Ast.d.ts +210 -0
- package/lib/compiler/Compiler.d.ts +53 -0
- package/lib/compiler/Formatter.d.ts +23 -0
- package/lib/compiler/Generator.d.ts +40 -0
- package/lib/compiler/Labels.d.ts +47 -0
- package/lib/grammar/LowLevel.d.ts +68 -0
- package/lib/grammar/Parse.d.ts +48 -0
- package/lib/grammar/z80.d.ts +2939 -0
- package/lib/types/Error.d.ts +62 -0
- package/{libs/z80-assembler/src/lib/types/Types.ts → lib/types/Types.d.ts} +11 -26
- package/package.json +14 -52
- package/.editorconfig +0 -13
- package/.eslintignore +0 -3
- package/.eslintrc.json +0 -35
- package/.github/workflows/node.js.yml +0 -47
- package/.prettierignore +0 -3
- package/.prettierrc +0 -3
- package/.vscode/extensions.json +0 -7
- package/apps/.gitkeep +0 -0
- package/apps/z80-assembler-app/.eslintrc.json +0 -18
- package/apps/z80-assembler-app/index.html +0 -16
- package/apps/z80-assembler-app/postcss.config.js +0 -24
- package/apps/z80-assembler-app/project.json +0 -70
- package/apps/z80-assembler-app/public/favicon.ico +0 -0
- package/apps/z80-assembler-app/public/logo.png +0 -0
- package/apps/z80-assembler-app/public/logo192.png +0 -0
- package/apps/z80-assembler-app/public/logo512.png +0 -0
- package/apps/z80-assembler-app/public/manifest.json +0 -25
- package/apps/z80-assembler-app/public/robots.txt +0 -3
- package/apps/z80-assembler-app/src/app/app.module.css +0 -0
- package/apps/z80-assembler-app/src/app/app.tsx +0 -122
- package/apps/z80-assembler-app/src/app/binary.tsx +0 -39
- package/apps/z80-assembler-app/src/app/editor.tsx +0 -228
- package/apps/z80-assembler-app/src/app/errors.tsx +0 -31
- package/apps/z80-assembler-app/src/app/footer.tsx +0 -20
- package/apps/z80-assembler-app/src/app/header.tsx +0 -57
- package/apps/z80-assembler-app/src/app/misc.ts +0 -13
- package/apps/z80-assembler-app/src/app/opcodes.tsx +0 -335
- package/apps/z80-assembler-app/src/assets/.gitkeep +0 -0
- package/apps/z80-assembler-app/src/assets/images/logo192.png +0 -0
- package/apps/z80-assembler-app/src/main.tsx +0 -22
- package/apps/z80-assembler-app/src/styles.css +0 -8
- package/apps/z80-assembler-app/tailwind.config.js +0 -28
- package/apps/z80-assembler-app/tsconfig.app.json +0 -22
- package/apps/z80-assembler-app/tsconfig.json +0 -21
- package/apps/z80-assembler-app/tsconfig.spec.json +0 -23
- package/apps/z80-assembler-app/vite.config.ts +0 -64
- package/assets/images/compile.png +0 -0
- package/assets/images/logo.png +0 -0
- package/assets/images/menu.png +0 -0
- package/assets/images/opcodes-load8.png +0 -0
- package/assets/images/opcodes.png +0 -0
- package/assets/images/open-dir.png +0 -0
- package/assets/images/z80-assembler-app.png +0 -0
- package/docs/assembly.md +0 -551
- package/docs/images/ZX81-0x00.png +0 -0
- package/docs/images/ZX81-0x0B.png +0 -0
- package/docs/images/ZX81-0x0C.png +0 -0
- package/docs/images/ZX81-0x0D.png +0 -0
- package/docs/images/ZX81-0x0E.png +0 -0
- package/docs/images/ZX81-0x0F.png +0 -0
- package/docs/images/ZX81-0x10.png +0 -0
- package/docs/images/ZX81-0x11.png +0 -0
- package/docs/images/ZX81-0x12.png +0 -0
- package/docs/images/ZX81-0x13.png +0 -0
- package/docs/images/ZX81-0x14.png +0 -0
- package/docs/images/ZX81-0x15.png +0 -0
- package/docs/images/ZX81-0x16.png +0 -0
- package/docs/images/ZX81-0x17.png +0 -0
- package/docs/images/ZX81-0x18.png +0 -0
- package/docs/images/ZX81-0x19.png +0 -0
- package/docs/images/ZX81-0x1A.png +0 -0
- package/docs/images/ZX81-0x1B.png +0 -0
- package/docs/images/ZX81-0x1C.png +0 -0
- package/docs/images/ZX81-0x1D.png +0 -0
- package/docs/images/ZX81-0x1E.png +0 -0
- package/docs/images/ZX81-0x1F.png +0 -0
- package/docs/images/ZX81-0x20.png +0 -0
- package/docs/images/ZX81-0x21.png +0 -0
- package/docs/images/ZX81-0x22.png +0 -0
- package/docs/images/ZX81-0x23.png +0 -0
- package/docs/images/ZX81-0x24.png +0 -0
- package/docs/images/ZX81-0x25.png +0 -0
- package/docs/images/ZX81-0x26.png +0 -0
- package/docs/images/ZX81-0x27.png +0 -0
- package/docs/images/ZX81-0x28.png +0 -0
- package/docs/images/ZX81-0x29.png +0 -0
- package/docs/images/ZX81-0x2A.png +0 -0
- package/docs/images/ZX81-0x2B.png +0 -0
- package/docs/images/ZX81-0x2C.png +0 -0
- package/docs/images/ZX81-0x2D.png +0 -0
- package/docs/images/ZX81-0x2E.png +0 -0
- package/docs/images/ZX81-0x2F.png +0 -0
- package/docs/images/ZX81-0x30.png +0 -0
- package/docs/images/ZX81-0x31.png +0 -0
- package/docs/images/ZX81-0x32.png +0 -0
- package/docs/images/ZX81-0x33.png +0 -0
- package/docs/images/ZX81-0x34.png +0 -0
- package/docs/images/ZX81-0x35.png +0 -0
- package/docs/images/ZX81-0x36.png +0 -0
- package/docs/images/ZX81-0x37.png +0 -0
- package/docs/images/ZX81-0x38.png +0 -0
- package/docs/images/ZX81-0x39.png +0 -0
- package/docs/images/ZX81-0x3A.png +0 -0
- package/docs/images/ZX81-0x3B.png +0 -0
- package/docs/images/ZX81-0x3C.png +0 -0
- package/docs/images/ZX81-0x3D.png +0 -0
- package/docs/images/ZX81-0x3E.png +0 -0
- package/docs/images/ZX81-0x3F.png +0 -0
- package/docs/images/ZX81-0x80.png +0 -0
- package/docs/images/ZX81-0x8B.png +0 -0
- package/docs/images/ZX81-0x8C.png +0 -0
- package/docs/images/ZX81-0x8D.png +0 -0
- package/docs/images/ZX81-0x8E.png +0 -0
- package/docs/images/ZX81-0x8F.png +0 -0
- package/docs/images/ZX81-0x90.png +0 -0
- package/docs/images/ZX81-0x91.png +0 -0
- package/docs/images/ZX81-0x92.png +0 -0
- package/docs/images/ZX81-0x93.png +0 -0
- package/docs/images/ZX81-0x94.png +0 -0
- package/docs/images/ZX81-0x95.png +0 -0
- package/docs/images/ZX81-0x96.png +0 -0
- package/docs/images/ZX81-0x97.png +0 -0
- package/docs/images/ZX81-0x98.png +0 -0
- package/docs/images/ZX81-0x99.png +0 -0
- package/docs/images/ZX81-0x9A.png +0 -0
- package/docs/images/ZX81-0x9B.png +0 -0
- package/docs/images/ZX81-0x9C.png +0 -0
- package/docs/images/ZX81-0x9D.png +0 -0
- package/docs/images/ZX81-0x9E.png +0 -0
- package/docs/images/ZX81-0x9F.png +0 -0
- package/docs/images/ZX81-0xA0.png +0 -0
- package/docs/images/ZX81-0xA1.png +0 -0
- package/docs/images/ZX81-0xA2.png +0 -0
- package/docs/images/ZX81-0xA3.png +0 -0
- package/docs/images/ZX81-0xA4.png +0 -0
- package/docs/images/ZX81-0xA5.png +0 -0
- package/docs/images/ZX81-0xA6.png +0 -0
- package/docs/images/ZX81-0xA7.png +0 -0
- package/docs/images/ZX81-0xA8.png +0 -0
- package/docs/images/ZX81-0xA9.png +0 -0
- package/docs/images/ZX81-0xAA.png +0 -0
- package/docs/images/ZX81-0xAB.png +0 -0
- package/docs/images/ZX81-0xAC.png +0 -0
- package/docs/images/ZX81-0xAD.png +0 -0
- package/docs/images/ZX81-0xAE.png +0 -0
- package/docs/images/ZX81-0xAF.png +0 -0
- package/docs/images/ZX81-0xB0.png +0 -0
- package/docs/images/ZX81-0xB1.png +0 -0
- package/docs/images/ZX81-0xB2.png +0 -0
- package/docs/images/ZX81-0xB3.png +0 -0
- package/docs/images/ZX81-0xB4.png +0 -0
- package/docs/images/ZX81-0xB5.png +0 -0
- package/docs/images/ZX81-0xB6.png +0 -0
- package/docs/images/ZX81-0xB7.png +0 -0
- package/docs/images/ZX81-0xB8.png +0 -0
- package/docs/images/ZX81-0xB9.png +0 -0
- package/docs/images/ZX81-0xBA.png +0 -0
- package/docs/images/ZX81-0xBB.png +0 -0
- package/docs/images/ZX81-0xBC.png +0 -0
- package/docs/images/ZX81-0xBD.png +0 -0
- package/docs/images/ZX81-0xBE.png +0 -0
- package/docs/images/ZX81-0xBF.png +0 -0
- package/libs/.gitkeep +0 -0
- package/libs/z80-assembler/.eslintrc.json +0 -18
- package/libs/z80-assembler/package.json +0 -20
- package/libs/z80-assembler/project.json +0 -35
- package/libs/z80-assembler/public/README.md +0 -54
- package/libs/z80-assembler/src/lib/assets/code/basic-end.zx81 +0 -4
- package/libs/z80-assembler/src/lib/assets/code/basic-line1.zx81 +0 -4
- package/libs/z80-assembler/src/lib/assets/code/basic-line2.zx81 +0 -9
- package/libs/z80-assembler/src/lib/assets/code/characters.zx81 +0 -190
- package/libs/z80-assembler/src/lib/assets/code/display.zx81 +0 -50
- package/libs/z80-assembler/src/lib/assets/code/system-variables.zx81 +0 -46
- package/libs/z80-assembler/src/lib/compiler/Ast.ts +0 -545
- package/libs/z80-assembler/src/lib/compiler/Compiler.test.ts +0 -2141
- package/libs/z80-assembler/src/lib/compiler/Compiler.ts +0 -185
- package/libs/z80-assembler/src/lib/compiler/Formatter.ts +0 -43
- package/libs/z80-assembler/src/lib/compiler/Generator.ts +0 -255
- package/libs/z80-assembler/src/lib/compiler/Labels.ts +0 -165
- package/libs/z80-assembler/src/lib/grammar/LowLevel.ts +0 -163
- package/libs/z80-assembler/src/lib/grammar/Parse.ts +0 -128
- package/libs/z80-assembler/src/lib/grammar/z80.peg +0 -1252
- package/libs/z80-assembler/src/lib/grammar/z80.ts +0 -10649
- package/libs/z80-assembler/src/lib/types/Error.ts +0 -105
- package/libs/z80-assembler/tsconfig.json +0 -23
- package/libs/z80-assembler/tsconfig.lib.json +0 -10
- package/libs/z80-assembler/tsconfig.spec.json +0 -19
- package/libs/z80-assembler/vite.config.ts +0 -58
- package/nx.json +0 -57
- package/tsconfig.base.json +0 -22
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Z80 Assembler in Typescript
|
|
3
|
+
*
|
|
4
|
+
* File: Error.ts
|
|
5
|
+
* Description: Compilation errors
|
|
6
|
+
* Author: Sebastien Andrivet
|
|
7
|
+
* License: GPLv3
|
|
8
|
+
* Copyrights: Copyright (C) 2023 Sebastien Andrivet
|
|
9
|
+
*/
|
|
10
|
+
import { SyntaxErr } from "../grammar/z80";
|
|
11
|
+
import { Position } from "./Types";
|
|
12
|
+
/**
|
|
13
|
+
* A compilation error.
|
|
14
|
+
*/
|
|
15
|
+
declare class CompilationError extends Error {
|
|
16
|
+
readonly position: Position;
|
|
17
|
+
/**
|
|
18
|
+
* Constructor.
|
|
19
|
+
* @param position Position (filename, line, offset) where the error occurred.
|
|
20
|
+
* @param message Description of the error.
|
|
21
|
+
*/
|
|
22
|
+
constructor(position: Position, message: string);
|
|
23
|
+
/**
|
|
24
|
+
* Format the error.
|
|
25
|
+
*/
|
|
26
|
+
toString(): string;
|
|
27
|
+
/**
|
|
28
|
+
* Format internal MatchAttempt.
|
|
29
|
+
* @param match The MatchAttempt to format.
|
|
30
|
+
* @private
|
|
31
|
+
*/
|
|
32
|
+
private static formatMatch;
|
|
33
|
+
/**
|
|
34
|
+
* Format a syntax error.
|
|
35
|
+
* @param err a syntax error.
|
|
36
|
+
* @private
|
|
37
|
+
*/
|
|
38
|
+
private static formatError;
|
|
39
|
+
/**
|
|
40
|
+
* Create a compilation error from a syntax error.
|
|
41
|
+
* @param filename Filename where the error occurred.
|
|
42
|
+
* @param e Syntax error.
|
|
43
|
+
*/
|
|
44
|
+
static fromSyntaxErr(filename: string, e: SyntaxErr): CompilationError;
|
|
45
|
+
/**
|
|
46
|
+
* Create a compilation error from different errors.
|
|
47
|
+
* @param filename Filename where the error occurred.
|
|
48
|
+
* @param e The error
|
|
49
|
+
*/
|
|
50
|
+
static fromAny(filename: string, e: any): CompilationError;
|
|
51
|
+
/**
|
|
52
|
+
* Check if an error is a compilation error (and cast the error in this case).
|
|
53
|
+
* @param err The error to check.
|
|
54
|
+
*/
|
|
55
|
+
static is(err: any): err is CompilationError;
|
|
56
|
+
/**
|
|
57
|
+
* Check if an error is an array of compilation errors (and cast the type in this case).
|
|
58
|
+
* @param err The error to check.
|
|
59
|
+
*/
|
|
60
|
+
static isArray(err: any): err is CompilationError[];
|
|
61
|
+
}
|
|
62
|
+
export { CompilationError };
|
|
@@ -7,56 +7,41 @@
|
|
|
7
7
|
* License: GPLv3
|
|
8
8
|
* Copyrights: Copyright (C) 2023 Sebastien Andrivet
|
|
9
9
|
*/
|
|
10
|
-
|
|
11
|
-
import {
|
|
12
|
-
import {CompilationError} from "./Error";
|
|
13
|
-
|
|
14
|
-
|
|
10
|
+
import { Line, PosInfo } from "../grammar/z80";
|
|
11
|
+
import { CompilationError } from "./Error";
|
|
15
12
|
/**
|
|
16
13
|
* A byte is represented by a number.
|
|
17
14
|
*/
|
|
18
15
|
type byte = number;
|
|
19
|
-
|
|
20
16
|
/**
|
|
21
17
|
* An array of bytes.
|
|
22
18
|
*/
|
|
23
19
|
type bytes = byte[];
|
|
24
|
-
|
|
25
20
|
/**
|
|
26
21
|
* An address is either a number (known) or null (unknown).
|
|
27
22
|
*/
|
|
28
23
|
type Address = number | null;
|
|
29
|
-
|
|
30
24
|
/**
|
|
31
25
|
* Information about lines.
|
|
32
26
|
*/
|
|
33
27
|
interface LinesInfo {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
// A filename associated with this lines.
|
|
37
|
-
filename: string;
|
|
28
|
+
lines: Line[];
|
|
29
|
+
filename: string;
|
|
38
30
|
}
|
|
39
|
-
|
|
40
31
|
/**
|
|
41
32
|
* The result of a compilation.
|
|
42
33
|
*/
|
|
43
34
|
interface CompilationInfo {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
// The Source Level Debugging data.
|
|
49
|
-
sld: string;
|
|
50
|
-
// The compilation errors.
|
|
51
|
-
errs: CompilationError[];
|
|
35
|
+
outputName: string;
|
|
36
|
+
bytes: bytes;
|
|
37
|
+
sld: string;
|
|
38
|
+
errs: CompilationError[];
|
|
52
39
|
}
|
|
53
|
-
|
|
54
40
|
/**
|
|
55
41
|
* Position in a source file.
|
|
56
42
|
*/
|
|
57
43
|
interface Position {
|
|
58
|
-
|
|
59
|
-
|
|
44
|
+
filename: string;
|
|
45
|
+
pos: PosInfo;
|
|
60
46
|
}
|
|
61
|
-
|
|
62
|
-
export {byte, bytes, Address, LinesInfo, CompilationInfo, Position}
|
|
47
|
+
export { byte, bytes, Address, LinesInfo, CompilationInfo, Position };
|
package/package.json
CHANGED
|
@@ -1,58 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@andrivet/z80-assembler",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.1",
|
|
4
|
+
"description": "A Z80 assembler entirely written in Typescript and derived from a PEG grammar.",
|
|
5
|
+
"author": "Sebastien Andrivet",
|
|
4
6
|
"license": "GPLv3",
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
|
|
8
|
-
"
|
|
9
|
-
"
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
"
|
|
13
|
-
"react": "^18.2.0",
|
|
14
|
-
"react-daisyui": "^4.1.2",
|
|
15
|
-
"react-dom": "^18.2.0",
|
|
16
|
-
"react-icons": "^4.9.0"
|
|
7
|
+
"type": "commonjs",
|
|
8
|
+
"keywords": [
|
|
9
|
+
"z80",
|
|
10
|
+
"assembler",
|
|
11
|
+
"ZX81"
|
|
12
|
+
],
|
|
13
|
+
"publishConfig": {
|
|
14
|
+
"access": "public"
|
|
17
15
|
},
|
|
18
|
-
"
|
|
19
|
-
"
|
|
20
|
-
"
|
|
21
|
-
"@nx/linter": "^16.3.1",
|
|
22
|
-
"@nx/react": "^16.3.1",
|
|
23
|
-
"@nx/vite": "^16.3.1",
|
|
24
|
-
"@nx/workspace": "^16.3.1",
|
|
25
|
-
"@swc/cli": "^0.5.1",
|
|
26
|
-
"@swc/core": "~1.3.61",
|
|
27
|
-
"@testing-library/react": "^14.0.0",
|
|
28
|
-
"@types/node": "^20.2.5",
|
|
29
|
-
"@types/react": "^18.2.8",
|
|
30
|
-
"@types/react-dom": "^18.2.4",
|
|
31
|
-
"@typescript-eslint/eslint-plugin": "^5.59.8",
|
|
32
|
-
"@typescript-eslint/parser": "^5.59.8",
|
|
33
|
-
"@vitejs/plugin-react": "^4.0.0",
|
|
34
|
-
"@vitest/coverage-c8": "~0.32.2",
|
|
35
|
-
"@vitest/ui": "~0.32.2",
|
|
36
|
-
"autoprefixer": "^10.4.14",
|
|
37
|
-
"eslint": "^8.57.1",
|
|
38
|
-
"eslint-config-prettier": "^8.8.0",
|
|
39
|
-
"eslint-plugin-cypress": "^2.13.3",
|
|
40
|
-
"eslint-plugin-import": "^2.27.5",
|
|
41
|
-
"eslint-plugin-jsx-a11y": "^6.7.1",
|
|
42
|
-
"eslint-plugin-react": "^7.32.2",
|
|
43
|
-
"eslint-plugin-react-hooks": "^4.6.0",
|
|
44
|
-
"gh-pages": "^5.0.0",
|
|
45
|
-
"jsdom": "~22.1.0",
|
|
46
|
-
"nx": "^16.3.1",
|
|
47
|
-
"postcss": "^8.4.24",
|
|
48
|
-
"prettier": "^2.8.8",
|
|
49
|
-
"tailwindcss": "^3.3.2",
|
|
50
|
-
"tspeg": "^3.3.2",
|
|
51
|
-
"typescript": "^5.1.3",
|
|
52
|
-
"vite": "^4.5.5",
|
|
53
|
-
"vite-plugin-dts": "^2.3.0",
|
|
54
|
-
"vite-plugin-eslint": "^1.8.1",
|
|
55
|
-
"vite-tsconfig-paths": "^4.2.0",
|
|
56
|
-
"vitest": "~0.32.2"
|
|
16
|
+
"repository": {
|
|
17
|
+
"type": "git",
|
|
18
|
+
"url": "https://github.com/andrivet/z80-assembler"
|
|
57
19
|
}
|
|
58
20
|
}
|
package/.editorconfig
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
# Editor configuration, see http://editorconfig.org
|
|
2
|
-
root = true
|
|
3
|
-
|
|
4
|
-
[*]
|
|
5
|
-
charset = utf-8
|
|
6
|
-
indent_style = space
|
|
7
|
-
indent_size = 2
|
|
8
|
-
insert_final_newline = true
|
|
9
|
-
trim_trailing_whitespace = true
|
|
10
|
-
|
|
11
|
-
[*.md]
|
|
12
|
-
max_line_length = off
|
|
13
|
-
trim_trailing_whitespace = false
|
package/.eslintignore
DELETED
package/.eslintrc.json
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"root": true,
|
|
3
|
-
"ignorePatterns": ["**/*"],
|
|
4
|
-
"plugins": ["@nx"],
|
|
5
|
-
"overrides": [
|
|
6
|
-
{
|
|
7
|
-
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
|
|
8
|
-
"rules": {
|
|
9
|
-
"@nx/enforce-module-boundaries": [
|
|
10
|
-
"error",
|
|
11
|
-
{
|
|
12
|
-
"enforceBuildableLibDependency": true,
|
|
13
|
-
"allow": [],
|
|
14
|
-
"depConstraints": [
|
|
15
|
-
{
|
|
16
|
-
"sourceTag": "*",
|
|
17
|
-
"onlyDependOnLibsWithTags": ["*"]
|
|
18
|
-
}
|
|
19
|
-
]
|
|
20
|
-
}
|
|
21
|
-
]
|
|
22
|
-
}
|
|
23
|
-
},
|
|
24
|
-
{
|
|
25
|
-
"files": ["*.ts", "*.tsx"],
|
|
26
|
-
"extends": ["plugin:@nx/typescript"],
|
|
27
|
-
"rules": {}
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
"files": ["*.js", "*.jsx"],
|
|
31
|
-
"extends": ["plugin:@nx/javascript"],
|
|
32
|
-
"rules": {}
|
|
33
|
-
}
|
|
34
|
-
]
|
|
35
|
-
}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
name: CD
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
push:
|
|
5
|
-
branches: [ "master" ]
|
|
6
|
-
pull_request:
|
|
7
|
-
branches: [ "master" ]
|
|
8
|
-
|
|
9
|
-
jobs:
|
|
10
|
-
build:
|
|
11
|
-
runs-on: ubuntu-latest
|
|
12
|
-
strategy:
|
|
13
|
-
matrix:
|
|
14
|
-
node-version: [16.x, 18.x, 20.x]
|
|
15
|
-
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
|
|
16
|
-
steps:
|
|
17
|
-
- name: Checkout repository
|
|
18
|
-
uses: actions/checkout@v3
|
|
19
|
-
- name: Use Node.js ${{ matrix.node-version }}
|
|
20
|
-
uses: actions/setup-node@v3
|
|
21
|
-
with:
|
|
22
|
-
node-version: ${{ matrix.node-version }}
|
|
23
|
-
cache: 'npm'
|
|
24
|
-
- name: Install dependencies
|
|
25
|
-
run: npm ci --legacy-peer-deps
|
|
26
|
-
- name: Build
|
|
27
|
-
run: npx nx build z80-assembler-app --prod --baseHref=/z80-assembler/
|
|
28
|
-
- name: Run tests
|
|
29
|
-
run: npx nx test z80-assembler
|
|
30
|
-
- name: Upload artifact
|
|
31
|
-
uses: actions/upload-pages-artifact@v1
|
|
32
|
-
with:
|
|
33
|
-
path: dist/apps/z80-assembler-app
|
|
34
|
-
|
|
35
|
-
deploy:
|
|
36
|
-
needs: build
|
|
37
|
-
permissions:
|
|
38
|
-
pages: write
|
|
39
|
-
id-token: write
|
|
40
|
-
environment:
|
|
41
|
-
name: github-pages
|
|
42
|
-
url: ${{ steps.deployment.outputs.page_url }}
|
|
43
|
-
runs-on: ubuntu-latest
|
|
44
|
-
steps:
|
|
45
|
-
- name: Deploy to GitHub Pages
|
|
46
|
-
id: deployment
|
|
47
|
-
uses: actions/deploy-pages@v2
|
package/.prettierignore
DELETED
package/.prettierrc
DELETED
package/.vscode/extensions.json
DELETED
package/apps/.gitkeep
DELETED
|
File without changes
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": ["plugin:@nx/react", "../../.eslintrc.json"],
|
|
3
|
-
"ignorePatterns": ["!**/*"],
|
|
4
|
-
"overrides": [
|
|
5
|
-
{
|
|
6
|
-
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
|
|
7
|
-
"rules": {}
|
|
8
|
-
},
|
|
9
|
-
{
|
|
10
|
-
"files": ["*.ts", "*.tsx"],
|
|
11
|
-
"rules": {}
|
|
12
|
-
},
|
|
13
|
-
{
|
|
14
|
-
"files": ["*.js", "*.jsx"],
|
|
15
|
-
"rules": {}
|
|
16
|
-
}
|
|
17
|
-
]
|
|
18
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="utf-8" />
|
|
5
|
-
<title>Z80 Assembler in Typescript</title>
|
|
6
|
-
<base href="/" />
|
|
7
|
-
|
|
8
|
-
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
9
|
-
<link rel="icon" type="image/x-icon" href="/favicon.ico" />
|
|
10
|
-
<link rel="stylesheet" href="/src/styles.css" />
|
|
11
|
-
</head>
|
|
12
|
-
<body>
|
|
13
|
-
<div id="root"></div>
|
|
14
|
-
<script type="module" src="/src/main.tsx"></script>
|
|
15
|
-
</body>
|
|
16
|
-
</html>
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Z80 Assembler in Typescript
|
|
3
|
-
*
|
|
4
|
-
* File: postcss.config.js
|
|
5
|
-
* Description: Configuration for PostCSS
|
|
6
|
-
* Author: Sebastien Andrivet
|
|
7
|
-
* License: GPLv3
|
|
8
|
-
* Copyrights: Copyright (C) 2023 Sebastien Andrivet
|
|
9
|
-
*/
|
|
10
|
-
const { join } = require('path');
|
|
11
|
-
|
|
12
|
-
// Note: If you use library-specific PostCSS/Tailwind configuration then you should remove the `postcssConfig` build
|
|
13
|
-
// option from your application's configuration (i.e. project.json).
|
|
14
|
-
//
|
|
15
|
-
// See: https://nx.dev/guides/using-tailwind-css-in-react#step-4:-applying-configuration-to-libraries
|
|
16
|
-
|
|
17
|
-
module.exports = {
|
|
18
|
-
plugins: {
|
|
19
|
-
tailwindcss: {
|
|
20
|
-
config: join(__dirname, 'tailwind.config.js'),
|
|
21
|
-
},
|
|
22
|
-
autoprefixer: {},
|
|
23
|
-
},
|
|
24
|
-
};
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "z80-assembler-app",
|
|
3
|
-
"$schema": "../../node_modules/nx/schemas/project-schema.json",
|
|
4
|
-
"sourceRoot": "apps/z80-assembler-app/src",
|
|
5
|
-
"projectType": "application",
|
|
6
|
-
"targets": {
|
|
7
|
-
"build": {
|
|
8
|
-
"executor": "@nx/vite:build",
|
|
9
|
-
"outputs": ["{options.outputPath}"],
|
|
10
|
-
"defaultConfiguration": "production",
|
|
11
|
-
"options": {
|
|
12
|
-
"outputPath": "dist/apps/z80-assembler-app"
|
|
13
|
-
},
|
|
14
|
-
"configurations": {
|
|
15
|
-
"development": {
|
|
16
|
-
"mode": "development"
|
|
17
|
-
},
|
|
18
|
-
"production": {
|
|
19
|
-
"mode": "production"
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
},
|
|
23
|
-
"dev": {
|
|
24
|
-
"executor": "@nx/vite:dev-server",
|
|
25
|
-
"defaultConfiguration": "development",
|
|
26
|
-
"options": {
|
|
27
|
-
"buildTarget": "z80-assembler-app:build"
|
|
28
|
-
},
|
|
29
|
-
"configurations": {
|
|
30
|
-
"development": {
|
|
31
|
-
"buildTarget": "z80-assembler-app:build:development",
|
|
32
|
-
"hmr": true
|
|
33
|
-
},
|
|
34
|
-
"production": {
|
|
35
|
-
"buildTarget": "z80-assembler-app:build:production",
|
|
36
|
-
"hmr": false
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
},
|
|
40
|
-
"preview": {
|
|
41
|
-
"executor": "@nx/vite:preview-server",
|
|
42
|
-
"defaultConfiguration": "development",
|
|
43
|
-
"options": {
|
|
44
|
-
"buildTarget": "z80-assembler-app:build"
|
|
45
|
-
},
|
|
46
|
-
"configurations": {
|
|
47
|
-
"development": {
|
|
48
|
-
"buildTarget": "z80-assembler-app:build:development"
|
|
49
|
-
},
|
|
50
|
-
"production": {
|
|
51
|
-
"buildTarget": "z80-assembler-app:build:production"
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
},
|
|
55
|
-
"lint": {
|
|
56
|
-
"executor": "@nx/linter:eslint",
|
|
57
|
-
"outputs": ["{options.outputFile}"],
|
|
58
|
-
"options": {
|
|
59
|
-
"lintFilePatterns": ["apps/z80-assembler-app/**/*.{ts,tsx,js,jsx}"]
|
|
60
|
-
}
|
|
61
|
-
},
|
|
62
|
-
"serve-static": {
|
|
63
|
-
"executor": "@nx/web:file-server",
|
|
64
|
-
"options": {
|
|
65
|
-
"buildTarget": "z80-assembler-app:build"
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
},
|
|
69
|
-
"tags": []
|
|
70
|
-
}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"short_name": "React App",
|
|
3
|
-
"name": "Create React App Sample",
|
|
4
|
-
"icons": [
|
|
5
|
-
{
|
|
6
|
-
"src": "favicon.ico",
|
|
7
|
-
"sizes": "64x64 32x32 24x24 16x16",
|
|
8
|
-
"type": "image/x-icon"
|
|
9
|
-
},
|
|
10
|
-
{
|
|
11
|
-
"src": "logo192.png",
|
|
12
|
-
"type": "image/png",
|
|
13
|
-
"sizes": "192x192"
|
|
14
|
-
},
|
|
15
|
-
{
|
|
16
|
-
"src": "logo512.png",
|
|
17
|
-
"type": "image/png",
|
|
18
|
-
"sizes": "512x512"
|
|
19
|
-
}
|
|
20
|
-
],
|
|
21
|
-
"start_url": ".",
|
|
22
|
-
"display": "standalone",
|
|
23
|
-
"theme_color": "#000000",
|
|
24
|
-
"background_color": "#ffffff"
|
|
25
|
-
}
|
|
File without changes
|
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Z80 Assembler in Typescript
|
|
3
|
-
*
|
|
4
|
-
* File: app.tsx
|
|
5
|
-
* Description: Application view
|
|
6
|
-
* Author: Sebastien Andrivet
|
|
7
|
-
* License: GPLv3
|
|
8
|
-
* Copyrights: Copyright (C) 2023 Sebastien Andrivet
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
12
|
-
import styles from './app.module.css';
|
|
13
|
-
|
|
14
|
-
import React, {useRef, useState} from 'react';
|
|
15
|
-
import {AppOpcodes} from "./opcodes";
|
|
16
|
-
import {Chunk, CompilationError, compile, formatBytes} from "@andrivet/z80-assembler";
|
|
17
|
-
import AppFooter from "./footer";
|
|
18
|
-
import AppHeader from "./header";
|
|
19
|
-
import AppBinary from "./binary";
|
|
20
|
-
import AppEditor, {AppEditorHandlers} from "./editor";
|
|
21
|
-
import Errors from "./errors";
|
|
22
|
-
import {closeDropdown} from "./misc";
|
|
23
|
-
import {fileSave} from "browser-fs-access";
|
|
24
|
-
|
|
25
|
-
interface BinaryOrOpCodesProps {
|
|
26
|
-
showOpCodes: boolean,
|
|
27
|
-
chunks: Chunk[] | undefined;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
function BinaryOrOpCodes({showOpCodes, chunks}: BinaryOrOpCodesProps) {
|
|
31
|
-
return showOpCodes ? <AppOpcodes /> : <AppBinary chunks={chunks} />;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export function App() {
|
|
35
|
-
const [code, setCode] = useState<string>('');
|
|
36
|
-
const [filepath, setFilepath] = useState<string>('');
|
|
37
|
-
const [errors, setErrors] = useState<CompilationError[] | undefined>();
|
|
38
|
-
const [bytes, setBytes] = useState<number[] | undefined>();
|
|
39
|
-
const [sld, setSld] = useState<string>('');
|
|
40
|
-
const [chunks, setChunks] = useState<Chunk[] | undefined>();
|
|
41
|
-
const [showOpCodes, setShowOpCodes] = useState<boolean>(false);
|
|
42
|
-
const [outputName, setOutputName] = useState<string | undefined>(undefined);
|
|
43
|
-
const ref = useRef<AppEditorHandlers>(null);
|
|
44
|
-
|
|
45
|
-
function handleGetFileCode(filename: string): string {
|
|
46
|
-
if(ref.current == null) throw new Error(`Invalid reference to the editor`);
|
|
47
|
-
return ref.current.getCode(filename);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
function handleCompile() {
|
|
51
|
-
const info = compile(filepath, code, handleGetFileCode);
|
|
52
|
-
if(info.errs.length > 0) {
|
|
53
|
-
setBytes([]);
|
|
54
|
-
setSld('');
|
|
55
|
-
setChunks([]);
|
|
56
|
-
setErrors(info.errs);
|
|
57
|
-
}
|
|
58
|
-
else {
|
|
59
|
-
setShowOpCodes(false);
|
|
60
|
-
setOutputName(info.outputName);
|
|
61
|
-
setBytes(info.bytes);
|
|
62
|
-
setSld(info.sld);
|
|
63
|
-
setChunks(formatBytes(info.bytes, 16));
|
|
64
|
-
setErrors([]);
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
async function handleSaveBinary() {
|
|
69
|
-
closeDropdown();
|
|
70
|
-
if (!bytes || !outputName) return;
|
|
71
|
-
const data = Uint8Array.from(bytes);
|
|
72
|
-
const blob = new Blob([data]);
|
|
73
|
-
await fileSave(blob, {
|
|
74
|
-
fileName: outputName,
|
|
75
|
-
extensions: ['.P']
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
async function handleSaveSld() {
|
|
80
|
-
closeDropdown();
|
|
81
|
-
if (sld.length <= 0 || !outputName) return;
|
|
82
|
-
const blob = new Blob([sld]);
|
|
83
|
-
await fileSave(blob, {
|
|
84
|
-
fileName: outputName.replace(/\.P$/, ''),
|
|
85
|
-
extensions: ['.sld']
|
|
86
|
-
});
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
return (
|
|
90
|
-
<div className="flex flex-col h-screen bg-neutral-600">
|
|
91
|
-
<AppHeader
|
|
92
|
-
onOpenCode={() => ref.current?.openCode()}
|
|
93
|
-
onOpenCodeDirectory={() => ref.current?.openCodeDirectory()}
|
|
94
|
-
onSaveCode={() => ref.current?.saveCode()}
|
|
95
|
-
onSaveBinary={handleSaveBinary}
|
|
96
|
-
onSaveSld={handleSaveSld}
|
|
97
|
-
onClose={() => ref.current?.closeCode()}
|
|
98
|
-
onCloseAll={() => ref.current?.closeAll()}
|
|
99
|
-
onCompile={handleCompile}
|
|
100
|
-
onShowOpCodes={() => setShowOpCodes(true)}
|
|
101
|
-
/>
|
|
102
|
-
<div className="flex-1 flex m-4 gap-4">
|
|
103
|
-
<div className="flex flex-col w-2/3">
|
|
104
|
-
<AppEditor
|
|
105
|
-
ref={ref}
|
|
106
|
-
code={code}
|
|
107
|
-
setFilePath={setFilepath}
|
|
108
|
-
setCode={setCode}
|
|
109
|
-
errors={errors}
|
|
110
|
-
setErrors={setErrors} />
|
|
111
|
-
</div>
|
|
112
|
-
<div className="flex flex-col w-1/3 z-0">
|
|
113
|
-
<BinaryOrOpCodes showOpCodes={showOpCodes} chunks={chunks}/>
|
|
114
|
-
</div>
|
|
115
|
-
</div>
|
|
116
|
-
<Errors errors={errors} />
|
|
117
|
-
<AppFooter />
|
|
118
|
-
</div>
|
|
119
|
-
);
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
export default App;
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Z80 Assembler in Typescript
|
|
3
|
-
*
|
|
4
|
-
* File: binary,tsx
|
|
5
|
-
* Description: Binary view
|
|
6
|
-
* Author: Sebastien Andrivet
|
|
7
|
-
* License: GPLv3
|
|
8
|
-
* Copyrights: Copyright (C) 2023 Sebastien Andrivet
|
|
9
|
-
*/
|
|
10
|
-
import React from "react";
|
|
11
|
-
import {Table} from "react-daisyui";
|
|
12
|
-
import {Chunk} from "@andrivet/z80-assembler";
|
|
13
|
-
|
|
14
|
-
interface AppBinaryProps {
|
|
15
|
-
chunks: Chunk[] | undefined;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export default function AppBinary({chunks}: AppBinaryProps) {
|
|
19
|
-
return (chunks == null || chunks.length <= 0) ? null : (
|
|
20
|
-
<>
|
|
21
|
-
<h1 className="font-bold mb-2 text-orange-400">Machine Code</h1>
|
|
22
|
-
<div className="flex flex-auto h-full relative mt-0">
|
|
23
|
-
<div className="absolute top-0 bottom-0 left-0 right-0 overflow-auto">
|
|
24
|
-
<Table zebra={true}>
|
|
25
|
-
<Table.Head>{['Address', 'Bytes']}</Table.Head>
|
|
26
|
-
<Table.Body>
|
|
27
|
-
{chunks?.map((data, index) => (
|
|
28
|
-
<Table.Row key={data.address} className="font-mono">{[
|
|
29
|
-
<strong key={`addr-${data.address}`} className="text-orange-400">{data.address}</strong>,
|
|
30
|
-
<span key={`data-${data.address}`} >{data.bytes}</span>
|
|
31
|
-
]}</Table.Row>
|
|
32
|
-
))}
|
|
33
|
-
</Table.Body>
|
|
34
|
-
</Table>
|
|
35
|
-
</div>
|
|
36
|
-
</div>
|
|
37
|
-
</>
|
|
38
|
-
);
|
|
39
|
-
}
|