@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.
Files changed (197) hide show
  1. package/{libs/z80-assembler/public/CHANGELOG.md → CHANGELOG.md} +8 -0
  2. package/README.md +27 -53
  3. package/{libs/z80-assembler/src/index.ts → index.d.ts} +1 -1
  4. package/index.js +312 -0
  5. package/index.mjs +6449 -0
  6. package/{libs/z80-assembler/src/lib/compiler/Assets.ts → lib/compiler/Assets.d.ts} +1 -6
  7. package/lib/compiler/Ast.d.ts +210 -0
  8. package/lib/compiler/Compiler.d.ts +53 -0
  9. package/lib/compiler/Formatter.d.ts +23 -0
  10. package/lib/compiler/Generator.d.ts +40 -0
  11. package/lib/compiler/Labels.d.ts +47 -0
  12. package/lib/grammar/LowLevel.d.ts +68 -0
  13. package/lib/grammar/Parse.d.ts +48 -0
  14. package/lib/grammar/z80.d.ts +2939 -0
  15. package/lib/types/Error.d.ts +62 -0
  16. package/{libs/z80-assembler/src/lib/types/Types.ts → lib/types/Types.d.ts} +11 -26
  17. package/package.json +14 -52
  18. package/.editorconfig +0 -13
  19. package/.eslintignore +0 -3
  20. package/.eslintrc.json +0 -35
  21. package/.github/workflows/node.js.yml +0 -47
  22. package/.prettierignore +0 -3
  23. package/.prettierrc +0 -3
  24. package/.vscode/extensions.json +0 -7
  25. package/apps/.gitkeep +0 -0
  26. package/apps/z80-assembler-app/.eslintrc.json +0 -18
  27. package/apps/z80-assembler-app/index.html +0 -16
  28. package/apps/z80-assembler-app/postcss.config.js +0 -24
  29. package/apps/z80-assembler-app/project.json +0 -70
  30. package/apps/z80-assembler-app/public/favicon.ico +0 -0
  31. package/apps/z80-assembler-app/public/logo.png +0 -0
  32. package/apps/z80-assembler-app/public/logo192.png +0 -0
  33. package/apps/z80-assembler-app/public/logo512.png +0 -0
  34. package/apps/z80-assembler-app/public/manifest.json +0 -25
  35. package/apps/z80-assembler-app/public/robots.txt +0 -3
  36. package/apps/z80-assembler-app/src/app/app.module.css +0 -0
  37. package/apps/z80-assembler-app/src/app/app.tsx +0 -122
  38. package/apps/z80-assembler-app/src/app/binary.tsx +0 -39
  39. package/apps/z80-assembler-app/src/app/editor.tsx +0 -228
  40. package/apps/z80-assembler-app/src/app/errors.tsx +0 -31
  41. package/apps/z80-assembler-app/src/app/footer.tsx +0 -20
  42. package/apps/z80-assembler-app/src/app/header.tsx +0 -57
  43. package/apps/z80-assembler-app/src/app/misc.ts +0 -13
  44. package/apps/z80-assembler-app/src/app/opcodes.tsx +0 -335
  45. package/apps/z80-assembler-app/src/assets/.gitkeep +0 -0
  46. package/apps/z80-assembler-app/src/assets/images/logo192.png +0 -0
  47. package/apps/z80-assembler-app/src/main.tsx +0 -22
  48. package/apps/z80-assembler-app/src/styles.css +0 -8
  49. package/apps/z80-assembler-app/tailwind.config.js +0 -28
  50. package/apps/z80-assembler-app/tsconfig.app.json +0 -22
  51. package/apps/z80-assembler-app/tsconfig.json +0 -21
  52. package/apps/z80-assembler-app/tsconfig.spec.json +0 -23
  53. package/apps/z80-assembler-app/vite.config.ts +0 -64
  54. package/assets/images/compile.png +0 -0
  55. package/assets/images/logo.png +0 -0
  56. package/assets/images/menu.png +0 -0
  57. package/assets/images/opcodes-load8.png +0 -0
  58. package/assets/images/opcodes.png +0 -0
  59. package/assets/images/open-dir.png +0 -0
  60. package/assets/images/z80-assembler-app.png +0 -0
  61. package/docs/assembly.md +0 -551
  62. package/docs/images/ZX81-0x00.png +0 -0
  63. package/docs/images/ZX81-0x0B.png +0 -0
  64. package/docs/images/ZX81-0x0C.png +0 -0
  65. package/docs/images/ZX81-0x0D.png +0 -0
  66. package/docs/images/ZX81-0x0E.png +0 -0
  67. package/docs/images/ZX81-0x0F.png +0 -0
  68. package/docs/images/ZX81-0x10.png +0 -0
  69. package/docs/images/ZX81-0x11.png +0 -0
  70. package/docs/images/ZX81-0x12.png +0 -0
  71. package/docs/images/ZX81-0x13.png +0 -0
  72. package/docs/images/ZX81-0x14.png +0 -0
  73. package/docs/images/ZX81-0x15.png +0 -0
  74. package/docs/images/ZX81-0x16.png +0 -0
  75. package/docs/images/ZX81-0x17.png +0 -0
  76. package/docs/images/ZX81-0x18.png +0 -0
  77. package/docs/images/ZX81-0x19.png +0 -0
  78. package/docs/images/ZX81-0x1A.png +0 -0
  79. package/docs/images/ZX81-0x1B.png +0 -0
  80. package/docs/images/ZX81-0x1C.png +0 -0
  81. package/docs/images/ZX81-0x1D.png +0 -0
  82. package/docs/images/ZX81-0x1E.png +0 -0
  83. package/docs/images/ZX81-0x1F.png +0 -0
  84. package/docs/images/ZX81-0x20.png +0 -0
  85. package/docs/images/ZX81-0x21.png +0 -0
  86. package/docs/images/ZX81-0x22.png +0 -0
  87. package/docs/images/ZX81-0x23.png +0 -0
  88. package/docs/images/ZX81-0x24.png +0 -0
  89. package/docs/images/ZX81-0x25.png +0 -0
  90. package/docs/images/ZX81-0x26.png +0 -0
  91. package/docs/images/ZX81-0x27.png +0 -0
  92. package/docs/images/ZX81-0x28.png +0 -0
  93. package/docs/images/ZX81-0x29.png +0 -0
  94. package/docs/images/ZX81-0x2A.png +0 -0
  95. package/docs/images/ZX81-0x2B.png +0 -0
  96. package/docs/images/ZX81-0x2C.png +0 -0
  97. package/docs/images/ZX81-0x2D.png +0 -0
  98. package/docs/images/ZX81-0x2E.png +0 -0
  99. package/docs/images/ZX81-0x2F.png +0 -0
  100. package/docs/images/ZX81-0x30.png +0 -0
  101. package/docs/images/ZX81-0x31.png +0 -0
  102. package/docs/images/ZX81-0x32.png +0 -0
  103. package/docs/images/ZX81-0x33.png +0 -0
  104. package/docs/images/ZX81-0x34.png +0 -0
  105. package/docs/images/ZX81-0x35.png +0 -0
  106. package/docs/images/ZX81-0x36.png +0 -0
  107. package/docs/images/ZX81-0x37.png +0 -0
  108. package/docs/images/ZX81-0x38.png +0 -0
  109. package/docs/images/ZX81-0x39.png +0 -0
  110. package/docs/images/ZX81-0x3A.png +0 -0
  111. package/docs/images/ZX81-0x3B.png +0 -0
  112. package/docs/images/ZX81-0x3C.png +0 -0
  113. package/docs/images/ZX81-0x3D.png +0 -0
  114. package/docs/images/ZX81-0x3E.png +0 -0
  115. package/docs/images/ZX81-0x3F.png +0 -0
  116. package/docs/images/ZX81-0x80.png +0 -0
  117. package/docs/images/ZX81-0x8B.png +0 -0
  118. package/docs/images/ZX81-0x8C.png +0 -0
  119. package/docs/images/ZX81-0x8D.png +0 -0
  120. package/docs/images/ZX81-0x8E.png +0 -0
  121. package/docs/images/ZX81-0x8F.png +0 -0
  122. package/docs/images/ZX81-0x90.png +0 -0
  123. package/docs/images/ZX81-0x91.png +0 -0
  124. package/docs/images/ZX81-0x92.png +0 -0
  125. package/docs/images/ZX81-0x93.png +0 -0
  126. package/docs/images/ZX81-0x94.png +0 -0
  127. package/docs/images/ZX81-0x95.png +0 -0
  128. package/docs/images/ZX81-0x96.png +0 -0
  129. package/docs/images/ZX81-0x97.png +0 -0
  130. package/docs/images/ZX81-0x98.png +0 -0
  131. package/docs/images/ZX81-0x99.png +0 -0
  132. package/docs/images/ZX81-0x9A.png +0 -0
  133. package/docs/images/ZX81-0x9B.png +0 -0
  134. package/docs/images/ZX81-0x9C.png +0 -0
  135. package/docs/images/ZX81-0x9D.png +0 -0
  136. package/docs/images/ZX81-0x9E.png +0 -0
  137. package/docs/images/ZX81-0x9F.png +0 -0
  138. package/docs/images/ZX81-0xA0.png +0 -0
  139. package/docs/images/ZX81-0xA1.png +0 -0
  140. package/docs/images/ZX81-0xA2.png +0 -0
  141. package/docs/images/ZX81-0xA3.png +0 -0
  142. package/docs/images/ZX81-0xA4.png +0 -0
  143. package/docs/images/ZX81-0xA5.png +0 -0
  144. package/docs/images/ZX81-0xA6.png +0 -0
  145. package/docs/images/ZX81-0xA7.png +0 -0
  146. package/docs/images/ZX81-0xA8.png +0 -0
  147. package/docs/images/ZX81-0xA9.png +0 -0
  148. package/docs/images/ZX81-0xAA.png +0 -0
  149. package/docs/images/ZX81-0xAB.png +0 -0
  150. package/docs/images/ZX81-0xAC.png +0 -0
  151. package/docs/images/ZX81-0xAD.png +0 -0
  152. package/docs/images/ZX81-0xAE.png +0 -0
  153. package/docs/images/ZX81-0xAF.png +0 -0
  154. package/docs/images/ZX81-0xB0.png +0 -0
  155. package/docs/images/ZX81-0xB1.png +0 -0
  156. package/docs/images/ZX81-0xB2.png +0 -0
  157. package/docs/images/ZX81-0xB3.png +0 -0
  158. package/docs/images/ZX81-0xB4.png +0 -0
  159. package/docs/images/ZX81-0xB5.png +0 -0
  160. package/docs/images/ZX81-0xB6.png +0 -0
  161. package/docs/images/ZX81-0xB7.png +0 -0
  162. package/docs/images/ZX81-0xB8.png +0 -0
  163. package/docs/images/ZX81-0xB9.png +0 -0
  164. package/docs/images/ZX81-0xBA.png +0 -0
  165. package/docs/images/ZX81-0xBB.png +0 -0
  166. package/docs/images/ZX81-0xBC.png +0 -0
  167. package/docs/images/ZX81-0xBD.png +0 -0
  168. package/docs/images/ZX81-0xBE.png +0 -0
  169. package/docs/images/ZX81-0xBF.png +0 -0
  170. package/libs/.gitkeep +0 -0
  171. package/libs/z80-assembler/.eslintrc.json +0 -18
  172. package/libs/z80-assembler/package.json +0 -20
  173. package/libs/z80-assembler/project.json +0 -35
  174. package/libs/z80-assembler/public/README.md +0 -54
  175. package/libs/z80-assembler/src/lib/assets/code/basic-end.zx81 +0 -4
  176. package/libs/z80-assembler/src/lib/assets/code/basic-line1.zx81 +0 -4
  177. package/libs/z80-assembler/src/lib/assets/code/basic-line2.zx81 +0 -9
  178. package/libs/z80-assembler/src/lib/assets/code/characters.zx81 +0 -190
  179. package/libs/z80-assembler/src/lib/assets/code/display.zx81 +0 -50
  180. package/libs/z80-assembler/src/lib/assets/code/system-variables.zx81 +0 -46
  181. package/libs/z80-assembler/src/lib/compiler/Ast.ts +0 -545
  182. package/libs/z80-assembler/src/lib/compiler/Compiler.test.ts +0 -2141
  183. package/libs/z80-assembler/src/lib/compiler/Compiler.ts +0 -185
  184. package/libs/z80-assembler/src/lib/compiler/Formatter.ts +0 -43
  185. package/libs/z80-assembler/src/lib/compiler/Generator.ts +0 -255
  186. package/libs/z80-assembler/src/lib/compiler/Labels.ts +0 -165
  187. package/libs/z80-assembler/src/lib/grammar/LowLevel.ts +0 -163
  188. package/libs/z80-assembler/src/lib/grammar/Parse.ts +0 -128
  189. package/libs/z80-assembler/src/lib/grammar/z80.peg +0 -1252
  190. package/libs/z80-assembler/src/lib/grammar/z80.ts +0 -10649
  191. package/libs/z80-assembler/src/lib/types/Error.ts +0 -105
  192. package/libs/z80-assembler/tsconfig.json +0 -23
  193. package/libs/z80-assembler/tsconfig.lib.json +0 -10
  194. package/libs/z80-assembler/tsconfig.spec.json +0 -19
  195. package/libs/z80-assembler/vite.config.ts +0 -58
  196. package/nx.json +0 -57
  197. 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 {Line, PosInfo} from "../grammar/z80";
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
- // An array of lines (AST).
35
- lines: Line[];
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
- // The name of the output (output directive).
45
- outputName: string;
46
- // The bytes, result of the compilation.
47
- bytes: bytes;
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
- filename: string;
59
- pos: PosInfo;
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.0",
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
- "homepage": "https://andrivet.github.io/z80-assembler",
6
- "private": false,
7
- "dependencies": {
8
- "@swc/helpers": "~0.5.1",
9
- "@uiw/react-codemirror": "^4.20.2",
10
- "browser-fs-access": "^0.34.1",
11
- "codemirror": "^6.0.1",
12
- "daisyui": "^3.9.4",
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
- "devDependencies": {
19
- "@nx/eslint-plugin": "^16.3.1",
20
- "@nx/js": "^16.3.1",
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
@@ -1,3 +0,0 @@
1
- node_modules
2
- libs/z80-assembler/src/lib/grammar/z80.ts
3
- libs/z80-assembler/src/lib/**/*.test.ts
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
@@ -1,3 +0,0 @@
1
- # Add files here to ignore them from prettier formatting
2
- /dist
3
- /coverage
package/.prettierrc DELETED
@@ -1,3 +0,0 @@
1
- {
2
- "singleQuote": true
3
- }
@@ -1,7 +0,0 @@
1
- {
2
- "recommendations": [
3
- "nrwl.angular-console",
4
- "esbenp.prettier-vscode",
5
- "dbaeumer.vscode-eslint"
6
- ]
7
- }
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
- }
@@ -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
- }
@@ -1,3 +0,0 @@
1
- # https://www.robotstxt.org/robotstxt.html
2
- User-agent: *
3
- Disallow:
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
- }