You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

version.asm 1.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. bits 16
  2. org 100h
  3. _start:
  4. ; first check for SYSLINUX
  5. mov ah, 30h
  6. int 21h
  7. cmp eax, 59530000h
  8. jne .not_syslinux
  9. cmp ebx, 4c530000h
  10. jne .not_syslinux
  11. cmp ecx, 4e490000h
  12. jne .not_syslinux
  13. cmp edx, 58550000h
  14. jne .not_syslinux
  15. ; now get syslinux version
  16. mov ax, 0001h
  17. int 22h
  18. push cx
  19. push dx
  20. push di
  21. push si
  22. push es
  23. ; print version string
  24. mov dx, str_version
  25. mov ah, 09h
  26. int 21h
  27. pop es
  28. pop bx
  29. push es
  30. mov ax, 0002h
  31. int 22h
  32. ; print copyright string
  33. mov dx, str_copyright
  34. mov ah, 09h
  35. int 21h
  36. pop es
  37. pop bx
  38. mov ax, 0002h
  39. int 22h
  40. ; print syslinux derivative id
  41. mov dx, str_derivative
  42. mov ah, 09h
  43. int 21h
  44. pop ax
  45. call print_hex_byte
  46. ; print version number
  47. mov dx, str_version_num
  48. mov ah, 09h
  49. int 21h
  50. pop cx
  51. push cx
  52. mov ax, cx
  53. and ax, 0FFh
  54. call print_dec_word
  55. mov dl, '.'
  56. mov ah, 02h
  57. int 21h
  58. pop cx
  59. mov ax, cx
  60. shr ax, 8
  61. call print_dec_word
  62. ret
  63. .not_syslinux:
  64. mov dx, str_not_syslinux
  65. mov ah, 09h
  66. int 21h
  67. ret
  68. ; input: al = byte to print in hex
  69. print_hex_byte:
  70. push ax
  71. shr al, 4
  72. call print_hex_nybble
  73. pop ax
  74. call print_hex_nybble
  75. ret
  76. ; input: bottom half of al = nybble to print in hex
  77. print_hex_nybble:
  78. push ax
  79. mov bl, al
  80. and bx, 1111b
  81. mov dl, [str_hex + bx]
  82. mov ah, 02h
  83. int 21h
  84. pop ax
  85. ret
  86. str_hex: db "01234567890abcdef"
  87. ; input: ax = word to print
  88. print_dec_word:
  89. mov cx, 10
  90. mov word [.count], 0
  91. .loop:
  92. xor dx, dx
  93. div cx
  94. inc word [.count]
  95. push dx
  96. test ax, ax
  97. jnz .loop
  98. .print:
  99. pop dx
  100. add dx, '0'
  101. mov ah, 02h
  102. int 21h
  103. dec word [.count]
  104. jnz .print
  105. ret
  106. .count: dw 0
  107. str_not_syslinux: db "Not SYSLINUX or derivative (running on DOS?)$"
  108. str_version: db "Version: $"
  109. str_copyright: db 10, "Copyright: $"
  110. str_derivative: db 10, "Derivative ID: 0x$"
  111. str_version_num: db 10, "Version number: $"