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