1
0

boot_sect_main.asm 898 B

1234567891011121314151617181920212223242526272829303132
  1. [org 0x7c00]
  2. mov bp, 0x8000 ; set the stack safely away from us
  3. mov sp, bp
  4. mov bx, 0x9000 ; es:bx = 0x0000:0x9000 = 0x09000
  5. mov dh, 2 ; read 2 sectors
  6. ; the bios sets 'dl' for our boot disk number
  7. ; if you have trouble, use the '-fda' flag: 'qemu -fda file.bin'
  8. call disk_load
  9. mov dx, [0x9000] ; retrieve the first loaded word, 0xdada
  10. call print_hex
  11. call print_nl
  12. mov dx, [0x9000 + 512] ; first word from second loaded sector, 0xface
  13. call print_hex
  14. jmp $
  15. %include "../05-bootsector-functions-strings/boot_sect_print.asm"
  16. %include "../05-bootsector-functions-strings/boot_sect_print_hex.asm"
  17. %include "boot_sect_disk.asm"
  18. ; Magic number
  19. times 510 - ($-$$) db 0
  20. dw 0xaa55
  21. ; boot sector = sector 1 of cyl 0 of head 0 of hdd 0
  22. ; from now on = sector 2 ...
  23. times 256 dw 0xdada ; sector 2 = 512 bytes
  24. times 256 dw 0xface ; sector 3 = 512 bytes