Import backup from 2003-08-24
This commit is contained in:
parent
8efede851c
commit
449917d434
@ -16,7 +16,8 @@
|
||||
%define BOOT_VESA_OEM 0x0004 ;258 - null-terminated OEM identification string
|
||||
%define BOOT_VESA_VBE 0x0106 ;512 - copy of VESA VBEInfoBlock
|
||||
%define BOOT_VESA_INFO 0x0306 ;256 - copy of VESA ModeInfoBlock for selected mode
|
||||
%define BOOT_MEGS 0x040A ;4 - dword - # of megabytes of RAM detected
|
||||
%define BOOT_MEMENTRIES 0x040A ;4 - dword = number of memmap entries
|
||||
%define BOOT_MEMMAP 0x040E ;? - memory map information
|
||||
|
||||
|
||||
|
||||
|
91
stage2.asm
91
stage2.asm
@ -196,34 +196,70 @@ copydisk_loop:
|
||||
|
||||
;------------------------------------------------------
|
||||
no_rd:
|
||||
mov ax, BOOT_DATA_SEG
|
||||
mov es, ax
|
||||
mov di, BOOT_MEMMAP ;store memmap info in es:di for kernel
|
||||
xor edx, edx
|
||||
mov ax, 0x0100
|
||||
mov ds, ax
|
||||
xor ebx, ebx
|
||||
getmemmap_loop:
|
||||
push es
|
||||
push di
|
||||
push edx
|
||||
mov ax, 0x0100 ;get memory map
|
||||
mov es, ax
|
||||
xor di, di
|
||||
mov eax, 0x0000E820
|
||||
mov ecx, 0x00000014
|
||||
;mov ebx, 0x00000000
|
||||
mov edx, 0x534D4150 ;'SMAP'
|
||||
int 0x15
|
||||
jc getmemmap_done
|
||||
cmp eax, 0x534D4150 ;eax should be 'SMAP' on return...
|
||||
jnz getmemmap_error
|
||||
cmp ebx, 0
|
||||
jz getmemmap_done
|
||||
|
||||
pop edx ;now, copy memmap entry to es:di on the stack
|
||||
pop di
|
||||
pop es
|
||||
xor si, si
|
||||
mov cx, 20
|
||||
getmemmap_copymem_loop:
|
||||
lodsb
|
||||
stosb
|
||||
loop getmemmap_copymem_loop
|
||||
inc edx
|
||||
jmp getmemmap_loop
|
||||
|
||||
getmemmap_error:
|
||||
mov ax, 0xb800
|
||||
mov es, ax
|
||||
mov di, 160*24
|
||||
xor ax, ax
|
||||
mov ds, ax
|
||||
mov edx, 4 ;we'll assume the system has 4 megabytes of RAM...
|
||||
mov esi, 0x3FFFFC ;4 bytes under 4 MB
|
||||
ram_loop:
|
||||
mov ebx, [ds:esi]
|
||||
mov dword [ds:esi], "KRIS"
|
||||
mov eax, [ds:esi]
|
||||
mov [ds:esi], ebx
|
||||
cmp eax, "KRIS"
|
||||
jnz got_mem
|
||||
inc edx
|
||||
add esi, 0x100000
|
||||
jmp ram_loop
|
||||
got_mem:
|
||||
mov ax, BOOT_DATA_SEG
|
||||
mov ds, ax
|
||||
mov [ds:BOOT_MEGS], edx
|
||||
mov si, txt_memerror
|
||||
mov ah, 0x04
|
||||
call puts
|
||||
hlt
|
||||
jmp $
|
||||
|
||||
; mov ax, 0xb800
|
||||
; mov es, ax
|
||||
; xor di, di
|
||||
; mov al, dh
|
||||
; call puthex2
|
||||
; mov al, dl
|
||||
; call puthex2
|
||||
; xor ax, ax
|
||||
; int 0x16
|
||||
getmemmap_done:
|
||||
pop edx
|
||||
pop di
|
||||
pop es
|
||||
|
||||
xor si, si
|
||||
mov cx, 20
|
||||
getmemmap_done_copymem_loop:
|
||||
lodsb
|
||||
stosb
|
||||
loop getmemmap_done_copymem_loop
|
||||
inc edx
|
||||
|
||||
mov di, BOOT_MEMENTRIES
|
||||
mov [es:di], edx ;save # of memmap entries for kernel
|
||||
|
||||
;on to vesa info...
|
||||
xor ax, ax
|
||||
@ -246,7 +282,7 @@ cls_vesa_loop:
|
||||
mov ax, 0x0100
|
||||
mov es, ax
|
||||
xor di, di
|
||||
mov dword [es:si], "2EBV"
|
||||
mov dword [es:di], "2EBV"
|
||||
mov ax, 0x4F00
|
||||
|
||||
int 0x10
|
||||
@ -807,6 +843,7 @@ txt_vesaerror: db "VESA function call error! Halting system!", 0
|
||||
txt_novesa: db "VESA not found. Starting in console mode...", 0
|
||||
txt_vesaold: db "VESA version 2.0 required. Starting in console mode...", 0
|
||||
txt_consolemode: db "a. Console mode only.", 0
|
||||
txt_memerror: db "Extended Memory Map information unavailable! Halting system...", 0
|
||||
|
||||
;------------------------------------------------------
|
||||
getCHSfromCluster:
|
||||
@ -876,6 +913,6 @@ pmode:
|
||||
mov gs, ax
|
||||
jmp KERNEL_CODE:BOOT_KERNEL_ADD
|
||||
|
||||
kernel: db "KERNEL BIN"
|
||||
kernel: db "KERNEL BIN", 0
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user