Commit Graph

7660 Commits

Author SHA1 Message Date
Kartik Agaram
c1b1d1f4e6 7460 - baremetal backend for SubX 2020-12-29 17:46:04 -08:00
Kartik Agaram
3618118c8d 7459
Bring baremetal variant up to date with recent changes.
2020-12-29 10:34:20 -08:00
Kartik Agaram
c88af82232 7458
Switch survey_elf to the new approach.
2020-12-29 10:28:15 -08:00
Kartik Agaram
8836afbcbd 7457 2020-12-28 23:30:13 -08:00
Kartik Agaram
286faf6f0b 7456 2020-12-28 23:28:07 -08:00
Kartik Agaram
b15db82f7c 7455
New approach to disambiguating /disp32 arguments: based on opcodes rather
than metadata.

I interpret /disp32 as PC-relative in a short list of instructions. Otherwise
it's absolute if it gets a label.

There should be no reason to pass labels into /disp8 or /disp16.
2020-12-28 23:20:14 -08:00
Kartik Agaram
d6d8ce2244 7454
Go back to commit 7448.
2020-12-28 23:05:00 -08:00
Kartik Agaram
c17b909b82 7453
Snapshot: this approach of disambiguating /disp32 based on metadata doesn't
work. The `survey` phase runs after `pack`, which gets rid of most metadata.
2020-12-28 23:03:26 -08:00
Kartik Agaram
59e4177c71 7452 2020-12-28 21:26:01 -08:00
Kartik Agaram
cb7139956e 7451 2020-12-28 21:16:08 -08:00
Kartik Agaram
5da03f118c 7450 2020-12-28 21:05:50 -08:00
Kartik Agaram
83bec4a59e 7449
There's an ambiguity in how x86 interprets disp32 fields:

- For jumps and calls they're displacements from the starting address of
  the next instruction. So far so good.

- However, when the ModR/M requires them they can also be absolute addresses.

Ideally I'd take the presence of the ModR/M byte into account in interpreting
them.

However, it's easier to assume relative addressing only for labels in the
code segment.

This commit raises an error if we ever refer to labels in the code segment
in instructions with a ModR/M byte. (I'm assuming that no instruction with
a ModR/M byte will ever use a displacement without the ModR/M byte requiring
it.)
2020-12-28 20:01:47 -08:00
Kartik Agaram
6e79e84a72 7448 2020-12-28 20:01:24 -08:00
Kartik Agaram
ce6aa0c9cc 7447 2020-12-28 17:05:17 -08:00
Kartik Agaram
ec8c039abf 7446 2020-12-28 15:30:23 -08:00
Kartik Agaram
d1c9894306 7445 2020-12-28 15:29:29 -08:00
Kartik Agaram
70b350dfba 7444 2020-12-28 12:36:51 -08:00
Kartik Agaram
2107d5f1f1 7443
A new phase for baremetal compilations. Doesn't work yet, but it passes
all its tests, so we can add it to CI.
2020-12-28 12:14:15 -08:00
Kartik Agaram
a51af593b0 7442 2020-12-28 12:14:15 -08:00
Kartik Agaram
2e48fac480 7441 2020-12-28 11:52:54 -08:00
Kartik Agaram
880464a7d2 7440 2020-12-28 11:09:31 -08:00
Kartik Agaram
dff67029ad 7439 - start translating Mu programs to baremetal 2020-12-28 11:09:30 -08:00
Kartik Agaram
7566d80ade 7438 2020-12-28 01:02:36 -08:00
Kartik Agaram
437fa654cb 7437 - baremetal: draw pixel on keyboard event
It's now clear that our keyboard handler doesn't trigger after the first
event.
2020-12-28 00:12:06 -08:00
Kartik Agaram
5d2f1c57a5 7436
Start highlighting lines that may need to be recomputed when offsets change.
2020-12-27 23:35:31 -08:00
Kartik Agaram
bf50df60a1 7435 - baremetal: buffer for keyboard events
I'm trying to read the status register, but I'm still not seeing the breakpoint
being hit a second time. (And I again ran into the Bochs bug that breakpoints
at the first instruction of an interrupt handler don't work.)

Maybe this is just a debugger issue. Let's keep going, and try to start
using the keyboard events.
2020-12-27 23:22:20 -08:00
Kartik Agaram
a9b25d62c1 7434
Fix a stale displacement.
2020-12-27 23:01:14 -08:00
Kartik Agaram
57fd753a01 7433 - some major layout changes
I'd missed that VBE call 0x4f01 (get video mode) can write up to 256 bytes.
Unexpected areas were getting clobbered because I wasn't reserving enough
space.
2020-12-27 22:54:54 -08:00
Kartik Agaram
4ffe861a45 7432
Bugfix: 32-bit code in 16-bit mode.
Seems like it was benign, maybe.
2020-12-27 22:38:07 -08:00
Kartik Agaram
74529e2e62 7431
Typo.
2020-12-27 22:33:47 -08:00
Kartik Agaram
2e24062f2f 7430 2020-12-27 21:09:22 -08:00
Kartik Agaram
0fa6d28e14 7429 2020-12-27 11:50:05 -08:00
Kartik Agaram
b3a0a540cd 7428 2020-12-27 11:39:38 -08:00
Kartik Agaram
46cf7b7908 7427 2020-12-27 11:39:17 -08:00
Kartik Agaram
490b26d061 7426 2020-12-27 10:57:44 -08:00
Kartik Agaram
3a67140281 7425 - baremetal: render the palette
It's now very obvious that we don't actually have 256 unique colors by
default in 256-color graphics modes.
2020-12-27 10:51:09 -08:00
Kartik Agaram
5095021f77 7424 - baremetal: downsize graphics resolution
If it's large enough that I have doubts whether my top-of-the-line Mac
is showing the bottom of the screen inside an emulator, it's too large.

This way I also feel more confident that most modern hardware will support
this graphics mode, and that these programs will work for others.
2020-12-27 08:45:03 -08:00
Kartik Agaram
0e0b0c6edb 7423 2020-12-27 08:03:48 -08:00
Kartik Agaram
2628a51f37 7422 2020-12-26 23:45:37 -08:00
Kartik Agaram
e5b2f3f169 7421 - baremetal: beginnings of keyboard map
First keypress is detected, but we need to ack it somehow.
2020-12-26 23:38:52 -08:00
Kartik Agaram
88d2df2f96 7420 2020-12-26 22:57:16 -08:00
Kartik Agaram
03708aa5a3 7419 2020-12-26 22:56:44 -08:00
Kartik Agaram
6f3f814839 7418 - baremetal: adjust entrypoint address
We need a few pages of data for the keyboard mappings.

If I moved them to some later address I'd be able to keep the nice round
starting address unchanged. But that seems like a superficial aesthetic
concern. There's really no value in having an array of hex bytes represented
in SubX rather than just raw hex. And it's better to colocate data near
the handler code which uses it (and which runs instructions SubX doesn't
support).
2020-12-26 22:36:52 -08:00
Kartik Agaram
0243ee4e83 7417 - baremetal: drawing on LFB in Bochs 2020-12-26 22:01:45 -08:00
Kartik Agaram
9ef034fde8 7416 - baremetal: drawing on frame buffer
This currently works on Qemu, but not on Bochs. I'm now trying to make
sense of https://wiki.osdev.org/Bochs_VBE_Extensions#Using_a_linear_frame_buffer_.28LFB.29
2020-12-26 21:44:01 -08:00
Kartik Agaram
a0aecc8267 7415 - baremetal: locate the linear frame buffer
0xa0000 only contains a single bank's worth of memory-mapped video RAM.
The LFB is supposed to have everything.
2020-12-26 21:23:04 -08:00
Kartik Agaram
a7ae16ed06 7414 2020-12-26 21:04:46 -08:00
Kartik Agaram
63d5534278 7413 2020-12-26 20:26:11 -08:00
Kartik Agaram
73728ec665 7412 - drawing pixels to screen
This works, but colors are unexpected. 0xff isn't white. Lots of colors
are black. Perhaps I need to initialize a palette.
2020-12-26 19:13:23 -08:00
Kartik Agaram
4b26c93e69 7411 2020-12-26 17:35:25 -08:00