mirror of https://github.com/E-Almqvist/eOS
parent
572be221b3
commit
9649d1a10d
@ -1,9 +1,14 @@ |
||||
# TO DO |
||||
- Multiboot (read end of memory etc) |
||||
- String interpolation |
||||
- Screen scrolling |
||||
- Math lib: powf, log10, numlen |
||||
- Str lib: int\_to\_str |
||||
- Read and display e820 memory mapping |
||||
- (Random lib: random num from a to b?) |
||||
- Shell: input, execute |
||||
|
||||
## Long term |
||||
- Get rust lang to work/switch to rust |
||||
- Shell? |
||||
- Improve memory management |
||||
- prog/time: show time |
||||
- prog/date: show date |
||||
- prog/mem: show amount of memory |
||||
- prog/bitmap: show phys bitmap |
||||
|
||||
# Long term |
||||
- Rust? |
||||
|
@ -1,18 +1,23 @@ |
||||
#include "conv.h" |
||||
#include "../drivers/vga.h" |
||||
|
||||
char* int_to_str(int i, char* buf) { |
||||
ulong num = (ulong)i; // convert to ulong
|
||||
uint len = ulong_len(num); // number of digits
|
||||
|
||||
*(buf+len) = '\0'; // add a "end-of-string" at the end
|
||||
// char* int_to_str(int i, char* buf) {
|
||||
// ulong num = (ulong)i; // convert to ulong
|
||||
// uint len = ulong_len(num); // number of digits
|
||||
//
|
||||
// *(buf+len) = '\0'; // add a "end-of-string" at the end
|
||||
//
|
||||
// int j;
|
||||
// for(j = 0; j < len; j++) { // iterate over each digit and assign it to the buffer
|
||||
// // super dangerous memory write
|
||||
// *(buf+j) = (char)(ndigit(num, len-1-j) + ASCII_OFFSET); // apply the ascii offset so that i becomes a char
|
||||
// println(*(buf+j), 0xc0);
|
||||
// }
|
||||
//
|
||||
// return buf;
|
||||
// }
|
||||
|
||||
int j; |
||||
for(j = 0; j < len; j++) { // iterate over each digit and assign it to the buffer
|
||||
// super dangerous memory write
|
||||
*(buf+j) = (char)(ndigit(num, len-1-j) + ASCII_OFFSET); // apply the ascii offset so that i becomes a char
|
||||
println(*(buf+j), 0xc0); |
||||
} |
||||
|
||||
return buf; |
||||
char* int_to_str(int i, char* buf) { |
||||
char* sign = (i < 0) ? "-" : "+"; |
||||
return (char*) sign; |
||||
} |
||||
|
Loading…
Reference in new issue