如何制作一个可引导的 USB 驱动器,引导扇区写入 nasm?

How is it possible to make a bootable usb drive , with bootsector written in nasm?

我有以下代码:

mov ah ,  0x0e

mov al , `h`

int 0x10

mov al , `1`

int 0x10

jmp $



times 510-($-$$) db 0 

dw 0xaa55

我用这个 bat 文件编译和 运行 qemu :

nasm -fbin boot_sect.asm -o boot_sect.iso

qemu-system-x86_64 -drive format=raw,file=boot_sect.iso

它工作正常。但后来我尝试使用 rufus 3.17 制作可启动的 USB 驱动器。 它显示:设备 -> [NO LABEL](disc 1)[16 gb] 我猜它是我想让它可启动的 usb。然后我选择了用 nasm (boot_sect.iso ) 创建的 iso 文件并按开始。该过程完成后,我收到以下消息:

Format operation started
Requesting disk access...
No drive letter was assigned...
Will use 'D:' as volume mountpoint
Opened \.\PhysicalDrive1 for exclusive write access
Requesting logical volume handle...
++

Found USB 2.0 device 'Generic Flash Disk USB Device' (058F:6387)
Found VHD device 'Εικονικός δίσκος της Microsoft'
No logical drive found (unpartitioned?)
2 devices found
No volume information for drive 0x81
Disk type: Removable, Disk size: 16 GB, Sector size: 512 bytes
Cylinders: 1912, Tracks per cylinder: 255, Sectors per track: 63
Partition type: MBR, NB Partitions: 0
Disk ID: 0x00000000
Drive has an unknown Master Boot Record

我忽略它并重新启动我的电脑。我按 F12 select 从 USB 启动。但没有任何反应,windows 开始启动。怎么回事,笔记本电脑无法从 USB 启动?

问题实际上并不是我最初认为的代码。我只需要从 bios 设置更改为 csm 模式,然后从 usb 启动。