Skip to content

Commit c9d9cff

Browse files
committed
Changes/fixes for 1.5.3 -- see CHANGELOG
1 parent 17d2c66 commit c9d9cff

15 files changed

Lines changed: 115 additions & 45 deletions

CHANGELOG.md

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

3+
### [1.5.3] - 2025-04-30
4+
5+
#### Added:
6+
* 64TASS [from agurtovoy]: All supported CPUs in .cpu syntax
7+
* 64TASS: Support for unspecified values (".byte ?", for example) in .structs
8+
* 64TASS: Support lower word, higher word, and lower byte swapped word operators
9+
10+
#### Fixed:
11+
* 64TASS: Change bank byte operator from "^" to "`"
12+
* DASM: Macros are case insensitive, unlike symbols
13+
314
### [1.5.2] - 2025-04-14
415

516
#### Added:

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"author": "Sean Callahan",
66
"publisher": "seanahan5000",
77
"license": "MIT",
8-
"version": "1.5.2",
8+
"version": "1.5.3",
99
"repository": {
1010
"type": "git",
1111
"url": "https://github.com/seanahan5000/rpw-ext.git"

server/src/asm/assembler.ts

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -443,9 +443,15 @@ export class Assembler {
443443
// known macro name, convert it to a macro invoke
444444
// statement and reparse.
445445
if (line.statement.labelExp) {
446-
const labelName = line.statement.labelExp.getString()
446+
let labelName = line.statement.labelExp.getString()
447+
448+
// TODO: choose case insensitive macro names by syntax
449+
// (DASM, for example, is case insensitive for macros, but
450+
// case sensitive for symbols)
451+
labelName = labelName.toLowerCase()
452+
447453
const foundSym = this.module.symbolMap.get(labelName)
448-
if (foundSym && foundSym.type == SymbolType.TypeName) {
454+
if (foundSym && foundSym.type == SymbolType.MacroName) {
449455
const newStatement = this.parser.reparseAsMacroInvoke(
450456
line.sourceFile,
451457
line.lineNumber,
@@ -868,7 +874,7 @@ export class Assembler {
868874
if (!symExp.isWeak) {
869875
// TODO: make temporary project check a setting
870876
if (!this.module.project.isTemporary) {
871-
if (symExp.symbolType == SymbolType.TypeName) {
877+
if (symExp.symbolType == SymbolType.MacroName) {
872878
symExp.setError("Unknown macro or opcode")
873879
}
874880
}
@@ -1521,9 +1527,13 @@ export class SymbolUtils {
15211527

15221528
if (expression instanceof exp.UnaryExpression) {
15231529
const opType = expression.opType
1524-
if (opType == Op.LowByte
1525-
|| opType == Op.HighByte
1526-
|| opType == Op.BankByte) {
1530+
// TODO: something other than this explicit check
1531+
if (opType == Op.LowByte ||
1532+
opType == Op.HighByte ||
1533+
opType == Op.BankByte ||
1534+
opType == Op.SwappedWord ||
1535+
opType == Op.HighWord ||
1536+
opType == Op.Word) {
15271537
return
15281538
}
15291539
}

server/src/asm/expressions.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -432,6 +432,15 @@ export class UnaryExpression extends Expression {
432432
case Op.BankByte:
433433
value = (value >> 16) & 255
434434
break
435+
case Op.SwappedWord:
436+
value = ((value & 255) << 8) + ((value >> 8) & 255)
437+
break
438+
case Op.HighWord:
439+
value = (value >> 8) & 0xFFFF
440+
break
441+
case Op.Word:
442+
value = value & 0xFFFF
443+
break
435444
}
436445
}
437446
return value
@@ -448,6 +457,10 @@ export class UnaryExpression extends Expression {
448457
case Op.HighByte:
449458
case Op.BankByte:
450459
return 1
460+
case Op.SwappedWord:
461+
case Op.HighWord:
462+
case Op.Word:
463+
return 2
451464
}
452465
// TODO: use resolved value to determine size (does -value change size?)
453466
return this.arg.getSize()

server/src/asm/parser.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -621,7 +621,7 @@ export class Parser extends Tokenizer {
621621
}
622622

623623
token.type = TokenType.Macro
624-
const symExp = this.newSymbolExpression([token], SymbolType.TypeName, false)
624+
const symExp = this.newSymbolExpression([token], SymbolType.MacroName, false)
625625
return this.initStatement(new stm.MacroInvokeStatement(), symExp)
626626
}
627627

@@ -712,6 +712,7 @@ export class Parser extends Tokenizer {
712712
return
713713
}
714714
// TODO: hack for handling indented data defs in .structs
715+
// (This will go away once parsing is integrated into pass 0)
715716
} else if (t2str == ".byte"
716717
|| t2str == ".res"
717718
|| t2str == ".dbyt"

server/src/asm/statements.ts

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1740,6 +1740,12 @@ export class IncludeStatement extends FileStatement {
17401740
}
17411741
}
17421742

1743+
// 64TASS: [<label>] .binclude "filename"
1744+
export class BlockIncludeStatement extends IncludeStatement {
1745+
// TODO: if label present, add named scope around include
1746+
// else, add anonymous unique scope around include
1747+
}
1748+
17431749
// MERLIN: SAV filename
17441750
// DASM: n/a
17451751
// ACME: n/a
@@ -1877,7 +1883,6 @@ export class TypeDefBeginStatement extends Statement {
18771883
}
18781884

18791885
postParse(parser: Parser) {
1880-
18811886
const name = this.findArg("type-name")
18821887
if (name instanceof exp.SymbolExpression) {
18831888
this.typeName = name
@@ -2027,6 +2032,16 @@ export class MacroDefStatement extends TypeDefBeginStatement {
20272032
super(NestingType.Macro, false)
20282033
}
20292034

2035+
public override postParse(parser: Parser) {
2036+
const name = this.findArg("macro-name")
2037+
if (name instanceof exp.SymbolExpression) {
2038+
this.typeName = name
2039+
} else if (this.labelExp) {
2040+
this.typeName = this.labelExp
2041+
this.typeName.setSymbolType(SymbolType.MacroName)
2042+
}
2043+
}
2044+
20302045
public override preprocess(asm: Assembler): void {
20312046

20322047
if (!this.canRecurse) {

server/src/asm/symbols.ts

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,18 @@ import { Expression, SymbolExpression} from "./expressions"
66

77
export enum SymbolType {
88
Variable = 0,
9-
TypeName = 1, // macro, struct, enum, define, etc.
10-
NamedParam = 2, // named params to macros, structs, enums
11-
12-
Simple = 3,
13-
Scoped = 4, // explicit scope, fully specified
14-
15-
CheapLocal = 5, // scoped to previous non-local
16-
ZoneLocal = 6, // scoped to SUBROUTINE or !zone
17-
AnonLocal = 7, // ++ or --
18-
LisaLocal = 8, // ^# def, <# or ># ref
19-
CA65Local = 9, // : def, :+ or :- ref
9+
MacroName = 1,
10+
TypeName = 2, // struct, enum, define, etc.
11+
NamedParam = 3, // named params to macros, structs, enums
12+
13+
Simple = 4,
14+
Scoped = 5, // explicit scope, fully specified
15+
16+
CheapLocal = 6, // scoped to previous non-local
17+
ZoneLocal = 7, // scoped to SUBROUTINE or !zone
18+
AnonLocal = 8, // ++ or --
19+
LisaLocal = 9, // ^# def, <# or ># ref
20+
CA65Local = 10 // : def, :+ or :- ref
2021
}
2122

2223
export function isLocalType(symbolType: SymbolType): boolean {
@@ -141,6 +142,7 @@ export class ScopeState {
141142
case SymbolType.CA65Local:
142143
return 1
143144

145+
case SymbolType.MacroName:
144146
case SymbolType.TypeName:
145147
case SymbolType.NamedParam:
146148
case SymbolType.Simple:
@@ -177,10 +179,21 @@ export class ScopeState {
177179
break
178180
}
179181

182+
case SymbolType.MacroName:
180183
case SymbolType.TypeName: {
181184
// skip invoke prefix token if present
182185
const nameToken = symExp.children[symExp.children.length - 1]
183186
result = nameToken?.getString() ?? ""
187+
188+
if (symExp.symbolType == SymbolType.MacroName) {
189+
// TODO: Choose case insensitive macro names by syntax,
190+
// separate from symbol sensitivity.
191+
// (DASM, for example, is case insensitive for macros, but
192+
// case sensitive for symbols)
193+
// TODO: may need to create/split SymbolType.MacroName
194+
result = result.toLowerCase()
195+
}
196+
184197
result = this.addScopePath(result, scopeIndex)
185198
break
186199
}

server/src/asm/syntaxes/64tass.ts

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export class Tass64Syntax extends SyntaxDef {
3535
this.keywordMap = new Map<string, KeywordDef>([
3636
// target
3737
[ ".cpu", { create: () => { return new stm.CpuStatement() },
38-
params: '{"6502"|"65c02"|"65816"|"65el02"|"default"}',
38+
params: '{"6502"|"65c02"|"65ce02"|"6502i"|"65816"|"65dtv02"|"65el02"|"r65c02"|"w65c02"|"4510"|"default"}',
3939
desc: "Selects CPU according to the string argument" } ],
4040

4141
// equates
@@ -82,9 +82,9 @@ export class Tass64Syntax extends SyntaxDef {
8282
[ ".include", { create: () => { return new stm.IncludeStatement() },
8383
params: "<filename>",
8484
desc: "Include source file" } ],
85-
[ ".binclude",{ // TODO
85+
[ ".binclude",{ create: () => { return new stm.BlockIncludeStatement() },
8686
params: "<filename>",
87-
desc: "Include source file here in it's local block" } ],
87+
desc: "Include source file here in its local block" } ],
8888
[ ".binary", { create: () => { return new stm.IncBinStatement() },
8989
params: "<filename>[, <offset>[, <length>]]",
9090
desc: "Include raw binary data from file" } ],
@@ -126,34 +126,34 @@ export class Tass64Syntax extends SyntaxDef {
126126

127127
// data storage
128128
[ ".byte", { create: () => { return new stm.DataStatement_U8() },
129-
params: "<expression>[, <expression> ...]",
129+
params: "{?|<expression>[, <expression> ...]}",
130130
desc: "Create bytes from 8 bit unsigned constants (0-255)" } ],
131131
[ ".char", { create: () => { return new stm.DataStatement_S8() },
132-
params: "<expression>[, <expression> ...]",
132+
params: "{?|<expression>[, <expression> ...]}",
133133
desc: "Create bytes from 8 bit signed constants (-128-127)" } ],
134134
[ ".word", { create: () => { return new stm.DataStatement_U16() },
135-
params: "<expression>[, <expression> ...]",
135+
params: "{?|<expression>[, <expression> ...]}",
136136
desc: "Create bytes from 16 bit unsigned constants (0-65535)" } ],
137137
[ ".sint", { create: () => { return new stm.DataStatement_S16() },
138-
params: "<expression>[, <expression> ...]",
138+
params: "{?|<expression>[, <expression> ...]}",
139139
desc: "Create bytes from 16 bit signed constants (-32768-32767)" } ],
140140
[ ".addr", { create: () => { return new stm.DataStatement_U16() },
141-
params: "<expression>[, <expression> ...]",
141+
params: "{?|<expression>[, <expression> ...]}",
142142
desc: "Create 16 bit address constants for addresses" } ],
143143
[ ".rta", { create: () => { return new stm.DataStatement_U16() },
144-
params: "<expression>[, <expression> ...]",
144+
params: "{?|<expression>[, <expression> ...]}",
145145
desc: "Create 16 bit return address constants for addresses" } ],
146146
[ ".long", { create: () => { return new stm.DataStatement_U24() },
147-
params: "<expression>[, <expression> ...]",
147+
params: "{?|<expression>[, <expression> ...]}",
148148
desc: "Create bytes from 24 bit unsigned constants (0-16777215)" } ],
149149
[ ".lint", { create: () => { return new stm.DataStatement_S24() },
150-
params: "<expression>[, <expression> ...]",
150+
params: "{?|<expression>[, <expression> ...]}",
151151
desc: "Create bytes from 24 bit signed constants (-8388608-8388607)" } ],
152152
[ ".dword", { create: () => { return new stm.DataStatement_U32() },
153-
params: "<expression>[, <expression> ...]",
153+
params: "{?|<expression>[, <expression> ...]}",
154154
desc: "Create bytes from 32 bit unsigned constants (0-4294967295)" } ],
155155
[ ".dint", { create: () => { return new stm.DataStatement_S32() },
156-
params: "<expression>[, <expression> ...]",
156+
params: "{?|<expression>[, <expression> ...]}",
157157
desc: "Create bytes from 32 bit signed constants (-2147483648-2147483647)" } ],
158158

159159
// text
@@ -479,12 +479,12 @@ export class Tass64Syntax extends SyntaxDef {
479479
[ "+", { pre: 17, op: Op.Pos }],
480480
[ "-", { pre: 17, op: Op.Neg }],
481481

482-
[ "^", { pre: 4, op: Op.BankByte }],
483-
[ ">", { pre: 4, op: Op.HighByte }],
484-
[ "<", { pre: 4, op: Op.LowByte }],
485-
// "swapped word '><", O_BSWORD, 4
486-
// "high word '>`", O_HWORD, 4
487-
// "word '<>", O_WORD, 4
482+
[ "`", { pre: 4, op: Op.BankByte }],
483+
[ ">", { pre: 4, op: Op.HighByte }],
484+
[ "<", { pre: 4, op: Op.LowByte }],
485+
[ "><", { pre: 4, op: Op.SwappedWord }],
486+
[ ">`", { pre: 4, op: Op.HighWord }],
487+
[ "<>", { pre: 4, op: Op.Word }],
488488

489489
[ "(", { pre: 0, op: Op.Group, end: ")" }],
490490
[ "[", { pre: 0, op: Op.Group, end: "]" }],

server/src/asm/syntaxes/acme.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ export class AcmeSyntax extends SyntaxDef {
7777
// macros
7878
[ "!macro", { create: () => { return new stm.MacroDefStatement() },
7979
label: "",
80-
params: "<type-name> [ [~]<type-param> [, [~]<type-param> ...] ] \\{ [<block> \\}]",
80+
params: "<macro-name> [ [~]<type-param> [, [~]<type-param> ...] ] \\{ [<block> \\}]",
8181
desc: "Define a macro" } ],
8282

8383
// data storage

server/src/asm/syntaxes/ca65.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ export class Ca65Syntax extends SyntaxDef {
9090

9191
// macros
9292
[ ".macro", { create: () => { return new stm.MacroDefStatement() },
93-
params: "<type-name> [<type-param> [, <type-param> ...]]",
93+
params: "<macro-name> [<type-param> [, <type-param> ...]]",
9494
desc: "Start a classic macro definition" } ],
9595
[ ".mac", { alias: ".macro" }],
9696
[ ".endmacro", { create: () => { return new stm.EndMacroDefStatement() },
@@ -105,7 +105,7 @@ export class Ca65Syntax extends SyntaxDef {
105105
params: "{atari|cbm|cpu|generic|longbranch}",
106106
desc: "Insert a predefined macro package" } ],
107107
[ ".delmacro", { // TODO
108-
params: "<type-name>",
108+
params: "<macro-name>",
109109
desc: "Delete a classic macro" } ],
110110
[ ".delmac", { alias: ".delmacro" }],
111111

0 commit comments

Comments
 (0)