Simple Operating System
stdlib.h
Go to the documentation of this file.
1 
6 #ifndef STDLIB_H
7 #define STDLIB_H
8 
9 #include "types.h"
10 
16 Word getMemorySize(void) {
17  Word size;
18  asm("int 0x12"
19  :"=a"(size));
20  return size;
21 }
22 
28 void udelay(unsigned long usecs);
29 void udelay(unsigned long usecs) {
30  //http://vitaly_filatov.tripod.com/ng/asm/asm_026.13.html
31  asm("int 0x15"
32  :
33  :"a"(0x8600), "c"(usecs>>16), "d"((Word)usecs));
34 }
35 
42 void exit(int val) {
43  asm("push cx\n"
44  "push bx\n"
45  "push dx\n"
46  "iretw"::"a"(val), "d"(*(int*)(0x8)), "b"(0x1000), "c"(0));
47 }
48 
49 #endif
Word getMemorySize(void)
Get RAM size in first 1MB.
Definition: stdlib.h:16
void exit(int val)
Exit from program.
Definition: stdlib.h:42
void udelay(unsigned long usecs)
Delay usecs microseconds.
Definition: stdlib.h:29
useful macros, definitions, enums etc.