1 /* 2 Init 3 */ 4 5 #include "init.h" 6 7 #include "addr.h" 8 #include "head.h" 9 #include "input.h" 10 #include "message.h" 11 #include "mem.h" 12 #include "page.h" 13 #include "random.h" 14 #include "shared.h" 15 #include "stop.h" 16 #include "support.h" 17 #include "var.h" 18 19 #define MAX_BYTES ((word)0xFE00) 20 init(void)21void init(void) 22 { 23 char *error = "Not enough memory"; 24 if(pg_head()) 25 { 26 if(init_addr()) 27 { 28 word minimum = hd_resident_blocks(); 29 word maximum = hd_version() >= VERSION_3 30 ? pg_blocks(ad_raw_addr(hd_verify())) : 256; 31 if(pg_init(minimum, maximum)) 32 { 33 init_input(); 34 init_message(); 35 seed_random(); 36 error = 0; 37 } 38 } 39 else 40 { 41 error = "Infocom file with bad version number (not 1 through 8)"; 42 } 43 } 44 if(error) 45 { 46 display((byte *) error); 47 quit(); 48 } 49 } 50