Fixed printf x86_div64_32 and testing

This commit is contained in:
xamidev
2024-07-07 10:08:25 +02:00
parent fea04d5cfd
commit 2b05b8b74f
6 changed files with 44 additions and 14 deletions

View File

@@ -1,5 +1,5 @@
megs: 32 megs: 32
display_library: sdl2 display_library: x
romimage: file=/usr/share/bochs/BIOS-bochs-legacy romimage: file=/usr/share/bochs/BIOS-bochs-legacy
vgaromimage: file=/usr/share/bochs/VGABIOS-lgpl-latest vgaromimage: file=/usr/share/bochs/VGABIOS-lgpl-latest
ata0-master: type=cdrom, path=os.iso, status=inserted ata0-master: type=cdrom, path=os.iso, status=inserted

34
io.s
View File

@@ -16,19 +16,29 @@ inb:
global x86_div64_32 global x86_div64_32
x86_div64_32: x86_div64_32:
mov eax, [bp+8] push ebp
mov ecx, [bp+12] mov ebp, esp
xor edx, edx
div ecx
mov bx, [bp+16] ; Arguments:
mov [bx+4], eax ; [ebp + 8] - lower 32 bits of dividend (uint32_t)
; [ebp + 12] - upper 32 bits of dividend (uint32_t)
; [ebp + 16] - divisor (uint32_t)
; [ebp + 20] - pointer to quotient (uint64_t*)
; [ebp + 24] - pointer to remainder (uint32_t*)
mov eax, [bp+4] mov eax, [ebp + 8]
div ecx mov edx, [ebp + 12]
mov [bx], eax mov ecx, [ebp + 16]
mov bx, [bp+18]
mov [bx], edx
ret div ecx
mov esi, [ebp + 20]
mov [esi], eax
mov dword [esi + 4], 0
mov esi, [ebp + 24]
mov [esi], edx
pop ebp
ret

Binary file not shown.

Binary file not shown.

22
kmain.c
View File

@@ -3,11 +3,31 @@
int kmain(int retvalue) int kmain(int retvalue)
{ {
// serial testing
init_serial(); init_serial();
log("serial connection established", 3); log("serial connection established", 3);
log("Kernel started", 2); log("Kernel started", 2);
clear(); clear();
printf("Formatted: %% %c %s %d\n", 'f', "Hello", 77);
// printf testing
int age = 34;
int problems = 124;
char* name = "xamidev";
printf("Hello %s, you are %d years old and have %d problems. wow %%\n", name, age, problems);
long suchwow = 2934342;
char character = 65;
printf("such number %u\nsuch character %c", suchwow, character);
printf("wow negative %d\n", -3742);
printf("such hex %x %X\n", 0xcafe, 0xdeadbeef);
printf("such pointer %p\n", (void*)0xcafe1234);
return retvalue; return retvalue;
} }

BIN
os.iso

Binary file not shown.