/asm/boot/gas/boot.S

http://github.com/dennis-gemini/tests · Assembly · 69 lines · 61 code · 8 blank · 0 comment · 0 complexity · fc4f000bad32506e3ac28397d23e96ca MD5 · raw file

  1. .code16
  2. .text
  3. jmp start
  4. nop
  5. oem_name: .ascii "-DENNIS-"
  6. byte_per_sector: .2byte 512
  7. sector_per_cluster: .byte 1
  8. reserved_sector_count: .2byte 1
  9. num_of_fat: .byte 2
  10. root_entry_count: .2byte 224
  11. total_sector_16: .2byte 2880
  12. media: .byte 0xf0
  13. fat_size_16: .2byte 9
  14. sector_per_track: .2byte 18
  15. number_of_heads: .2byte 2
  16. hidden_sector: .4byte 0
  17. total_sector_32: .4byte 0
  18. drive_number: .byte 0
  19. reserved1: .byte 0
  20. boot_signature: .byte 0x29
  21. volume_id: .4byte 0
  22. volume_label: .ascii "BootableDsk"
  23. file_system_type: .ascii "FAT12 "
  24. start:
  25. mov %cs, %ax
  26. mov %ax, %ds
  27. mov %ax, %es
  28. mov $booting, %ax
  29. mov $booting_len, %cx
  30. mov $0007, %bx
  31. mov $0000, %dx
  32. call print
  33. mov $0xb800, %ax
  34. mov %ax, %es
  35. movw %es:((80*12 + 40) * 2), %ax
  36. movb $0x71, %ah
  37. inc %al
  38. movw %ax, %es:((80*12 + 40) * 2)
  39. halt:
  40. cli
  41. hlt
  42. jmp halt
  43. // mov $0xf000, %ax
  44. // mov %ax, %es
  45. // xor %bx, %bx
  46. // ljmp $0xffff, $0
  47. print:
  48. //%ax: str
  49. //%cx: len
  50. //%bh: page
  51. //%bl: color
  52. //%dh: y
  53. //%dl: x
  54. mov %ax, %bp
  55. mov $0x1301, %ax
  56. int $0x10
  57. ret
  58. booting: .ascii "Booting..."
  59. .set booting_len, (. - booting)
  60. .org 510
  61. .word 0xaa55