Leaked source code of windows server 2003
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.

288 lines
6.6 KiB

  1. page ,160
  2. title msinit for BIOS
  3. ;
  4. ;----------------------------------------------------------------------------
  5. ;
  6. ; Modification history
  7. ;
  8. ; 26-Feb-1991 sudeepb Ported for NT DOSEm
  9. ;----------------------------------------------------------------------------
  10. ;
  11. EXTENDEDKEY equ 1 ; use extended keyboard functions
  12. include version.inc ; set build flags
  13. include biosseg.inc ; establish bios segment structure
  14. include msequ.inc
  15. include dossym.inc
  16. include dosmac.inc
  17. include biostruc.inc
  18. include dossvc.inc
  19. include vint.inc
  20. ; the following segment follows sysinit. It is used to define
  21. ; the location to load MSDOS.SYS into.
  22. dos_load_seg segment para public 'dos_load_seg'
  23. dos_load_seg ends
  24. extrn RomVectors:dword
  25. extrn NUMROMVECTORS:abs
  26. extrn res_dev_list:word
  27. extrn keyrd_func:byte ; for mscon. defined in msdata.
  28. extrn keysts_func:byte ; for mscon. defined in msdata.
  29. extrn endBIOSData:byte
  30. extrn dosdatasg:word
  31. extrn Int15:far ; M036
  32. extrn int19:far
  33. extrn intret:near
  34. extrn cbreak:near
  35. extrn outchr:near
  36. extrn outchr:near
  37. sysinitseg segment
  38. assume cs:sysinitseg
  39. extrn current_dos_location:word
  40. extrn device_list:dword
  41. extrn memory_size:word
  42. extrn sysinit:far
  43. sysinitseg ends
  44. Bios_Data_Init segment
  45. assume cs:datagrp
  46. ;*********************************************************
  47. ; system initialization
  48. ;
  49. ; the entry conditions are established by the bootstrap
  50. ; loader and are considered unknown. the following jobs
  51. ; will be performed by this module:
  52. ;
  53. ; 1. all device initialization is performed
  54. ;
  55. ; 2. a local stack is set up and ds:si are set
  56. ; to point to an initialization table. then
  57. ; an inter-segment call is made to the first
  58. ; byte of the dos
  59. ;
  60. ; 3. once the dos returns from this call the ds
  61. ; register has been set up to point to the start
  62. ; of free memory. the initialization will then
  63. ; load the command program into this area
  64. ; beginning at 100 hex and transfer control to
  65. ; this program.
  66. ;
  67. ;********************************************************
  68. ;===========================================================================
  69. ;
  70. ; entry from boot sector. the register contents are:
  71. ;
  72. ; dl = int 13 drive number we booted from
  73. ; ch = media byte
  74. ; bx = first data sector on disk.
  75. ; ax = first data sector (high)
  76. ; di = sectors/fat for the boot media.
  77. ;
  78. public init
  79. init proc near
  80. assume ds:nothing,es:nothing
  81. FCLI
  82. xor ax,ax
  83. mov ds,ax
  84. ; Save a pack of interrupt vectors...
  85. push cs
  86. pop es ; cannot use cs override for stos
  87. mov cx, NUMROMVECTORS ; no. of rom vectors to be saved
  88. mov si, offset RomVectors ; point to list of int vectors
  89. next_int:
  90. lods byte ptr cs:[si] ; get int number
  91. cbw ; assume < 128
  92. shl ax, 1
  93. shl ax, 1 ; int no * 4
  94. mov di, ax
  95. xchg si, di
  96. lodsw
  97. stosw
  98. lodsw
  99. stosw ; save the vector
  100. xchg si, di
  101. loop next_int
  102. ; set up int 15 for new action ; M036
  103. mov word ptr ds:[15h*4],offset Int15 ; M036
  104. mov ds:[15h*4+2],cs ; M036
  105. ; set up int 19 for new action
  106. mov word ptr ds:[19h*4],offset int19
  107. mov ds:[19h*4+2],cs
  108. ;
  109. xor dx,dx
  110. mov ss,dx
  111. mov sp,700h ;local stack
  112. FSTI
  113. assume ss:nothing
  114. ; NTVDM we do not intialize the com,prn ports here
  115. ; to stay seamless with the host OS
  116. ; 15-Sep-1992 Jonle
  117. ;
  118. ; mov al,3 ; init com4
  119. ; call aux_init
  120. ; mov al,2 ; init com3
  121. ; call aux_init
  122. ; mov al,1 ; init com2
  123. ; call aux_init
  124. ; xor al,al ; init com1
  125. ; call aux_init
  126. ;
  127. ; mov al,2 ; init lpt3
  128. ; call print_init
  129. ; mov al,1 ; init lpt2
  130. ; call print_init
  131. ; xor al,al ; init lpt1
  132. ; call print_init
  133. xor dx,dx
  134. mov ds,dx ; to initialize print screen vector
  135. mov es,dx
  136. xor ax,ax
  137. mov di,initspot
  138. stosw ; init four bytes to 0
  139. stosw
  140. mov ax,cs ; fetch segment
  141. mov ds:word ptr brkadr,offset cbreak ;break entry point
  142. mov ds:brkadr+2,ax ;vector for break
  143. mov ds:word ptr chrout*4,offset outchr
  144. mov ds:word ptr chrout*4+2,ax
  145. mov di,4
  146. mov bx,offset intret ;will initialize rest of interrupts
  147. xchg ax,bx
  148. stosw ;location 4
  149. xchg ax,bx
  150. stosw ;int 1 ;location 6
  151. add di,4
  152. xchg ax,bx
  153. stosw ;location 12
  154. xchg ax,bx
  155. stosw ;int 3 ;location 14
  156. xchg ax,bx
  157. stosw ;location 16
  158. xchg ax,bx
  159. stosw ;int 4 ;location 18
  160. mov ds:word ptr 500h,dx ;set print screen & break =0
  161. mov ds:word ptr lstdrv,dx ;clean out last drive spec
  162. mov dx,sysinitseg
  163. mov ds,dx
  164. assume ds:sysinitseg
  165. ; set pointer to resident device driver chain
  166. mov word ptr device_list,offset res_dev_list
  167. mov word ptr device_list+2,cs
  168. mov current_dos_location,dos_load_seg ; will load MSDOS here
  169. ifdef EXTENDEDKEY
  170. ; we will check if the system has ibm extended keyboard by
  171. ; looking at a byte at 40:96. if bit 4 is set, then extended key board
  172. ; is installed, and we are going to set keyrd_func to 10h, keysts_func to 11h
  173. ; for the extended keyboard function. use cx as the temporary register.
  174. xor cx,cx
  175. mov ds,cx
  176. assume ds:nothing
  177. mov cl,ds:0496h ; get keyboard flag
  178. test cl,00010000b
  179. jz org_key ; orginal keyboard
  180. mov byte ptr keyrd_func,10h ; extended keyboard
  181. mov byte ptr keysts_func,11h ; change for ext. keyboard functions
  182. org_key:
  183. endif
  184. push cs
  185. pop ds
  186. push cs
  187. pop es
  188. assume ds:datagrp, es:datagrp
  189. mov di, offset endBIOSData ; BIOS data segment end address
  190. shr di,1
  191. shr di,1
  192. shr di,1
  193. shr di,1 ; Converted to segmnet
  194. inc di ; para align
  195. add di,datagrp ; Add segment of BIOS data
  196. mov [dosdatasg],di ; di = to be dos data segment
  197. mov di,dos_load_seg
  198. SVC SVC_DEMLOADDOS ; di is segment to load DOS
  199. ; If it fails it never comes back
  200. jmp sysinit
  201. init endp
  202. ;--------------------------------------------------------------------
  203. ; al = device number
  204. print_init proc near
  205. assume ds:nothing,es:nothing
  206. cbw
  207. mov dx,ax ; get printer port number into dx
  208. mov ah,1 ;initalize printer port
  209. int 17h ;call rom-bios routine
  210. ret
  211. print_init endp
  212. ;--------------------------------------------------------------------
  213. aux_init proc near
  214. assume ds:nothing,es:nothing
  215. cbw
  216. mov dx,ax
  217. mov al,rsinit ;2400,n,1,8 (msequ.inc)
  218. mov ah,0 ;initalize aux port
  219. int 14h ;call rom-bios routine
  220. ret
  221. aux_init endp
  222. Bios_Data_Init ends
  223. end
  224.