|
| 1 | +@echo off |
| 2 | +cd %~d0%~p0 |
| 3 | + |
| 4 | +set IMAGE_TYPE= |
| 5 | +set DEBUG=0 |
| 6 | +set EFI=0 |
| 7 | +set SECONDARY_HD_IMAGE= |
| 8 | +set QEMU_CMD=tools\qemu-windows\qemu-system-i386.exe |
| 9 | +set QEMU_ARGS=-audiodev dsound,id=stdsound -machine pcspk-audiodev=stdsound |
| 10 | + |
| 11 | +:argLoop |
| 12 | + |
| 13 | +setlocal ENABLEDELAYEDEXPANSION |
| 14 | + |
| 15 | +if "%1" neq "" ( |
| 16 | + if "%1"=="floppy" ( |
| 17 | + set IMAGE_TYPE=Floppy |
| 18 | + ) else if "%1"=="hd" ( |
| 19 | + set IMAGE_TYPE=HD |
| 20 | + ) else if "%1"=="--debug" ( |
| 21 | + set DEBUG=1 |
| 22 | + ) else if "%1"=="--efi" ( |
| 23 | + set EFI=1 |
| 24 | + ) else if "%1"=="--x64" ( |
| 25 | + set QEMU_CMD=tools\qemu-windows\qemu-system-x86_64.exe |
| 26 | + ) else if "%1"=="--secondary-hd-image" ( |
| 27 | + set SECONDARY_HD_IMAGE=%2 |
| 28 | + set SECONDARY_HD_IMAGE=!SECONDARY_HD_IMAGE:"=! |
| 29 | + shift |
| 30 | + ) else ( |
| 31 | + goto USAGE |
| 32 | + ) |
| 33 | + |
| 34 | + shift |
| 35 | + goto argLoop |
| 36 | +) |
| 37 | + |
| 38 | +endlocal |
| 39 | + |
| 40 | +if "%IMAGE_TYPE%"=="" goto USAGE |
| 41 | +if "%EFI%"=="1" set QEMU_ARGS=%QEMU_ARGS% -bios tools/bios32.bin |
| 42 | +if "%SECONDARY_HD_IMAGE%" NEQ "" set QEMU_ARGS=%QEMU_ARGS% -drive format=raw,file="%SECONDARY_HD_IMAGE%",index=1,if=ide |
| 43 | + |
| 44 | +if "%IMAGE_TYPE%"=="HD" ( |
| 45 | + set QEMU_ARGS=%QEMU_ARGS% -drive format=raw,file=HDImage.bin,index=0,if=ide -boot c |
| 46 | +) else if "%IMAGE_TYPE%"=="Floppy" ( |
| 47 | + set QEMU_ARGS=%QEMU_ARGS% -drive format=raw,file=FloppyImage.bin,index=0,if=floppy -boot a |
| 48 | +) |
| 49 | + |
| 50 | +if "%DEBUG%"=="1" ( |
| 51 | + call SET_ENV_VARS.BAT |
| 52 | + if not exist kernel\CHAOSKRN.SYS_debug cecho {0C}WARNING^^! CHAOSKRN.SYS_debug does not exist{#}{\n} |
| 53 | + start /b cmd /c %QEMU_CMD% %QEMU_ARGS% -S -s |
| 54 | + tools\gdb-multiarch.bat -x kernel_debug.gdb |
| 55 | +) else ( |
| 56 | + %QEMU_CMD% %QEMU_ARGS% |
| 57 | +) |
| 58 | + |
| 59 | +goto eof |
| 60 | + |
| 61 | +:USAGE |
| 62 | +echo Usage: %0 ^<floppy^|hd^> [options] |
| 63 | +echo Options: |
| 64 | +echo --debug Run with debugger |
| 65 | +echo --efi Enable EFI |
| 66 | +echo --x64 Emulate 64-bit CPU |
| 67 | +echo --secondary-hd-image ^<image^> Add a secondary hard drive image |
| 68 | +EXIT /B 1 |
| 69 | + |
| 70 | +:eof |
0 commit comments