Commit graph

7811 commits

Author SHA1 Message Date
David Given 61d623c4d6 Add a few minor top optimisations. 2019-02-16 01:18:31 +01:00
David Given 6a8b298861 Fix typo where I was confusing sbi and sui, with hilarious results. 2019-02-16 01:18:21 +01:00
David Given dfd75c770b
Merge pull request #170 from davidgiven/dtrg-i169
Fix driver crash when using -R
2019-02-15 23:56:00 +01:00
David Given 245478a030 Fix memory corruption when using -R; the values being stored in the list
weren't freeable when they should have been.
2019-02-15 23:40:42 +01:00
David Given e976e10708 Reformat before editing. 2019-02-15 23:24:10 +01:00
David Given d4d5eee1cd
Merge pull request #168 from davidgiven/dtrg-i167
i80: fix large stack frames
2019-02-15 23:12:12 +01:00
David Given 4474d6433a Loading large constants now computes the stack offset correctly. 2019-02-15 23:03:01 +01:00
David Given 34c67698ef Generate the proper function prologues for big stack frames. 2019-02-15 23:01:33 +01:00
David Given e1ddbf969a
Merge pull request #166 from davidgiven/dtrg-comparisons
i80: grabbag of optimisations
2019-02-15 22:54:13 +01:00
David Given 8ca4d6ea1e Cleanup. 2019-02-15 22:26:14 +01:00
David Given c9467b683a Add rules for converting smallnconst2 and smallpconst2 to registers, to stop
the conversion from happening via the stack. Star Trek goes from 39450 to 39384
bytes.
2019-02-15 22:20:07 +01:00
David Given afd45acb89 Using regpair instead of hl_or_de is not, in fact, safe until we've stopped
using bc.
2019-02-15 21:38:17 +01:00
David Given d63a359a49 Fix nearly all the comparisons, a lot of which were broken. Using a rst for
unsigned comparisons is surprisingly not that useful due to marshalling
overhead; it's only four bytes to do inline (plus jc), or six for a constant.
Also add some useful top optimisations.  Star Trek goes from 39890 to 39450
bytes.
2019-02-15 21:30:27 +01:00
David Given 91c75f81b5 Call cmps rather than cmpu for bge... make cmps and cmpu rsts. Apply various
other tiny optimisations.
2019-02-15 00:38:39 +01:00
David Given 2924ce8ffa Use nicely optimised helper tools to do signed comparisons of words. Star Trek
goes from 40452 to 39890 bytes.
2019-02-14 23:57:55 +01:00
David Given 0694cf34b0
Merge pull request #165 from davidgiven/dtrg-b164
i80: fix bad code in inl using faddrn
2019-02-14 23:29:41 +01:00
David Given 3c3d2a4520 Fix bad helper tool invocation for inl with faddrn. 2019-02-14 23:21:47 +01:00
David Given cf6041c57f Add failing test case. 2019-02-14 23:19:11 +01:00
David Given 44c8b53a2d
Merge pull request #163 from davidgiven/dtrg-regmoves
i80: fix pathological behaviour in asp
2019-02-14 00:13:41 +01:00
David Given 8eaa11ac72 Turns out that every time the compiler tried to do a stack retraction with asp,
it would flush registers onto the stack. This stops it doing this. Star Trek
goes from 40779 to 40452 bytes.
2019-02-14 00:05:08 +01:00
David Given 2deead3d3d
Merge pull request #161 from davidgiven/dtrg-faststack
i80: use helper functions for stack access
2019-02-13 22:56:18 +01:00
David Given 6e3ba8e9a0 Merge from default. 2019-02-13 22:46:00 +01:00
David Given 79a38ecc08 Instead of using parameterised rsts for stack access, add a huge swathe of
automatically built helper tools. Star Trek goes up from 40243 to 40779 bytes,
but should be a lot faster.
2019-02-13 22:45:22 +01:00
David Given f70659f460 Don't do weird things if files starting with a hyphen exist in the build
directory.
2019-02-13 22:42:05 +01:00
David Given 37ded7e65d
Merge pull request #160 from davidgiven/dtrg-b159
i80, powerpc, mips: fix issue with logical operations and signed small constants
2019-02-13 21:16:06 +01:00
David Given 8200f041c2 Fix issue with logical operations and small signed constants which turned out
to affect multiple platforms.
2019-02-13 20:56:10 +01:00
David Given eb57db75a4 Update test case to provoke bug. 2019-02-13 20:10:38 +01:00
David Given 55f3880f43
Merge pull request #158 from davidgiven/dtrg-b157
i80: fix bad code in comparisons
2019-02-12 22:29:01 +01:00
David Given f4b45f1ed7 Fix bad code generation due to not correctly flushing the stack before
comparisons.
2019-02-12 22:19:07 +01:00
David Given a2b5202081 Added a test case for #157. 2019-02-12 22:08:08 +01:00
David Given 073451dd44
Merge pull request #154 from ccodere/buildfix
Bugfix of compilation on gcc 4.8
2019-02-12 21:51:46 +01:00
carl 664338aa49 Fix compilation issue on C90 compilers (gcc 4.8 was failing to compile with default flags) - updated following comment. 2019-02-13 00:17:45 +08:00
David Given 360e1525ae Replace the non-working Z80 style signed comparison sign adjustment with
something which actually works on the 8080. Sadly, Star Trek is up to
40243 bytes again.
2019-02-12 11:57:37 +01:00
David Given ee716754d3
Merge pull request #156 from davidgiven/dtrg-arraysizes
i80: add 8085 instruction support
2019-02-11 21:35:16 +01:00
David Given e8994afdf0 Apply Alan Cox's patch to add the 8085 extended instructions to the i80
assembler.
2019-02-11 21:14:35 +01:00
David Given ae6ea14e93
Merge pull request #155 from davidgiven/dtrg-arraysizes
i80: fix signed comparisons
2019-02-11 21:09:52 +01:00
David Given f1b128baeb Signed comparisons now work correctly; sadly, Star Trek increases from 39656 to
39726 bytes. Note that the emulator doesn't set P/V correctly and all the tests
fail. Testing in z80ex works fine.
2019-02-11 20:46:06 +01:00
carl c63f527dde Fix compilation issue on C90 compilers (gcc 4.8 was failing to compile with default flags). 2019-02-12 00:46:09 +08:00
David Given 34e9573929 Merge from default. 2019-02-10 23:40:07 +01:00
David Given 1564e65c2d Add tests for simple comparisons (which i80 fails). 2019-02-10 23:39:15 +01:00
David Given 3991a0db3a
Merge pull request #153 from davidgiven/dtrg-i80
i80: more code generator improvements
2019-02-10 19:45:00 +01:00
David Given fca54ccc1b Improve subtractions, using dad and inline constants where possible. Shrinks
Star Trek from 39740 to 39656 bytes.
2019-02-10 19:40:48 +01:00
David Given 7d34cd7407 Simplify simple comparisons and use inlie constants where possible. Reduces
Star Trek from 39771 to 39740 bytes.
2019-02-10 19:22:43 +01:00
David Given 35d1f36ca4 Use pop rather than inx;inx to retract the stack; consumes a register but
halves the number of calls. Reduces Star Trek from 39976 to 39771 bytes.
2019-02-10 18:57:20 +01:00
David Given b34ff2bdec Teach the i80 code generator how to do left shifts by using dad hl; prevents it
from calling out to .sli2 for simple shifts. Shrinks Star Trek from 40055 bytes
to 39976.
2019-02-10 18:44:47 +01:00
David Given 608e386ca4
Merge pull request #152 from davidgiven/dtrg-osx
Enable OSX builds again.
2019-02-10 16:40:16 +01:00
David Given c95d5db372 Replace mkstemp() with the more modern and safer and simpler tmpfile(). 2019-02-10 14:36:15 +01:00
David Given 63fa647bc9 freopen() appears to be problematic on OSX; as it's only ever used to rewind
files, replace with rewind().
2019-02-10 14:32:17 +01:00
David Given 1dfafe070c Better error reporting. 2019-02-10 14:19:18 +01:00
David Given 813595358c More common symbol removal. 2019-02-10 14:09:52 +01:00