Commit Graph

107 Commits

Author SHA1 Message Date
Michael C. Martin 1c7174e696 Merge pull request #14 from catseye/fix-templabelcount
Declare templabelcount as a global in atom().
2013-01-10 22:25:03 -08:00
Michael C. Martin c25047ca66 Merge pull request #17 from catseye/exit-code-1-on-error
Exit with exit code 1 when errors occurred
2013-01-10 22:18:23 -08:00
Cat's Eye Technologies 5fc504c6c1 Exit with exit code 1 if there were errors, 0 otherwise. 2012-10-25 10:51:39 +01:00
Cat's Eye Technologies 0b020a827b Add missing 'sys.' and remove unused module import. 2012-08-03 20:13:00 -05:00
Cat's Eye Technologies 45784e9b95 Declare templabelcount as a global in atom(). 2012-07-28 13:34:51 -05:00
Michael Martin 4ad16be245 Put tools under src 2012-06-16 02:07:02 -07:00
Michael Martin ae59cbf3c4 Remove outdated website data 2012-06-16 02:05:45 -07:00
Michael Martin 5362a635c8 Fix up some typos in meta text. 2012-06-16 01:37:55 -07:00
Michael Martin 9ef2b91e9e packaging for 2.0 release 2012-06-13 00:24:21 -07:00
Michael Martin 55d7344cc7 PDF version of manual 2012-06-13 00:07:10 -07:00
Michael Martin 0faae3f5b4 Update manuals 2012-06-12 23:13:55 -07:00
Michael Martin 51583ce5e0 Remind git about binary files and not to mangle them. 2012-06-12 19:11:34 -07: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 10c3b46996 Finish up the test suite
Quite a few tests fail; that'll need fixing.
2012-06-12 06:29:03 -07:00
Michael Martin 926eef2287 Many more unit tests.
- Labels
 - Expressions
 - Macros
 - Outline for remaining tests (compilation units, segments, scoping)
2012-06-10 22:16:24 -07:00
Michael Martin 382a6a218b Set STDOUT to binary mode on Windows if needed 2012-06-10 18:53:49 -07:00
Michael Martin ffd96a8c2f Update documentation. 2012-06-09 03:21:33 -07:00
Michael Martin 07f807d680 Documentation and examples reorganization 2012-06-08 23:41:16 -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 47be777884 Test suite: new tests for basic I/O and binary transforms 2012-06-08 21:50:28 -07:00
Michael Martin 6e30cc4153 Wide instruction format for 65c02 2012-06-08 21:45:38 -07:00
Michael Martin e44ad61af9 Improved test script
This script requires Python 2.4, for the subprocess module.
2012-06-08 02:49:29 -07:00
Michael Martin 23700276a6 Introduce wide-mode override opcodes.
This solves the --no-collapse problem by letting you force
Absolute mode on an instruction by instruction bases, which is
usually going to be what you want anyway.
2012-06-06 05:13:19 -07:00
Michael Martin 4891849e4a Pass control command line options.
It turns out that --enable-collapse is fundamentally misguided. We'll
need a better solution for that. --no-branch-extension looks pretty good.
2012-06-06 04:33:21 -07:00
Michael Martin 7e503df96f Bugfix: .include wasn't blocking later .requires
When crossing directories, this will still be wrong, but that's a
larger fix for later.
2012-06-04 00:35:53 -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 Martin 9ea0962e52 Fixed missing import. 2012-06-03 20:22:48 -07:00
Michael Martin 86e58efce8 Merge catseye's incbin-range enhancement.
Needed a little work to merge cleanly, but no real surprises.

This isn't a complete solution yet, but it will work for the
basic case. It should allow expressions and gracefully handle
non-hardcoded cases (while still efficiently handling hardcoded
ones).
2012-06-03 20:00:40 -07:00
Michael Martin cf0df92fb1 Wrap up the new file/dir handling.
An .outfile directive lets sources suggest default filenames.

Also, .include, .require, .incbin, and .charmapbin are relative
to their _source file_ as opposed the _directory you called Ophis
from_, like it really should have always been.
2012-06-03 19:50:17 -07:00
Michael Martin 17f68399ef Allow support for multiple input files.
To account for this change, output files are now prefixed with the
-o option, and if none is specified, it defaults to 'ophis.bin'.
2012-06-03 18:32:25 -07:00
Michael Martin 809bf51239 NES Hello World code
Includes iNES and UNIF linkage.
2012-06-03 15:09:18 -07:00
Michael C. Martin a9f406489d Demo "Hello World" for the Stella/Atari 2600. 2012-06-02 20:06:14 -07:00
Michael Martin feba267ee7 Basic platform headers.
* C64, NES, and Atari 2600 ("Stella") useful constants headers.
 * crt0.s equivalent for C64.
 * Hello World for the C64.
2012-06-02 02:45:05 -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 Martin f83379287f Don't destroy the OptParser.
As long as we're not gratuitously breaking compatibility, this
cleanup isn't available in 2.3 and it's not like ophis runs long
enough for this to be an issue anyway.
2012-06-01 00:39:12 -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 1bbb2f1f1b Braindead test script 2012-06-01 00:24:30 -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 Martin e58d5ccaac Win32 installer.
Includes the py2exe script, the version of the MSVC++ runtime Python 2.7
needs, and an NSIS script to assemble the installables out of the checkout
tree.

NB: Even though MakeNSIS is multiplatform, it should only be run on
Windows, since otherwise the linebreaks in the README won't be
Notepad-friendly.
2012-05-30 08:32:52 -07:00
Michael C. Martin 57e663cf29 Remove spurious CRLFs 2012-05-29 18:24:20 -07:00
Michael C. Martin af50326e39 Add the NOP Zero Page undocumented opcode.
This seems to be one of the preferred undocced ops in the Atari
2600 VCS development community.
2012-05-29 18:24:20 -07:00
Michael C. Martin 196cb47f05 Fix bug in pass manager that was making the branch extender too aggressive.
We need to let the zero-page collapser do as much work as it can before
we get bent out of shape about out-of-range branches.
2012-05-28 22:53:53 -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 3184b22e41 Add backup files to .gitignore 2012-05-27 15:57:22 -07:00
Michael C. Martin c1c102291c Remove the deprecated and incomplete compatibility mode for Perl65. 2012-05-27 15:57:10 -07:00
Cat's Eye Technologies b843ba9ba9 Have .incbin take an optional offset and length for source bytes. 2012-05-08 18:12:28 -05: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 d5ec7bdacd A simple distutils wrapper to make ophis a standalone program on a system. 2012-05-06 18:20:47 -07:00