mirror of
https://github.com/pfusik/xasm.git
synced 2025-04-18 17:37:05 +00:00
Instruction pairing extended to more than two instructions.
This commit is contained in:
parent
f33c112ac6
commit
9aae1ad4c4
25
source/app.d
25
source/app.d
@ -2664,19 +2664,24 @@ unittest {
|
||||
void assemblyPair() {
|
||||
assert(!inOpcode);
|
||||
string instruction = readInstruction();
|
||||
if (!eol() && line[column] == ':') {
|
||||
string[] extraInstructions;
|
||||
while (!eol() && line[column] == ':') {
|
||||
pairing = true;
|
||||
column++;
|
||||
string instruction2 = readInstruction();
|
||||
extraInstructions ~= readInstruction();
|
||||
}
|
||||
if (!extraInstructions.empty) {
|
||||
int savedColumn = column;
|
||||
if (willSkip)
|
||||
warning("Skipping only the first instruction");
|
||||
assemblyInstruction(instruction);
|
||||
checkNoExtraCharacters();
|
||||
column = savedColumn;
|
||||
wereManyInstructions = false;
|
||||
assemblyInstruction(instruction2);
|
||||
wereManyInstructions = true;
|
||||
foreach (instruction2; extraInstructions) {
|
||||
column = savedColumn;
|
||||
assemblyInstruction(instruction2);
|
||||
wereManyInstructions = true;
|
||||
}
|
||||
} else {
|
||||
pairing = false;
|
||||
assemblyInstruction(instruction);
|
||||
@ -2847,6 +2852,16 @@ void assemblyFile(string filename) {
|
||||
lineNo = oldLineNo;
|
||||
}
|
||||
|
||||
unittest {
|
||||
sourceFiles[""] = " lda:sne:ldy:inx $1234".representation;
|
||||
assemblyFile("");
|
||||
pass2 = true;
|
||||
objectBuffer.length = 0;
|
||||
assemblyFile("");
|
||||
writefln!"%(%02x%)"(objectBuffer);
|
||||
assert(objectBuffer == [0xad, 0x34, 0x12, 0xd0, 0x03, 0xac, 0x34, 0x12, 0xe8]);
|
||||
}
|
||||
|
||||
void assemblyPass() {
|
||||
origin = -1;
|
||||
loadOrigin = -1;
|
||||
|
@ -160,7 +160,7 @@ to start a comment.
|
||||
-------------------------------------------------------------
|
||||
|
||||
[[new_pairing]]
|
||||
You may put two instructions in one line so they share their operand.
|
||||
You may put two or more instructions in one line so they share their operand.
|
||||
For example:
|
||||
------------
|
||||
eor:sta foo
|
||||
@ -173,9 +173,9 @@ is equivalent to
|
||||
|
||||
Note that
|
||||
------------
|
||||
lda:tax #0
|
||||
lda:tax:tay #0
|
||||
------------
|
||||
is allowed because `#0` is treated as a comment for `tax`.
|
||||
is allowed because `#0` is treated as a comment for `tax` and `tay`.
|
||||
|
||||
EXPRESSIONS
|
||||
-----------
|
||||
@ -716,6 +716,7 @@ Version 3.x.x (20xx-xx-xx)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
- source can optionally be read from standard input, and object can be
|
||||
written to standard output instead of files (by Adrian Matoga)
|
||||
- <<new_pairing,any number of instructions in one line>> (by Adrian Matoga)
|
||||
|
||||
Version 3.2.0 (2021-06-22)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
Loading…
x
Reference in New Issue
Block a user