File tree Expand file tree Collapse file tree 3 files changed +18
-1
lines changed
Expand file tree Collapse file tree 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');
2626const net = require ( './net' ) ;
2727const stdio = require ( './stdio' ) ;
2828const speaker = require ( '../driver/ibmpc/pcspeaker' ) ;
29+ const ata = require ( '../driver/ata' ) ;
2930
3031class 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 ) ,
Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments