/*
* KERNEL
*/
#include <asm.h>
#include <disk.h>
#include <fat.h>
#include <global.h>
#include <init.h>
#include <malloc.h>
#include <mem.h>
#include <printf.h>
#include <string.h>
#include <types.h>
#include <video.h>
/******************************************************************************/
/********************************* MAIN KERNEL ******************************/
/******************************************************************************/
int main(void) {
char cmd[80];
int i = 0;
DirectoryEntry *file = malloc(sizeof(DirectoryEntry));
init();
while(1) {
if(strlen(cmd)!=0) {
if(!strcmp(cmd,"dir")) {
printf("Nazov suboru | Velkost\r\n");
i = 0;
while((i = findfile(file, i)) != -1) /* najdeme subor */
printf(" %12s > %u bajtou\r\n", file->realname, file->filesize);
} else if(!strcmp(cmd,"file")) {
textcolor(GREEN);
printf("<<%s|%s>%s ZADAJ NAZOV SUBORU: ", user_name, pc_name, path);
textcolor(WHITE);
gets(cmd, 79);
catfile(cmd);
} else if(!strcmp(cmd,"info")) {
printf("Element je operacny system navrhnuty ako maturitny projekt\r\n");
printf("pre.................................................................................................... \r\n");
printf("Ulohou tohto operacneho systemu nie je komercne vyuzivanie.\r\n");
printf("Mne posluzil najma nato aby som sa blyzsie zoznamil s tvorbou\r\n");
printf("a programovanim operacnych systemov a s ich algoritmami.\r\n");
} else {
printf("Zadali ste retazec '");
textcolor(YELLOW);
printf("%s", cmd);
textcolor(WHITE);
printf("'\r\n");
}
}
textcolor(GREEN);
printf("<<%s|%s>%s ", user_name, pc_name, path);
textcolor(WHITE);
gets(cmd, 79);
}
return 0;
}
Toto je kernel operacneho systemu ale ako ked niekto napise "time" sa zobrazi systemovy cas????Compilator je Turbo C 2.01 a uz som skusal vela moznosti ale stale nejaka chyba. Takze co tam mam dopisat aby my to po vypisani "time" zobrazilo cas.
Fórum › C / C++
Ako zobraziť čas v tomto programe????

Tohle jsem prevzal z Linuxu:
#define BCD_TO_BIN(val) ((val)=((val)&15) + ((val)>>4)*10)
void out(ushort port, uchar data){
asm("outb %1, %0" : : "dN" (port), "a" (data));
}
uchar cmos_read(uchar data){
out(0x70, data);
return in(0x71);
}
typedef struct time
{
uint sec;
uint min;
uint hour;
uint day;
uint mon;
uint year;
} time_t;
time_t _time;
_time.sec = (uint)cmos_read(0x80);
_time.min = (uint)cmos_read(0x82);
_time.hour = (uint)cmos_read(0x84);
_time.day = (uint)cmos_read(0x87);
_time.mon = (uint)cmos_read(0x88);
_time.year = (uint)cmos_read(0x89);
_time.sec = BCD_TO_BIN(_time.sec);
_time.min = BCD_TO_BIN(_time.min);
_time.hour = BCD_TO_BIN(_time.hour);
_time.day = BCD_TO_BIN(_time.day);
_time.mon = BCD_TO_BIN(_time.mon)-1;
_time.year = BCD_TO_BIN(_time.year)+2000;

Přidej příspěvek
Toto téma je starší jak čtvrt roku – přidej svůj příspěvek jen tehdy, máš-li k tématu opravdu co říct!
Ano, opravdu chci reagovat → zobrazí formulář pro přidání příspěvku
×Vložení zdrojáku
×Vložení obrázku
×Vložení videa
Aktuálně jsou podporována videa ze serverů YouTube, Vimeo a Dailymotion.
×






























































Uživatelé prohlížející si toto vlákno
Uživatelé on-line: 0 registrovaných, 138 hostů
Podobná vlákna
Ako zobrazit zdroj. kod súboru v textaree? — založil Nepster
Ako zobraziť údaje z databázy na webe pomocou PHP ? — založil rttv
Co je na tomto spatne? — založil
Co se v tomto kodu deje? — založil soli
V tomto hledám chybu marně — založil Razomil
Moderátoři diskuze