Skip to content

Commit 716b6e1

Browse files
committed
hdd
1 parent 2c8bea9 commit 716b6e1

File tree

3 files changed

+18
-1
lines changed

3 files changed

+18
-1
lines changed

.initrd

191 Bytes
Binary file not shown.

js/core/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ const pci = require('./pci');
2626
const net = require('./net');
2727
const stdio = require('./stdio');
2828
const speaker = require('../driver/ibmpc/pcspeaker');
29+
const ata = require('../driver/ata');
2930

3031
class Runtime {
3132
constructor() {
@@ -39,6 +40,7 @@ class Runtime {
3940
net,
4041
stdio,
4142
speaker,
43+
ata,
4244
machine: {
4345
reboot: __SYSCALL.reboot,
4446
shutdown: () => __SYSCALL.acpiEnterSleepState(5),

js/service/shell/commands.js

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ const cmds = {
150150

151151
if (mode === 'play') {
152152
$$.speaker.play(frec, duration);
153-
f.stdio.writeLine(`Playing ${frec} gz at ${duration} ms...`);
153+
f.stdio.writeLine(`Playing ${frec} Hz at ${duration} ms...`);
154154
return res(0);
155155
} else if (mode === 'stop') {
156156
$$.speaker.stop();
@@ -160,6 +160,21 @@ const cmds = {
160160
f.stdio.writeError('Use "play" or "stop"!');
161161
return res(1);
162162
},
163+
listparts: {
164+
description: 'List HDD partitions',
165+
usage: 'listparts',
166+
run(args, f, res) {
167+
const buf = $$.ata.read(0, 1).slice(0x1BE, 64);
168+
for (let i = 0; i < 4; i++) {
169+
if (buf[i * 16]) {
170+
f.stdio.writeLine(`Partition ${i} exists on drive`);
171+
} else {
172+
f.stdio.writeLine(`Partition ${i} doesn't exist on drive`);
173+
}
174+
}
175+
return res(0);
176+
},
177+
},
163178
},
164179
};
165180

0 commit comments

Comments
 (0)