Commit Graph

28 Commits

Author SHA1 Message Date
Michael Martin
94d0b9d0c4 Rework code structure and metadata to be setuptools-friendly 2024-07-19 21:06:02 -07:00
Michael Martin
41bf01d035 Convert Ophis to Python 3.
Most of the work is handled by 2to3, but there's a few extra tricks
needed to finish the job, mostly about picking the right bits to be
Unicode and the right bits to be bytes.
2019-01-09 20:45:01 -08:00
Michael Martin
c3d48da59d Fix issue with branches in listfiles.
Due to whitespace vagaries, etc., a sample correct output has been
added to the test case files, but isn't directly checked as part
of verification.
2014-05-24 19:52:33 -07:00
Michael Martin
5b64c9701e Refactor the label mapper to be more like the lister. 2014-05-14 05:56:59 -07:00
Michael Martin
bac908bff5 Much prettier label map files 2014-05-09 23:55:56 -07:00
Michael Martin
70f93b22eb Rework label map collection
This uses a pass to interrogate the system for locations, then dumps
those out instead. It handles includes, anonymous labels, and basic
macros, but it does so in a somewhat ugly way. This data can be
readily abbreviated and should also be re-sorted.
2014-05-09 23:11:09 -07:00
Cat's Eye Technologies
c0bf2e98b7 A very, *very* poor-man's version of label<->address dump. Ugh! 2014-03-24 12:32:17 +00:00
Michael Martin
42f01f7cd6 Bump minor version number and copyright dates 2014-03-22 22:09:11 -07:00
gardners
bcfd08c750 Fix 16-bit immediate mode. 2014-02-08 02:55:26 +10:30
gardners
dcc37f5751 Implement test for 4502 extensions.
Fix numerous bugs revealed through tests, some more remain.
2014-02-08 02:51:42 +10:30
gardners
591fc2fe35 make addressing mode cooercion work with varying addressing mode
lists.
2014-02-08 02:19:14 +10:30
gardners
5c162d2407 restore branch expansion for non-4502 targets 2014-02-08 01:59:42 +10:30
gardners
6856da1bbf fix various bugs with 4502 assembly. 2014-02-07 20:52:11 +10:30
gardners
5c4b23cbee fix 16-bit branch out-by-one error 2014-02-07 20:23:56 +10:30
gardners
dec3106744 implement new 4510 addressing modes.
promote relative branches to 16-bit when required.
2014-02-07 20:22:06 +10:30
Michael Martin
364b39edfb First draft of listfile support.
The .listfile pragma and the -l command line option will select the
output file for the listing.
2013-04-13 19:57:24 -07:00
Michael Martin
e5ac21f0f9 Second attempt at implementation of the BBXn instructions for Rockwell 65c02 chips.
Reliable technical documentation for how these instructions are decoded is a
little thin on the ground online, so some of this implementation is still
speculative.
2013-01-27 20:18:08 -08:00
Michael Martin
7f650e787d Fix the bugs the test suite found
- .require now tracks absolute paths of loaded files
 - stricter checking of .incbin arguments
 - fix charmap reset directive
 - Allow register names (a, x, y) as labels, with warning
 - Allow opcode names as labels, with warning
2012-06-12 06:29:03 -07:00
Michael Martin
cc9acf3ce4 Bugfix: Let Collapse Pass reverse collapses
This can happen if a branch extender pass shifts a load's target
label past the zero-page boundary.
2012-06-08 22:23:42 -07:00
Michael Martin
9323067e91 Improve .incbin to let its arguments be arbitrary expressions
This introduces a new IR node for mutable-during-assembly ranges.
In the common case, where offset and range are hardcoded or missing,
it continues with the older, more efficient behavior.
2012-06-03 23:50:29 -07:00
Michael C. Martin
14a37ca879 Massive code modernization spree.
Full PEP8 compliance. Also, booleans have been inserted where
they make sense (introduced in 2.3!) and I haven't knowingly
added anything that will break 2.3 compatibility.

At this point the code really doesn't look like it was written
ten years ago. Hooray!
2012-06-02 00:04:15 -07:00
Michael C. Martin
d955fe00a1 Switch to "new-style" classes, because come on.
Ophis was originally written for Python 2.1, and it kind of shows.
Python 2.3 introduced booleans and optparse, so there's no reason
to not use new-style classes.
2012-06-01 00:24:51 -07:00
Michael C. Martin
e47073bc1d New command-line system.
This is a full optparse-based parser for all the options we want
to have in Ophis 2.0, but the pass-disablers aren't working yet.

This also doesn't handle positional arguments the way we hope
to eventually; that will come later.

optparse is deprecated in 2.7, but its replacement isn't available
in any previous version of Python, so we avoid it so as to not
gratuitously break compatibility on older machines.

It would be nice to at least stay usable on stock Leopard Macs (2.5).
2012-06-01 00:09:25 -07:00
Michael C. Martin
eae4ea7dcd Extend .advance to allow a filler expression. 2012-05-30 20:45:37 -07:00
Michael C. Martin
741390e955 Allow '-' as a filename to mean standard input or output.
As part of this change, all assembler chat is being pushed to
standard error, where it probably should have been in the first place.
Scripts and batchfiles that relied on capturing the output of Ophis
will need to capture stderr now instead.
2012-05-28 19:19:08 -07:00
Michael C. Martin
f8bc917601 A new 'correctness optimization': ExtendBranches.
This pass actually isn't an optimizer in that it produces larger
binaries when it triggers. However, the larger binaries created
will actually assemble properly.

The ExtendBranches pass detects Relative instructions (that is,
branches) that extend past the signed-8-bit range Relative instructions
permit, and replaces them with a branch-jump combination with identical
semantics.

Since this may be evidence of a program bug, Ophis will warn when
the optimization is triggered.

Due to similarities between this pass and UpdateLabels, both passes
have been refactored in passing.
2012-05-27 15:57:23 -07:00
Michael C. Martin
1df8ad465d Major formatting fixes:
* No more tabs
 * Fix copyright notices to point at right files and name the license right
2012-05-06 20:06:28 -07:00
Michael C. Martin
2c8dba2450 Initial import of the Ophis 1.0 distribution and supplemental material 2011-08-20 16:33:25 -07:00