From 59105e102d95105a06f7a01eb9a983e53c15b0bb Mon Sep 17 00:00:00 2001 From: VinceAle7082 Date: Fri, 6 Sep 2024 00:40:37 +0200 Subject: [PATCH] Some things (still doesn't compile) --- .gitignore | 2 +- src/bootloader/stage2/stdio.c | 4 ++-- src/bootloader/stage2/x86.asm | 4 ++++ src/bootloader/stage2/x86.h | 3 ++- 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 17a1953..3fbd3a3 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,3 @@ build/ -.mailmap +*.err .vscode \ No newline at end of file diff --git a/src/bootloader/stage2/stdio.c b/src/bootloader/stage2/stdio.c index 6820e04..c9aa479 100644 --- a/src/bootloader/stage2/stdio.c +++ b/src/bootloader/stage2/stdio.c @@ -232,8 +232,8 @@ int *printf_number(int *argp, int length, bool sign, int radix) // convert number to ASCII do { - uint32_t rem; - x86_div64_32(number, radix, &number, &rem); + uint32_t rem = number % radix; + number = number / radix; buffer[pos++] = g_HexChars[rem]; } while (number > 0); diff --git a/src/bootloader/stage2/x86.asm b/src/bootloader/stage2/x86.asm index 14cdc90..706f4fe 100644 --- a/src/bootloader/stage2/x86.asm +++ b/src/bootloader/stage2/x86.asm @@ -21,3 +21,7 @@ _x86_Video_WriteCharTeletype: pop bp ret + +global _x86_div64_32 + +_x86_div64_32: \ No newline at end of file diff --git a/src/bootloader/stage2/x86.h b/src/bootloader/stage2/x86.h index 21cf724..8a057dc 100644 --- a/src/bootloader/stage2/x86.h +++ b/src/bootloader/stage2/x86.h @@ -1,4 +1,5 @@ #pragma once #include "stdint.h" -void _cdecl x86_Video_WriteCharTeletype(char c, uint8_t page); \ No newline at end of file +void _cdecl x86_Video_WriteCharTeletype(char c, uint8_t page); +void _cdecl x86_div64_32(uint64_t dividend, uint32_t divisor, uint64_t *quotientOut, uint64_t *remainderOut); \ No newline at end of file