Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //#define TRUE 1
- //#define FALSE 0
- #include "libs/stdbool.h"
- #include "libs/string.h"
- #include "libs/stdlib.h"
- typedef unsigned int UINT; // Defining UINT
- void shutdown();
- void putchar(char c);
- void puts(const char *s);
- char* gets(int maxChar);
- char getchar();
- //void loop_1();
- //Defining variables
- //char a;
- char* hello = "Hello!\r\n";
- char* input = "";
- void main(void) {
- puts("X-DOS Ver 1.0\r\n\r\n");
- while(1==1) {
- puts("> ");
- input = gets(200);/*
- if (strncmp(input, "print\n\r", 7) == 0) {
- puts (input += 3);
- puts ("\r\n");
- }*/
- if (input == "sysinfo") {
- puts("OS: X-DOS\r\nOS Ver: 1.0\n\r");
- }puts(input);
- }
- }
- /*
- void loop_1() {
- ans = getchar();
- putchar(ans);
- puts("\r\n");
- if (ans == 'y'){
- puts("idk lol");
- getchar();
- shutdown();
- } else if (ans == 'n') {
- puts("idk lelelelel");
- getchar();
- shutdown();
- } else {
- puts("That is not an available option.\r\n");
- loop_1();
- }
- }
- */
- void shutdown() {
- __asm {
- mov ax, 0x1000
- mov ax, ss
- mov sp, 0xf000
- mov ax, 0x5307
- mov bx, 0x0001
- mov cx, 0x0003
- int 0x15
- }
- }
- char getchar() {
- char a;
- __asm {
- xor ah, ah
- int 16h
- mov [a], AL
- }
- return a;
- }
- char* gets(int maxChar) {
- char a;
- char* b = (char *)malloc(maxChar);
- int i;
- for(i = 0; i<maxChar; i = i + 1){
- a = getchar();
- if (a !=13) {putchar(a);} else {puts("\r\n");break;}
- b[i] = a;
- }
- return b;
- //if (b[sizeof(b)-1] != '')
- }
- void putchar(char c) {
- __asm {
- mov ah, 0Eh
- mov al, [c]
- mov bh, 0
- mov bl, 0Fh
- int 10h
- }
- }
- void puts(const char* s) {
- while(*s != 0) {
- putchar(*s);
- s++;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement