2018-12-04 09:46:27 +00:00
|
|
|
/* https://github.com/cirosantilli/x86-bare-metal-examples#minimal-gas-example */
|
|
|
|
|
|
2015-09-06 16:17:39 +02:00
|
|
|
/* Tell GAS to generate 16 bit code. */
|
|
|
|
|
.code16
|
|
|
|
|
|
|
|
|
|
/* Don't listen to interrupts. */
|
|
|
|
|
cli
|
|
|
|
|
|
2018-05-06 14:33:33 +01:00
|
|
|
/* Zero ds.
|
|
|
|
|
*
|
|
|
|
|
* This is only needed if we are going to access memory.
|
|
|
|
|
*
|
|
|
|
|
* The program might work on QEMU without this, but fail on real hardware:
|
|
|
|
|
* http://stackoverflow.com/questions/32508919/how-to-produce-a-minimal-bios-hello-world-boot-sector-with-gcc-that-works-from-a
|
|
|
|
|
*
|
2019-03-19 09:22:14 +01:00
|
|
|
* You cannot write immediates directly to it, must pass through ax:
|
2018-05-06 14:33:33 +01:00
|
|
|
* http://stackoverflow.com/questions/19074666/8086-why-cant-we-move-an-immediate-data-into-segment-register
|
|
|
|
|
*/
|
2015-09-11 10:17:17 +02:00
|
|
|
xor %ax, %ax
|
2015-09-10 21:55:51 +02:00
|
|
|
mov %ax, %ds
|
|
|
|
|
|
2015-09-06 16:17:39 +02:00
|
|
|
/* Stop the processor. */
|
2018-07-17 09:46:13 +01:00
|
|
|
hlt
|