+++ /dev/null
-\r
-[INSTRSET "i486p"]\r
-BOTPAK equ 0x00280000\r
-DSKCAC equ 0x00100000\r
-DSKCAC0 equ 0x00008000\r
-\r
-; BOOT_INFO_ADDR\r
-CYLS equ 0x0ff0 ; uchar\r
-LEDS equ 0x0ff1 ; uchar\r
-VMODE equ 0x0ff2 ; uchar\r
- ; uchar Padding\r
-SCRNX equ 0x0ff4 ; ushort\r
-SCRNY equ 0x0ff6 ; ushort\r
-VRAM equ 0x0ff8 ; uchar*\r
-VESAVER equ 0x0ffc ; ushort\r
-APMVER equ 0x0ffe ; ushort\r
-ACPI_MEMMAPS equ 0x1000 ; uint\r
-ACPI_MEMMAP equ 0x1004 ; 0x18(24)*16=0x180(384)bytes\r
-APM_FLAGS equ 0x1184 ; ushort\r
-\r
-; INFO_ADDR\r
-ADR_VESA_BIOS_INFO equ 0x0d00 ;0x0d00-0x0dff\r
-ADR_VESA_MODE_INFO equ 0x0e00 ;0x0e00-0x0eff\r
-\r
-XRESOLUTION equ 0x12\r
-YRESOLUTION equ 0x14\r
-BITSPERPIXEL equ 0x19\r
-PHYSBASEPTR equ 0x28\r
-\r
-[BITS 16]\r
-\r
- org 0xc200\r
-asmhead:\r
- mov ax, 0\r
- mov ss, ax\r
- mov sp, 0xc200\r
- mov ds, ax\r
- mov es, ax\r
-\r
- mov ah, 0x00\r
- mov al, 0x03\r
- int 0x10\r
-\r
- lea di, [msg000]\r
- call text_putstr\r
- call text_newline\r
-\r
- call a20_try_loop\r
- call text_newline\r
-\r
- call chk_acpi_memmap\r
-\r
- call chk_apm\r
- call text_newline\r
-\r
- call chk_vesa\r
-\r
- call set_vesa\r
- call chk_keyled\r
-\r
- call pmode\r
-\r
-halt_loop:\r
- hlt\r
- jmp halt_loop\r
-\r
-; \83T\83u\83\8b\81[\83`\83\93\r
-\r
-chk_acpi_memmap:\r
- pushad\r
- mov edi, ACPI_MEMMAP\r
- mov ebx, 0\r
-chk_acpi_memmap_loop:\r
- mov eax, 0xe820\r
- mov ecx, 24\r
- mov edx, 0x534d4150 ; edx="SMAP"\r
- int 0x15\r
- jc chk_acpi_memmap_err\r
- add edi, 24\r
- or ebx, ebx\r
- jnz chk_acpi_memmap_loop\r
- sub edi, ACPI_MEMMAP\r
- mov eax, edi\r
- xor edx, edx\r
- mov ecx, 24\r
- div ecx\r
- mov [ACPI_MEMMAPS], eax\r
- lea di, [msg017]\r
- call text_putstr\r
- call text_newline\r
- jmp chk_acpi_memmap_end\r
-\r
-chk_acpi_memmap_err:\r
- lea di, [msg016]\r
- call text_putstr\r
- call text_newline\r
- mov dword [ACPI_MEMMAPS], 0\r
-\r
-chk_acpi_memmap_end:\r
- popad\r
- ret\r
-\r
-chk_keyled:\r
- mov ah, 0x02\r
- int 0x16\r
- mov [LEDS], al\r
- ret\r
-\r
-A20_TEST_LOOPS equ 32\r
-A20_ENABLE_LOOPS equ 255\r
-A20_TEST_ADDR equ 4*0x80\r
-\r
-\r
-a20_try_loop:\r
-a20_none:\r
- call a20_test\r
- jnz a20_done\r
-a20_bios:\r
- mov ax, 0x2401\r
- pushfd\r
- int 0x15\r
- popfd\r
- call a20_test\r
- jnz a20_done\r
-a20_kbc:\r
- call empty_8042\r
- call a20_test\r
- jnz a20_done\r
- mov al, 0xD1\r
- out 0x64, al\r
- call empty_8042\r
- mov al, 0xDF\r
- out 0x60, al\r
- call empty_8042\r
-a20_kbc_wait:\r
- xor cx, cx\r
-a20_kbc_wait_loop:\r
- call a20_test\r
- jnz a20_done\r
- loop a20_kbc_wait_loop\r
-a20_fast:\r
- in al, 0x92\r
- or al, 0x02\r
-\r
- and al, 0xFE\r
- out 0x92, al\r
-a20_fast_wait:\r
- xor cx, cx\r
-a20_fast_wait_loop:\r
- call a20_test\r
- jnz a20_done\r
- loop a20_fast_wait_loop\r
- dec byte [a20_tries]\r
- jnz a20_try_loop\r
-a20_die:\r
- lea di, [msg014]\r
- call text_putstr\r
- jmp halt_loop\r
-\r
-a20_tries:\r
- db A20_ENABLE_LOOPS\r
-\r
-a20_done:\r
- lea di, [msg015]\r
- call text_putstr\r
- ret\r
-\r
-a20_test:\r
- push cx\r
- push ax\r
- xor cx, cx\r
- mov fs, cx\r
- dec cx\r
- mov gs, cx\r
- mov cx, A20_TEST_LOOPS\r
- mov ax, word [fs:A20_TEST_ADDR]\r
- push ax\r
-a20_test_wait:\r
- inc ax\r
- mov word [fs:A20_TEST_ADDR], ax\r
- call delay\r
- cmp ax, word [gs:A20_TEST_ADDR + 0x10]\r
- loop a20_test_wait\r
-\r
- pop word [fs:A20_TEST_ADDR]\r
- pop ax\r
- pop cx\r
- ret\r
-\r
-empty_8042:\r
- push ecx\r
- mov ecx, 100000\r
-\r
-empty_8042_loop:\r
- dec ecx\r
- jz empty_8042_end_loop\r
-\r
- call delay\r
-\r
- in al, 0x64\r
- test al, 1 \r
- jz no_output\r
-\r
- call delay\r
-; in al, 0x60\r
-\r
- jmp empty_8042_loop\r
-\r
-no_output:\r
- test al, 2\r
- jnz empty_8042_loop\r
-\r
-empty_8042_end_loop:\r
- pop ecx\r
- ret\r
-\r
-delay:\r
- out 0x80, al\r
- ret\r
-\r
-set_vesa: ; cx\82É\83\82\81[\83h\94Ô\8d\86\82ð\95Û\91¶ bx\82É\95¶\8e\9a\90\94\82ð\95Û\91¶\r
- pusha\r
-set_vesa_start:\r
- call text_newline\r
- lea di, [msg007]\r
- call text_putstr\r
- lea di, [msg008]\r
- call text_putstr\r
- lea di, [msg009]\r
- call text_putstr\r
- mov bx, 0x0000\r
- mov cx, 0x0000\r
-set_vesa_key_loop:\r
- mov ah, 0x00\r
- int 0x16\r
- cmp ah, 0x0e\r
- je set_vesa_key_bs\r
- jmp set_vesa_key_chk\r
-set_vesa_key_bs:\r
- cmp bx, 0\r
- je set_vesa_key_loop\r
- mov al, 0x08\r
- mov ah, 0x0e\r
- int 0x10\r
- mov al, ' '\r
- mov ah, 0x0e\r
- int 0x10\r
- mov al, 0x08\r
- mov ah, 0x0e\r
- int 0x10\r
- dec bx\r
- shr cx, 4\r
- jmp set_vesa_key_loop\r
-set_vesa_key_chk:\r
- cmp bx, 4\r
- je set_vesa_key_chk_ent\r
- cmp ah, 0x0b\r
- je set_vesa_key_chk_0\r
- cmp ah, 0x02\r
- je set_vesa_key_chk_1\r
- cmp ah, 0x03\r
- je set_vesa_key_chk_2\r
- cmp ah, 0x04\r
- je set_vesa_key_chk_3\r
- cmp ah, 0x05\r
- je set_vesa_key_chk_4\r
- cmp ah, 0x06\r
- je set_vesa_key_chk_5\r
- cmp ah, 0x07\r
- je set_vesa_key_chk_6\r
- cmp ah, 0x08\r
- je set_vesa_key_chk_7\r
- cmp ah, 0x09\r
- je set_vesa_key_chk_8\r
- cmp ah, 0x0a\r
- je set_vesa_key_chk_9\r
- cmp ah, 0x1e\r
- je set_vesa_key_chk_A\r
- cmp ah, 0x30\r
- je set_vesa_key_chk_B\r
- cmp ah, 0x2e\r
- je set_vesa_key_chk_C\r
- cmp ah, 0x20\r
- je set_vesa_key_chk_D\r
- cmp ah, 0x12\r
- je set_vesa_key_chk_E\r
- cmp ah, 0x21\r
- je set_vesa_key_chk_F\r
- jmp set_vesa_key_loop\r
-set_vesa_key_chk_0:\r
- mov al, '0'\r
- mov ah, 0x0e\r
- int 0x10\r
- inc bx\r
- shl cx, 4\r
- add cx, 0x00\r
- jmp set_vesa_key_loop\r
-set_vesa_key_chk_1:\r
- mov al, '1'\r
- mov ah, 0x0e\r
- int 0x10\r
- inc bx\r
- shl cx, 4\r
- add cx, 0x01\r
- jmp set_vesa_key_loop\r
-set_vesa_key_chk_2:\r
- mov al, '2'\r
- mov ah, 0x0e\r
- int 0x10\r
- inc bx\r
- shl cx, 4\r
- add cx, 0x02\r
- jmp set_vesa_key_loop\r
-set_vesa_key_chk_3:\r
- mov al, '3'\r
- mov ah, 0x0e\r
- int 0x10\r
- inc bx\r
- shl cx, 4\r
- add cx, 0x03\r
- jmp set_vesa_key_loop\r
-set_vesa_key_chk_4:\r
- mov al, '4'\r
- mov ah, 0x0e\r
- int 0x10\r
- inc bx\r
- shl cx, 4\r
- add cx, 0x04\r
- jmp set_vesa_key_loop\r
-set_vesa_key_chk_5:\r
- mov al, '5'\r
- mov ah, 0x0e\r
- int 0x10\r
- inc bx\r
- shl cx, 4\r
- add cx, 0x05\r
- jmp set_vesa_key_loop\r
-set_vesa_key_chk_6:\r
- mov al, '6'\r
- mov ah, 0x0e\r
- int 0x10\r
- inc bx\r
- shl cx, 4\r
- add cx, 0x06\r
- jmp set_vesa_key_loop\r
-set_vesa_key_chk_7:\r
- mov al, '7'\r
- mov ah, 0x0e\r
- int 0x10\r
- inc bx\r
- shl cx, 4\r
- add cx, 0x07\r
- jmp set_vesa_key_loop\r
-set_vesa_key_chk_8:\r
- mov al, '8'\r
- mov ah, 0x0e\r
- int 0x10\r
- inc bx\r
- shl cx, 4\r
- add cx, 0x08\r
- jmp set_vesa_key_loop\r
-set_vesa_key_chk_9:\r
- mov al, '9'\r
- mov ah, 0x0e\r
- int 0x10\r
- inc bx\r
- shl cx, 4\r
- add cx, 0x09\r
- jmp set_vesa_key_loop\r
-set_vesa_key_chk_A:\r
- mov al, 'A'\r
- mov ah, 0x0e\r
- int 0x10\r
- inc bx\r
- shl cx, 4\r
- add cx, 0x0a\r
- jmp set_vesa_key_loop\r
-set_vesa_key_chk_B:\r
- mov al, 'B'\r
- mov ah, 0x0e\r
- int 0x10\r
- inc bx\r
- shl cx, 4\r
- add cx, 0x0b\r
- jmp set_vesa_key_loop\r
-set_vesa_key_chk_C:\r
- mov al, 'C'\r
- mov ah, 0x0e\r
- int 0x10\r
- inc bx\r
- shl cx, 4\r
- add cx, 0x0c\r
- jmp set_vesa_key_loop\r
-set_vesa_key_chk_D:\r
- mov al, 'D'\r
- mov ah, 0x0e\r
- int 0x10\r
- inc bx\r
- shl cx, 4\r
- add cx, 0x0d\r
- jmp set_vesa_key_loop\r
-set_vesa_key_chk_E:\r
- mov al, 'E'\r
- mov ah, 0x0e\r
- int 0x10\r
- inc bx\r
- shl cx, 4\r
- add cx, 0x0e\r
- jmp set_vesa_key_loop\r
-set_vesa_key_chk_F:\r
- mov al, 'F'\r
- mov ah, 0x0e\r
- int 0x10\r
- inc bx\r
- shl cx, 4\r
- add cx, 0x0f\r
- jmp set_vesa_key_loop\r
-set_vesa_key_chk_ent:\r
- cmp ah, 0x1c\r
- jne set_vesa_key_loop\r
- call text_newline\r
- jmp set_vesa_key_end\r
-set_vesa_key_end:\r
- lea di, [msg010]\r
- call text_putstr\r
- mov ax, cx\r
- call text_puthex_str_16\r
- call text_newline\r
-\r
- cmp cx, 0x0000\r
- je set_VGA\r
-\r
- mov ax, 0x4f01\r
- mov di, ADR_VESA_MODE_INFO\r
- int 0x10\r
- cmp al, 0x4f\r
- jne set_vesa_nosup\r
- cmp ah, 0\r
- jne set_vesa_func_err\r
-\r
- lea di, [msg012]\r
- call text_putstr\r
-\r
- mov ax, 0x0000\r
- mov al, [ADR_VESA_MODE_INFO + BITSPERPIXEL]\r
- call hex2bcd_16\r
- call text_puthex_str_08_no_0x\r
-\r
- mov al, '('\r
- mov ah, 0x0e\r
- int 0x10\r
- mov ax, [ADR_VESA_MODE_INFO + XRESOLUTION]\r
- call hex2bcd_16\r
- call text_puthex_str_16_no_0x\r
- mov al, 'x'\r
- mov ah, 0x0e\r
- int 0x10\r
- mov ax, [ADR_VESA_MODE_INFO + YRESOLUTION]\r
- call hex2bcd_16\r
- call text_puthex_str_16_no_0x\r
- mov al, ')'\r
- mov ah, 0x0e\r
- int 0x10\r
- call text_newline\r
-\r
- lea di, [msg013]\r
- call text_putstr\r
-set_vesa_key_YN:\r
- mov ah, 0x00\r
- int 0x16\r
- cmp ah, 0x15\r
- je set_vesa_key_Y\r
- cmp ah, 0x31\r
- je set_vesa_key_N\r
-\r
-set_vesa_key_N:\r
- mov al, 'N'\r
- mov ah, 0x0e\r
- int 0x10\r
- call text_newline\r
- jmp set_vesa_start\r
-set_vesa_key_Y:\r
- mov al, 'Y'\r
- mov ah, 0x0e\r
- int 0x10\r
- call text_newline\r
-\r
- mov ax, 0x4f02\r
- mov bx, cx\r
- or bx, 0x4000\r
- int 0x10\r
- cmp al, 0x4f\r
- jne set_vesa_nosup\r
- cmp ah, 0\r
- jne set_vesa_func_err\r
-\r
- mov ax, [ADR_VESA_MODE_INFO + XRESOLUTION]\r
- mov [SCRNX], ax\r
- mov ax, [ADR_VESA_MODE_INFO + YRESOLUTION]\r
- mov [SCRNY], ax\r
- mov al, [ADR_VESA_MODE_INFO + BITSPERPIXEL]\r
- mov [VMODE], al\r
- mov eax, [ADR_VESA_MODE_INFO + PHYSBASEPTR]\r
- mov [VRAM], eax\r
-\r
- jmp set_vesa_end\r
-set_vesa_nosup:\r
- lea di, [msg001]\r
- call text_putstr\r
- lea di, [msg003]\r
- call text_putstr\r
- jmp set_vesa_start\r
-set_vesa_func_err:\r
- lea di, [msg001]\r
- call text_putstr\r
- lea di, [msg011]\r
- call text_putstr\r
- jmp set_vesa_start\r
-set_VGA:\r
- mov ah, 0x00\r
- mov al, 0x13\r
- int 0x10\r
- mov byte [VMODE], 8\r
- mov word [SCRNX], 320\r
- mov word [SCRNY], 200\r
- mov dword [VRAM], 0xa0000\r
- mov word [ADR_VESA_MODE_INFO + XRESOLUTION], 320\r
- mov word [ADR_VESA_MODE_INFO + YRESOLUTION], 200\r
- mov byte [ADR_VESA_MODE_INFO + BITSPERPIXEL], 8\r
- mov dword [ADR_VESA_MODE_INFO + PHYSBASEPTR], 0xa0000\r
-set_vesa_end:\r
- popa\r
- ret\r
-\r
-chk_apm:\r
- pusha\r
- lea di, [msg006]\r
- call text_putstr\r
- lea di, [msg002]\r
- call text_putstr\r
-\r
- mov ax, 0x5300\r
- mov bx, 0x0000\r
- pusha\r
- int 0x15\r
- jc chk_apm_err_nosup\r
- mov [APMVER], ax\r
- mov [APM_FLAGS], cx\r
- popa\r
-\r
- lea di, [msg004]\r
- call text_putstr\r
- mov ax, [APMVER]\r
- shr ax, 8\r
- call text_puthex_char\r
- mov al, '.'\r
- mov ah, 0x0e\r
- int 0x10\r
- mov ax, [APMVER]\r
- shr ax, 4\r
- call text_puthex_char\r
- mov ax, [APMVER]\r
- call text_puthex_char\r
- jmp chk_apm_end\r
-\r
-chk_apm_err_nosup:\r
- mov word [APMVER], 0x0000\r
- mov word [APM_FLAGS], 0x0000\r
- lea di, [msg006]\r
- call text_putstr\r
- lea di, [msg003]\r
- call text_putstr\r
-chk_apm_end:\r
- popa\r
- ret\r
-\r
-chk_vesa:\r
- pusha\r
- lea di, [msg001]\r
- call text_putstr\r
- lea di, [msg002]\r
- call text_putstr\r
-\r
- mov ax, 0x4f00\r
- mov di, ADR_VESA_BIOS_INFO\r
- int 0x10\r
- cmp al, 0x4f\r
- jne chk_vesa_err_nosup\r
- lea di, [msg004]\r
- call text_putstr\r
- mov ax, [ADR_VESA_BIOS_INFO + 0x04]\r
- mov [VESAVER], ax\r
- shr ax, 8\r
- call text_puthex_char\r
- mov al, '.'\r
- mov ah, 0x0e\r
- int 0x10\r
- mov ax, [ADR_VESA_BIOS_INFO + 0x04]\r
- shr ax, 4\r
- call text_puthex_char\r
- mov ax, [ADR_VESA_BIOS_INFO + 0x04]\r
- call text_puthex_char\r
-\r
- call text_newline\r
-\r
- mov ax, [ADR_VESA_BIOS_INFO + 0x06 + 0x02]\r
- mov di, [ADR_VESA_BIOS_INFO + 0x06]\r
- mov bx, es\r
- mov es, ax\r
- call text_putstr\r
- mov es, bx\r
-\r
- call text_newline\r
-\r
- lea di, [msg005]\r
- call text_putstr\r
-\r
- mov ax, [ADR_VESA_BIOS_INFO + 0x0e + 0x02]\r
- mov di, [ADR_VESA_BIOS_INFO + 0x0e]\r
- mov bx, es\r
- mov es, ax\r
-chk_vesa_vmode_array_loop:\r
- mov ax, [es:di]\r
- cmp ax, 0xffff\r
- je chk_vesa_vmode_array_end\r
- mov cx, ax\r
-\r
- mov al, '['\r
- mov ah, 0x0e\r
- int 0x10\r
-\r
- mov ax, cx\r
- call text_puthex_str_16\r
-\r
- mov al, ']'\r
- mov ah, 0x0e\r
- int 0x10\r
-\r
- add di, 2\r
- jmp chk_vesa_vmode_array_loop\r
-chk_vesa_vmode_array_end:\r
- mov es, bx\r
- jmp chk_vesa_end\r
-chk_vesa_err_nosup:\r
- mov word [VESAVER], 0x0000\r
- lea di, [msg001]\r
- call text_putstr\r
- lea di, [msg003]\r
- call text_putstr\r
- jmp chk_vesa_end\r
-chk_vesa_end:\r
- call text_newline\r
- popa\r
- ret\r
-\r
-hex2bcd_16: ;ax\82ðBCD\82É\95Ï\8a·\81B\8dÅ\91å9999\82Ü\82Å\81Bcx\82É\90Vax\82ð\95Û\91¶\r
- push cx\r
- push bx\r
- push dx\r
- and eax, 0x0000ffff\r
- mov cx, 0x000000\r
-\r
- mov dx, 0x0000\r
- mov bx, 1000\r
- div bx\r
- shl ax, 12\r
- or cx, ax\r
-\r
- mov ax, dx\r
- mov dx, 0x0000\r
- mov bx, 100\r
- div bx\r
- shl ax, 8\r
- or cx, ax\r
-\r
- mov ax, dx\r
- mov dx, 0x0000\r
- mov bx, 10\r
- div bx\r
- shl ax, 4\r
- or cx, ax\r
-\r
- or cx, dx\r
-\r
- mov ax, cx\r
-\r
- pop dx\r
- pop bx\r
- pop cx\r
- ret\r
-\r
-text_puthex_str_16: ; ax\82ð\8fo\97Í\81B0x\82Ì\95t\89Á\82 \82è\81B\r
- push ax\r
- push cx\r
- mov cx, ax\r
- mov ah, 0x0e\r
- mov al, '0'\r
- int 0x10\r
- mov al, 'x'\r
- int 0x10\r
- mov ax, cx\r
- shr ax, 12\r
- call text_puthex_char\r
- mov ax, cx\r
- shr ax, 8\r
- call text_puthex_char\r
- mov ax, cx\r
- shr ax, 4\r
- call text_puthex_char\r
- mov ax, cx\r
- call text_puthex_char\r
- pop cx\r
- pop ax\r
- ret\r
-\r
-text_puthex_str_16_no_0x: ; ax\82ð\8fo\97Í\81B0x\82Ì\95t\89Á\82È\82µ\81BBCD\95\\8e¦\97p\r
- push ax\r
- push cx\r
- mov cx, ax\r
- shr ax, 12\r
- call text_puthex_char\r
- mov ax, cx\r
- shr ax, 8\r
- call text_puthex_char\r
- mov ax, cx\r
- shr ax, 4\r
- call text_puthex_char\r
- mov ax, cx\r
- call text_puthex_char\r
- pop cx\r
- pop ax\r
- ret\r
-\r
-text_puthex_str_08_no_0x: ; al\82ð\8fo\97Í\81B0x\82Ì\95t\89Á\82È\82µ\81BBCD\95\\8e¦\97p\r
- push ax\r
- push cx\r
- mov cx, ax\r
- shr al, 4\r
- call text_puthex_char\r
- mov ax, cx\r
- call text_puthex_char\r
- pop cx\r
- pop ax\r
- ret\r
-\r
-text_puthex_char: ; al\82Ì\89º\88Ê4bit\95ª\8fo\97Í\81B0x\82Ì\95t\89Á\82Í\82È\82µ\81B\r
- pusha\r
- and al, 0x0f\r
- cmp al, 9\r
- ja text_puthex_char_alphabet\r
- add al, 0x30\r
- jmp text_puthex_char_end\r
-text_puthex_char_alphabet:\r
- add al, 0x37\r
-text_puthex_char_end:\r
- mov ah, 0x0e\r
- int 0x10\r
- popa\r
- ret\r
-\r
-text_putstr: ; di=char*\r
- pusha\r
- mov cx, 0\r
- mov ah, 0x0e\r
-text_putstr_loop:\r
- mov al, [es:di]\r
- cmp al, 0\r
- je text_putstr_end\r
- inc di\r
- int 0x10\r
- jmp text_putstr_loop\r
-text_putstr_end:\r
- popa\r
- ret\r
-\r
-text_newline:\r
- pusha\r
- mov ah, 0x0e\r
- mov al, 0x0d\r
- int 0x10\r
- mov al, 0x0a\r
- int 0x10\r
- popa\r
- ret\r
-\r
-; \88È\89º\81A\83v\83\8d\83e\83N\83g\83\82\81[\83h\88Ú\8ds\81Abootpack\8eÀ\8ds\8aÖ\90\94\8cQ\r
-\r
-pmode:\r
- mov al, 0xff\r
- out 0x21, al ; pic0-imr = 11111111\r
- nop\r
- out 0xa1, al ; pic1-imr = 11111111\r
- cli\r
-\r
- lgdt [GDTR0]\r
-\r
- mov eax, cr0\r
- and eax, 0x7fffffff ; PG = 0\r
- or eax, 0x00000001 ; PE = 1\r
- mov cr0, eax\r
-\r
- jmp pipelineflush\r
-pipelineflush:\r
-\r
- mov ax, 1 * 8\r
- mov ds, ax\r
- mov es, ax\r
- mov fs, ax\r
- mov gs, ax\r
- mov ss, ax\r
-\r
- mov esi, bootpack\r
- mov edi, BOTPAK\r
- mov ecx, 512 * 1024 / 4\r
- call memcpy\r
-\r
- mov esi, 0x7c00\r
- mov edi, DSKCAC\r
- mov ecx, 512 / 4\r
- call memcpy\r
-\r
- mov esi, DSKCAC0 + 512\r
- mov edi, DSKCAC + 512\r
- mov ecx, 0\r
- mov cl, byte[CYLS]\r
- imul ecx, 512 * 18 * 2 / 4\r
- sub ecx, 512 / 4\r
- call memcpy\r
-\r
- mov ebx, BOTPAK\r
- mov ecx, [ebx + 16]\r
- add ecx, 3\r
- shr ecx, 2\r
- jz skip\r
- mov esi, [ebx + 20]\r
- add esi, ebx\r
- mov edi, [ebx + 12]\r
- call memcpy\r
-\r
-skip:\r
- mov esp, [ebx + 12]\r
- jmp dword 2 * 8:0x0000001b\r
-\r
-memcpy:\r
- mov eax,[esi]\r
- add esi,4\r
- mov [edi],eax\r
- add edi,4\r
- sub ecx,1\r
- jnz memcpy\r
- ret\r
-\r
-; \83f\81[\83^\r
-\r
-msg000: db "CHNOSProject Boot Menu...", 0x0d, 0x0a, 0x00\r
-msg001: db "VESA BIOS Extention ", 0x00\r
-msg002: db "Checking...", 0x0d, 0x0a, 0x00\r
-msg003: db "is not supported by this computer.", 0x0d, 0x0a, 0x00\r
-msg004: db "Version:", 0x00\r
-msg005: db "Video Mode Numbers...", 0x0d, 0x0a, 0x00\r
-msg006: db "Advanced Power Management BIOS ", 0x00\r
-msg007: db "Please select the Video Mode Number.", 0x0d, 0x0a, 0x00\r
-msg008: db "VGA mode is 0x0000.", 0x0d, 0x0a, 0x00\r
-msg009: db ">0x", 0x00\r
-msg010: db "ModeInfo:", 0x00\r
-msg011: db "Function Error...", 0x0d, 0x0a, 0x00\r
-msg012: db "bpp:", 0x00\r
-msg013: db "Do you want to start in this screen mode?[Y/N]", 0x0d, 0x0a, ">", 0x00\r
-msg014: db "A20GateLine Failed.", 0x0d, 0x0a, 0x00\r
-msg015: db "A20GateLine Passed.", 0x0d, 0x0a, 0x00\r
-msg016: db "ACPI 0xe820 Failed.", 0x0d, 0x0a, 0x00\r
-msg017: db "ACPI 0xe820 Passed.", 0x0d, 0x0a, 0x00\r
-\r
-GDTR0:\r
- dw 8 * 3 - 1 ; GDT\83\8a\83~\83b\83g = 8 * \83Z\83\8c\83N\83^\90\94 - 1\r
- dd GDT0 ; GDT\8aJ\8en\83A\83h\83\8c\83X\r
-\r
- alignb 16\r
-\r
-GDT0: ; \89¼GDT\r
- resb 8 ; \83k\83\8b\81E\83Z\83\8c\83N\83^\81[\r
- dw 0xffff, 0x0000, 0x9200, 0x00cf ; \93Ç\82Ý\8f\91\82«\89Â\94\32\83r\83b\83g\r
- dw 0xffff, 0x0000, 0x9a28, 0x0047 ; \8eÀ\8ds\89Â\94\32\83r\83b\83g\r
- dw 0\r
-\r
- alignb 16\r
-\r
-bootpack:\r