AssemblyCraftCompiler 1.2.0__tar.gz → 2.0.0__tar.gz
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.
- {assemblycraftcompiler-1.2.0 → assemblycraftcompiler-2.0.0}/AssemblyCraftCompiler.egg-info/PKG-INFO +2 -2
- {assemblycraftcompiler-1.2.0 → assemblycraftcompiler-2.0.0}/PKG-INFO +2 -2
- {assemblycraftcompiler-1.2.0 → assemblycraftcompiler-2.0.0}/README.md +1 -1
- {assemblycraftcompiler-1.2.0 → assemblycraftcompiler-2.0.0}/asmcc/__init__.py +31 -15
- {assemblycraftcompiler-1.2.0 → assemblycraftcompiler-2.0.0}/pyproject.toml +1 -1
- {assemblycraftcompiler-1.2.0 → assemblycraftcompiler-2.0.0}/AssemblyCraftCompiler.egg-info/SOURCES.txt +0 -0
- {assemblycraftcompiler-1.2.0 → assemblycraftcompiler-2.0.0}/AssemblyCraftCompiler.egg-info/dependency_links.txt +0 -0
- {assemblycraftcompiler-1.2.0 → assemblycraftcompiler-2.0.0}/AssemblyCraftCompiler.egg-info/top_level.txt +0 -0
- {assemblycraftcompiler-1.2.0 → assemblycraftcompiler-2.0.0}/LICENSE +0 -0
- {assemblycraftcompiler-1.2.0 → assemblycraftcompiler-2.0.0}/setup.cfg +0 -0
{assemblycraftcompiler-1.2.0 → assemblycraftcompiler-2.0.0}/AssemblyCraftCompiler.egg-info/PKG-INFO
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: AssemblyCraftCompiler
|
|
3
|
-
Version:
|
|
3
|
+
Version: 2.0.0
|
|
4
4
|
Summary: The official Assembly Craft compiler
|
|
5
5
|
Author-email: Orbinuity <orbinuity@ratgers.nl>
|
|
6
6
|
License-Expression: BSD-3-Clause
|
|
@@ -18,7 +18,7 @@ Dynamic: license-file
|
|
|
18
18
|
|
|
19
19
|
[](https://orbinuity.nl/license)
|
|
20
20
|
[](https://github.com/Orbinuity/ASMCC/commits)
|
|
21
|
-
[](https://github.com/Orbinuity/ASMCC/releases/v2.0.0)
|
|
22
22
|
[](https://orbinuity.nl/)
|
|
23
23
|
[](https://help.orbinuity.nl/doc?project=ASMCC)
|
|
24
24
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: AssemblyCraftCompiler
|
|
3
|
-
Version:
|
|
3
|
+
Version: 2.0.0
|
|
4
4
|
Summary: The official Assembly Craft compiler
|
|
5
5
|
Author-email: Orbinuity <orbinuity@ratgers.nl>
|
|
6
6
|
License-Expression: BSD-3-Clause
|
|
@@ -18,7 +18,7 @@ Dynamic: license-file
|
|
|
18
18
|
|
|
19
19
|
[](https://orbinuity.nl/license)
|
|
20
20
|
[](https://github.com/Orbinuity/ASMCC/commits)
|
|
21
|
-
[](https://github.com/Orbinuity/ASMCC/releases/v2.0.0)
|
|
22
22
|
[](https://orbinuity.nl/)
|
|
23
23
|
[](https://help.orbinuity.nl/doc?project=ASMCC)
|
|
24
24
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://orbinuity.nl/license)
|
|
4
4
|
[](https://github.com/Orbinuity/ASMCC/commits)
|
|
5
|
-
[](https://github.com/Orbinuity/ASMCC/releases/v2.0.0)
|
|
6
6
|
[](https://orbinuity.nl/)
|
|
7
7
|
[](https://help.orbinuity.nl/doc?project=ASMCC)
|
|
8
8
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
__version__ = "
|
|
1
|
+
__version__ = "2.0.0"
|
|
2
2
|
import struct
|
|
3
3
|
import re
|
|
4
4
|
|
|
@@ -6,7 +6,7 @@ class AssemblyCraftCompilerError(Exception):
|
|
|
6
6
|
pass
|
|
7
7
|
|
|
8
8
|
class AssemblyCraftCompiler:
|
|
9
|
-
MAGIC_HEADER = (b"ACX"+__version__.split(".")[0].encode())
|
|
9
|
+
MAGIC_HEADER = (b"ACX" + __version__.split(".")[0].encode())
|
|
10
10
|
|
|
11
11
|
ALLOC_SIZES = {
|
|
12
12
|
'ds': 16,
|
|
@@ -114,7 +114,22 @@ class AssemblyCraftCompiler:
|
|
|
114
114
|
f"Line {line_num}: Duplicate variable definition '{var_name}'."
|
|
115
115
|
)
|
|
116
116
|
|
|
117
|
-
|
|
117
|
+
# Check if values_str is a single integer specifying buffer allocation size (e.g. 'disk_buffer dm 512')
|
|
118
|
+
single_num_match = re.fullmatch(r'^(\d+|0x[0-9a-fA-F]+)$', values_str.strip())
|
|
119
|
+
if single_num_match:
|
|
120
|
+
val = int(single_num_match.group(1), 0)
|
|
121
|
+
if size_type == 'dm' or val > 255:
|
|
122
|
+
alloc_len = val
|
|
123
|
+
padded_data = bytes(alloc_len)
|
|
124
|
+
self.variables[var_name] = {
|
|
125
|
+
'id': var_id,
|
|
126
|
+
'size_type': size_type,
|
|
127
|
+
'alloc_len': alloc_len,
|
|
128
|
+
'data': padded_data
|
|
129
|
+
}
|
|
130
|
+
var_id += 1
|
|
131
|
+
continue
|
|
132
|
+
|
|
118
133
|
raw_bytes = bytearray()
|
|
119
134
|
tokens = re.findall(r'"([^"]*)"|(\d+|0x[0-9a-fA-F]+)', values_str)
|
|
120
135
|
|
|
@@ -134,18 +149,19 @@ class AssemblyCraftCompiler:
|
|
|
134
149
|
) from e
|
|
135
150
|
elif num_val:
|
|
136
151
|
val = int(num_val, 0)
|
|
137
|
-
if
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
152
|
+
if size_type == 'db':
|
|
153
|
+
if not (0 <= val <= 255):
|
|
154
|
+
raise AssemblyCraftCompilerError(
|
|
155
|
+
f"Line {line_num}: Byte literal {val} out of range (0-255) in '{var_name}'."
|
|
156
|
+
)
|
|
157
|
+
raw_bytes.append(val)
|
|
158
|
+
elif size_type == 'ds':
|
|
159
|
+
raw_bytes.extend(struct.pack("<H", val & 0xFFFF))
|
|
160
|
+
elif size_type == 'dm':
|
|
161
|
+
raw_bytes.extend(struct.pack("<I", val & 0xFFFFFFFF))
|
|
162
|
+
|
|
163
|
+
min_alloc = self.ALLOC_SIZES[size_type]
|
|
164
|
+
alloc_len = max(len(raw_bytes), min_alloc)
|
|
149
165
|
padded_data = bytes(raw_bytes).ljust(alloc_len, b'\x00')
|
|
150
166
|
|
|
151
167
|
self.variables[var_name] = {
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|