Advertisement
Guest User

Untitled

a guest
Jan 18th, 2011
857
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.50 KB | None | 0 0
  1. BITS 16
  2.  
  3. start:
  4. mov ax, 07C0h ; Set up 4K stack space after this bootloader
  5. add ax, 288 ; (4096 + 512) / 16 bytes per paragraph
  6. mov ss, ax
  7. mov sp, 4096
  8.  
  9. mov ax, 07C0h ; Set data segment to where we're loaded
  10. mov ds, ax
  11.  
  12. mov si, text_string ; Put string position into SI
  13. call print_string ; Call our string-printing routine
  14.  
  15. mov si, name_string
  16. call print_name
  17.  
  18. jmp $ ; Infinite loop so that the text is displayed and
  19.  
  20. text_string db 'This is my cool new OS! Woohoo!',0
  21. name_string db 'Chiggins',0
  22.  
  23. ;---------------------------------------------------------------------------------------
  24.  
  25. exit:
  26. ret
  27.  
  28. ;---------------------------------------------------------------------------------------
  29.  
  30. print_string: ; Routine: output string in SI to screen
  31. mov ah, 0Eh ; int 10h 'print char' function - puts in upper half of AX (AH)
  32.  
  33. .repeat:
  34. lodsb ; Get character from string (from SI)
  35. cmp al, 0 ; Places character in lower half of AX (AL)
  36. je .done ; If char is zero, end of string
  37. int 10h ; Otherwise, print it (gets char from AL)
  38. jmp .repeat
  39.  
  40. .done:
  41. call exit
  42.  
  43. ;---------------------------------------------------------------------------------------
  44.  
  45. print_name:
  46. mv ah, 0Eh
  47.  
  48. .repeat:
  49. lodsb
  50. cmp al,0
  51. je .done
  52. int 10h
  53. jmp .repeat
  54.  
  55. .done
  56. call exit
  57.  
  58. ;---------------------------------------------------------------------------------------
  59.  
  60. times 510-($-$$) db 0 ; Pad remainder of boot sector with 0x
  61. dw 0xAA55 ; The standard PC boot signature
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement