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