Advertisement
Guest User

kernel.h

a guest
Feb 8th, 2019
251
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.56 KB | None | 0 0
  1.  
  2. /* various shorthand types */
  3. #define byte unsigned char
  4. #define word unsigned short
  5. #define dword unsigned int
  6. #define qword unsigned long
  7. #define shortbuf unsigned short int *
  8.  
  9. /* extern functions: devices.h */
  10.  
  11. /* VGA screen & colors */
  12. #define vga_width 80
  13. #define vga_height 25
  14. #define vga_mem (unsigned short*)0xB8000
  15. #define vga_color(fg,bg) ( ((byte)fg) | ((byte)bg) << 4 )
  16. #define vga_entry(ch,col) ( ((word)ch) | ((word)col) << 8 )
  17. #define vga_pitch 160 /* bytes until term[x][y+1] */
  18. #define vga_depth 2 /* bytes per entry */
  19. #define vga_black 0
  20. #define vga_blue 1
  21. #define vga_green 2
  22. #define vga_cyan 3
  23. #define vga_red 4
  24. #define vga_magenta 5
  25. #define vga_brown 6
  26. #define vga_lightgrey 7
  27. #define vga_darkgrey 8
  28. #define vga_lightblue 9
  29. #define vga_lightgreen 10
  30. #define vga_lightcyan 11
  31. #define vga_lightred 12
  32. #define vga_lightmagenta 13
  33. #define vga_lightbrown 14
  34. #define vga_white 15
  35.  
  36. /* utility functions */
  37. #define i2c(i) ('0'+i)
  38. #define checkb(num,b) (((num) & (1<<b))>>b)
  39. #define assert(x) do { if(!(x)) printerr('a'); } while(0)
  40.  
  41. /* device drivers: -> devices.h */
  42.  
  43. /* standard integers */
  44. #ifdef _stdint_types
  45. #define uint8_t unsigned char
  46. #define int8_t signed char
  47. #define uint16_t unsigned short int
  48. #define int16_t signed short int
  49. #define uint32_t unsigned int
  50. #define int32_t signed int
  51. #define uint64_t unsigned long int
  52. #define int64_t signed long int
  53. #endif
  54.  
  55. /* strict functional types */
  56. #ifdef _pure_functional
  57. #define c_int const int
  58. #define mut_int int
  59. #define c_char const char
  60. #define mut_char char
  61. #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement