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.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. #if !defined(USE_NASM) && !defined(USE_AS86)
  2. #define USE_AS86
  3. #endif
  4. #ifdef USE_AS86
  5. #define CON(x) *x
  6. #define BCON(x) *x
  7. #define WCON(x) *x
  8. #define LOC(x) x
  9. #define BLOC(x) byte ptr x
  10. #define WLOC(x) word ptr x
  11. #define JMP(x) jmp x
  12. #define STRDECL(s) .ascii s
  13. #define SEGCS seg cs
  14. #define SEGES seg es
  15. #define ALIGN(x) .align x
  16. #define SPACE(x) .space x
  17. #endif
  18. #ifdef USE_NASM
  19. #define CON(x) x
  20. #define BCON(x) byte x
  21. #define WCON(x) word x
  22. #define LOC(x) [x]
  23. #define BLOC(x) byte [x]
  24. #define WLOC(x) word [x]
  25. #define JMP(x) jmp short x
  26. #define STRDECL(s) db s
  27. #define SEGCS cs
  28. #define SEGES es
  29. #define ALIGN(x) align x, db 0
  30. #define SPACE(x) times x db 0
  31. #endif
  32. ROMLOAD equ 0x5000
  33. start:
  34. cli
  35. xor ax, ax
  36. mov ss, ax
  37. mov sp, CON(0x7C00)
  38. mov si, sp
  39. mov es, ax
  40. mov ds, ax
  41. sti
  42. cld
  43. mov di, CON(0x600)
  44. mov cx, CON(0x100)
  45. rep
  46. movsw
  47. db 0xEA
  48. dw jump
  49. dw 0
  50. jump:
  51. mov si, CON(Hlaska)
  52. call print
  53. ; rozmery prvniho HD
  54. mov ah, CON(8)
  55. mov dl, CON(0x80)
  56. int 0x13
  57. jc chyba
  58. ; dh - H, cx - CS
  59. ; prvi stopa obsahuje bootrom, tak ji natahneme do RAM
  60. mov ah, CON(2)
  61. mov al, cl
  62. and al, CON(0x3F)
  63. dec al
  64. mov dx, CON(0x80)
  65. mov cx, CON(2)
  66. mov bx, CON(ROMLOAD)
  67. mov es, bx
  68. xor bx, bx
  69. int 0x13
  70. jc chyba
  71. ; hromada kodu podle zdrojaku netboot
  72. xor di, di
  73. mov es, di
  74. mov di, CON(0x380)
  75. push di
  76. mov cx, CON(10)
  77. cld
  78. rep
  79. stosw
  80. pop di
  81. #ifdef USE_AS86
  82. mov word ptr [ di ], CON(0x5a5a)
  83. mov byte ptr [ di + 2 ], CON(0x50)
  84. mov word ptr [ di + 0x10 ], CON(0xFFFF)
  85. mov word ptr [ di + 0x12 ], CON(0xFFFF)
  86. #endif
  87. #ifdef USE_NASM
  88. mov word [ di ], CON(0x5a5a)
  89. mov byte [ di + 2 ], CON(0x50)
  90. mov word [ di + 10h ], CON(0xFFFF)
  91. mov word [ di + 12h ], CON(0xFFFF)
  92. #endif
  93. ; navratova adresa, kdyby nezabrala ROM
  94. SEGCS
  95. mov WLOC(OfsErr), CON(RomErr)
  96. push cs
  97. push WCON(chyba)
  98. mov ax, CON(ROMLOAD)
  99. mov es, ax
  100. push es
  101. ; kouzelny jump....
  102. SEGES
  103. mov si, [ 0x1a ]
  104. SEGES
  105. #ifdef USE_AS86
  106. push word ptr [ si + 0x1a ] ; ...do bootrom v RAM
  107. #endif
  108. #ifdef USE_NASM
  109. push word [ si + 0x1a ] ; ...do bootrom v RAM
  110. #endif
  111. retf
  112. chyba:
  113. SEGCS
  114. mov si, LOC(OfsErr)
  115. call print
  116. mov si, CON(CRLF)
  117. call print
  118. JMP(chyba)
  119. print:
  120. lodsb
  121. cmp al,CON(0)
  122. je navrat
  123. push si
  124. mov bx,CON(7)
  125. mov ah,CON(0x0E)
  126. int 0x10
  127. pop si
  128. JMP(print)
  129. navrat:
  130. ret
  131. Hlaska: db 13, 10
  132. STRDECL('HD Net Loader v1.0 (c) poli 1999')
  133. db 13, 10, 0
  134. CRLF: db 13, 10, 0
  135. OfsErr: dw Error
  136. Error: STRDECL('Error load from HD !')
  137. db 0
  138. RomErr: STRDECL('ROM Error !')
  139. db 0
  140. mbrend:
  141. ret
  142. #ifdef USE_AS86
  143. org 510
  144. #endif
  145. #ifdef USE_NASM
  146. times 510-($-$$) db 0
  147. #endif
  148. dw 0xAA55