Subversion Repositories Kolibri OS

Rev

Rev 1703 | Rev 1952 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1703 Rev 1941
Line 9... Line 9...
9
;;  KolibriOS 16-bit loader,                                    ;;
9
;;  KolibriOS 16-bit loader,                                    ;;
10
;;                        based on bootcode for MenuetOS        ;;
10
;;                        based on bootcode for MenuetOS        ;;
11
;;                                                              ;;
11
;;                                                              ;;
12
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
12
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Line 13... Line 13...
13
 
13
 
Line 14... Line 14...
14
$Revision: 1703 $
14
$Revision: 1941 $
15
 
15
 
16
 
16
 
17
;==========================================================================
17
;==========================================================================
18
;
18
;
Line 19... Line 19...
19
;                           16 BIT FUNCTIONS
19
;                           16 BIT FUNCTIONS
20
;
20
;
21
;==========================================================================
21
;==========================================================================
22
 
22
 
23
 
23
if 0
24
putchar:
24
putchar:
Line 59... Line 59...
59
{
59
{
60
	mov	dx, row*256 + column
60
	mov	dx, row*256 + column
61
	call	setcursor
61
	call	setcursor
62
}
62
}
Line -... Line 63...
-
 
63
 
-
 
64
end if
63
 
65
 
64
boot_read_floppy:
66
boot_read_floppy:
65
	push	si
67
	push	si
66
	xor	si, si
68
	xor	si, si
67
	mov	ah, 2	; read
69
	mov	ah, 2	; read
Line 76... Line 78...
76
@@:
78
@@:
77
	pop	si
79
	pop	si
78
	ret
80
	ret
Line 79... Line 81...
79
 
81
 
80
sayerr_plain:
-
 
81
	call	printplain
82
sayerr_plain:
Line 82... Line 83...
82
	jmp	$
83
	jmp	$
83
 
-
 
84
sayerr:
84
 
Line 85... Line 85...
85
	call	print
85
sayerr:
86
	jmp	$
86
	jmp	$
Line 171... Line 171...
171
	push	0xb800
171
	push	0xb800
172
	pop	es
172
	pop	es
173
	xor	di, di
173
	xor	di, di
174
	mov	ah, 1*16+15
174
	mov	ah, 1*16+15
Line 175... Line -...
175
 
-
 
176
; draw top
-
 
177
	mov	si, d80x25_top
-
 
178
	mov	cx, d80x25_top_num * 80
-
 
179
@@:
-
 
180
	lodsb
-
 
181
	stosw
-
 
182
	loop	@b
-
 
183
; draw spaces
-
 
184
	mov	si, space_msg
-
 
185
	mov	dx, 25 - d80x25_top_num - d80x25_bottom_num
-
 
186
dfl1:
-
 
187
	push	si
-
 
188
	mov	cx, 80
-
 
189
@@:
-
 
190
	lodsb
-
 
191
	stosw
-
 
192
	loop	@b
-
 
193
	pop	si
-
 
194
	dec	dx
-
 
195
	jnz	dfl1
-
 
196
; draw bottom
-
 
197
	mov	si, d80x25_bottom
-
 
198
	mov	cx, d80x25_bottom_num * 80
-
 
199
@@:
-
 
200
	lodsb
-
 
201
	stosw
-
 
202
	loop	@b
-
 
203
 
-
 
204
	mov	byte [space_msg+80], 0	  ; now space_msg is null terminated
-
 
205
 
-
 
206
	_setcursor d80x25_top_num,0
-
 
207
 
175
 
Line 208... Line 176...
208
cpugood:
176
cpugood:
209
 
177
 
210
	push	0
178
	push	0
Line 266... Line 234...
266
	test	cx, 2
234
	test	cx, 2
267
	jz	apm_end 		; APM 32-bit protected-mode interface not supported
235
	jz	apm_end 		; APM 32-bit protected-mode interface not supported
268
	mov	[es:0x9044], ax 	; Save APM Version
236
	mov	[es:0x9044], ax 	; Save APM Version
269
	mov	[es:0x9046], cx 	; Save APM flags
237
	mov	[es:0x9046], cx 	; Save APM flags
Line 270... Line -...
270
 
-
 
271
	; Write APM ver ----
-
 
272
	and	ax, 0xf0f
-
 
273
	add	ax, '00'
-
 
274
	mov	si, msg_apm
-
 
275
	mov	[si + 5], ah
-
 
276
	mov	[si + 7], al
-
 
277
	_setcursor 0, 3
-
 
278
	call	printplain
-
 
279
	; ------------------
-
 
280
 
238
 
281
	mov	ax, 0x5304		; Disconnect interface
239
	mov	ax, 0x5304		; Disconnect interface
282
	xor	bx, bx
240
	xor	bx, bx
283
	int	0x15
241
	int	0x15
284
	mov	ax, 0x5303		; Connect 32 bit mode interface
242
	mov	ax, 0x5303		; Connect 32 bit mode interface
Line 289... Line 247...
289
	mov	[es:0x9050], ax
247
	mov	[es:0x9050], ax
290
	mov	[es:0x9052], cx
248
	mov	[es:0x9052], cx
291
	mov	[es:0x9054], dx
249
	mov	[es:0x9054], dx
Line 292... Line 250...
292
 
250
 
293
apm_end:
-
 
Line 294... Line 251...
294
	_setcursor d80x25_top_num, 0
251
apm_end:
295
 
252
 
296
;CHECK current of code
253
;CHECK current of code
297
	cmp	[cfgmanager.loader_block], -1
254
	cmp	[cfgmanager.loader_block], -1
298
	jz	noloaderblock
255
	jz	noloaderblock
299
	les	bx, [cfgmanager.loader_block]
-
 
300
	cmp	byte [es:bx], 1
256
	les	bx, [cfgmanager.loader_block]
301
	mov	si, loader_block_error
257
	cmp	byte [es:bx], 1
302
	jnz	sayerr
258
	jnz	sayerr
Line 303... Line 259...
303
	push	0
259
	push	0
Line 342... Line 298...
342
	cmp	byte [di+preboot_dma-preboot_device], 1
298
	cmp	byte [di+preboot_dma-preboot_device], 1
343
	adc	byte [di+preboot_dma-preboot_device], 0
299
	adc	byte [di+preboot_dma-preboot_device], 0
344
	cmp	byte [di+preboot_biosdisk-preboot_device], 1
300
	cmp	byte [di+preboot_biosdisk-preboot_device], 1
345
	adc	byte [di+preboot_biosdisk-preboot_device], 0
301
	adc	byte [di+preboot_biosdisk-preboot_device], 0
Line 346... Line -...
346
 
-
 
347
	_setcursor 7,0
-
 
348
	mov	si, space_msg
-
 
349
	call	printplain
302
 
350
;        pop     ax              ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< ??
303
;        pop     ax              ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< ??
351
	jmp	.continue
304
	jmp	.continue
352
.loader_block dd -1
305
.loader_block dd -1
353
.continue:
306
.continue:
354
	sti
-
 
355
	_setcursor 6,0
-
 
356
	mov	si, space_msg
-
 
357
	call	printplain
-
 
358
	call	printplain
-
 
359
	_setcursor 6,0
-
 
360
	mov	si, loading_msg
-
 
361
	call	print
-
 
362
	_setcursor 15,0
307
	sti
Line 363... Line 308...
363
	jmp	 .load
308
	jmp	 .load
364
 
309
 
365
.loadc:
310
.loadc:
366
	pop	eax
311
	pop	eax
367
.cont:
312
.cont:
368
	push	cs
-
 
369
	pop	ds
-
 
370
	mov	si, space_msg
-
 
371
	mov	byte [si+80], 0
-
 
372
	_setcursor 15,0
-
 
373
	call	printplain
313
	push	cs
Line 374... Line 314...
374
	_setcursor 15,0
314
	pop	ds
Line 375... Line 315...
375
.load:
315
.load:
Line 404... Line 344...
404
 
344
 
Line 405... Line 345...
405
; READ DISKETTE TO MEMORY
345
; READ DISKETTE TO MEMORY
406
 
346
 
407
	cmp	[boot_dev],0
-
 
408
	jne	no_sys_on_floppy
-
 
409
	mov	si,diskload
347
	cmp	[boot_dev],0
410
	call	print
348
	jne	no_sys_on_floppy
411
	xor	ax, ax		  ; reset drive
349
	xor	ax, ax		  ; reset drive
412
	xor	dx, dx
350
	xor	dx, dx
413
	int	0x13
351
	int	0x13
Line 462... Line 400...
462
	jnz	.a1
400
	jnz	.a1
463
	mov	dh, 0
401
	mov	dh, 0
464
	inc	ch
402
	inc	ch
465
	cmp	ch, 80
403
	cmp	ch, 80
466
	jae	ok_sys_on_floppy
404
	jae	ok_sys_on_floppy
467
	pusha
-
 
468
	mov	al, ch
405
	mov	al, ch
469
	shr	ch, 2
406
	shr	ch, 2
470
	add	al, ch
-
 
471
	aam
-
 
472
	xchg	al, ah
-
 
473
	add	ax, '00'
-
 
474
	mov	si, pros
-
 
475
	mov	[si], ax
-
 
476
	call	printplain
-
 
477
	popa
-
 
478
	jmp	.a1
407
	jmp	.a1
479
.nocd:
408
.nocd:
480
; no - read only used sectors from floppy
409
; no - read only used sectors from floppy
481
; now load floppy image to memory
410
; now load floppy image to memory
482
; at first load boot sector and first FAT table
411
; at first load boot sector and first FAT table
Line 702... Line 631...
702
	mul	cx
631
	mul	cx
703
	div	di
632
	div	di
704
	aam
633
	aam
705
	xchg	al, ah
634
	xchg	al, ah
706
	add	ax, '00'
635
	add	ax, '00'
707
	mov	si, pros
-
 
708
	cmp	[si], ax
-
 
709
	jz	@f
-
 
710
	mov	[si], ax
-
 
711
	call	printplain
-
 
712
@@:
636
@@:
713
	popa
637
	popa
714
	inc	di
638
	inc	di
715
	cmp	di, word [end_of_FAT]	; max number of cluster
639
	cmp	di, word [end_of_FAT]	; max number of cluster
716
	jnz	.read_loop
640
	jnz	.read_loop
717
	pop	bx			; clear stack
641
	pop	bx			; clear stack
Line 718... Line 642...
718
 
642
 
719
ok_sys_on_floppy:
-
 
720
	mov	si, backspace2
-
 
721
	call	printplain
-
 
722
	mov	si, okt
-
 
723
	call	printplain
643
ok_sys_on_floppy:
724
no_sys_on_floppy:
644
no_sys_on_floppy:
725
	xor	ax, ax		; reset drive
645
	xor	ax, ax		; reset drive
726
	xor	dx, dx
646
	xor	dx, dx
727
	int	0x13
647
	int	0x13