Skip to content

Commit 269d7ee

Browse files
committed
1.3.1: AS fixes
1 parent c0aad5a commit 269d7ee

File tree

4 files changed

+22
-3
lines changed

4 files changed

+22
-3
lines changed

CHANGELOG

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog
22

3+
## [1.3.1]
4+
- Readd support for @label syntax
5+
- Fix a bug with the even macro
6+
37
## [1.3.0]
48
- Assembler now uses AS Macro Assembler for full macro support
59
- MapMacros.asm definitions added for Sonic 1 and 2

app/formats/asm/index.js

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,22 @@ const p2binMessages = {
1919
toolsmsg,
2020
};
2121

22+
function atLabels(code) {
23+
const labels = /^@[a-zA-Z0-9_$]+\s*:/gm;
24+
25+
while (true) {
26+
const result = labels.exec(code);
27+
if (!result) break;
28+
const label = result[0].slice(0, -1);
29+
30+
if (label.startsWith('@')) {
31+
code = code.replace(new RegExp(label, 'g'), `._at_${label.slice(1)}`);
32+
}
33+
}
34+
35+
return code;
36+
}
37+
2238
export async function assemble(
2339
code,
2440
{ filename } = {
@@ -28,7 +44,7 @@ export async function assemble(
2844
const aslWorker = new Worker('bundles/asl-worker.js');
2945
const asl = Comlink.wrap(aslWorker);
3046

31-
const pFile = await asl.assemble(code, {
47+
const pFile = await asl.assemble(atLabels(code), {
3248
messages: asMessages,
3349
filename,
3450
});

app/formats/scripts/run-script.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,6 @@ export default catchFunc((file) => {
334334
prelude: `
335335
even macro
336336
if (*)&1
337-
paddingSoFar set paddingSoFar+1
338337
dc.b 0 ;ds.b 1
339338
endif
340339
endm

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"version": "1.3.0",
2+
"version": "1.3.1",
33
"scripts": {
44
"start": "electron ./static --dev"
55
},

0 commit comments

Comments
 (0)