about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--boot.subx27
1 files changed, 24 insertions, 3 deletions
diff --git a/boot.subx b/boot.subx
index 0b840d58..b2ac17b6 100644
--- a/boot.subx
+++ b/boot.subx
@@ -347,7 +347,7 @@ keyboard-interrupt-handler:
   # check output buffer of 8042 keyboard controller (https://web.archive.org/web/20040604041507/http://panda.cs.ndsu.nodak.edu/~achapwes/PICmicro/keyboard/atkeyboard.html)
   e4/read-port-into-al 0x64/imm8
   a8/test-bits-in-al 0x01/imm8  # set zf if bit 0 (least significant) is not set
-  74/jump-if-not-set $keyboard-interrupt-handler:epilogue/disp8
+  0f 84/jump-if-not-set $keyboard-interrupt-handler:epilogue/disp32
   # - if keyboard buffer is full, return
   # var dest-addr/ecx: (addr byte) = (keyboard-buffer + *keyboard-buffer:write)
   31/xor %ecx 1/r32/ecx
@@ -357,7 +357,7 @@ keyboard-interrupt-handler:
   8a/byte-> *ecx 0/r32/al
   # if (al != 0) return
   3c/compare-al-and 0/imm8
-  75/jump-if-!= $keyboard-interrupt-handler:epilogue/disp8
+  0f 85/jump-if-!= $keyboard-interrupt-handler:epilogue/disp32
   # - read keycode
   e4/read-port-into-al 0x60/imm8
   # - key released
@@ -950,6 +950,7 @@ load-sectors:  # disk: (addr disk), lba: int, n: int, out: (addr stream byte)
       49/decrement-ecx
       eb/jump loop/disp8
     }
+    # next sector
     ff 1/subop/decrement *(ebp+0x10)
 #?     (draw-int32-decimal-wrapping-right-then-down-from-cursor-over-full-screen 0 *(ebp+0x10) 0xc 0)
     81 7/subop/compare *(ebp+0x10) 0/imm32
@@ -988,6 +989,8 @@ store-sectors:  # disk: (addr disk), lba: int, n: int, in: (addr stream byte)
   (ata-lba *(ebp+8) *(ebp+0xc))
   (ata-command *(ebp+8) 0x30)  # write sectors with retries
   # for each sector
+#?   (set-cursor-position 0 0 0)
+#?   (draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0 "0" 7 0)
   {
     # wait
     (while-ata-busy *(ebp+8))
@@ -1000,6 +1003,7 @@ store-sectors:  # disk: (addr disk), lba: int, n: int, in: (addr stream byte)
     # . var first-byte/ebx: byte
     # . when it's more than 0xff, we're at an even-numbered byte
     bb/copy-to-ebx 0xffff/imm32
+#?     (draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0 "D" 7 0)
 $store-sectors:store-sector:
     {
       81 7/subop/compare %ecx 0/imm32
@@ -1028,6 +1032,7 @@ $store-sectors:store-sector:
       eb/jump loop/disp8
     }
     # write out final first-byte if necessary
+#?     (draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0 "I" 7 0)
     81 7/subop/compare %ebx 0xff/imm32
     {
       7f/jump-if-> break/disp8
@@ -1037,6 +1042,7 @@ $store-sectors:store-sector:
       49/decrement-ecx
     }
     # pad zeroes
+#?     (draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0 "P" 7 0)
     31/xor %eax 0/r32/eax
     {
       81 7/subop/compare %ecx 0/imm32
@@ -1046,8 +1052,19 @@ $store-sectors:store-sector:
       49/decrement-ecx
       eb/jump loop/disp8
     }
+    # next sector
+#?     (draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0 "N" 7 0)
+    ff 1/subop/decrement *(ebp+0x10)
+    81 7/subop/compare *(ebp+0x10) 0/imm32
+    7e/jump-if-<= break/disp8
+#?     (draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0 "W" 7 0)
+    (wait-400ns *(ebp+8))
+#?     (draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0 "L" 7 0)
+    e9/jump loop/disp32
   }
+#?   (draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0 "F" 7 0)
   (flush-ata-cache *(ebp+8))
+#?   (draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0 "Y" 7 0)
 $store-sectors:end:
   # . restore registers
   5b/pop-to-ebx
@@ -1335,8 +1352,12 @@ flush-ata-cache:  # disk: (addr disk)
   #
   (ata-drive-select *(ebp+8) 0)
   (ata-command *(ebp+8) 0xe7)  # flush cache
+#?   (draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0 "W" 7 0)
   (while-ata-busy *(ebp+8))
-  (until-ata-ready-for-data *(ebp+8))
+#?   (draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0 "X" 7 0)
+  # TODO: seems unneeded? works for a single sector but Qemu hangs with multiple
+  # sectors. Data is still written.
+#?   (until-ata-ready-for-data *(ebp+8))
 $flush-ata-cache:end:
   # . epilogue
   89/<- %esp 5/r32/ebp
5954ef3f90c9ea1021ad51b8617'>8f5f24d ^
fdc444f ^

78778ce ^

ea14e7c ^
1e63070 ^

ea14e7c ^
9afdfbd ^

1e63070 ^

78778ce ^

ea14e7c ^
78778ce ^
8f5f24d ^
4460dd2 ^



bea671d ^


ea4cb99 ^
bea671d ^
4460dd2 ^
8f5f24d ^
ea14e7c ^
78778ce ^
6a3cb14 ^



9afdfbd ^


fdc444f ^
6a3cb14 ^




907d729 ^

6a3cb14 ^
907d729 ^
6a3cb14 ^

ea14e7c ^
78778ce ^
8f5f24d ^
3368af1 ^
8f5f24d ^

ea14e7c ^
4460dd2 ^


ea4cb99 ^


4460dd2 ^



ea4cb99 ^



4460dd2 ^


44d2fb9 ^





9afdfbd ^
44d2fb9 ^











3368af1 ^
8f5f24d ^
3368af1 ^
8f5f24d ^
3368af1 ^


8f5f24d ^
3368af1 ^


8f5f24d ^
3368af1 ^



fdc444f ^



44d2fb9 ^

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171