File tree 3 files changed +18
-1
lines changed
3 files changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -26,6 +26,7 @@ const pci = require('./pci');
26
26
const net = require ( './net' ) ;
27
27
const stdio = require ( './stdio' ) ;
28
28
const speaker = require ( '../driver/ibmpc/pcspeaker' ) ;
29
+ const ata = require ( '../driver/ata' ) ;
29
30
30
31
class Runtime {
31
32
constructor ( ) {
@@ -39,6 +40,7 @@ class Runtime {
39
40
net,
40
41
stdio,
41
42
speaker,
43
+ ata,
42
44
machine : {
43
45
reboot : __SYSCALL . reboot ,
44
46
shutdown : ( ) => __SYSCALL . acpiEnterSleepState ( 5 ) ,
Original file line number Diff line number Diff line change @@ -150,7 +150,7 @@ const cmds = {
150
150
151
151
if ( mode === 'play' ) {
152
152
$$ . speaker . play ( frec , duration ) ;
153
- f . stdio . writeLine ( `Playing ${ frec } gz at ${ duration } ms...` ) ;
153
+ f . stdio . writeLine ( `Playing ${ frec } Hz at ${ duration } ms...` ) ;
154
154
return res ( 0 ) ;
155
155
} else if ( mode === 'stop' ) {
156
156
$$ . speaker . stop ( ) ;
@@ -160,6 +160,21 @@ const cmds = {
160
160
f . stdio . writeError ( 'Use "play" or "stop"!' ) ;
161
161
return res ( 1 ) ;
162
162
} ,
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
+ } ,
163
178
} ,
164
179
} ;
165
180
You can’t perform that action at this time.
0 commit comments