From 65514ec0400b10eb4a35344ed94238849553ef17 Mon Sep 17 00:00:00 2001 From: Eggert Jung Date: Sun, 11 May 2025 02:20:07 +0200 Subject: [PATCH] add app --- main.cc | 3 +++ user/app1/appl.cc | 37 +++++++++++++++++++++++++++++++++++++ user/app1/appl.h | 2 +- 3 files changed, 41 insertions(+), 1 deletion(-) diff --git a/main.cc b/main.cc index ff33970..46f8206 100644 --- a/main.cc +++ b/main.cc @@ -12,6 +12,7 @@ #include "device/textstream.h" #include "device/ps2controller.h" #include "arch/ioapic.h" +#include "user/app1/appl.h" TextStream kout = TextStream(0, 80, 0, 10, true); @@ -97,6 +98,8 @@ extern "C" int main() { PS2Controller::drainBuffer(); + Application{}.action(); + while (true){ } diff --git a/user/app1/appl.cc b/user/app1/appl.cc index 25f97b1..ab80cb1 100644 --- a/user/app1/appl.cc +++ b/user/app1/appl.cc @@ -1,6 +1,43 @@ // vim: set noet ts=4 sw=4: #include "appl.h" +#include "../../device/ps2controller.h" +#include "../../object/outputstream.h" +#include "../../device/textstream.h" + +char text[] = "Ich mag\n\ +Saftige Pflaumen voller Aroma\n\ +Ich ficke jede Oma ins Koma\n\ +Ich bin Großmutterficker, Großmutterficker\n\ +Ich bin Großmutterficker, ich bin Großmutterficker\n\ +\n\ +Saftige Pflaumen voller Aroma\n\ +Ich ficke jede Oma ins Koma\n\ +Ich bin Großmutterficker, Großmutterficker\n\ +Ich bin Großmutterficker\n\ +Und wacht sie aus'm Koma auf, kriegt sie von mir 'n Sticker\n\ +\n"; + +extern TextStream kout; + +void activeWaitDelay(uint64_t cycles) { + uint64_t counter = 0; // Use volatile to prevent optimization + for (uint64_t i = 0; i < cycles; ++i) { + counter++; // Simple operation to consume cycles + asm("nop"); + } +} void Application::action() { // NOLINT + uint16_t cnt = 0; + while (1) { + while(text[cnt++] != '\n'){ + kout << text[cnt-1]; + } + kout << endl << flush; + + activeWaitDelay(1000000000); + if(cnt >= sizeof(text)-1) + cnt=0; + } } diff --git a/user/app1/appl.h b/user/app1/appl.h index e39456d..5c16b6d 100644 --- a/user/app1/appl.h +++ b/user/app1/appl.h @@ -18,7 +18,7 @@ class Application { Application& operator=(const Application&) = delete; public: - Application(Application&&) = default; // XXX: is this used anywhere? + Application() = default; // XXX: is this used anywhere? /*! \brief Constructor *