Guest User

Untitled

a guest
May 24th, 2018
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.45 KB | None | 0 0
  1. bits 16
  2. ;; enforce CS:IP
  3. org 7C00h
  4.  
  5. jmp 0x0000: start
  6. tempdata dw 0x0000
  7. start:
  8. call print_time
  9. jmp $
  10.  
  11. ;;; Print the time to wherever cursor is
  12. ;;; Modified: AX, BX, CX, DX
  13. print_time:
  14. call get_real_time_clock_time
  15. mov al, ch
  16. call print_bcd_byte
  17. mov al, ":"
  18. call print_char
  19. mov al, cl
  20. call print_bcd_byte
  21. mov al, ":"
  22. call print_char
  23. mov al, dh
  24. call print_bcd_byte
  25. ret
  26.  
  27. ;;; Get time of day according to the hardware clock.
  28. ;;; Return: (all times in BCD)
  29. ;;; CH = hour
  30. ;;; CL = minutes
  31. ;;; DH = seconds
  32. ;;; DL = daylight savings flag. 0x0 = standard, 0x01 = daylight savings.
  33. ;;; CF is clear if successful/set on error.
  34. get_real_time_clock_time:
  35. mov ah, 0x02
  36. ;; clear CF (look up how)
  37. int 0x1a
  38. ret
  39.  
  40. ;;; Print a binary coded byte (two numbers) to where point is.
  41. ;;; Input:
  42. ;;; AL = BCD number to print
  43. ;;; Modified: AX, BX
  44. print_bcd_byte:
  45. push ax
  46. shr al, 4
  47. add al, 0x30
  48. call print_char
  49. pop ax
  50. and al, 0x0f
  51. add al, 0x30
  52. call print_char
  53. ret
  54.  
  55. ;;; Display a single character on the screen.
  56. ;;; Input:
  57. ;;; AL = character to write
  58. ;;; Modified:
  59. ;;; AH - Set to 0x0e
  60. ;;; BX - zeroed out.
  61. print_char:
  62. mov ah, 0x0e
  63. ;;clear to 0, lest unexpected color changes happen.
  64. xor bx, bx
  65. int 0x10
  66. ret
Add Comment
Please, Sign In to add comment