mirror of
https://github.com/ksherlock/x65.git
synced 2024-12-28 04:31:46 +00:00
Bug fixes
- Fixed section alignment - Fixed nested scopes - Fixed a borked parameter sent to label pools - Added -all as a command line option for dump_x65
This commit is contained in:
parent
662982404b
commit
8fdeb287e1
@ -32,6 +32,8 @@ x65.cpp requires struse.h which is a single file text parsing library that can b
|
||||
* [6502 opcodes](http://www.6502.org/tutorials/6502opcodes.html)
|
||||
* [6502 opcode grid](http://www.llx.com/~nparker/a2/opcodes.html)
|
||||
* [Codebase64 CPU section](http://codebase64.org/doku.php?id=base:6502_6510_coding)
|
||||
* [6502 illegal opcodes](http://www.oxyron.de/html/opcodes02.html)
|
||||
* [65816 opcodes](http://wiki.superfamicom.org/snes/show/65816+Reference#fn:14)
|
||||
|
||||
## Command Line Options
|
||||
|
||||
@ -239,6 +241,8 @@ The following lines will place all sections named Code sequentially at location
|
||||
|
||||
There is currently object file support (use -obj <filename> argument to generate), the recommended file extension for object files is .x65. In order to access symbols from object file code use XDEF <labelname> prior to declaring a label within the object.
|
||||
|
||||
To inspect the contents of x65 objects files there is a 'dump_x65' tool included in this archive.
|
||||
|
||||
<a name="load">**LOAD**
|
||||
|
||||
```
|
||||
@ -799,12 +803,13 @@ FindFirstSpace
|
||||
|
||||
### Development Status
|
||||
|
||||
Currently the assembler is in a limited release and while all features are in place and tested, more testing is needed to verify the completeness. Primarily tested with personal archive of sources written for Kick assmebler, DASM, TASM, XASM, etc. and passing most of Apple II Prince of Persia and Pinball Construction set.
|
||||
Fish food! Assembler has all important features and switching to make a 6502 project for more testing. Currently the assembler is in a limited release. Primarily tested with personal archive of sources written for Kick assmebler, DASM, TASM, XASM, etc. and passing most of Apple II Prince of Persia and Pinball Construction set.
|
||||
|
||||
**TODO**
|
||||
* irp (indefinite repeat)
|
||||
|
||||
**FIXED**
|
||||
* Nested scopes and label pools broke recently and was fixed, section alignment wasn't working.
|
||||
* Link file issues fixed, added a dump tool to show the contents of object files for debugging.
|
||||
* Rastan for Apple II gs assembles and links.
|
||||
* Merlin LNK, ENT, ADR, ADRL functional
|
||||
@ -846,7 +851,7 @@ Currently the assembler is in a limited release and while all features are in pl
|
||||
* TEXT directive converts ascii to petscii (respect uppercase or lowercase petscii) (simplistic)
|
||||
|
||||
Revisions:
|
||||
* 8 - Linking tested and passed with external project (Apple II gs Rastan)
|
||||
* 8 - Fish food / Linking tested and passed with external project (Apple II gs Rastan)
|
||||
* 7 - 65816 support
|
||||
* 6 - 65C02 support
|
||||
* 5 - Merlin syntax
|
||||
|
@ -294,6 +294,9 @@ int main(int argc, char **argv)
|
||||
} else if (arg.same_str("late_eval")) {
|
||||
show = prv_show | SHOW_LATE_EVAL;
|
||||
prv_show = show;
|
||||
} else if (arg.same_str("all")) {
|
||||
show = prv_show | SHOW_SECTIONS | SHOW_RELOCS | SHOW_LABELS | SHOW_MAP_SYMBOLS | SHOW_LATE_EVAL;
|
||||
prv_show = show;
|
||||
}
|
||||
} else if (!file)
|
||||
file = argv[a];
|
||||
|
37
x65.cpp
37
x65.cpp
@ -1788,7 +1788,8 @@ unsigned char* Asm::BuildExport(strref append, int &file_size, int &addr)
|
||||
StatusCode status = AppendSection(*i, allSections[last_fixed_section]);
|
||||
if (status != STATUS_OK)
|
||||
return nullptr;
|
||||
end_address = allSections[last_fixed_section].start_address +
|
||||
Section &s = allSections[last_fixed_section];
|
||||
end_address = s.start_address +
|
||||
(int)allSections[last_fixed_section].size();
|
||||
}
|
||||
}
|
||||
@ -1914,6 +1915,20 @@ StatusCode Asm::AppendSection(Section &s, Section &curr)
|
||||
int section_size = (int)s.size();
|
||||
|
||||
int section_address = curr.GetPC();
|
||||
|
||||
// calculate space for alignment
|
||||
int align_size = s.align_address <= 1 ? 0 :
|
||||
(s.align_address-(section_address % s.align_address)) % s.align_address;
|
||||
|
||||
// Get base addresses
|
||||
curr.CheckOutputCapacity(section_size + align_size);
|
||||
|
||||
// add 0's
|
||||
for (int a = 0; a<align_size; a++)
|
||||
curr.AddByte(0);
|
||||
|
||||
section_address += align_size;
|
||||
|
||||
curr.CheckOutputCapacity((int)s.size());
|
||||
unsigned char *section_out = curr.curr;
|
||||
if (s.output)
|
||||
@ -1925,19 +1940,6 @@ StatusCode Asm::AppendSection(Section &s, Section &curr)
|
||||
s.curr = 0;
|
||||
s.output_capacity = 0;
|
||||
|
||||
// calculate space for alignment
|
||||
int align_size = s.align_address <= 1 ? 0 :
|
||||
((section_address + s.align_address - 1) % s.align_address);
|
||||
|
||||
// Get base addresses
|
||||
curr.CheckOutputCapacity(section_size + align_size);
|
||||
|
||||
// add 0's
|
||||
for (int a = 0; a<align_size; a++)
|
||||
curr.AddByte(0);
|
||||
|
||||
section_address += align_size;
|
||||
|
||||
// Update address range and mark section as merged
|
||||
s.start_address = section_address;
|
||||
s.address += section_address;
|
||||
@ -4131,9 +4133,11 @@ StatusCode Asm::ApplyDirective(AssemblerDirective dir, strref line, strref sourc
|
||||
IncludeSymbols(line);
|
||||
break;
|
||||
|
||||
case AD_LABPOOL:
|
||||
AddLabelPool(line.split_range_trim(word_char_range, line[0]=='.' ? 1 : 0), line);
|
||||
case AD_LABPOOL: {
|
||||
strref name = line.split_range_trim(word_char_range, line[0]=='.' ? 1 : 0);
|
||||
AddLabelPool(name, line);
|
||||
break;
|
||||
}
|
||||
|
||||
case AD_IF:
|
||||
if (NewConditional()) { // Start new conditional block
|
||||
@ -4687,7 +4691,6 @@ StatusCode Asm::BuildLine(strref line)
|
||||
case '{':
|
||||
error = EnterScope();
|
||||
if (error == STATUS_OK) {
|
||||
scope_address[++scope_depth] = CurrSection().GetPC();
|
||||
++line;
|
||||
line.skip_whitespace();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user