uncompress.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. /*
  2. *
  3. * Copyright (C) 1996 Russell King
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License version 2 as
  7. * published by the Free Software Foundation.
  8. */
  9. #define VIDMEM ((char *)0x02000000)
  10. int video_num_columns, video_num_lines, video_size_row;
  11. int white, bytes_per_char_h;
  12. extern unsigned long con_charconvtable[256];
  13. struct param_struct {
  14. unsigned long page_size;
  15. unsigned long nr_pages;
  16. unsigned long ramdisk_size;
  17. unsigned long mountrootrdonly;
  18. unsigned long rootdev;
  19. unsigned long video_num_cols;
  20. unsigned long video_num_rows;
  21. unsigned long video_x;
  22. unsigned long video_y;
  23. unsigned long memc_control_reg;
  24. unsigned char sounddefault;
  25. unsigned char adfsdrives;
  26. unsigned char bytes_per_char_h;
  27. unsigned char bytes_per_char_v;
  28. unsigned long unused[256/4-11];
  29. };
  30. static struct param_struct *params = (struct param_struct *)0x0207c000;
  31. /*
  32. * This does not append a newline
  33. */
  34. static void puts(const char *s)
  35. {
  36. extern void ll_write_char(char *, unsigned long);
  37. int x,y;
  38. unsigned char c;
  39. char *ptr;
  40. x = params->video_x;
  41. y = params->video_y;
  42. while ( ( c = *(unsigned char *)s++ ) != '\0' ) {
  43. if ( c == '\n' ) {
  44. x = 0;
  45. if ( ++y >= video_num_lines ) {
  46. y--;
  47. }
  48. } else {
  49. ptr = VIDMEM + ((y*video_num_columns*params->bytes_per_char_v+x)*bytes_per_char_h);
  50. ll_write_char(ptr, c|(white<<16));
  51. if ( ++x >= video_num_columns ) {
  52. x = 0;
  53. if ( ++y >= video_num_lines ) {
  54. y--;
  55. }
  56. }
  57. }
  58. }
  59. params->video_x = x;
  60. params->video_y = y;
  61. }
  62. static void error(char *x);
  63. /*
  64. * Setup for decompression
  65. */
  66. static void arch_decomp_setup(void)
  67. {
  68. int i;
  69. video_num_lines = params->video_num_rows;
  70. video_num_columns = params->video_num_cols;
  71. bytes_per_char_h = params->bytes_per_char_h;
  72. video_size_row = video_num_columns * bytes_per_char_h;
  73. if (bytes_per_char_h == 4)
  74. for (i = 0; i < 256; i++)
  75. con_charconvtable[i] =
  76. (i & 128 ? 1 << 0 : 0) |
  77. (i & 64 ? 1 << 4 : 0) |
  78. (i & 32 ? 1 << 8 : 0) |
  79. (i & 16 ? 1 << 12 : 0) |
  80. (i & 8 ? 1 << 16 : 0) |
  81. (i & 4 ? 1 << 20 : 0) |
  82. (i & 2 ? 1 << 24 : 0) |
  83. (i & 1 ? 1 << 28 : 0);
  84. else
  85. for (i = 0; i < 16; i++)
  86. con_charconvtable[i] =
  87. (i & 8 ? 1 << 0 : 0) |
  88. (i & 4 ? 1 << 8 : 0) |
  89. (i & 2 ? 1 << 16 : 0) |
  90. (i & 1 ? 1 << 24 : 0);
  91. white = bytes_per_char_h == 8 ? 0xfc : 7;
  92. if (params->nr_pages * params->page_size < 4096*1024) error("<4M of mem\n");
  93. }
  94. /*
  95. * nothing to do
  96. */
  97. #define arch_decomp_wdog()