Commit graph

34 commits

Author SHA1 Message Date
Jeff Epler
e9ef90fa63 ptasm: -o to send hex-format output to designated file 2014-08-20 11:00:47 -05:00
Jeff Epler
be4de7021d output now matches all values in sslbp.inc, 8i20inc.inc
.. though for the latter, you have to specify --8i20
2014-08-20 11:00:21 -05:00
Jeff Epler
c9f850e2d0 misnamed program, makes .equ files from .inc files 2014-08-19 21:21:00 -05:00
Jeff Epler
03f119137e jmpa came from a macro, not sure why I needed it at some point 2014-08-19 20:38:55 -05:00
Jeff Epler
d6eb374b12 more WIP
it's closer to compiling sslbp; my mock makeinc (not yet committed)
doesn't give right results for _byte, _flag, etc
2014-08-16 22:15:13 -05:00
Jeff Epler
d3f308ee5d ptasm: #define, #include, .macro/.endm
(the latter not tested)
2014-08-16 15:58:02 -05:00
Jeff Epler
8164482e59 grammar: define prefix operators 2014-08-16 15:57:32 -05:00
Jeff Epler
175179455b unused rule 2014-08-12 06:49:22 -05:00
Jeff Epler
ba38159c1d saner handling of comments 2014-08-12 06:48:35 -05:00
Jeff Epler
70b0cb9643 implement dw/word, msfirst, lsfirst 2014-08-12 06:40:43 -05:00
Jeff Epler
6a5363b6ba Allow weird whitespace in opaque parts 2014-08-12 06:09:07 -05:00
Jeff Epler
47d9553f83 perfomance improvements
pyparsing is very slow when there are dozens of alternatives, as there
were when the whole instruction set appeared as alternatives of the main
production.

Instead, use our knowledge of the structure of assembler files so that there
are only a few top-level rules: only one for all types of instruction,
and only one for all types of pseudo-ops

Also, lay the basis for a proper pseudo-op implementation.  Implement
pseudo-ops .org and .equ; parse but don't act on .end.

Change the format of the test program accordingly.

This improves the speed by a factor of about 4 on the 'ssremote' input.
This real program goes from 4s runtime to 1s.
2014-08-11 21:28:39 -05:00
Jeff Epler
9cd1acd815 leading space *required* when there's no label 2014-08-10 21:36:12 -05:00
Jeff Epler
cf7111aeda parse the .end directive (but ignore it) 2014-08-10 21:36:12 -05:00
Jeff Epler
2ee646eb86 Support all tasm operators
note that tasm follows strict l-to-r evaluation, but admonishes programmers
to fully parenthesize calculations for compatibility with other
assemblers.
2014-08-10 21:36:12 -05:00
Jeff Epler
5bf5ab42a8 support character literals in expressions 2014-08-10 21:36:12 -05:00
Jeff Epler
93f8640f23 huff, matchfirst is grumpy again. I thought I tested this 2014-08-10 21:36:12 -05:00
Jeff Epler
31145041ce This is a markdown file, mostly 2014-08-08 07:11:37 -05:00
Jeff Epler
5300ab3e2b Always match first instruction from table
.. this requires explicitly matching the space after an instruction
because otherwise the pattern order
 JMP *
 JMPNZ *
would cause 'JMPNZ LABEL' to actually parse as 'JMP NZ LABEL', and
issue an error due to the trailing 'LABEL'.  (This doesn't actually
make sense to me, except that it's what pyparsing seemed to do)
2014-08-08 06:59:46 -05:00
Jeff Epler
b86c6255c6 fix comment stripping
the sequence
 stab YH ; comment
didn't parse because of trailing space
2014-08-08 06:47:49 -05:00
Jeff Epler
5d7d94e6bd temporarily(?) make range messages into warnings 2014-08-08 06:35:13 -05:00
Jeff Epler
6556992f80 spell ORG like tasm 2014-08-07 22:24:48 -05:00
Jeff Epler
e410ddf812 implement DW pseudo-instruction 2014-08-07 22:24:24 -05:00
Jeff Epler
f4de7b69e4 use 'equ' instead of '=' for tasm compatibility 2014-08-07 22:24:09 -05:00
Jeff Epler
bf60ec5b7c numbers: parse tasm-style numbers with prefixes and suffixes 2014-08-07 22:09:56 -05:00
Jeff Epler
c5e1b78751 use a simple search path for tables
.. they can be in the current directory, with the pta module,
or with the ptasm script
2014-08-07 21:39:29 -05:00
Jeff Epler
fa3b5d76a8 tasm compatibility for label parsing
the token in the first column is a label

the colon after a token is optional
2014-08-07 21:38:03 -05:00
Jeff Epler
d78899bc26 d8: more than 8 MSBs are determined by the opcode 2014-08-07 21:05:52 -05:00
Jeff Epler
80ccc56ee6 full instruction table for d8 2014-08-07 19:34:13 -05:00
Jeff Epler
9fa451f0c6 A tool for converting d8 table to python 2014-08-07 19:34:13 -05:00
Jeff Epler
4cb27bf635 exercise case bending 2014-08-07 19:34:13 -05:00
Jeff Epler
238bea1c22 make assembly tokens case insensitive 2014-08-07 19:34:13 -05:00
Jeff Epler
38b5ad4dcd script should be executable 2014-08-07 19:34:12 -05:00
Jeff Epler
0b7557de0f Initial commit 2014-08-07 18:57:30 -05:00