Commit Graph

78 Commits

Author SHA1 Message Date
Kartik Agaram 03c6f1d385 4949 2019-02-02 22:05:11 -08:00
Kartik Agaram 0ad068dd1d 4945 2019-02-01 23:49:41 -08:00
Kartik Agaram c65dee2d99 4938 2019-01-20 23:20:34 -08:00
Kartik Agaram 332cbba31f 4937 2019-01-20 22:50:44 -08:00
Kartik Agaram bf58189697 4930 2019-01-15 16:36:24 -08:00
Kartik Agaram 7011322ad1 4929
Clean up primitives for converting from/to hex chars.
2019-01-15 14:11:26 -08:00
Kartik Agaram 8472406209 4928 2019-01-14 23:16:22 -08:00
Kartik Agaram 3f97166cf7 4927 2019-01-14 17:29:10 -08:00
Kartik Agaram 509f0a12ca 4926 2019-01-14 17:06:10 -08:00
Kartik Agaram feec2292b5 4925 2019-01-14 16:54:41 -08:00
Kartik Agaram 220ac38964 4923
We want slice-equal? for length-prefixed strings, not null-terminated "kernel"
strings.
2019-01-12 22:24:06 -08:00
Kartik Agaram dadae33848 4920 2019-01-11 17:50:29 -08:00
Kartik Agaram 8b9dd2d1a9 4916
In the process of building slice primitives I found an out-of-bounds access
in write-byte.
2019-01-10 17:06:38 -08:00
Kartik Agaram 74a46597aa 4913 2019-01-07 13:34:16 -08:00
Kartik Agaram aff782c429 4911 2019-01-06 12:52:33 -08:00
Kartik Agaram 2eb174d697 4908
Fix CI.

a) Update canonical binaries.
b) Fix an out-of-bounds access in `clear-stream`. This also required supporting
   a new instruction in `subx run` to load an imm8 into rm8.
2019-01-05 01:07:37 -08:00
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 6a7eaa81ee 4883 - rudimentary memory allocator 2018-12-28 11:14:29 -08:00
Kartik Agaram 044b413021 4879 2018-12-28 02:07:11 -08:00
Kartik Agaram 3d4fba4d12 4865
More mnemonic register usage in write-stream.
2018-12-10 09:55:46 -08:00
Kartik Agaram 3a4d870730 4864
Our first buffer overflow!
2018-12-10 00:17:47 -08:00
Kartik Agaram 33e7c3a751 4846
Clean up a few things:

a) Call scan-next-byte in hex.subx with the right number of args. Turns
out tests continue to work fine if they never use the other args.

b) Tear down a test for 'stop' in the right order. Not important since we
have no EBP to restore. But can still be misleading.

c) Have 'check-ints-equal' return nothing. Handy for it to not mess up
EAX. I never use the result anyway, and the name also is imperative suggesting
callers won't expect a return value.
2018-12-06 09:34:55 -08:00
Kartik Agaram 0becf53645 4844 2018-12-06 00:18:13 -08:00
Kartik Agaram 79328f9ad6 4841
New helper: print an error message, then a numeric byte, then abort.
2018-12-04 12:26:27 -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 af5797eeff 4838
Better to use EDI as a mnemonic for 'destination'.
2018-12-04 10:40:01 -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 381d80f8a4 4834
Fix CI since 4827.
2018-12-04 09:56:23 -08:00
Kartik Agaram a9cce7121a 4833 2018-12-04 00:30:00 -08:00
Kartik Agaram 83822d6324 4828 - writing to buffered-file
This is likely a sub-optimal interface, but I'm trying not to agonize.
The whole point of Mu is to permit radical changes at any point in time.
2018-12-03 17:08:53 -08:00
Kartik Agaram 5e27c7f13e 4827
I was 'returning' a phantom value from 'write' when the underlying '_write'
returns nothing.

In general, returning counts of bytes written is not so useful for error
checking when my primitives abstract away from that. We'll come back to
error signalling later.
2018-12-03 16:44:16 -08:00
Kartik Agaram 1eb9cc5679 4822
Fix CI.

It's kind of a hassle (and wasteful) that I need to redefine 'main' in
every single layer.
2018-12-03 11:41:33 -08:00
Kartik Agaram 0eb0f69616 4821 2018-12-02 22:41:28 -08:00
Kartik Agaram 87c606ee06 4810 2018-11-30 16:56:35 -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 5f6edeea51 4768 2018-11-24 15:06:35 -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 fa04aebdc2 4756
Long-standing and long-copied typo has been messing with our exit status
on test failures.
2018-11-19 23:34:20 -08:00
Kartik Agaram bd6f1928d7 4755 - read-byte (sometimes called getchar) 2018-11-19 23:11:00 -08:00
Kartik Agaram b31455f81d 4747 - subx: 'read' primitive 2018-11-18 00:17:29 -08:00
Kartik Agaram 267fd885b2 4745 2018-11-17 20:45:22 -08:00
Kartik Agaram 11a5fffade 4743 2018-11-12 22:00:51 -08:00
Kartik Agaram 8b0e960dbb 4741
Extract a helper that we'll need for 'read'.
2018-10-30 23:10:49 -07:00
Kartik Agaram b3d8c144a4 4740 2018-10-30 22:46:05 -07:00
Kartik Agaram f94442fe2d 4736
We'll use a common stream data structure for input and output streams.

Having separate types makes more sense in a more high-level language, where
we have type checking and where functions for handling the different types
are more concise. But in machine code the sweet spot is more toward fewer
types.
2018-10-29 16:34:47 -07:00
Kartik Agaram bb5cc54f96 4732 2018-10-28 12:45:11 -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