Commit Graph

56 Commits

Author SHA1 Message Date
Kartik Agaram dd9ba09a7c 4888
We only can't use rm32=5 when mod=0. Totally fine when it's mod=1.
2018-12-29 13:36:06 -08:00
Kartik Agaram 431627b242 4886 2018-12-28 21:26:42 -08:00
Kartik Agaram 044b413021 4879 2018-12-28 02:07:11 -08:00
Kartik Agaram 81605224f0 4847 2018-12-06 09:41:40 -08:00
Kartik Agaram a94b60b5cc 4840
New helper: printing a string to a buffered file.
2018-12-04 12:16:17 -08:00
Kartik Agaram 9e03e2bd37 4837
Let's standardize to use opcode 39 rather than 3b by default.
2018-12-04 10:19:18 -08:00
Kartik Agaram cf02c20bb0 4832
Let's start adding ':end' labels in all functions, just because it helps
us visualize where function calls end in traces, thanks to the '--map'
commandline argument.
2018-12-04 00:29:06 -08:00
Kartik Agaram 5082923e81 4826 2018-12-03 16:34:16 -08:00
Kartik Agaram 0eb0f69616 4821 2018-12-02 22:41:28 -08:00
Kartik Agaram 0043952064 4819 2018-12-02 16:58:30 -08:00
Kartik Agaram c98d4b1c6a 4818 2018-12-02 14:41:21 -08:00
Kartik Agaram f44c595267 4815 2018-12-02 11:08:30 -08:00
Kartik Agaram 54e5128a14 4813 2018-12-01 12:44:10 -08:00
Kartik Agaram c7d45d918b 4812 2018-11-30 22:57:52 -08:00
Kartik Agaram 9d27e966b5 4808 - clean up comments in all subx files 2018-11-30 16:45:15 -08:00
Kartik Agaram f52bc40d6f 4803 2018-11-30 11:23:08 -08:00
Kartik Agaram ee9a9237d6 4802
Some automated commenting cleanup. Still needs more careful manual scanning.

  sed -i 's/^#   1-3/# . 1-3/' *.subx */*.subx
  sed -i 's/^#   op/# . op/' *.subx */*.subx
  sed -i 's/# vim/# . . vim/' *.subx */*.subx
  sed -i 's/^    # push args/    # . . push args/' *.subx */*.subx
  sed -i 's/^    # discard args/    # . . discard args/' *.subx */*.subx
  sed -i 's/^    # call/    # . . call/' *.subx */*.subx
  sed -i 's/^    # prolog/    # . prolog/' *.subx */*.subx
  sed -i 's/^    # epilog/    # . epilog/' *.subx */*.subx
  sed -i 's/^    # save registers/    # . save registers/' *.subx */*.subx
  sed -i 's/^    # restore registers/    # . restore registers/' *.subx */*.subx
  sed -i 's/  operand  /  register /' *.subx */*.subx
2018-11-30 11:13:36 -08:00
Kartik Agaram 6030d7e2e5 4801
Reindent all SubX code to make some room for the new comment style.
2018-11-30 10:54:42 -08:00
Kartik Agaram e9661581f0 4800 2018-11-30 10:37:14 -08:00
Kartik Agaram a20b51bdb7 4797 2018-11-30 09:45:07 -08:00
Kartik Agaram c56d803cd8 4796 2018-11-30 09:43:49 -08:00
Kartik Agaram 33fdc60b16 4775
Start with an exactly corresponding version to Crenshaw 2-1: single-digit
numbers. The only change: we assume the number is in hex.

The next version now supports multi-digit hex numbers.
2018-11-24 23:26:14 -08:00
Kartik Agaram 31ff94214b 4774
Simplification.
2018-11-24 23:14:21 -08:00
Kartik Agaram 732cf4e7cc 4773 - done with crenshaw chapter 2-1
In the process I had to fix a couple more bugs in support for disp16 instructions.
2018-11-24 23:06:55 -08:00
Kartik Agaram ba196240ff 4770 2018-11-24 20:25:54 -08:00
Kartik Agaram 9f3c5187b2 4766 2018-11-24 12:54:39 -08:00
Kartik Agaram 9fa3f5dc4e 4765 2018-11-23 16:21:04 -08:00
Kartik Agaram e345224833 4764 2018-11-23 16:19:06 -08:00
Kartik Agaram d373c008b3 4763 - back to the 'trivial' crenshaw2-1 compiler
This time I've ported (and test-driven) 'GetChar' and 'GetNum'. The new
tests bring together our new testable interfaces for read() and exit().
2018-11-23 00:42:30 -08:00
Kartik Agaram 172e52c47b 4733 2018-10-28 13:27:53 -07:00
Kartik Agaram 93be389bef 4731 2018-10-28 12:41:04 -07:00
Kartik Agaram eb9087635b 4729
Start injecting all dependencies in the Crenshaw compiler app.

In the process I realized the non-fake code path of 'stop' had a bug.
2018-10-28 00:19:46 -07:00
Kartik Agaram 4cc517e0de 4710
Start using write() instead of _write().. and we promptly find a typo when
dealing with real file descriptors.
2018-10-17 08:19:03 -07:00
Kartik Agaram 6528a08992 4699 2018-10-14 22:25:57 -07:00
Kartik Agaram a9a5718d08 4698 2018-10-14 12:53:50 -07:00
Kartik Agaram 94ad882e82 4668 2018-10-05 21:30:22 -07:00
Kartik Agaram 03d50cc83c 4667
Standardize on hyphens in all names.
And we'll use colons for namespacing labels in functions.
2018-10-05 19:49:47 -07:00
Kartik Agaram ed0e64a981 4662 2018-10-05 10:42:16 -07:00
Kartik Agaram d383ba7634 4655 2018-10-02 20:58:39 -07:00
Kartik Agaram d25e51dc0f 4644 2018-10-01 15:53:44 -07:00
Kartik Agaram 57628c0e44 4638 - extract some common libraries from apps
I'm still trying to figure out what the defaults should be. At the moment
you have to explicitly pass in every file you want loaded into the output
binary. Maybe that control is a good thing. The examples need no libraries
so far.
2018-10-01 12:27:39 -07:00
Kartik Agaram 1dcd9350ce 4624
Start requiring a '-o' flag to designate the output binary when translating.

Things currently get funky if you pass in multiple inputs, but that's ok.
This is the first step to supporting multiple input files for a single
output binary.
2018-09-30 23:12:54 -07:00
Kartik Agaram bc3e572acd 4518 2018-09-24 23:49:43 -07:00
Kartik Agaram 5347cf8bf4 4517 2018-09-24 23:01:38 -07:00
Kartik K. Agaram c5d9a32fe6 4516
More calling convention tweaks.

Use EBP to get consistently at parameters and locals.
Always put the first function argument closest to EBP.
2018-09-24 22:55:37 -07:00
Kartik Agaram 37735c1da4 4510
Add the test harness to the crenshaw compiler. Though we aren't calling
it yet. But that's because we aren't actually doing anything useful yet.
2018-09-23 21:12:39 -07:00
Kartik Agaram c437c6dd90 4509
Back to the Crenshaw compiler. Start by using string literals.
2018-09-23 21:04:32 -07:00
Kartik Agaram 9372c16c00 4581
Even more cuddling. We want to keep lines short where the opcode and operands
are self-explanatory.

If there are any implicit registers, etc., we'll continue to do the table
layout.

The first two columns look messy now; let's see how this goes.
Maybe I'll give up on the tabular layout altogether, just string args with
a single space.
2018-09-21 16:56:37 -07:00
Kartik Agaram 9c50655a26 4576 2018-09-21 15:29:59 -07:00
Kartik Agaram 94ddf7d7d4 4560 2018-09-20 16:37:18 -07:00