aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid <dbphillipsnz@gmail.com>2013-08-14 15:56:17 +1200
committerDavid <dbphillipsnz@gmail.com>2014-03-27 20:32:47 +1300
commit9d9de30b314f763069ed18fe8da8b6187d6faf38 (patch)
tree8f5c182d423da7256e491e6d332f8e162ec83fe6
parente8b4c2e0631426ac7ee596884d35432d02afdb57 (diff)
downloadtoast-9d9de30b314f763069ed18fe8da8b6187d6faf38.tar.xz
Bugfixes
-rw-r--r--README.md2
l---------boot.s1
-rw-r--r--kernel.c25
-rw-r--r--string/common.c9
-rw-r--r--string/common.h1
5 files changed, 32 insertions, 6 deletions
diff --git a/README.md b/README.md
index 5fb52de..a85f18a 100644
--- a/README.md
+++ b/README.md
@@ -4,4 +4,4 @@ An (Accidentally) Protected Operating System written in C and assembly
Don't expect great things here
------------------------------
-This operating system isn't being written by an OS development veteran, nor a programming veteran. I'm not a professional in this area, and still finding my way. Don't expect much.
+This operating system isn't being written by an OS development veteran, nor a programming veteran. I'm not a professional in this area, and still finding my way. Plus, I work on my operating is bursts of about a month with two or so months in between. Don't expect much.
diff --git a/boot.s b/boot.s
deleted file mode 120000
index 320d590..0000000
--- a/boot.s
+++ /dev/null
@@ -1 +0,0 @@
-boot.asm \ No newline at end of file
diff --git a/kernel.c b/kernel.c
index 84d5587..293045e 100644
--- a/kernel.c
+++ b/kernel.c
@@ -1,5 +1,24 @@
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ */
+
+
// Complain if some pleb's not using a cross-compiler
-#ifdef __linux__
+#if defined(__linux__)
#error "You're not using a cross-compiler. Good luck with that."
#endif
@@ -7,10 +26,14 @@
void kernel_main()
{
+ char b[10];
console_init();
console_set_colors(COLOR_BRIGHT_GRAY,COLOR_BLACK);
console_clear();
console_print("Welcome to Toast "KERNEL_VERSION" (nickname '"KERNEL_NICKNAME"')\n");
console_set_color(COLOR_RED);
console_print("Here is kernel_main()\n");
+ char test[] = "1234";
+ int a = atoi(test);
+ itoa(a,b);
} \ No newline at end of file
diff --git a/string/common.c b/string/common.c
index b303cb0..d61bdff 100644
--- a/string/common.c
+++ b/string/common.c
@@ -45,14 +45,17 @@ void itoa(uint32_t num,char *buffer)
}
-void atoi(char *string)
+uint32_t atoi(char *string)
{
uint32_t i;
- uint32_t multiplier;
+ uint32_t multiplier = 1;
+ uint32_t total = 0;
for (i = 0; i < strlen(string); i++)
{
-
+ total += (string[strlen(string)-1-i] - 48) * multiplier;
+ multiplier*=10;
}
+ return total;
}
#endif
diff --git a/string/common.h b/string/common.h
index 28ab975..f332f1c 100644
--- a/string/common.h
+++ b/string/common.h
@@ -21,5 +21,6 @@
uint64_t strlen(char *string);
void itoa(uint32_t num,char *buffer);
+uint32_t atoi(char *string);
#endif \ No newline at end of file