/*
* header.h -- part of ZilUtils/ZilAsm
*
- * Copyright (C) 2016, 2019 Jason Self <j@jxself.org>
+ * Copyright (C) 2016, 2019, 2020 Jason Self <j@jxself.org>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
#ifndef ZILASM_HEADER
#define ZILASM_HEADER 1
-
+extern "C"
+{
#include "zmem.h"
-
-typedef unsigned long Byte_address;
-typedef unsigned long Word_address;
+}
+typedef unsigned long Byte_address;
+typedef unsigned long Word_address;
typedef unsigned long Packed_address;
-typedef unsigned long Offset8;
-typedef unsigned short Word;
-typedef unsigned char Byte;
-typedef int Bool;
+typedef unsigned long Offset8;
+typedef unsigned short Word;
+typedef unsigned char Byte;
+typedef int Bool;
//typedef struct {
-// unsigned version; // 1..6
-// // [$01] V1..V3: Flags1
-// Bool statusline_type; // bit1: 0=score/turns, 1=hh:mm
-// Bool split_two_discs; // bit2
-// Bool statusline_notavail; // bit4
-// Bool screensplit_avail; // bit5
-// Bool varpitchfont_default; // bit6
-// // [$01] V4: Flags1
-// Bool colors_avail; // v5: bit0
-// Bool pics_avail; // v6: bit1
-// Bool bold_avail; // v4: bit2
-// Bool italic_avail; // v4: bit3
-// Bool fixedspace_avail; // v4: bit4
-// Bool sound_avail; // v6: bit5
-// Bool timedkeyb_avail; // v4: bit7
-// // Addresses
-// Byte_address highmem_base; // [$04]
-// Byte_address start_pc; // [$06], v1
-// Packed_address start_routine; // [$06], v6
-// Byte_address dictionary; // [$08]
-// Byte_address objects; // [$0A]
-// Byte_address globals; // [$0C]
-// Byte_address static_base; // [$0E]
-// // [$10] Flags2
-// Bool transcript_on; // v1: bit0
-// Bool print_fixedfont; // v3: bit1
-// Bool request_redraw; // v6: bit2
-// Bool want_pics; // v5: bit3
-// Bool want_undo; // v5: bit4
-// Bool want_mouse; // v5: bit5
-// Bool want_colors; // v5: bit6
-// Bool want_sound; // v5: bit7
-// Bool want_menus; // v5: bit8
-// //
-// Byte_address abbrevs; // [$18], v2
-// Word file_length; // [$1A], v3
-// Word checksum; // [$1C], v3
-// Byte interpreter_number; // [$1E], v4
-// Byte interpreter_version; // [$1F], v4
-// // Screen
-// Byte screen_lines; // [$20], v4 ($FF = infinite)
-// Byte screen_chars; // [$21], v4
-// Word screen_width; // [$22], v5
-// Word screen_height; // [$24], v5
-// Byte font_width; // [$26], v5/v6
-// Byte font_height; // [$27], v5/v6
-// // Tables
-// Offset8 routines; // [$28], v6
-// Offset8 strings; // [$2A], v6
-// Byte backcolor; // [$2C], v5
-// Byte forecolor; // [$2D], v5
-// Byte_address term_chartable; // [$2E], v5
-// Word width3; // [$30], v6
-// Word revnumber; // [$32], v1
-// Byte_address alphabet; // [$34], v5
-// Byte_address header_ext; // [$36], v5
+// unsigned version; // 1..6
+// // [$01] V1..V3: Flags1
+// Bool statusline_type; // bit1: 0=score/turns, 1=hh:mm
+// Bool split_two_discs; // bit2
+// Bool statusline_notavail; // bit4
+// Bool screensplit_avail; // bit5
+// Bool varpitchfont_default; // bit6
+// // [$01] V4: Flags1
+// Bool colors_avail; // v5: bit0
+// Bool pics_avail; // v6: bit1
+// Bool bold_avail; // v4: bit2
+// Bool italic_avail; // v4: bit3
+// Bool fixedspace_avail; // v4: bit4
+// Bool sound_avail; // v6: bit5
+// Bool timedkeyb_avail; // v4: bit7
+// // Addresses
+// Byte_address highmem_base; // [$04]
+// Byte_address start_pc; // [$06], v1
+// Packed_address start_routine; // [$06], v6
+// Byte_address dictionary; // [$08]
+// Byte_address objects; // [$0A]
+// Byte_address globals; // [$0C]
+// Byte_address static_base; // [$0E]
+// // [$10] Flags2
+// Bool transcript_on; // v1: bit0
+// Bool print_fixedfont; // v3: bit1
+// Bool request_redraw; // v6: bit2
+// Bool want_pics; // v5: bit3
+// Bool want_undo; // v5: bit4
+// Bool want_mouse; // v5: bit5
+// Bool want_colors; // v5: bit6
+// Bool want_sound; // v5: bit7
+// Bool want_menus; // v5: bit8
+// //
+// Byte_address abbrevs; // [$18], v2
+// Word file_length; // [$1A], v3
+// Word checksum; // [$1C], v3
+// Byte interpreter_number; // [$1E], v4
+// Byte interpreter_version; // [$1F], v4
+// // Screen
+// Byte screen_lines; // [$20], v4 ($FF = infinite)
+// Byte screen_chars; // [$21], v4
+// Word screen_width; // [$22], v5
+// Word screen_height; // [$24], v5
+// Byte font_width; // [$26], v5/v6
+// Byte font_height; // [$27], v5/v6
+// // Tables
+// Offset8 routines; // [$28], v6
+// Offset8 strings; // [$2A], v6
+// Byte backcolor; // [$2C], v5
+// Byte forecolor; // [$2D], v5
+// Byte_address term_chartable; // [$2E], v5
+// Word width3; // [$30], v6
+// Word revnumber; // [$32], v1
+// Byte_address alphabet; // [$34], v5
+// Byte_address header_ext; // [$36], v5
//} Program_header_struct;
enum MODE_FLAGS
{
- COLOR_AVAILABLE = 0,
- DISPLAY_AVAILABLE = 1,
- BOLD_AVAILABLE = 2,
- ITALIC_AVAILABLE = 4,
- MONOSPACE_AVAILABLE = 8
+ COLOR_AVAILABLE = 0,
+ DISPLAY_AVAILABLE = 1,
+ BOLD_AVAILABLE = 2,
+ ITALIC_AVAILABLE = 4,
+ MONOSPACE_AVAILABLE = 8
};
-typedef struct {
- Byte version; // 1..6
- Byte mode;
- Word release;
- Word resident_size;
- Word startPC;
- Word dictionaryTableOffset;
- Word objectsTableOffset;
- Word globalsTableOffset;
- Word dynamic_size;
- Word flags;
- unsigned char serial[6];
- Word h_abbreviations;
- Word h_file_size;
- Word checkSum;
- unsigned char interpreterNumber;
- unsigned char interpreterVersion;
- unsigned char H_SCREEN_ROWS;
- unsigned char H_SCREEN_COLS;
- Word H_SCREEN_WIDTH;
- Word H_SCREEN_HEIGHT;
- unsigned char H_FONT_HEIGHT; /* this is the font width in V5 */
- unsigned char H_FONT_WIDTH; /* this is the font height in V5 */
- Word H_FUNCTIONS_OFFSET;
- Word H_STRINGS_OFFSET;
- unsigned char H_DEFAULT_BACKGROUND;
- unsigned char H_DEFAULT_FOREGROUND;
- Word H_TERMINATING_KEYS;
- Word H_LINE_WIDTH;
- unsigned char H_STANDARD_HIGH;
- unsigned char H_STANDARD_LOW;
- Word H_ALPHABET;
- Word H_EXTENSION_TABLE;
- char USER_NAME[8];
+typedef struct
+{
+ Byte version; // 1..6
+ Byte mode;
+ Word release;
+ Word resident_size; // also it's a start of "high" memory region
+ Word startPC;
+ Word dictionaryTableOffset;
+ Word objectsTableOffset;
+ Word globalsTableOffset;
+ Word dynamic_size; // also it's a start of "static" memory region
+ Word flags;
+ unsigned char serial[6];
+ Word h_abbreviations;
+ Word h_file_size;
+ Word checkSum;
+ unsigned char interpreterNumber;
+ unsigned char interpreterVersion;
+ unsigned char H_SCREEN_ROWS;
+ unsigned char H_SCREEN_COLS;
+ Word H_SCREEN_WIDTH;
+ Word H_SCREEN_HEIGHT;
+ unsigned char H_FONT_HEIGHT; /* this is the font width in V5 */
+ unsigned char H_FONT_WIDTH; /* this is the font height in V5 */
+ Word H_FUNCTIONS_OFFSET;
+ Word H_STRINGS_OFFSET;
+ unsigned char H_DEFAULT_BACKGROUND;
+ unsigned char H_DEFAULT_FOREGROUND;
+ Word H_TERMINATING_KEYS;
+ Word H_LINE_WIDTH;
+ unsigned char H_STANDARD_HIGH;
+ unsigned char H_STANDARD_LOW;
+ Word H_ALPHABET;
+ Word H_EXTENSION_TABLE;
+ char USER_NAME[8];
} Program_header_struct;
-extern Program_header_struct Program_header;
-void program_header_reset(unsigned zversion);
-ZMemblock *program_header_build(void);
+extern Program_header_struct program_header;
+
+void program_header_reset (unsigned zversion);
+ZMemblock *program_header_build (void);
-typedef struct {
- Byte numberOfSelfinseringCharacters;
- Byte *pSymbols;
- Byte numberOfBytesInEachEntry;
+typedef struct
+{
+ Byte numberOfSelfinseringCharacters;
+ Byte *pSymbols;
+ Byte numberOfBytesInEachEntry;
-} Program_dictionary_struct ;
+} Program_dictionary_struct;
-void outputToFile(Program_header_struct *h, FILE* file);
+void outputToFile (Program_header_struct * h, FILE * file);
-#endif /* ifndef ZILASM_HEADER */
+//void relase_parser ();
+#endif /* ifndef ZILASM_HEADER */