diff --git a/README.md b/README.md index d4b8286..71ef680 100644 --- a/README.md +++ b/README.md @@ -19,6 +19,16 @@ The long-term goal of this OS is to be capable of running user programs and havi ## Usage +Download the latest BlankOS ISO image from the "Releases" tab, and emulate it directly using the QEMU emulator: + +``` +qemu-system-i386 blankOS-i386-1.4.45.iso +``` + +Alternatively, burn the image on a USB stick and use it on a machine (see section "Real Hardware"). + +## Building from source + ### Dependencies For Debian-based distros: @@ -42,7 +52,7 @@ A cross-compiler is needed to build the system. More info on why [here](https:// Why didn't I use one sooner? Can't tell. Maybe I was too lazy. This is actually problematic because I wasn't able to use some libraries and I had to put in a bunch of weird compilation flags. It's better like this. -## Building and running +To clone and build, do: ``` git clone https://github.com/xamidev/blankos @@ -50,7 +60,8 @@ make make run ``` -This will start a new Bochs debugger instance. To proceed with the kernel execution, you will have to type `c` in the shell spawning Bochs. Serial output will be saved under the `com1.out` file, this way you can debug the kernel by viewing its log messages. To quit, type `q`. Feel free to open issues or pull requests. +This will start a new Bochs debugger instance. To proceed with the kernel execution, you will have to type `c` in the shell spawning Bochs. Serial output will be saved under the `com1.out` file, this way you can debug the kernel by viewing its log messages. To quit, type `q`. +You can try out QEMU too. ## Running on real hardware diff --git a/iso/boot/kernel.elf b/iso/boot/kernel.elf index ef91c7e..58988fc 100755 Binary files a/iso/boot/kernel.elf and b/iso/boot/kernel.elf differ diff --git a/src/kernel/kmain.c b/src/kernel/kmain.c index 2483599..2557363 100644 --- a/src/kernel/kmain.c +++ b/src/kernel/kmain.c @@ -3,6 +3,7 @@ #include "gdt.h" #include "idt.h" #include "system.h" +//#include char* ascii_title = "\n" diff --git a/src/libc/stdio.c b/src/libc/stdio.c index 70a8555..31d1c7f 100644 --- a/src/libc/stdio.c +++ b/src/libc/stdio.c @@ -183,7 +183,6 @@ void dtostrf(double val, char *buffer, int precision) double fractional_part = val - whole_part; if (fractional_part < 0) fractional_part = -fractional_part; - char *start = buffer; if (whole_part == 0) { *buffer++ = '0'; diff --git a/src/programs/math.c b/src/programs/math.c index 70d20c1..9f96c9e 100644 --- a/src/programs/math.c +++ b/src/programs/math.c @@ -87,7 +87,6 @@ Token lexer_get_next_token(Lexer *lexer) } lexer->current_token.type = TOKEN_NUMBER; lexer->current_token.value = value; - //printf("NUMBER %f\n", value); return lexer->current_token; } @@ -95,7 +94,6 @@ Token lexer_get_next_token(Lexer *lexer) { lexer_advance(lexer); lexer->current_token.type = TOKEN_PLUS; - printf("PLUS\n"); return lexer->current_token; } @@ -103,7 +101,6 @@ Token lexer_get_next_token(Lexer *lexer) { lexer_advance(lexer); lexer->current_token.type = TOKEN_MINUS; - printf("MINUS\n"); return lexer->current_token; } @@ -111,7 +108,6 @@ Token lexer_get_next_token(Lexer *lexer) { lexer_advance(lexer); lexer->current_token.type = TOKEN_MULTIPLY; - printf("MULTIPLY\n"); return lexer->current_token; } @@ -119,7 +115,6 @@ Token lexer_get_next_token(Lexer *lexer) { lexer_advance(lexer); lexer->current_token.type = TOKEN_DIVIDE; - printf("DIVIDE\n"); return lexer->current_token; } @@ -127,7 +122,6 @@ Token lexer_get_next_token(Lexer *lexer) { lexer_advance(lexer); lexer->current_token.type = TOKEN_LPAREN; - printf("LPAREN\n"); return lexer->current_token; } @@ -135,16 +129,14 @@ Token lexer_get_next_token(Lexer *lexer) { lexer_advance(lexer); lexer->current_token.type = TOKEN_RPAREN; - printf("RPAREN\n"); return lexer->current_token; } - printf("Unknown character %c\n", current_char); - //shell_install(); + printf("\nUnknown character %c\n", current_char); + shell_install(); } lexer->current_token.type = TOKEN_END; - printf("END\n"); return lexer->current_token; } @@ -166,8 +158,8 @@ void parser_eat(Parser *parser, TokenType type) { parser->current_token = lexer_get_next_token(&parser->lexer); } else { - printf("Unexpected token %d\n", parser->current_token.type); - //shell_install(); + printf("\nUnexpected token %d\n", parser->current_token.type); + shell_install(); } } @@ -181,17 +173,15 @@ double parser_factor(Parser *parser) if (token.type == TOKEN_NUMBER) { parser_eat(parser, TOKEN_NUMBER); - //printf("Factor: %f\n", token.value); return token.value; } else if (token.type == TOKEN_LPAREN) { parser_eat(parser, TOKEN_LPAREN); double result = parser_expression(parser); parser_eat(parser, TOKEN_RPAREN); - //printf("Factor (expression): %f\n", result); return result; } else { - printf("Unexpected token in factor %d\n", token.type); - //shell_install(); + printf("\nUnexpected token in factor %d\n", token.type); + shell_install(); } return -1; } @@ -199,7 +189,6 @@ double parser_factor(Parser *parser) double parser_term(Parser *parser) { double result = parser_factor(parser); - //printf("Initial term: %f\n", result); while (parser->current_token.type == TOKEN_MULTIPLY || parser->current_token.type == TOKEN_DIVIDE) { @@ -208,11 +197,9 @@ double parser_term(Parser *parser) { parser_eat(parser, TOKEN_MULTIPLY); result *= parser_factor(parser); - //printf("Term after multiply: %f\n", result); } else if (token.type == TOKEN_DIVIDE) { parser_eat(parser, TOKEN_DIVIDE); result /= parser_factor(parser); - //printf("Term after divide: %f\n", result); } } return result; @@ -221,7 +208,6 @@ double parser_term(Parser *parser) double parser_expression(Parser *parser) { double result = parser_term(parser); - //printf("Initial expression: %f\n", result); while (parser->current_token.type == TOKEN_PLUS || parser->current_token.type == TOKEN_MINUS) { @@ -230,11 +216,9 @@ double parser_expression(Parser *parser) { parser_eat(parser, TOKEN_PLUS); result += parser_term(parser); - //printf("Expression after plus: %f\n", result); } else if (token.type == TOKEN_MINUS) { parser_eat(parser, TOKEN_MINUS); result -= parser_term(parser); - //printf("Expression after minus: %f\n", result); } } return result; @@ -245,7 +229,6 @@ double parse(const char* text) Parser parser; parser_init(&parser, text); double result = parser_expression(&parser); - //printf("Final result: %f\n", result); return result; } @@ -254,7 +237,6 @@ void program_math() char input_buffer[BUFFER_SIZE]; puts("Expression? "); get_input(input_buffer, BUFFER_SIZE); - printf("Input: %s\n", input_buffer); double result = parse(input_buffer); printf("\n%f\n", result); } diff --git a/src/programs/misc.c b/src/programs/misc.c index 321c9a6..c255492 100644 --- a/src/programs/misc.c +++ b/src/programs/misc.c @@ -35,5 +35,7 @@ void program_clear() void program_uptime() { - printf("%d ticks\n", uptime()); + int ticks = uptime(); + double seconds = ticks/18.2065; // PIC channel 0 freq + printf("%d ticks\t%f seconds\n", ticks, seconds); }