📄 nucloada.lst
字号:
487 00000203 89C1 mov ecx,eax
488 00000205 89C2 mov edx,eax
489 00000207 89C6 mov esi,eax
490 00000209 89C7 mov edi,eax
491 0000020B 89C5 mov ebp,eax
492
493 ; safemsg_pm "Cleaning flags"
494
495 ; Clean eflags
496 0000020D 6A02 push dword 0x00000002
497 0000020F 9D popfd
498
499 ; safemsg_pm "Jumping to kernel"
500
501 ; The entry point is stored in the header
502 00000210 FF251C001000 jmp [0x0010001c]
503
504 [BITS 16]
505
506 ; ============================================================================
507 ; A20 Control
508 ; ============================================================================
509
510 ; ------------------
511 ; Wrapper jumps off vector
512 _enable_A20:
513 00000216 FA cli
514 00000217 6667833D[00000000]- cmp dword [dword _ena_A20_vec],0
515 0000021F 00
516 00000220 7508 jnz .detect_done
517 00000222 66E822010000 call dword _detect_A20_type
518 00000228 720E jc .failed
519
520 .detect_done:
521 0000022A 6667FF15[00000000] call dword [dword _ena_A20_vec]
522
523 00000232 66E864FFFFFF call dword _shortdelay
524
525 .failed:
526 00000238 66C3 o32 ret
527
528 ; ------------------
529 ; Wrapper jumps off vector
530 _disable_A20:
531 0000023A 6667833D[04000000]- cmp dword [dword _dis_A20_vec],0
532 00000242 00
533 00000243 7508 jnz .detect_done
534 00000245 66E8FF000000 call dword _detect_A20_type
535 0000024B 720E jc .failed
536
537 .detect_done:
538 0000024D 6667FF15[04000000] call dword [dword _dis_A20_vec]
539
540 00000255 66E841FFFFFF call dword _shortdelay
541
542 .failed:
543 0000025B FB sti
544 0000025C 66C3 o32 ret
545
546 ; Null function
547 _a20_func_null:
548 0000025E 66C3 o32 ret
549
550 ; ------------------
551 ; Helpers to synchronize with keyboard controller
552 a20wait_tosend:
553 00000260 50 push ax
554 .L0:
555 00000261 E464 in al,0x64
556 00000263 A802 test al,2
557 00000265 75FA jnz .L0
558 00000267 58 pop ax
559 00000268 66C3 o32 ret
560
561 a20wait_torecv:
562 0000026A 50 push ax
563 .L0:
564 0000026B E464 in al,0x64
565 0000026D A801 test al,1
566 0000026F 74FA jz .L0
567 00000271 58 pop ax
568 00000272 66C3 o32 ret
569
570 ; ----------------
571 ; Use BIOS
572 _a20_func_ena_bios:
573 00000274 6660 pushad
574 00000276 B80124 mov ax,0x2401
575 00000279 CD15 int 0x15
576 0000027B 6661 popad
577 0000027D 66C3 o32 ret
578
579 _a20_func_dis_bios:
580 0000027F 6660 pushad
581 00000281 B80024 mov ax,0x2400
582 00000284 CD15 int 0x15
583 00000286 6661 popad
584 00000288 66C3 o32 ret
585
586 ; ----------------
587 ; Use keyboard controller
588 _a20_func_ena_kbc:
589 0000028A 6650 push eax
590 0000028C 6652 push edx
591 0000028E 66E8CCFFFFFF call dword a20wait_tosend
592 00000294 B0D1 mov al,0xD1
593 00000296 E664 out 0x64,al
594 00000298 66E8C2FFFFFF call dword a20wait_tosend
595 0000029E B0DF mov al,0xDF
596 000002A0 E660 out 0x60,al
597 000002A2 66E8B8FFFFFF call dword a20wait_tosend
598 000002A8 665A pop edx
599 000002AA 6658 pop eax
600 000002AC 66C3 o32 ret
601
602 _a20_func_dis_kbc:
603 000002AE 50 push ax
604 000002AF 52 push dx
605 000002B0 66E8AAFFFFFF call dword a20wait_tosend
606 000002B6 B0D1 mov al,0xD1
607 000002B8 E664 out 0x64,al
608 000002BA 66E8A0FFFFFF call dword a20wait_tosend
609 000002C0 B0DD mov al,0xDD
610 000002C2 E660 out 0x60,al
611 000002C4 66E896FFFFFF call dword a20wait_tosend
612 000002CA 5A pop dx
613 000002CB 58 pop ax
614 000002CC 66C3 o32 ret
615
616 ; ----------------
617 ; Use port 0xEE
618 _a20_func_ena_port_ee:
619 000002CE 50 push ax
620 000002CF E4EE in al,0xEE
621 000002D1 58 pop ax
622 000002D2 66C3 o32 ret
623
624 _a20_func_dis_port_ee:
625 000002D4 50 push ax
626 000002D5 B000 mov al,0
627 000002D7 E6EE out 0xEE,al
628 000002D9 58 pop ax
629 000002DA 66C3 o32 ret
630
631 ; ----------------
632 ; Use port 0x92
633 _a20_func_ena_port_92:
634 000002DC 50 push ax
635 000002DD E492 in al,0x92
636 000002DF 24FE and al,~1
637 000002E1 0C02 or al,2
638 000002E3 E692 out 0x92,al
639 000002E5 58 pop ax
640 000002E6 66C3 o32 ret
641
642 _a20_func_dis_port_92:
643 000002E8 50 push ax
644 000002E9 E492 in al,0x92
645 000002EB 24FC and al,~(1 | 2)
646 000002ED E692 out 0x92,al
647 000002EF 58 pop ax
648 000002F0 66C3 o32 ret
649
650 ; ----------------
651 ; Use keyboard controller AND port 0x92
652 _a20_func_ena_port_92_kbc:
653 000002F2 66E892FFFFFF call dword _a20_func_ena_kbc
654 000002F8 66E8DEFFFFFF call dword _a20_func_ena_port_92
655 000002FE 66C3 o32 ret
656
657 _a20_func_dis_port_92_kbc:
658 00000300 66E8A8FFFFFF call dword _a20_func_dis_kbc
659 00000306 66E8DCFFFFFF call dword _a20_func_dis_port_92
660 0000030C 66C3 o32 ret
661
662 ; ----------------
663 ; Use keyboard controller special command
664 _a20_func_ena_kbc_cmd:
665 0000030E 50 push ax
666 0000030F 66E84BFFFFFF call dword a20wait_tosend
667 00000315 B0DF mov al,0xDF
668 00000317 E664 out 0x64,al
669 ; Twice!
670 00000319 66E841FFFFFF call dword a20wait_tosend
671 0000031F B0DF mov al,0xDF
672 00000321 E664 out 0x64,al
673 00000323 66E837FFFFFF call dword a20wait_tosend
674 00000329 58 pop ax
675 0000032A 66C3 o32 ret
676
677 _a20_func_dis_kbc_cmd:
678 0000032C 50 push ax
679 0000032D 66E82DFFFFFF call dword a20wait_tosend
680 00000333 B0DD mov al,0xDD
681 00000335 E664 out 0x64,al
682 ; Twice!
683 00000337 66E823FFFFFF call dword a20wait_tosend
684 0000033D B0DD mov al,0xDD
685 0000033F E664 out 0x64,al
686 00000341 66E819FFFFFF call dword a20wait_tosend
687 00000347 58 pop ax
688 00000348 66C3 o32 ret
689
690 ; ----------------
691 ; Detect the type of A20 control this chipset uses
692 [GLOBAL _detect_A20_type]
693 _detect_A20_type:
694 0000034A 669C pushfd
695 0000034C FA cli
696 0000034D 6660 pushad
697
698 safemsg "Probing for A20 control method"
699 <1> %if 1
700 0000034F EB21 <1> jmp %%overtext
701 00000351 0A50726F62696E6720- <1> %%msg: db 10,%1,10,0
702 0000035A 666F72204132302063- <1>
703 00000363 6F6E74726F6C206D65- <1>
704 0000036C 74686F640A00 <1>
705 <1> %%overtext:
706 00000372 6660 <1> pushad
707 00000374 6606 <1> o32 push es
708 00000376 B800B8 <1> mov ax,0xb800
709 00000379 8EC0 <1> mov es,ax
710 0000037B 66BE[51030000] <1> mov esi,%%msg
711 00000381 31FF <1> xor di,di
712 <1> %%another:
713 00000383 AC <1> lodsb
714 00000384 3C00 <1> cmp al,0
715 00000386 7406 <1> jz %%done
716 00000388 AA <1> stosb
717 00000389 B007 <1> mov al,7
718 0000038B AA <1> stosb
719 0000038C EBF5 <1> jmp %%another
720 <1> %%done:
721 <1>
722 0000038E B80008 <1> mov ax,0x0800
723 <1> %%another2:
724 00000391 AB <1> stosw
725 00000392 81FFA000 <1> cmp di,80*2
726 00000396 72F9 <1> jb %%another2
727 <1>
728 <1> %if USE_MSG_DELAY
729 <1> mov ecx,200000000
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -