Commit Graph

6742 Commits

Author SHA1 Message Date
Kartik Agaram 5462619d96 6742 - support for formatting in fake screens
We still need a few primitives, but we can implement these as needed. I'm
ready to call the fake screen done.
2020-09-07 14:18:48 -07:00
Kartik Agaram 9f293fef05 6741 - fake screen now scrolls correctly 2020-09-06 22:45:43 -07:00
Kartik Agaram 05b9b2ab9c 6740 2020-09-06 22:06:12 -07:00
Kartik Agaram 454e345e49 6739 2020-09-06 21:55:11 -07:00
Kartik Agaram eaf95be101 6738 2020-09-06 21:39:05 -07:00
Kartik Agaram 742bbf27f7 6737 2020-09-06 21:36:05 -07:00
Kartik Agaram 58a70a38cf 6736 2020-09-02 21:50:12 -07:00
Kartik Agaram 150f2bce23 6735 - print unicode string to fake screen 2020-09-02 21:48:26 -07:00
Kartik Agaram 6c54814131 6734 - first test for text-mode screen primitives 2020-09-02 21:27:41 -07:00
Kartik Agaram cd94852dbc 6733 - read utf-8 'grapheme' from byte stream
No support for combining characters. Graphemes are currently just utf-8
encodings of a single Unicode code-point. No support for code-points that
require more than 32 bits in utf-8.
2020-08-28 23:24:04 -07:00
Kartik Agaram 392ebcce80 6732 2020-08-28 22:38:08 -07:00
Kartik Agaram d07dfdd40c 6731 2020-08-28 22:34:07 -07:00
Kartik Agaram 34ac52cb43 6730 2020-08-28 22:04:12 -07:00
Kartik Agaram ddea9a73e2 6729 2020-08-28 21:57:06 -07:00
Kartik Agaram 6358afc5c1 6728 - new skeleton for screen primitives
Finally this compiles.
2020-08-22 14:44:01 -07:00
Kartik Agaram 15b9880136 6727 - bugfix in a multiply instruction
Also more error-detection for this case all across the toolchain.
2020-08-22 14:35:44 -07:00
Kartik Agaram db894e7968 6726 2020-08-22 14:25:29 -07:00
Kartik Agaram ef8e98dd06 6725 - support negative literals 2020-08-22 13:59:57 -07:00
Kartik Agaram 0361a76d86 6724 2020-08-22 13:30:48 -07:00
Kartik Agaram 426fcd3ec3 6723 2020-08-22 13:26:08 -07:00
Kartik Agaram 38128ae167 6722 2020-08-22 12:35:39 -07:00
Kartik Agaram db541c3595 6721 2020-08-22 10:15:14 -07:00
Kartik Agaram 66daf3cc1f 6720 2020-08-22 10:14:37 -07:00
Kartik Agaram e8ffaf29ce 6719 - error-checking for 'index' instructions
1000+ LoC spent; just 300+ excluding tests.

Still one known gap; we don't check the entirety of an array's element
type if it's a compound. So far we just check if say both sides start with
'addr'. Obviously that's not good enough.
2020-08-21 21:32:48 -07:00
Kartik Agaram be2a94d9b8 6718 2020-08-16 22:43:03 -07:00
Kartik Agaram 1a1ab91e77 6717 2020-08-15 21:43:52 -07:00
Kartik Agaram 828bc32057 6716 2020-08-15 21:38:36 -07:00
Kartik Agaram 208b28303c 6715
There's a question of how we should match array types with a capacity on
ones without. For now we're going to do the simplest possible thing and
just make type-match? more robust. It'll always return false if the types
don't match exactly. For ignoring capacity we'll rely on the checks of
the `address` operation (which don't exist yet). This means we should do
this to pass an address to an array to a function f with signature `f (addr
array int)`:

  var a: (array int 3)
  var b/eax: (addr array int) <- address a
  f b

rather than this:

  var a: (array int 3)
  var b/eax: (addr array int 3) <- address a
  f b

Similar reasoning applies to stream types. Arrays and streams are currently
the only types that can have an optional capacity.
2020-08-03 21:45:41 -07:00
Kartik Agaram 672ea33132 6714 2020-08-02 21:25:28 -07:00
Kartik Agaram 75bdc0ad5b 6713 - move-cursor on fake screen 2020-08-02 21:19:16 -07:00
Kartik Agaram 03e4ff608b 6712 - new prototype with cleaner box shapes 2020-08-02 21:16:09 -07:00
Kartik Agaram 2ab2af0c05 6711 2020-08-02 21:01:48 -07:00
Kartik Agaram ab445d6e75 6710 - utf-8 encoding
Example program:

  fn main -> r/ebx: int {
    var x/eax: code-point <- copy 0x2192  # unicode character 'rightwards arrow'
    print-code-point 0, x
    print-string 0, "\n"
    r <- copy 0
  }

Run:
  $ ./translate_mu x.mu  &&  ./a.elf
  →
  $
2020-08-02 20:53:36 -07:00
Kartik Agaram ea2d44bdef snapshot: encoding code-points to utf-8
I have it partly working, but just realized I've been reversing the output
bytes.
2020-08-02 20:14:50 -07:00
Kartik Agaram 9ee9f37dc7 6708 2020-08-02 17:45:46 -07:00
Kartik Agaram ecc31a4928 6707 2020-08-02 17:32:01 -07:00
Kartik Agaram 89c9ed80f9 6706 - support utf-8
For example:

  fn main -> r/ebx: int {
    var x/eax: grapheme <- copy 0x9286e2  # code point 0x2192 in utf-8
    print-grapheme-to-real-screen x
    print-string-to-real-screen "\n"
  }

Graphemes must fit in 4 bytes (21 bits for code points). Unclear what we
should do for longer clusters since graphemes are a fixed-size type at
the moment.
2020-08-02 15:50:19 -07:00
Kartik Agaram 0f5d0ec519 6705
Another stupid bug: I've been printing out 3 nulls for every byte of ascii.
2020-08-02 15:30:59 -07:00
Kartik Agaram 0a8e8f4e2f 6704
This is stupid; all this while I've been writing escape sequences to the
screen they've been going out on stderr.
2020-08-02 15:19:27 -07:00
Kartik Agaram 0452b05f5a 6703 - new types: code-point and grapheme
Both have the same size: 4 bytes.

So far I've just renamed print-byte to print-grapheme, but it still behaves
the same.

I'm going to support printing code-points next, but grapheme 'clusters'
spanning multiple code-points won't be supported for some time.
2020-08-02 15:11:52 -07:00
Kartik Agaram 1b79f705b9 6702 2020-08-02 11:51:29 -07:00
Kartik Agaram 7d33cce069 6701 2020-08-02 11:42:59 -07:00
Kartik Agaram 902b4084af 6700 - clear fake screen
One thing I hadn't realized in all my hacking on the mu1 prototype: clear-screen
doesn't modify active attributes. It's equivalent to printing spaces all
over the screen with the current attributes.
2020-08-01 23:41:48 -07:00
Kartik Agaram 6b343a82f2 6699 - start building out fake screen
We now have all existing apps and prototypes going through the dependency-injected
wrapper, even though it doesn't actually implement the fake screen yet.
2020-08-01 23:39:57 -07:00
Kartik Agaram 59a2e363f5 6698 2020-08-01 16:28:32 -07:00
Kartik Agaram af983921f6 6697 2020-08-01 16:25:34 -07:00
Kartik Agaram d01d4f0c9f 6696 2020-07-31 20:51:30 -07:00
Kartik Agaram 7ad38707ad 6695 2020-07-31 20:51:01 -07:00
Kartik Agaram 1694f9a3b5 6694 2020-07-31 16:15:39 -07:00
Kartik Agaram 7fa80570a0 6693 2020-07-31 16:11:34 -07:00