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
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
dff67029ad
7439 - start translating Mu programs to baremetal
2020-12-28 11:09:30 -08:00
Kartik Agaram
d8eacb3893
7403 - baremetal/ for apps without a kernel
2020-12-26 13:30:04 -08:00
Kartik Agaram
2fcf7e24d1
7402
2020-12-26 13:09:16 -08:00
Kartik Agaram
faef965611
7399
2020-12-24 16:31:45 -08:00
Kartik Agaram
bf8f246e08
7398
2020-12-23 23:24:16 -08:00
Kartik Agaram
32fc6c2ddf
7395 - boot.hex: recognize '1' press on keyboard
...
https://stackoverflow.com/questions/37618111/keyboard-irq-within-an-x86-kernel
is right, no need to mess with the status port at the start.
2020-12-23 23:06:54 -08:00
Kartik Agaram
169adc36d3
7394
...
I think https://stackoverflow.com/questions/37618111/keyboard-irq-within-an-x86-kernel
has more insight to provide. Among other things the comment about grub
may answer the distinction between entry 0x21 and entry 9.
2020-12-23 22:48:47 -08:00
Kartik Agaram
a94ac8f068
7393
...
Snapshot. Keyboard interrupt being triggered.
This was hard to debug until https://stackoverflow.com/questions/37618111/keyboard-irq-within-an-x86-kernel
reminded me that I'd forgotten to enable IRQ1 on port 0x21.
For a while I was confused by never hitting a breakpoint at the start of
the keyboard handler. Then I found https://sourceforge.net/p/bochs/discussion/39592/thread/5e397455
and started skipping one instruction in my breakpoint.
I still don't understand the discrepancy between some people installing
the handler at entry 9, and others installing at entry 0x21 = 33.
2020-12-23 22:18:11 -08:00
Kartik Agaram
3a66a90930
7392
2020-12-23 20:00:14 -08:00
Kartik Agaram
22bef2d148
7391
...
Turns out we just need a null handler at offset 8 rather than offset 9.
If the keyboard handler is indeed at offset 9 as
https://alex.dzyoba.com/blog/os-interrupts says (I don't understand
why), then the clock handler's at offset 8, which makes sense.
2020-12-23 12:24:36 -08:00
Kartik Agaram
63362f814b
7390 - null interrupt tables
...
Looks like the reset loops stop if we create null handlers for the first
10 indexes in the IDT.
2020-12-23 12:14:01 -08:00
Kartik Agaram
e60e0e0645
7389 - snapshot
...
Ok, we're back at the reset loop. Let's keep going; maybe having a decent
keyboard handler will fix it.
The bug I fixed here was caused by misunderstanding what m16&32 mean in
the Intel manual. It's still a regular regmem operand that uses all of
the ModR/M byte (which can be interpreted in 16-bit mode, adding to the
complication). It's just constrained to not allow direct addressing (mod 00).
I needed to better internalize the format of the instruction set references
at the start of Volume 2, Chapter 3.
2020-12-23 11:10:52 -08:00
Kartik Agaram
286ccc40e0
7388 - snapshot initializing interrupt table
...
I'm now back at the state of commit 7382 (including 7376). The existing
print to screen surprisingly seems to work without reset-looping, but when
I step through I notice that the lidt isn't doing what I expect.
Desired: at address 0x7cce, the processor executes:
0f 01 1e 00 7f # lidt ds:*idt_descriptor
Observed: at address 0x7cce, the processor executes:
0f 01 1e # lidt ds:*esi
As a result the next instruction is:
00 7f fb
So the `fb` isn't interpreted to enable interrupts. So the problem of commit
7376 is latent.
Past this point the instruction stream is lined up again, and everything
occurs as it should. Purely by chance.
I fully expect all hell to break loose again, like it did in commit 7376,
once I debug the lidt encoding. There's still something I don't understand
about enabling interrupts. Perhaps I need to fill in more entries in the
table.
2020-12-23 10:39:54 -08:00
Kartik Agaram
2ff765b658
7387
...
Redo commit 7381. There was a bug.
Current state: commit 7381 excluding 7376.
2020-12-23 10:10:53 -08:00
Kartik Agaram
5ba5f319db
7386
...
Commit 7380 excluding 7376.
2020-12-23 10:06:04 -08:00
Kartik Agaram
895aa71616
7385
...
Commit 7379 excluding 7376.
2020-12-23 10:04:21 -08:00
Kartik Agaram
d70711e1b0
7384
...
Currently at commit 7378 (reset the A20 address line) except without 7376
(enabling interrupts).
2020-12-23 10:04:01 -08:00
Kartik Agaram
f29b6c6b1a
7383
...
Currently at commit 7377 except without 7376 (enabling interrupts). Works
as advertised.
2020-12-23 10:03:51 -08:00
Kartik Agaram
de7bd3998b
7382 - snapshot
...
Turns out I've been "testing" with a stale file since commit 7373. We need
to go over everything since then.
2020-12-23 08:41:53 -08:00
Kartik Agaram
e82e7d644c
7381
2020-12-23 00:39:42 -08:00
Kartik Agaram
364133226c
7380
2020-12-23 00:37:39 -08:00
Kartik Agaram
e412bf9443
7379
2020-12-23 00:34:46 -08:00
Kartik Agaram
6a9fff36c4
7378
...
Turns out we only had access to 50% of RAM so far. Closing my nose and
moving right along..
Though this _does_ give me practice interacting with ports. That'll be
handy for the keyboard.
2020-12-23 00:20:36 -08:00
Kartik Agaram
2e7798e39c
7377
...
Ooh, look at that, the device number comes conveniently initialized in
the right register. No need to hardcode it.
https://wiki.osdev.org/MBR_(x86)
2020-12-23 00:04:20 -08:00
Kartik Agaram
2b61e5e0a0
7376
2020-12-23 00:04:20 -08:00
Kartik Agaram
6216a79974
7375
...
A little more robustness after reading https://stackoverflow.com/questions/43786251/int-13h-42h-doesnt-load-anything-in-bochs/43787939#43787939
2020-12-23 00:04:20 -08:00
Kartik Agaram
50c994dd88
7373
...
apps/boot.hex doesn't need much by way of syntax highlighting. Have it
work even for people who haven't installed subx.vim
2020-12-21 00:22:12 -08:00
Kartik Agaram
0a4cf3397f
7372 - successful read from disk using BIOS
2020-12-21 00:21:51 -08:00
Kartik Agaram
e4edacfecb
7371
2020-12-21 00:13:03 -08:00
Kartik Agaram
946dfe7ffb
7370
...
Use a more realistically sized disk image. Now we can read the second sector.
2020-12-21 00:04:38 -08:00
Kartik Agaram
6ac16fd1ae
7369 - read hard disk using BIOS
...
There were two problems:
a) We have only 1 sector per track (spt=1), so 'second sector' is meaningless.
b) Drives 0-127 are reserved for floppies.
2020-12-20 23:52:21 -08:00
Kartik Agaram
a350fb4c68
7368 - ooh, int 13h works with a floppy
...
Lots of great tips here:
https://stackoverflow.com/questions/43786251/int-13h-42h-doesnt-load-anything-in-bochs/43787939#43787939
2020-12-20 23:37:43 -08:00
Kartik Agaram
d12094ee4d
7367 - start of boot sector for Mu computer
...
Not working yet. Reading sectors from disk returns an error (sets carry
flag).
2020-12-20 22:58:37 -08:00
Kartik Agaram
9b867ab438
7366
...
Move more padding around.
Reading a sector from disk requires about 24 bytes of code.
2020-12-20 21:02:52 -08:00
Kartik Agaram
61a2813f2f
7365
2020-12-20 20:53:08 -08:00
Kartik Agaram
d26836caae
7364
2020-12-20 20:51:15 -08:00
Kartik Agaram
c1ffd4c0a6
7363
...
Kinda brutal way to lose the bochs warning. Should suffice for now. As
we add more code we'll introduce more sectors.
2020-12-20 20:47:19 -08:00
Kartik Agaram
3f6bb8a0ca
7362
...
I hadn't noticed that bochs was getting into a reset loop after executing
my code correctly. Fix that.
2020-12-20 20:38:29 -08:00
Kartik Agaram
d5a9a92452
7361
...
Switch bochs from floppy to hard disk.
Bochs throws a new warning, but otherwise 32bit.hex continues to work.
2020-12-20 20:13:15 -08:00
Kartik Agaram
72e34ecb63
7360
...
Insert padding in a few places so we don't have to recalculate addresses
quite so much.
2020-12-20 20:03:02 -08:00
Kartik Agaram
02135b7ae8
7359 - boot into 32-bit mode
2020-12-20 00:44:23 -08:00
Kartik Agaram
9b5b8471ca
7358
...
Snapshot: first draft of a boot image that switches to 32-bit mode as quickly
as possible (~70 bytes)
Doesn't work yet. Gets stuck in an infinite reset loop.
2020-12-20 00:16:15 -08:00
Kartik Agaram
70bb19100e
7357
2020-12-19 21:22:28 -08:00
Kartik Agaram
1e46a0f6b2
7356
2020-12-19 21:09:05 -08:00
Kartik Agaram
a84fadd65d
7355 - learning to boot into 32-bit mode
...
These exercises are from the incomplete "Writing a simple operating system
from scratch" by Nick Blundell.
https://www.cs.bham.ac.uk/~exr/lectures/opsys/10_11/lectures/os-dev.pdf
2020-12-19 21:06:05 -08:00
Kartik Agaram
cbe8bfd87a
7354 - tile: stop trying to center menu
2020-12-14 22:29:34 -08:00
Kartik Agaram
8c2e580e0f
7353
2020-12-14 22:18:02 -08:00
Kartik Agaram
001efc35f0
7352
2020-12-14 22:14:13 -08:00
Kartik Agaram
88152c621a
7350 - mu.subx optimization: skip no-op copies
2020-12-11 22:43:09 -08:00
Kartik Agaram
a6167c6472
7349
2020-12-11 21:59:22 -08:00
Kartik Agaram
84f7026e82
7348 - mu.subx bug with string literals
2020-12-11 21:52:55 -08:00
Kartik Agaram
1626a32f2d
7347 - tile: separate sandbox and function menus
2020-12-06 22:16:22 -08:00
Kartik Agaram
026ab21673
7346
2020-12-06 22:13:48 -08:00
Kartik Agaram
35898016ac
7345
2020-12-06 22:12:49 -08:00
Kartik Agaram
b0d323ff87
7344
2020-12-06 22:08:12 -08:00
Kartik Agaram
601785364f
7343
2020-12-06 22:06:44 -08:00
Kartik Agaram
642c7c8cab
7342 - tile: hotkeys for ending function edit
2020-12-06 21:57:27 -08:00
Kartik Agaram
bec147690f
7341 - tile: function editing done
...
A tiny modicum of reuse amidst all this copypasta: I'm able to reuse the
same function that renders lines without stacks in the sandbox.
2020-12-06 21:48:39 -08:00
Kartik Agaram
4cf5916c2b
7340 - tile: function editing almost done
...
Still a bug in cursor positioning. It's always shown at the start of the
function body.
2020-12-06 21:47:53 -08:00
Kartik Agaram
60ac5d9e93
7339 - tile: position cursor in correct function
...
Still can't edit functions, but we're getting there.
2020-12-06 20:57:43 -08:00
Kartik Agaram
5c46d55532
7338 - tile: architecture starting to crystallize
...
In particular, I'm starting to have opinions about how to scalably position
the cursor at the end of each frame.
One advantage of text mode without a pointer device (mouse/trackpad): only
one cursor to track. UI can't be modified anywhere. That simplifies any
reactive UI framework.
2020-12-05 21:01:30 -08:00
Kartik Agaram
4ef29dc9d5
7337 - tile: jumping to a function
...
We can't yet edit the function once we jump to it.
2020-12-05 01:17:52 -08:00
Kartik Agaram
fcdd9238cb
7336 - tile: back to function editing
2020-12-05 00:20:10 -08:00
Kartik Agaram
68a5032ccd
7334 - advent day 5 done
2020-12-04 23:35:18 -08:00
Kartik Agaram
d893ae58b7
7333 - advent day 5 part 1
2020-12-04 23:25:21 -08:00
Kartik Agaram
6570a0c146
7332 - advent day 4 done
...
The code is shit and I can't be arsed to clean it up. But it was a useful
exercise given the bugs and gaps it caught in Mu.
2020-12-04 23:02:53 -08:00
Kartik Agaram
eea6659a40
7331 - hacky way to convert slice to string
2020-12-04 23:02:53 -08:00
Kartik Agaram
273c42c066
7330 - snapshot: advent day 4 part 2 easy cases
...
Now I need to tune the SubX vocabulary.
2020-12-04 23:02:53 -08:00
Kartik Agaram
18d5bab2b6
7329 - snapshot: advent day 4 part 2
...
I've found two bugs in SubX libraries:
1. next-word had an out-of-bounds read
2. next-word was skipping comments, because that's what I need during bootstrapping.
I've created a new variant called next-raw-word that doesn't skip comments.
These really need better names.
We're now at the point where 4b.mu has the right structure and returns
identical result to 4a.mu.
2020-12-04 23:02:53 -08:00
Kartik Agaram
8a8db34f25
7328 - advent day 4 part 1
...
Bug #1 : forgot to process final passport
Stupid mistake #2 : was reporting invalid rather than valid passports
2020-12-04 21:01:59 -08:00
Kartik Agaram
2d14f6c971
7327
2020-12-03 21:49:03 -08:00
Kartik Agaram
f2ee237eea
7326
2020-12-03 21:43:21 -08:00
Kartik Agaram
6c7d9300e2
7325 - tile: start implementing function editing
2020-12-03 21:22:32 -08:00
Kartik Agaram
ed59e2eda9
7323 - advent day 3 done
...
Stupid mistake; I missed one slope in the question.
2020-12-02 22:32:27 -08:00
Kartik Agaram
50973ad178
7322 - snapshot: advent day 3 part 2
...
Answer isn't right.
2020-12-02 22:21:07 -08:00
Kartik Agaram
124f515826
7321 - advent day 3 part 1
2020-12-02 22:12:55 -08:00
Kartik Agaram
36b4bf1f1b
7320 - snapshot: advent day 3 part 1
2020-12-02 22:08:37 -08:00
Kartik Agaram
f60ebed0fb
7318 - advent day 2 done
...
Funny story: I got the right answer for part 1 even though I missed the
':' in the line format. But of course that didn't work for part 2.
2020-12-02 19:36:10 -08:00
Kartik Agaram
a41a6eadd1
7317 - advent day 2 part 1
...
https://adventofcode.com/2020/day/2
2020-12-02 19:20:06 -08:00
Kartik Agaram
74bc598c44
7316
2020-12-01 01:19:07 -08:00
Kartik Agaram
3d291822ca
7315
2020-12-01 01:03:30 -08:00
Kartik Agaram
05ad07b63e
7313 - advent: day 1 done
2020-12-01 01:01:49 -08:00
Kartik Agaram
69f4c36b71
7312 - advent: snapshot of 1b
2020-12-01 00:54:09 -08:00
Kartik Agaram
a06611f35c
7310 - advent day 1 part 1
...
In the process I had to:
* Fix a bug in reading lines from stdin into streams
* Start trailing newlines when parsing ints from streams
* Implement `find` in an array
2020-12-01 00:32:43 -08:00
Kartik Agaram
8a73ef7052
7309 - tile: parsing strings into words
2020-11-30 23:20:13 -08:00
Kartik Agaram
3c84f1ae41
7308
2020-11-29 16:52:46 -08:00
Kartik Agaram
55dfa5b985
7305 - make float-size more consistent as well
2020-11-29 13:26:48 -08:00
Kartik Agaram
ee3ddc3961
7302 - tile: at long last, division
...
Also square roots.
But there's a bug in rendering floats without precision.
2020-11-29 12:51:57 -08:00