Subversion Repositories Kolibri OS

Rev

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

Rev 34 Rev 40
Line 137... Line 137...
137
{
137
{
138
	mov	dx, row*256 + column
138
	mov	dx, row*256 + column
139
	call	setcursor
139
	call	setcursor
140
}
140
}
Line -... Line 141...
-
 
141
 
-
 
142
pagetable_set:
-
 
143
	or	al, 7
-
 
144
@@:
-
 
145
	stosd
-
 
146
	add	eax, 1000h
-
 
147
	loop	@b
-
 
148
	ret
141
 
149
 
142
; 16-bit data
150
; 16-bit data
143
; videomodes table
151
; videomodes table
144
gr_table:
152
gr_table:
145
	dw      0x112+0100000000000000b ,  640 ,  480		; 1
153
	dw      0x112+0100000000000000b ,  640 ,  480		; 1
Line 273... Line 281...
273
        and     ax,bx
281
        and     ax,bx
274
        and     dx,bx
282
        and     dx,bx
275
        cmp     ax,dx
283
        cmp     ax,dx
276
        jnz     cpugood
284
        jnz     cpugood
277
        mov     si,not386-0x10000
285
        mov     si,not386-0x10000
-
 
286
sayerr:
278
        call    print
287
        call    print
279
        jmp     $
288
        jmp     $
280
     cpugood:
289
     cpugood:
Line 281... Line 290...
281
 
290
 
Line 345... Line 354...
345
        cmp     ax,0x004f
354
        cmp     ax,0x004f
346
        mov	si, novesa-0x10000
355
        mov	si, novesa-0x10000
347
        jnz	@f
356
        jnz	@f
348
        mov     ax,[es:di+4]
357
        mov     ax,[es:di+4]
349
        add     ax,'0'*256+'0'
358
        add     ax,'0'*256+'0'
350
        mov     [vervesa+vervesa_off-0x10000], ah
-
 
351
        mov     [vervesa+vervesa_off+2-0x10000], al
-
 
352
        mov     si,vervesa-0x10000
359
        mov	si,vervesa-0x10000
-
 
360
        mov     [si+vervesa_off], ah
-
 
361
        mov     [si+vervesa_off+2], al
353
@@:     call    print
362
@@:     call    print
Line 354... Line 363...
354
 
363
 
355
; \begin{diamond}[30.11.2005]
364
; \begin{diamond}[30.11.2005]
356
cfgmanager:
365
cfgmanager:
357
; settings:
366
; settings:
358
; a) preboot_graph = graphical mode
367
; a) preboot_graph = graphical mode
359
;    preboot_gprobe = probe this mode?
368
;    preboot_gprobe = probe this mode?
360
; b) preboot_mtrr = use hardware acceleration?
369
; b) preboot_mtrr = use hardware acceleration?
361
; c) preboot_vrrm = use VRR?
370
; c) preboot_vrrm = use VRR?
362
; d) preboot_device = from what boot?
371
; d) preboot_device = from what boot?
363
	mov	si, preboot_graph-0x10000
372
	mov	di, preboot_graph-0x10000
364
; check bootloader block
373
; check bootloader block
365
	cmp	[.loader_block-0x10000], 0
374
	cmp	[.loader_block-0x10000], 0
366
	jz	.noloaderblock
375
	jz	.noloaderblock
367
	les	bx, [.loader_block-0x10000]
376
	les	bx, [.loader_block-0x10000]
368
	cmp	byte [es:bx], 1
-
 
369
	jz	@f
377
	cmp	byte [es:bx], 1
370
	mov	si, loader_block_error-0x10000
-
 
371
	call	print
378
	mov	si, loader_block_error-0x10000
372
	jmp	$
-
 
373
@@:
379
	jnz	sayerr
374
	test	byte [es:bx+1], 1
380
	test	byte [es:bx+1], 1
375
	jz	@f
381
	jz	@f
376
; image in memory present
382
; image in memory present
377
	cmp	[si+preboot_device-preboot_graph], 0
383
	cmp	[di+preboot_device-preboot_graph], 0
378
	jnz	@f
384
	jnz	@f
379
	mov	[si+preboot_device-preboot_graph], 3
385
	mov	[di+preboot_device-preboot_graph], 3
380
@@:
386
@@:
381
.noloaderblock:
387
.noloaderblock:
382
; determine default settings
388
; determine default settings
383
	mov	[.bSettingsChanged-0x10000], 0
389
	mov	[.bSettingsChanged-0x10000], 0
384
	cmp	byte [si], 0
390
	cmp	byte [di], 0
385
	jnz	.preboot_gr_end
391
	jnz	.preboot_gr_end
386
	mov	[si+preboot_gprobe-preboot_graph], 0
392
	mov	[di+preboot_gprobe-preboot_graph], 0
387
	mov	al, [vervesa+vervesa_off-0x10000]
393
	mov	al, [vervesa+vervesa_off-0x10000]
388
	cmp	al, 'x'
394
	cmp	al, 'x'
389
	jz	.novesa
395
	jz	.novesa
390
	cmp	al, '1'
396
	cmp	al, '1'
391
	jz	.vesa12
397
	jz	.vesa12
392
	mov	[si+preboot_gprobe-preboot_graph], 2
398
	mov	[di+preboot_gprobe-preboot_graph], 2
393
	mov	al, 3
399
	mov	al, 3
394
	jmp	@f
400
	jmp	@f
395
.vesa12:
401
.vesa12:
396
	mov	al, 7
402
	mov	al, 7
397
	jmp	@f
403
	jmp	@f
398
.novesa:
404
.novesa:
399
	mov	al, 10
405
	mov	al, 10
400
@@:
406
@@:
401
	mov	[si], al
407
	mov	[di], al
402
.preboot_gr_end:
408
.preboot_gr_end:
403
	cmp	[si+preboot_mtrr-preboot_graph], 1
409
	cmp	[di+preboot_mtrr-preboot_graph], 1
404
	adc	[si+preboot_mtrr-preboot_graph], 0
410
	adc	[di+preboot_mtrr-preboot_graph], 0
405
	cmp	[si+preboot_vrrm-preboot_graph], 1
411
	cmp	[di+preboot_vrrm-preboot_graph], 1
406
	adc	[si+preboot_vrrm-preboot_graph], 0
412
	adc	[di+preboot_vrrm-preboot_graph], 0
407
	cmp	[si+preboot_device-preboot_graph], 1
413
	cmp	[di+preboot_device-preboot_graph], 1
408
	adc	[si+preboot_device-preboot_graph], 0
414
	adc	[di+preboot_device-preboot_graph], 0
409
; notify user
415
; notify user
410
	mov	si, linef-0x10000
416
	mov	si, linef-0x10000
411
	call	print
417
	call	print
412
	mov	si, start_msg-0x10000
418
	mov	si, start_msg-0x10000
Line 455... Line 461...
455
	jmp	@b
461
	jmp	@b
456
.c:
462
.c:
457
	mov	si, linef-0x10000
463
	mov	si, linef-0x10000
458
	call	printplain
464
	call	printplain
459
	mov	si, mtrr_msg-0x10000
465
	mov	si, mtrr_msg-0x10000
460
	call	print
-
 
461
	mov	si, on_msg-0x10000
-
 
462
	cmp	[preboot_mtrr-0x10000], 1
466
	cmp	[preboot_mtrr-0x10000], 1
463
	jz	@f
-
 
464
	mov	si, off_msg-0x10000
-
 
465
@@:
-
 
466
	call	printplain
467
	call	.say_on_off
467
	mov	si, vrrm_msg-0x10000
468
	mov	si, vrrm_msg-0x10000
468
	call	print
-
 
469
	mov	si, on_msg-0x10000
-
 
470
	cmp	[preboot_vrrm-0x10000], 1
469
	cmp	[preboot_vrrm-0x10000], 1
471
	jz	@f
-
 
472
	mov	si, off_msg-0x10000
-
 
473
@@:
-
 
474
	call	printplain
470
	call	.say_on_off
475
	mov	si, preboot_device_msg-0x10000
471
	mov	si, preboot_device_msg-0x10000
476
	call	print
472
	call	print
477
	mov	al, [preboot_device-0x10000]
473
	mov	al, [preboot_device-0x10000]
478
	and	eax, 3
474
	and	eax, 3
479
	mov	si, [preboot_device_msgs-0x10000+eax*2]
475
	mov	si, [preboot_device_msgs-0x10000+eax*2]
480
	call	printplain
476
	call	printplain
481
.wait:
477
.wait:
482
; empty BIOS keyboard buffer
-
 
483
	_setcursor 25,0		; out of screen
478
	_setcursor 25,0		; out of screen
484
; set timer interrupt handler
479
; set timer interrupt handler
485
	cli
480
	cli
486
	push	0
481
	push	0
487
	pop	es
482
	pop	es
Line 495... Line 490...
495
	int	16h
490
	int	16h
496
	push	ax
491
	push	ax
497
; restore timer interrupt
492
; restore timer interrupt
498
	push	0
493
	push	0
499
	pop	es
494
	pop	es
500
	mov	ecx, [.oldtimer-0x10000]
495
	mov	eax, [.oldtimer-0x10000]
501
	mov	[es:8*4], ecx
496
	mov	[es:8*4], eax
502
	mov	[.timer-0x10000], ecx
497
	mov	[.timer-0x10000], eax
503
	_setcursor 7,0
498
	_setcursor 7,0
504
	mov	si, space_msg-0x10000
499
	mov	si, space_msg-0x10000
505
	call	printplain
500
	call	printplain
506
	pop	ax
501
	pop	ax
507
; switch on key
502
; switch on key
Line 516... Line 511...
516
	jz	.change_c
511
	jz	.change_c
517
	cmp	al, 'd'
512
	cmp	al, 'd'
518
	jnz	.wait
513
	jnz	.wait
519
	_setcursor 15,0
514
	_setcursor 15,0
520
	mov     si,bdev-0x10000
515
	mov     si,bdev-0x10000
521
	call    printplain
516
	call    print
522
	mov     bx,'13'
517
	mov     bx,'13'
523
	call    getkey
518
	call    getkey
524
	mov	[preboot_device-0x10000], al
519
	mov	[preboot_device-0x10000], al
525
	_setcursor 13,0
520
	_setcursor 13,0
526
.d:
521
.d:
527
	mov	[.bSettingsChanged-0x10000], al
522
	mov	[.bSettingsChanged-0x10000], 1
528
	mov	si, space_msg-0x10000
523
	mov	si, space_msg-0x10000
529
	call	printplain
524
	call	printplain
530
	_setcursor 15,0
525
	_setcursor 15,0
531
	mov	cx, 6
526
	mov	cx, 6
532
@@:
527
@@:
Line 551... Line 546...
551
	_setcursor 10,0
546
	_setcursor 10,0
552
	jmp	.d
547
	jmp	.d
553
.change_b:
548
.change_b:
554
	_setcursor 15,0
549
	_setcursor 15,0
555
	mov	si, gr_acc-0x10000
550
	mov	si, gr_acc-0x10000
556
	call	printplain
551
	call	print
557
	mov	bx, '12'
552
	mov	bx, '12'
558
	call	getkey
553
	call	getkey
559
	mov	[preboot_mtrr-0x10000], al
554
	mov	[preboot_mtrr-0x10000], al
560
	_setcursor 11,0
555
	_setcursor 11,0
561
	jmp	.d
556
	jmp	.d
562
.change_c:
557
.change_c:
563
	_setcursor 15,0
558
	_setcursor 15,0
564
	mov	si, vrrmprint-0x10000
559
	mov	si, vrrmprint-0x10000
565
	call	printplain
560
	call	print
566
	mov	bx, '12'
561
	mov	bx, '12'
567
	call	getkey
562
	call	getkey
568
	mov	[preboot_vrrm-0x10000], al
563
	mov	[preboot_vrrm-0x10000], al
569
	_setcursor 12,0
564
	_setcursor 12,0
570
	jmp	.d
565
	jmp	.d
-
 
566
.say_on_off:
-
 
567
	pushf
-
 
568
	call	print
-
 
569
	mov	si, on_msg-0x10000
-
 
570
	popf
-
 
571
	jz	@f
-
 
572
	mov	si, off_msg-0x10000
-
 
573
@@:	call	printplain
-
 
574
	ret
-
 
575
; novesa and vervesa strings are not used at the moment of executing this code
-
 
576
virtual at novesa
571
.oldtimer dd ?
577
.oldtimer dd ?
572
.starttime dd ?
578
.starttime dd ?
573
.bSettingsChanged db ?
579
.bSettingsChanged db ?
574
.timer dd ?
580
.timer dd ?
-
 
581
end virtual
575
.loader_block dd 0
582
.loader_block dd 0
576
.gettime:
583
.gettime:
577
	mov	ah, 0
584
	mov	ah, 0
578
	int	1Ah
585
	int	1Ah
579
	xchg	ax, cx
586
	xchg	ax, cx
Line 670... Line 677...
670
.loadc:
677
.loadc:
671
	pop	eax
678
	pop	eax
672
.cont:
679
.cont:
673
	push	cs
680
	push	cs
674
	pop	ds
681
	pop	ds
675
	mov	byte [space_msg-0x10000+80], 0
-
 
676
	_setcursor 15,0
-
 
677
	mov	si, space_msg-0x10000
682
	mov	si, space_msg-0x10000
-
 
683
	mov	byte [si+80], 0
-
 
684
	_setcursor 15,0
678
	call	printplain
685
	call	printplain
679
	_setcursor 15,0
686
	_setcursor 15,0
680
.load:
687
.load:
681
; \end{diamond}[02.12.2005]
688
; \end{diamond}[02.12.2005]
Line 682... Line 689...
682
 
689
 
Line 683... Line 690...
683
; ASK GRAPHICS MODE
690
; ASK GRAPHICS MODE
684
 
-
 
685
	movzx	ax, [preboot_graph-0x10000]
-
 
686
	test	ax, ax
-
 
687
        jne     pre_graph
-
 
688
        mov     si,gr_mode-0x10000
-
 
689
        call    printplain
-
 
690
        mov     bx,'09'
-
 
691
        call    getkey
691
 
692
       pre_graph:
692
	movzx	ax, [preboot_graph-0x10000]
693
	push	0
693
	push	0
694
	pop	es
694
	pop	es
695
; address is gr_table+6*(ax-1)-0x10000
695
; address is gr_table+6*(ax-1)-0x10000
696
        add	ax, ax
696
        add	ax, ax
697
        lea	si, [gr_table-0x10000 + eax + eax*2 - 6]
697
        lea	si, [gr_table-0x10000 + eax + eax*2 - 6]
698
        mov     bx,[si+0]
698
        mov     bx,[si+0]
699
        mov     cx,[si+2]
699
        mov     cx,[si+2]
-
 
700
        mov     dx,[si+4]
700
        mov     dx,[si+4]
701
        cmp	al, 9*2
701
        cmp	al, 9*2
702
        mov	al, 32	; BPP
702
        jb	@f
703
        jb	@f
703
        mov	byte [es:0x9000], 32
704
        mov	[es:0x9000], al
704
        mov	dword [es:0x9018], 0x800000
705
        mov	dword [es:0x9018], 0x800000
705
       @@:
706
       @@:
706
        mov     [es:0x9008],bx
707
        mov     [es:0x9008],bx
707
        mov     [es:0x900A],cx
-
 
708
        mov     [es:0x900C],dx
708
        mov     [es:0x900A],cx
709
        mov     ax,32
709
        mov     [es:0x900C],dx
Line 710... Line 710...
710
        test	bh, bh
710
        test	bh, bh
Line 711... Line 711...
711
        jz	nov
711
        jz	nov
712
 
-
 
713
; USE DEFAULTS OR PROBE
-
 
714
 
712
 
715
; bx - mode : cx - x size : dx - y size
-
 
716
 
-
 
717
     ;!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
 
718
        movzx   ax,[preboot_gprobe-0x10000]
-
 
719
        test    ax,ax
-
 
720
        jne     pre_probe
713
; USE DEFAULTS OR PROBE
Line 721... Line -...
721
     ;!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
 
722
 
-
 
723
        test    bx,0100000000000000b
-
 
724
        jz      noprobe
-
 
725
 
-
 
726
        mov     si,probetext-0x10000
-
 
727
        call    printplain
-
 
728
        push    bx
-
 
729
        mov	bx, '12'
-
 
730
        call    getkey
-
 
731
        pop     bx
-
 
732
 
-
 
733
     pre_probe:
-
 
734
	dec	ax
714
 
735
        je      noprobe
-
 
736
 
715
; bx - mode : cx - x size : dx - y size
737
        push    cx dx
-
 
738
 
716
	cmp	[preboot_gprobe-0x10000], 1
739
        mov     bx,0x100
717
	jz	noprobe
740
 
-
 
741
     newprobe:
-
 
742
 
718
 
743
        inc     bx
-
 
744
        cmp     bx,0x17f
-
 
745
        jne     probemore
719
        mov     bx,0x100
Line 746... Line 720...
746
 
720
     newprobe:
747
        mov     si,prnotfnd-0x10000
721
        inc     bx
748
        call    printplain
722
        cmp     bx,0x17f
749
 
723
        mov	si,prnotfnd-0x10000
750
        jmp     $
724
        jz	sayerr
751
 
725
 
752
     probemore:
726
     probemore:
-
 
727
     	push	cx
Line 753... Line 728...
753
 
728
        mov     ax,0x4f01
754
        mov     ax,0x4f01
729
        mov     cx,bx
755
        mov     cx,bx
730
        and     cx,0xfff
756
        and     cx,0xfff
-
 
757
        mov     di,0xa000
731
        mov     di,0xa000
758
        int     0x10
732
        int     0x10
759
 
733
        pop	cx
760
	test	byte [es:di], 80h	; lfb?
734
 
761
	jz	newprobe
735
	test	byte [es:di], 80h	; lfb?
Line 762... Line 736...
762
	mov	ax, [es:di+0x12]	; x size?
736
	jz	newprobe
-
 
737
	cmp	[es:di+0x12], cx	; x size?
763
	cmp	ax, [esp+2]
738
	jnz	newprobe
764
	jnz	newprobe
-
 
Line 765... Line 739...
765
	cmp	[es:di+0x14], dx	; y size?
739
	cmp	[es:di+0x14], dx	; y size?
Line 766... Line 740...
766
	jnz	newprobe
740
	jnz	newprobe
Line 780... Line 754...
780
        mov     cx,bx
754
        mov     cx,bx
781
        and     cx,0xfff
755
        and     cx,0xfff
782
        mov     di,0xa000
756
        mov     di,0xa000
783
        int     0x10
757
        int     0x10
784
        ; LFB
758
        ; LFB
785
        mov     ecx,[es:di+0x28]
759
        mov     eax,[es:di+0x28]
786
        mov     [es:0x9018],ecx
760
        mov     [es:0x9018],eax
787
        ; ---- vbe voodoo
761
        ; ---- vbe voodoo
788
        BytesPerScanLine equ 0x10
762
        BytesPerScanLine equ 0x10
789
        mov ax, [es:di+BytesPerScanLine]
763
        mov ax, [es:di+BytesPerScanLine]
790
        mov [es:0x9001],ax
764
        mov [es:0x9001],ax
791
        ; BPP
765
        ; BPP
792
        movzx   ax,byte [es:di+0x19]
766
        mov     al,byte [es:di+0x19]
793
        mov     [es:0x9000],al
767
        mov     [es:0x9000],al
794
       nov:
768
       nov:
795
        cmp     ax,24
769
        cmp     al,24
796
        mov	si,bt24-0x10000
770
        mov	si,bt24-0x10000
797
        jz	bppl
771
        jz	bppl
798
        cmp     ax,32
772
        cmp     al,32
799
        mov     si,bt32-0x10000
773
        mov     si,bt32-0x10000
800
        jz     bppl
774
        jz     bppl
801
        mov     si,btns-0x10000
775
        mov     si,btns-0x10000
802
        call    print
-
 
803
        jmp     $
776
        jmp	sayerr
804
       bppl:
777
       bppl:
805
        call    printplain
778
        call    print
Line 806... Line 779...
806
 
779
 
Line 807... Line 780...
807
 
780
 
Line 823... Line 796...
823
 
796
 
Line 824... Line 797...
824
 
797
 
825
; GRAPHICS ACCELERATION
-
 
826
 
-
 
827
        mov     al, [preboot_mtrr-0x10000]
-
 
828
        test    al,al
-
 
829
        jne     pre_mtrr
-
 
830
        mov     si,gr_acc-0x10000
-
 
831
        call    printplain
-
 
832
        mov     bx,'12'
798
; GRAPHICS ACCELERATION
833
        call    getkey
-
 
834
      pre_mtrr:
-
 
835
        mov     [es:0x901C],al
-
 
836
; commented by diamond - newlines are not used now
-
 
Line 837... Line 799...
837
;        mov     si,linef-0x10000
799
 
Line 838... Line 800...
838
;        call    printplain
800
        mov     al, [preboot_mtrr-0x10000]
839
 
-
 
840
 
-
 
841
; VRR_M USE
-
 
842
 
-
 
843
        mov     al,[preboot_vrrm-0x10000]
-
 
844
        test    al,al
-
 
845
        jne     pre_vrrm
-
 
846
        mov     si,vrrmprint-0x10000
801
        mov     [es:0x901C],al
847
        call    print
-
 
848
        mov     bx,'13'
-
 
849
        call    getkey
-
 
Line 850... Line 802...
850
      pre_vrrm:
802
 
Line 851... Line 803...
851
        mov     [es:0x9030],al
803
; VRR_M USE
Line 937... Line 889...
937
 
889
 
Line 938... Line 890...
938
 
890
 
939
; BOOT DEVICE
-
 
940
 
-
 
941
	mov	al, [preboot_device-0x10000]
-
 
942
	test	al, al
-
 
943
	jnz	pre_device
-
 
944
        mov     si,bdev-0x10000
-
 
945
        call    printplain
-
 
946
        mov     bx,'13'
891
; BOOT DEVICE
947
        call    getkey
892
 
948
      pre_device:
-
 
949
        dec     ax
-
 
950
        mov     [boot_dev-0x10000],al
-
 
951
; commented by diamond - newlines are not used now
-
 
952
;        mov     si,linef-0x10000
-
 
Line 953... Line 893...
953
;        call    printplain
893
	mov	al, [preboot_device-0x10000]
Line 954... Line 894...
954
 
894
        dec     al
955
 
895
        mov     [boot_dev-0x10000],al
956
 
896
 
957
; READ DISKETTE TO MEMORY
897
; READ DISKETTE TO MEMORY
958
 
898
 
959
        cmp     [boot_dev-0x10000],0
899
;        cmp     [boot_dev-0x10000],0
Line 977... Line 917...
977
        jz      goodread
917
        jz      goodread
978
        inc	si
918
        inc	si
979
        cmp     si,10
919
        cmp     si,10
980
        jnz     newread
920
        jnz     newread
981
        mov     si,badsect-0x10000
921
        mov     si,badsect-0x10000
-
 
922
sayerr_plain:
982
        call    printplain
923
        call    printplain
983
        jmp     $
924
        jmp     $
984
       goodread:
925
       goodread:
985
        ; move -> 1mb
926
        ; move -> 1mb
986
        mov     si,movedesc-0x10000
927
        mov     si,movedesc-0x10000
Line 996... Line 937...
996
        je      goodmove
937
        je      goodmove
997
        mov     dx,0x3f2              ; floppy motor off
938
        mov     dx,0x3f2              ; floppy motor off
998
        mov     al,0
939
        mov     al,0
999
        out     dx,al
940
        out     dx,al
1000
        mov     si,memmovefailed-0x10000
941
        mov     si,memmovefailed-0x10000
1001
        call    print
942
        jmp	sayerr_plain
1002
        jmp     $
-
 
1003
      goodmove:
943
      goodmove:
Line 1004... Line 944...
1004
 
944
 
1005
	add	dword [movedesc-0x10000+0x18+2], 512*18
945
	add	dword [movedesc-0x10000+0x18+2], 512*18
1006
        popa
946
        popa
Line 1028... Line 968...
1028
        dec     ax
968
        dec     ax
1029
        push    ax
969
        push    ax
1030
        jnz     reads
970
        jnz     reads
1031
       readdone:
971
       readdone:
1032
        pop     ax
972
        pop     ax
1033
        mov     si,backspace-0x10000
973
        mov     si,backspace2-0x10000
1034
        call    printplain
-
 
1035
        call    printplain
974
        call    printplain
1036
        mov     si,okt-0x10000
975
        mov     si,okt-0x10000
1037
        call    printplain
976
        call    printplain
1038
       no_sys_on_floppy:
977
       no_sys_on_floppy:
1039
        xor	ax, ax		; reset drive
978
        xor	ax, ax		; reset drive
Line 1052... Line 991...
1052
 
991
 
1053
        push	0x6000
992
        push	0x6000
1054
        pop	es                    ; es:di = 6000:0
993
        pop	es                    ; es:di = 6000:0
1055
        xor     di,di
994
        xor     di,di
1056
        mov     cx,256*map_mem         ; Map (mapmem) M
995
        mov     cx,256*map_mem         ; Map (mapmem) M
1057
        mov     eax,7
996
;        mov     eax,7
1058
       pt2:
997
;       pt2:
1059
        cmp     cx,256*(map_mem-8)     ; 8 M map to LFB
998
;        cmp     cx,256*(map_mem-8)     ; 8 M map to LFB
-
 
999
;        jnz     pt3
-
 
1000
;        pop     eax
-
 
1001
;        add     eax,7
-
 
1002
;       pt3:
-
 
1003
;        cmp     cx,256*(map_mem-12)    ; 12 M back to linear = physical
-
 
1004
;        jnz     pt4
-
 
1005
;        mov     eax,12*0x100000 + 7
-
 
1006
;       pt4:
-
 
1007
;        stosd
-
 
1008
;        add     eax,4096
-
 
1009
;        loop    pt2
-
 
1010
; initialize as identity mapping
-
 
1011
	xor	eax, eax
-
 
1012
	call	pagetable_set
1060
        jnz     pt3
1013
; 8M..12M map to LFB
1061
        pop     eax
-
 
1062
        add     eax,7
-
 
1063
       pt3:
-
 
1064
        cmp     cx,256*(map_mem-12)    ; 12 M back to linear = physical
1014
	pop	eax
1065
        jnz     pt4
-
 
1066
        mov     eax,12*0x100000 + 7
1015
;	mov	cx, 256*4
1067
       pt4:
1016
	mov	ch, 4
1068
        stosd
-
 
1069
        add     eax,4096
1017
	mov	di, 2000h
Line 1070... Line 1018...
1070
        loop    pt2
1018
	call	pagetable_set
1071
        
1019
 
1072
	push	0x7100
1020
	push	0x7100
1073
	pop	es
1021
	pop	es
1074
        xor     di,di
1022
        xor     di,di
1075
        mov     eax,8*0x100000+7
-
 
1076
        mov     cx,256*4
-
 
1077
      pt5:
1023
        mov     eax,8*0x100000
1078
        stosd
-
 
Line 1079... Line 1024...
1079
        add     eax,0x1000
1024
        mov     cx,256*4
Line 1080... Line 1025...
1080
        loop    pt5
1025
        call	pagetable_set
1081
        
1026
        
1082
; 4 KB PAGE DIRECTORY
1027
; 4 KB PAGE DIRECTORY
1083
 
1028
 
1084
	push	0x7F00
1029
	push	0x7F00
1085
	pop	es                ; es:di = 7F00:0
-
 
1086
        xor     di, di
-
 
1087
        mov     cx, 64 / 4
1030
	pop	es                ; es:di = 7F00:0
1088
        mov     eax, 0x60007            ; for 0 M
-
 
1089
      pd4k:
1031
        xor     di, di
1090
        stosd
1032
        mov     cx, 64 / 4
1091
        add     eax, 0x1000
1033
        mov     eax, 0x60007            ; for 0 M
1092
        loop    pd4k
1034
        call	pagetable_set
1093
        mov     dword [es:0x800],0x71007   ;map region 0x80000000-0x803FFFFF to 0x800000-0xCFFFFF
1035
        mov     dword [es:0x800],0x71007   ;map region 0x80000000-0x803FFFFF to 0x800000-0xCFFFFF
Line 1094... Line 1036...
1094
        xor     si,si
1036
        xor     si,si
1095
        mov     di,second_base_address shr 20
1037
        mov     di,second_base_address shr 20
Line 1096... Line 1038...
1096
        mov     cx,64/4
1038
        mov     cx,64/2
Line 1097... Line 1039...
1097
        rep     movs dword [es:di], [es:si]
1039
        rep     movs word [es:di], [es:si]
1098
       
1040
       
1099
        mov     eax, 0x7F000 +8+16      ; Page directory and enable caches
1041
        mov     eax, 0x7F000 +8+16      ; Page directory and enable caches
1100
        mov     cr3, eax
-
 
1101
 
1042
        mov     cr3, eax
1102
; SET GRAPHICS
1043
 
1103
 
1044
; SET GRAPHICS
1104
	pop	es
1045
 
1105
        mov     bx,[es:0x9008]		; vga & 320x200
1046
	pop	es
1106
        mov	ax, bx
1047
        mov     ax,[es:0x9008]		; vga & 320x200
1107
	push	ax
1048
        mov	bx, ax
1108
        cmp     ax,0x13
1049
        cmp     ax,0x13
1109
        je      setgr
-
 
1110
        cmp     ax,0x12
1050
        je      setgr
1111
        je      setgr
-
 
1112
        mov     ax,0x4f02            ; Vesa
1051
        cmp     ax,0x12
1113
       setgr:
-
 
1114
        int     0x10
-
 
1115
        test	ah,ah
1052
        je      setgr
1116
        jz      gmok
1053
        mov     ax,0x4f02            ; Vesa
1117
        mov     si,fatalsel-0x10000
1054
       setgr:
Line 1118... Line 1055...
1118
        call    print
1055
        int     0x10
1119
        jmp     $
1056
        test	ah,ah
-
 
1057
        mov	si, fatalsel-0x10000
1120
        
1058
        jnz	sayerr
1121
       gmok:
1059
; set mode 0x12 graphics registers:
1122
; set mode 0x12 graphics registers:
1060
        cmp     bx,0x12
1123
        cmp     bx,0x12
1061
        jne     gmok2
Line 1136... Line 1074...
1136
        mov     al,0x0f
1074
        mov     al,0x0f
1137
        inc	dx
1075
        inc	dx
1138
        out     dx,al      ; set mask for all planes 0-3
1076
        out     dx,al      ; set mask for all planes 0-3
Line 1139... Line 1077...
1139
 
1077
 
1140
        mov     al,0x08
1078
        mov     al,0x08
1141
        mov     dx,0x03ce
1079
        pop	dx
1142
        out     dx,al      ; select GDC bit mask register
1080
        out     dx,al      ; select GDC bit mask register
Line 1143... Line 1081...
1143
                           ; for writes to 0x03cf
1081
                           ; for writes to 0x03cf
1144
 
1082