Skip to content
Snippets Groups Projects
Commit 623ab2ed authored by k26-chow's avatar k26-chow
Browse files

edited2

parent 7f793171
Branches
No related tags found
No related merge requests found
global loader ;
MAGIC_NUMBER equ 0x1BADB002 ;
FLAGS equ 0x0 ;
CHECKSUM equ -MAGIC_NUMBER ;
extern main ;
; (magic number + checksum + flags should equal 0)
section .text ;
align 4 ;
; Multiboot header
dd MAGIC_NUMBER ;
dd FLAGS ;
dd CHECKSUM ;
loader: ;
mov eax, 0xCAFEBABE ;
.loop:
jmp .loop ;
; Second part of the code
global _start ;
extern sum_of_three ;
_start:
;
push dword 3 ;
push dword 2 ;
push dword 1 ;
call sum_of_three ;
hlt ;
File added
/* The C function */
int sum_of_three(int arg1, int arg2, int arg3)
{
return arg1 + arg2 + arg3;
}
int multiply_two(int arg1, int arg2)
{
return arg1 * arg2;
}
void main() {
int result1 = sum_of_three(1,2,3);
int result2 = multiply_two(10,20);
while (1)
{}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment