diff --git a/hello/Makefile b/hello/Makefile index db544657..108a5fbe 100644 --- a/hello/Makefile +++ b/hello/Makefile @@ -38,8 +38,8 @@ hello: hello.o $(LD) $(LDFLAGS) hello.o -o hello.tmp $(LIBC) objcopy -O binary hello.tmp hello -hello.o: hello.c - $(CC) $(CPPFLAGS) $(CFLAGS) -O2 -c hello.c -o hello.o +hello.o: hello.cpp + $(CXX) $(CPPFLAGS) $(CXXFLAGS) -O2 -c hello.cpp -o hello.o clean: rm -f hello.tmp hello.o hello diff --git a/hello/hello.c b/hello/hello.c deleted file mode 100644 index 526c72fb..00000000 --- a/hello/hello.c +++ /dev/null @@ -1,9 +0,0 @@ -#include - -int main(int argc, char* argv[]) -{ - printf("\e[m\e[0J"); - printf("OH MY GOD! Sortix can load programs!\n"); - return 0; -} - diff --git a/hello/hello.cpp b/hello/hello.cpp new file mode 100644 index 00000000..ee143e05 --- /dev/null +++ b/hello/hello.cpp @@ -0,0 +1,34 @@ +#include +#include + +int main(int argc, char* argv[]) +{ + printf("\e[m\e[0J"); + printf("Hello World: Welcome to Sortix! This is a program running in user-space.\n" + "This program is a probably the worst text editor ever made.\n" + "You are currently using the buggy USA keyboard layout.\n" + "This terminal is controlled using ANSI Escape Sequences:\n" + " - Type \e[32mESC [ 2 J\e[m to clear the screen\n" + ); + + while (true) + { + unsigned method = System::Keyboard::POLL; + uint32_t codepoint = System::Keyboard::ReceieveKeystroke(method); + + if ( codepoint == 0 ) { continue; } + if ( codepoint & Maxsi::Keyboard::DEPRESSED ) { continue; } + if ( codepoint == Maxsi::Keyboard::UP ) { printf("\e[A"); continue; } + if ( codepoint == Maxsi::Keyboard::DOWN ) { printf("\e[B"); continue; } + if ( codepoint == Maxsi::Keyboard::RIGHT ) { printf("\e[C"); continue; } + if ( codepoint == Maxsi::Keyboard::LEFT ) { printf("\e[D"); continue; } + if ( codepoint == Maxsi::Keyboard::ESC ) { printf("\e"); continue; } + if ( codepoint >= 0x80 ) { continue; } + + char msg[2]; msg[0] = codepoint; msg[1] = '\0'; + printf(msg); + } + + return 0; +} + diff --git a/libmaxsi/c/hsrc/features.h b/libmaxsi/c/hsrc/features.h index ad362da4..8d0e28fc 100644 --- a/libmaxsi/c/hsrc/features.h +++ b/libmaxsi/c/hsrc/features.h @@ -29,10 +29,10 @@ #ifdef __cplusplus #define __BEGIN_DECLS extern "C" { #define __END_DECLS } + #define restrict #else #define __BEGIN_DECLS #define __END_DECLS - #define restrict #endif #define __POSIX_NO_OBSOLETE diff --git a/sortix/memorymanagement.cpp b/sortix/memorymanagement.cpp index 6e376b7a..7b52ee69 100644 --- a/sortix/memorymanagement.cpp +++ b/sortix/memorymanagement.cpp @@ -76,7 +76,7 @@ namespace Sortix // Check that we can use this kind of RAM. if ( MMap->type != 1 ) { continue; } - Log::PrintF("RAM at 0x%64x\t of length 0x%64zx\n", MMap->addr, MMap->len); + //Log::PrintF("RAM at 0x%64x\t of length 0x%64zx\n", MMap->addr, MMap->len); // The kernels code may split this memory area into multiple pieces. struct { uintptr_t Base; size_t Length; } Entries[2]; nat Num = 1; @@ -150,7 +150,7 @@ namespace Sortix Fragmentize(); #ifndef PLATFORM_SERIAL - Log::PrintF("%zu pages are available for paging (%zu MiB RAM)\n", PagesTotal, PagesTotal >> 8 /* * 0x1000 / 1024 / 1024*/); + //Log::PrintF("%zu pages are available for paging (%zu MiB RAM)\n", PagesTotal, PagesTotal >> 8 /* * 0x1000 / 1024 / 1024*/); #endif } } diff --git a/sortix/pci.cpp b/sortix/pci.cpp index 5cebd557..dd35c1bb 100644 --- a/sortix/pci.cpp +++ b/sortix/pci.cpp @@ -235,6 +235,7 @@ namespace Sortix void Init() { +#if 0 Log::Print("PCI Devices: "); for ( nat Bus = 0; Bus < 256; Bus++ ) @@ -264,6 +265,7 @@ namespace Sortix } Log::Print("\b\b\n"); +#endif } uint32_t ReadLong(uint8_t Bus, uint8_t Slot, uint8_t Function, uint8_t Offset)