@@ -277,35 +277,37 @@ public Emulator(String[] args) {
277277
278278 hardware .add (bootDrive );
279279 } else {
280- M35FD bootDrive ;
281- if (bootloader ) {
282- File tmpFile = File .createTempFile ("DCPUToolchain" , Long .toString (System .currentTimeMillis ()));
283- byte [] input_file_data = Files .readAllBytes (Paths .get (input_file ));
284-
285- byte [] bootloader_data_bytes = new byte [1024 ];
286- for (int i = 0 ; i < 512 ; ++i ) {
287- if (little_endian != bootloader_little_endian ) {
288- bootloader_data_bytes [i * 2 ] = (byte ) (bootloader_data [i ] & 0xFF );
289- bootloader_data_bytes [i * 2 + 1 ] = (byte ) ((bootloader_data [i ] >> 8 ) & 0xFF );
290- } else {
291- bootloader_data_bytes [i * 2 ] = (byte ) ((bootloader_data [i ] >> 8 ) & 0xFF );
292- bootloader_data_bytes [i * 2 + 1 ] = (byte ) (bootloader_data [i ] & 0xFF );
280+ if (!input_file .equalsIgnoreCase ("none" )) {
281+ M35FD bootDrive ;
282+ if (bootloader ) {
283+ File tmpFile = File .createTempFile ("DCPUToolchain" , Long .toString (System .currentTimeMillis ()));
284+ byte [] input_file_data = Files .readAllBytes (Paths .get (input_file ));
285+
286+ byte [] bootloader_data_bytes = new byte [1024 ];
287+ for (int i = 0 ; i < 512 ; ++i ) {
288+ if (little_endian != bootloader_little_endian ) {
289+ bootloader_data_bytes [i * 2 ] = (byte ) (bootloader_data [i ] & 0xFF );
290+ bootloader_data_bytes [i * 2 + 1 ] = (byte ) ((bootloader_data [i ] >> 8 ) & 0xFF );
291+ } else {
292+ bootloader_data_bytes [i * 2 ] = (byte ) ((bootloader_data [i ] >> 8 ) & 0xFF );
293+ bootloader_data_bytes [i * 2 + 1 ] = (byte ) (bootloader_data [i ] & 0xFF );
294+ }
293295 }
294- }
295296
296- FileOutputStream fos = new FileOutputStream (tmpFile );
297- fos .write (bootloader_data_bytes );
298- fos .write (input_file_data );
299- fos .close ();
297+ FileOutputStream fos = new FileOutputStream (tmpFile );
298+ fos .write (bootloader_data_bytes );
299+ fos .write (input_file_data );
300+ fos .close ();
300301
301- bootDrive = hardwareTracker .requestM35FD (tmpFile .getAbsolutePath (), little_endian );
302- } else {
303- bootDrive = hardwareTracker .requestM35FD (input_file , little_endian );
304- }
305- bootDrive .connectTo (dcpu );
306- bootDrive .powerOn ();
302+ bootDrive = hardwareTracker .requestM35FD (tmpFile .getAbsolutePath (), little_endian );
303+ } else {
304+ bootDrive = hardwareTracker .requestM35FD (input_file , little_endian );
305+ }
306+ bootDrive .connectTo (dcpu );
307+ bootDrive .powerOn ();
307308
308- hardware .add (bootDrive );
309+ hardware .add (bootDrive );
310+ }
309311 }
310312 dcpu .setRam (getClass ().getResourceAsStream ("/rom.bin" ), rom_little_endian );
311313
0 commit comments