Commit Graph

96 Commits

Author SHA1 Message Date
Kartik Agaram
0f73127ef1 7547 - baremetal: rpn calculator
Still in progress. Known bugs:
* Cursor management is broken. Every line currently seems to leave
  behind a shadow cursor.
* No shift-key support yet, which means no addition or multiplication.
  (This app doesn't have division yet.)
2021-01-22 23:29:04 -08:00
Kartik Agaram
328d76e4ef 7545 2021-01-22 22:16:59 -08:00
Kartik Agaram
a688f8f8a1 7543 2021-01-22 22:03:28 -08:00
Kartik Agaram
1b09418c60 7542 - baremetal: support cursor on a grapheme
So far we've drawn a space implicitly at the cursor. Now I allow drawing
an arbitrary grapheme when drawing the cursor. But the caller has to
specify what to draw. (The alternative would be for layer 103 to
track every single grapheme on screen along with its color and any other
future attributes, just to be able to paint and unpaint the background
for a single character.)

I've modified existing helpers for drawing multiple graphemes to always
clear the final cursor position after they finish drawing. That seems
reasonable for terminal-like applications. Applications that need to
control the screen in a more random-access manner will need to track the
grapheme at the cursor for themselves.
2021-01-22 20:57:29 -08:00
Kartik Agaram
a51bc7a1e0 7541 - baremetal: debug screen test helpers 2021-01-22 20:55:57 -08:00
Kartik Agaram
121a9eba56 7540 - baremetal: cursor
I spent over a week agonizing over this.

* I had to come to terms with the fact that I don't really know how to
make pixel graphics testable. ASCII art on a pixel by pixel basis feels
inhuman. Just focus on text mode for now.

* I had to set aside the problem of non-English family languages.
Languages like Arabic that can stack complex graphemes together likely
can't be fixed-width. But I don't know enough at the moment to solve for
them.

* I spent a while trying to juggle two cursors, one invisible output
cursor for tracking the most recent print, and one visible one that's
just a hint to the user of what the next keystroke will do. But it looks
like I can fold both into a single cursor. Drawing things updates the
location of the cursor but doesn't display it. Explicitly moving the
cursor displays it, but future drawing can overwrite the cursor.
2021-01-22 19:57:33 -08:00
Kartik Agaram
c316a11ffa 7539 - baremetal: handle unrecognized keys 2021-01-22 16:52:44 -08:00
Kartik Agaram
dbf434f096 7538 - baremetal: screen coords in graphemes 2021-01-22 16:44:23 -08:00
Kartik Agaram
7363c6dfd3 7537 - baremetal: start of cursor support 2021-01-19 22:48:49 -08:00
Kartik Agaram
6ce43fce4f 7536 2021-01-19 22:48:49 -08:00
Kartik Agaram
c5b573cf83 7535 2021-01-17 10:49:23 -08:00
Kartik Agaram
851959ccc6 7534
Don't assume screen dimensions.
2021-01-17 10:43:31 -08:00
Kartik Agaram
9822a2429f 7533
Both issues of commit 7531 fixed.
2021-01-16 20:56:28 -08:00
Kartik Agaram
aa6c50d2bc 7532 2021-01-16 19:07:33 -08:00
Kartik Agaram
966daf1473 7531 - checking fake screens
This uncovers two open issues:
* incrementing the cursor after drawing a single grapheme
* needing to clear background pixels when drawing a grapheme
2021-01-16 16:41:39 -08:00
Kartik Agaram
117a710a9d 7530 - baremetal: print ints to screen 2021-01-16 16:27:58 -08:00
Kartik Agaram
6efc1ebed7 7529 - baremetal: fake screen 2021-01-16 15:32:26 -08:00
Kartik Agaram
3d6c6e5286 7528 - heap allocator 2021-01-16 11:35:13 -08:00
Kartik Agaram
2803748890 7527 2021-01-16 10:40:19 -08:00
Kartik Agaram
a8dd0d4094 7525
Bring back runtime support for bounds-checking arrays. Again, the error
messages kinda suck, because I can't yet print integers. But something
is better than nothing.
2021-01-16 09:06:01 -08:00
Kartik Agaram
0d246473c5 7524 - bring back some abort messages
Our infrastructure for displaying errors is far more rudimentary in
baremetal. Many ways things can go wrong. But making the attempt seems
better than not.

I'm also making some effort to keep it easy to see what has been copied
over from the top-level, by not modifying copied code to use syntax
sugar and so on. It may not be an important enough reason to mix
notations in a single file.
2021-01-15 21:27:52 -08:00
Kartik Agaram
49424b1933 7523
There's a dependency cycle here:

- draw-grapheme (Mu) uses read-grapheme (Mu) to be unicode-aware.
- read-grapheme uses read-byte (SubX). Streams are a fundamental data
  structure in Mu. For the Mu compiler to be able to reason about the
  safety of stream operations, they need to be an opaque type. All
  stream primitives are written in SubX. To manipulate a stream's
  internals we force people to reach for SubX. That way if there's no
  SubX code there's confidence that things are safe.
- read-byte and other stream operations have unit tests, like they
  should. The unit tests need to print data to screen when say a test
  fails. To do this they use various check- functions (SubX) that take a
  string argument.
- Printing a string to screen uses draw-grapheme (Mu).

Perhaps I should maintain variants of drawing primitives that operate
only on ASCII.
2021-01-15 21:22:33 -08:00
Kartik Agaram
8ed27ce431 7522 - bring back a few tests in .subx files
Even though baremetal has tests in SubX, they can only run in Mu
programs since the test harness is currently in a Mu layer. Baremetal
isn't really intended for running SubX programs at the moment. Is this a
step down the slippery slope towards C compilers that I complained about
in http://akkartik.name/akkartik-convivial-20200607.pdf?
2021-01-15 21:11:30 -08:00
Kartik Agaram
6e36ce06dd 7521 - new plan for tests
It's not really manageable to make the fake screen pixel-oriented. Feels
excessive to compare things pixel by pixel when we will mostly be
writing text to screen. It'll also make expected screen assertions
more difficult to manage.

So I'm not sure how to make assertions about pixels for now. Instead
we'll introduce fake screens at draw-grapheme.
2021-01-15 20:30:07 -08:00
Kartik Agaram
232b4a1511 . 2021-01-14 13:37:28 -08:00
Kartik Agaram
21bddb2e4b 7519 - baremetal: run all tests on boot 2021-01-13 21:50:38 -08:00
Kartik Agaram
32bb01ba4a 7518 2021-01-13 21:41:45 -08:00
Kartik Agaram
30e4df8172 7517 2021-01-13 21:19:02 -08:00
Kartik Agaram
686307abe0 7516 2021-01-13 21:15:24 -08:00
Kartik Agaram
fc9286f3b3 7514 2021-01-13 21:00:20 -08:00
Kartik Agaram
f8cb5f97c6 7513 2021-01-13 19:50:30 -08:00
Kartik Agaram
ec0d5bb17e 7510 - baremetal: a game of snake 2021-01-13 16:57:04 -08:00
Kartik Agaram
422ebaf88c 7508
This is the right way to be direction-independent. Don't save the cursor
when drawing a single grapheme. Where the next char goes is just a
property of the direction-oriented primitives.
2021-01-13 00:02:35 -08:00
Kartik Agaram
4413168269 7507 - baremetal: drawing text down then right 2021-01-12 23:52:24 -08:00
Kartik Agaram
fcad74b7b1 7505 2021-01-12 22:01:50 -08:00
Kartik Agaram
c5e617f5cc 7504 2021-01-12 21:51:46 -08:00
Kartik Agaram
e59086e65a 7503 - baremetal: noodling on default VGA palette 2021-01-12 19:50:22 -08:00
Kartik Agaram
0d12f6676b 7502 - baremetal text: better interface 2021-01-12 00:32:06 -08:00
Kartik Agaram
bb0e67a308 7501 - baremetal: draw text within a rectangle 2021-01-12 00:20:22 -08:00
Kartik Agaram
589eba07e2 7500 - baremetal: bounds-check screen space before drawing 2021-01-12 00:00:20 -08:00
Kartik Agaram
ebf912eb7a 7499 2021-01-12 00:00:20 -08:00
Kartik Agaram
b7e736b508 7497 2021-01-11 23:24:35 -08:00
Kartik Agaram
f6075374f5 7496 2021-01-11 23:19:43 -08:00
Kartik Agaram
3de4d557d5 7493 2021-01-09 19:01:13 -08:00
Kartik Agaram
57e4978eac 7492
Port some support for unicode to baremetal.
2021-01-09 18:55:24 -08:00
Kartik Agaram
0518944e37 7491 - baremetal: draw ASCII text to screen 2021-01-09 18:29:04 -08:00
Kartik Agaram
7f8770ae08 7490 - baremetal: draw a grapheme to screen 2021-01-09 18:28:14 -08:00
Kartik Agaram
dbd7082a0e 7489 - include GNU Unifont
https://en.wikipedia.org/wiki/GNU_Unifont#The_.hex_font_format
http://unifoundry.com/unifont/index.html

Since GNU Unifont is covered under the GPL v2, so I believe is this repo.
2021-01-09 18:20:28 -08:00
Kartik Agaram
952ccfc66e 7488 2021-01-09 13:45:41 -08:00
Kartik Agaram
26697e649b 7487 2021-01-09 13:43:39 -08:00