; Listing generated by Microsoft (R) Optimizing Compiler Version 16.00.30319.01 

	TITLE	C:\Documents and Settings\Administrator\My Documents\Visual Studio 2010\Projects\test\test\main.cpp
	.686P
	.XMM
	include listing.inc
	.model	flat

INCLUDELIB OLDNAMES

PUBLIC	??_C@_0CG@IINAHCGJ@Hello?5World?5from?5GRUB?5and?5PE?5ker@ ; `string'
;	COMDAT ??_C@_0CG@IINAHCGJ@Hello?5World?5from?5GRUB?5and?5PE?5ker@
CONST	SEGMENT
??_C@_0CG@IINAHCGJ@Hello?5World?5from?5GRUB?5and?5PE?5ker@ DB 'Hello Worl'
	DB	'd from GRUB and PE kernel !', 00H		; `string'
CONST	ENDS
PUBLIC	_main
; Function compile flags: /Ogtpy
; File c:\documents and settings\administrator\my documents\visual studio 2010\projects\test\test\main.cpp
;	COMDAT _main
_TEXT	SEGMENT
_magic$ = 8						; size = 4
_addr$ = 12						; size = 4
_main	PROC						; COMDAT

; 42   :    char *string = "Hello World from GRUB and PE kernel !", *ch;
; 43   :     unsigned short *vidmem = (unsigned short *) 0xB8000;
; 44   :     int i;
; 45   :    if (magic == MULTIBOOT_BOOTLOADER_MAGIC){

	cmp	DWORD PTR _magic$[esp-4], 732803074	; 2badb002H
	jne	SHORT $LN10@main

; 46   :       
; 47   :         
; 48   :         for(ch = string, i = 0; *ch; ch++, i++)

	mov	ecx, OFFSET ??_C@_0CG@IINAHCGJ@Hello?5World?5from?5GRUB?5and?5PE?5ker@
	mov	al, 72					; 00000048H
	mov	edx, 753664				; 000b8000H
	push	esi
	npad	9
$LL4@main:

; 49   :                 vidmem[i] = (unsigned char) *ch | 0xA000;

	movzx	eax, al
	mov	esi, 40960				; 0000a000H
	or	ax, si
	inc	ecx
	mov	WORD PTR [edx], ax
	mov	al, BYTE PTR [ecx]
	add	edx, 2
	test	al, al
	jne	SHORT $LL4@main
	pop	esi
$LN10@main:

; 50   :    }else
; 51   :    {
; 52   :       // DO SOMETHING
; 53   :    }
; 54   : }

	xor	eax, eax
	ret	0
_main	ENDP
_TEXT	ENDS
PUBLIC	?multiboot_entry@@YGXXZ				; multiboot_entry
; Function compile flags: /Ogtpy
;	COMDAT ?multiboot_entry@@YGXXZ
_TEXT	SEGMENT
?multiboot_entry@@YGXXZ PROC				; multiboot_entry, COMDAT

; 6    : {

$multiboot_header$2536:

; 7    :    __asm{
; 8    :       align 4
; 9    : 
; 10   :    multiboot_header:
; 11   :                 dd(MULTIBOOT_HEADER_MAGIC)      ; magic number

	DB	2
	DB	-80					; ffffffb0H
	DB	-83					; ffffffadH
	DB	27					; 0000001bH

; 12   :                 dd(MULTIBOOT_HEADER_FLAGS)      ; flags

	DB	3
	DB	0
	DB	1
	DB	0

; 13   :                 dd(CHECKSUM)               ; checksum

	DB	-5					; fffffffbH
	DB	79					; 0000004fH
	DB	81					; 00000051H
	DB	-28					; ffffffe4H

; 14   :                 dd(HEADER_ADRESS)            ; header address

	DB	0
	DB	4
	DB	16					; 00000010H
	DB	0

; 15   :                 dd(LOADBASE)               ; load address

	DB	0
	DB	0
	DB	16					; 00000010H
	DB	0

; 16   :             dd(00)                     ; load end address : not used

	DB	0
	DB	0
	DB	0
	DB	0

; 17   :             dd(00)                     ; bss end addr : not used

	DB	0
	DB	0
	DB	0
	DB	0

; 18   :             dd(HEADER_ADRESS + 0x20)      ; entry_addr : equ kernel entry      

	DB	32					; 00000020H
	DB	4
	DB	16					; 00000010H
	DB	0
$kernel_entry$2537:

; 19   :                                     ; 0x20 is the size of multiboot heeader
; 20   :          
; 21   :    kernel_entry:
; 22   :                 mov     esp,     KERNEL_STACK   ;Setup the stack

	mov	esp, 1064960				; 00104000H

; 23   : 
; 24   :                 push    0                  ;Reset EFLAGS

	push	0

; 25   :                 popf

	popf

; 26   : 
; 27   :                 push    ebx                  ;Push multiboot info adress

	push	ebx

; 28   :                 push    eax                  ;and magic number  

	push	eax

; 29   :                                     ;which are loaded in registers
; 30   :                                     ;eax and ebx before jump to
; 31   :                                     ;entry adress
; 32   :                                     ;[HEADER_ADRESS + 0x20]
; 33   :                 call    main               ;kernel entry

	call	_main
$halt$2538:

; 34   :    halt:
; 35   :             jmp halt                  ; halt processor

	jmp	SHORT $halt$2538
?multiboot_entry@@YGXXZ ENDP				; multiboot_entry
_TEXT	ENDS
END
