Steps for operating system running on Windows:. ASM->. bim->. IMG-> load and run
I. Create an IMG Image File
Method 1:
1. Use the tool bximage.exe provided by bochsto generate a. imgfile, which is a null file of all 0 and needs to be written into it.
2. Create your own boot. ASM boot program. This program is found online and does not know the source.
Org 07c00h; tells the compiler program to load mov ax, CS mov ds, ax mov es, ax call dispstr at 7c00; call the display string routine JMP $; infinite loop dispstr: mov ax, bootmessage mov bp, ax; es: BP = string address mov CX, 16; Cx = string lengths mov ax, 01301 h; Ah = 13, Al = 01 H mov BX, 000ch; page number is 0 (bH = 0) black background red letter (BL = 0ch, highlighted) mov DL, 0 int 10 h; 10 h interrupt RET bootmessage: DB "Hello, OS world! "Times 510-($-$) db 0; fill in the remaining space to make the generated binary code exactly DW 0xaa55; End mark
3. Use the NASM boot. ASM-O boot. Bin command for disassembly to obtain a. binfile of 512b.
4. Use ultraedit to open boot. Bin and boot. IMG respectively, copy boot. bin to the first 512b of boot. IMG, and create boot. IMG.
Method 2
1. Run winimage, Select Options> setting> image, and set compression to none.
2. File-> New, select the capacity in the format of 1.44mb
3. Image-> Boot Sector properties-> MS-DOS
4. Save the file in the all files (*. *) type (*.*)
5. Use ultraedit to open boot. IMG and keep the data starting with EB 3C 90 4d and ending with 55 AA. The size is exactly B, and delete the remaining data.
2. Create the bochs preparation file. Assume that the folder location of the new operating system is D: \ Program Files \ Bochs-2.5.1, And the folder name is floppy.
Method 1:
Configuration File: bochsrc.txt
#how much memory the emulated machine will havemegs:4#filename of ROM imagesromimage:file=../BIOS-bochs-latest,address=Oxf0000vgaromimage:file=../VGABIOS-elpin-2.40#what disk images will be usedfloppya:1_44=boot.img,status=inserted#Choose the boot diskboot:a#where do we send log messages?log:bochsout.txt
Run. bat
cd "d:\Program Files\Bochs-2.5.1\floppy"..\bochs -q -f bochsrc.txt
Method 2:
Configuration File: bochsrc.txt
#how much memory the emulated machine will havemegs:4#filename of ROM imagesromimage:file=$BXSHARE/BIOS-bochs-latest,address=Oxf0000#vgaromimage: file=$BXSHARE/VGABIOS-lgpl-latestvgaromimage: file=$BXSHARE/VGABIOS-elpin-2.40#what disk images will be usedfloppya:1_44=boot.img,status=inserted#Choose the boot diskboot:a#where do we send log messages?log:bochsout.txt
Execution file: Run. bat
SET BXSHARE=d:\Program Files\Bochs-2.5.1..\bochs -q -f bochsrc.txt
3. Run. bat