Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "kernel.h"
- void init(void)
- {
- clearscreen(); // Bildschirm löschen
- printf(".....................................\n");
- printf("Halihalo\n");
- printf("nochma\n");
- }
- ############################################################
- #include "video.h"
- #define videobuffer 2500
- /*
- * Standard-Ein/Ausgabe
- * Copyright (c) Tobias Markus 2011
- * BUILDSTAMP 28/05/2011
- */
- // 80 Zeichen 25 Zeilen
- static unsigned char buffer[videobuffer];
- static unsigned char pointerx = 0;
- static unsigned char pointery = 0;
- static unsigned char pointer;
- void printf(char hw[])
- {
- printreal((unsigned char*) hw);
- }
- void printreal(unsigned char hw[])
- {
- int i;
- // C-Strings haben ein Nullbyte als Abschluss
- for (i = 0; hw[i] != '\0'; i++) {
- putc(hw[i]);
- }
- if ((pointery == 25 && pointerx == 80) || pointery == 26) { wraparound(); pointery = 25; pointerx = 0; }
- }
- void putc(unsigned char output)
- {
- getpointer();
- if (output != '\n' && output != '\0') {
- // Zeichen in den Buffer kopieren
- buffer[pointer] = (unsigned char) output;
- // 0x07 = Hellgrau auf Schwarz
- buffer[pointer + 1] = 0x07;
- pointerx++;
- } else if (output == '\n') {
- newline();
- }
- if (pointerx == 80) { newline(); }
- refresh();
- }
- void refresh()
- {
- int i;
- char* video = (char*) 0xb8000;
- for (i = 0; i != 2500; i++) {
- video[i] = buffer[i];
- }
- }
- int getpointer()
- {
- pointer = ((pointery * 80) + pointerx) * 2;
- return pointer;
- }
- char getcharfrompointer()
- {
- getpointer();
- return buffer[pointer];
- }
- void clearscreen()
- {
- int i;
- for (i = 0; i != 2000; i++)
- {
- buffer[i] = (int) 0x0;
- }
- refresh();
- }
- void wraparound()
- {
- int i,x;
- for (i = 0; i != 25; i++)
- {
- for (x = 0; x != 80; x++)
- {
- buffer[((i * 80) + x) * 2] = buffer[((i * 80) + x + 80) * 2];
- }
- }
- for (i = 1920; i != 2000; i++)
- {
- buffer[i] = (int) 0x0;
- }
- refresh();
- }
- void newline()
- {
- pointerx = 0;
- pointery++;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement