min.S 691 B

123456789101112131415161718192021222324
  1. /* https://github.com/cirosantilli/x86-bare-metal-examples#minimal-gas-example */
  2. /* Tell GAS to generate 16 bit code. */
  3. .code16
  4. /* Don't listen to interrupts. */
  5. cli
  6. /* Zero ds.
  7. *
  8. * This is only needed if we are going to access memory.
  9. *
  10. * The program might work on QEMU without this, but fail on real hardware:
  11. * http://stackoverflow.com/questions/32508919/how-to-produce-a-minimal-bios-hello-world-boot-sector-with-gcc-that-works-from-a
  12. *
  13. * You cannot write immediates directly to it, must pass through ax:
  14. * http://stackoverflow.com/questions/19074666/8086-why-cant-we-move-an-immediate-data-into-segment-register
  15. */
  16. xor %ax, %ax
  17. mov %ax, %ds
  18. /* Stop the processor. */
  19. hlt