header.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. /*
  2. * header.h -- part of ZilUtils/ZilAsm
  3. *
  4. * Copyright (C) 2016 Jason Self <j@jxself.org>
  5. *
  6. * This program is free software: you can redistribute it and/or modify
  7. * it under the terms of the GNU Affero General Public License as
  8. * published by the Free Software Foundation, either version 3 of the
  9. * License, or (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU Affero General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU Affero General Public License
  17. * along with this program. If not, see <http://www.gnu.org/licenses/>
  18. *
  19. * SPDX-License-Identifier: AGPL-3.0-or-later
  20. */
  21. #ifndef ZILASM_HEADER
  22. #define ZILASM_HEADER 1
  23. #include "zmem.h"
  24. typedef unsigned long Byte_address;
  25. typedef unsigned long Word_address;
  26. typedef unsigned long Packed_address;
  27. typedef unsigned long Offset8;
  28. typedef unsigned int Word;
  29. typedef signed char Byte;
  30. typedef int Bool;
  31. typedef struct {
  32. unsigned version; // 1..6
  33. // [$01] V1..V3: Flags1
  34. Bool statusline_type; // bit1: 0=score/turns, 1=hh:mm
  35. Bool split_two_discs; // bit2
  36. Bool statusline_notavail; // bit4
  37. Bool screensplit_avail; // bit5
  38. Bool varpitchfont_default; // bit6
  39. // [$01] V4: Flags1
  40. Bool colors_avail; // v5: bit0
  41. Bool pics_avail; // v6: bit1
  42. Bool bold_avail; // v4: bit2
  43. Bool italic_avail; // v4: bit3
  44. Bool fixedspace_avail; // v4: bit4
  45. Bool sound_avail; // v6: bit5
  46. Bool timedkeyb_avail; // v4: bit7
  47. // Addresses
  48. Byte_address highmem_base; // [$04]
  49. Byte_address start_pc; // [$06], v1
  50. Packed_address start_routine; // [$06], v6
  51. Byte_address dictionary; // [$08]
  52. Byte_address objects; // [$0A]
  53. Byte_address globals; // [$0C]
  54. Byte_address static_base; // [$0E]
  55. // [$10] Flags2
  56. Bool transcript_on; // v1: bit0
  57. Bool print_fixedfont; // v3: bit1
  58. Bool request_redraw; // v6: bit2
  59. Bool want_pics; // v5: bit3
  60. Bool want_undo; // v5: bit4
  61. Bool want_mouse; // v5: bit5
  62. Bool want_colors; // v5: bit6
  63. Bool want_sound; // v5: bit7
  64. Bool want_menus; // v5: bit8
  65. //
  66. Byte_address abbrevs; // [$18], v2
  67. Word file_length; // [$1A], v3
  68. Word checksum; // [$1C], v3
  69. Byte interpreter_number; // [$1E], v4
  70. Byte interpreter_version; // [$1F], v4
  71. // Screen
  72. Byte screen_lines; // [$20], v4 ($FF = infinite)
  73. Byte screen_chars; // [$21], v4
  74. Word screen_width; // [$22], v5
  75. Word screen_height; // [$24], v5
  76. Byte font_width; // [$26], v5/v6
  77. Byte font_height; // [$27], v5/v6
  78. // Tables
  79. Offset8 routines; // [$28], v6
  80. Offset8 strings; // [$2A], v6
  81. Byte backcolor; // [$2C], v5
  82. Byte forecolor; // [$2D], v5
  83. Byte_address term_chartable; // [$2E], v5
  84. Word width3; // [$30], v6
  85. Word revnumber; // [$32], v1
  86. Byte_address alphabet; // [$34], v5
  87. Byte_address header_ext; // [$36], v5
  88. } Program_header_struct;
  89. extern Program_header_struct Program_header;
  90. void program_header_reset(unsigned zversion);
  91. ZMemblock *program_header_build(void);
  92. #endif /* ifndef ZILASM_HEADER */