; SkoolKit disassembly for Through the Trap Door ; ; Copyright (c) 2017 Philip M. Anderson (this disassembly) ; Copyright (c) 1987 Don Priestley / Piranha / Alternative Software Ltd (Through the Trap Door) @start=34200 @org ; System Data / BASIC Program / System Variables b23296 DEFB 0,0,0,0,0,0,0,0 23304 DEFB 0,0,0,0,0,0,0,0 23312 DEFB 0,0,0,0,0,0,0,0 23320 DEFB 0,0,0,0,0,0,0,0 23328 DEFB 0,0,0,0,0,0,0,0 23336 DEFB 0,0,0,0,0,0,0,0 23344 DEFB 0,0,0,0,0,0,0,0 23352 DEFB 0,0,0,0,0,0,0,0 23360 DEFB 0,0,0,0,0,0,0,0 23368 DEFB 0,0,0,0,0,0,0,0 23376 DEFB 0,0,0,0,0,0,0,0 23384 DEFB 0,0,0,0,0,0,0,0 23392 DEFB 0,0,0,0,0,0,0,0 23400 DEFB 0,0,0,0,0,0,0,0 23408 DEFB 0,0,0,0,0,0,0,0 23416 DEFB 0,0,0,0,0,0,0,0 23424 DEFB 0,0,0,0,0,0,0,0 23432 DEFB 0,0,0,0,0,0,0,0 23440 DEFB 0,0,0,0,0,0,0,0 23448 DEFB 0,0,0,0,0,0,0,0 23456 DEFB 0,0,0,0,0,0,0,0 23464 DEFB 0,0,0,0,0,0,0,0 23472 DEFB 0,0,0,0,0,0,0,0 23480 DEFB 0,0,0,0,0,0,0,0 23488 DEFB 0,0,0,0,0,0,0,0 23496 DEFB 0,0,0,0,0,0,0,0 23504 DEFB 0,0,0,0,0,0,0,0 23512 DEFB 0,0,0,0,0,0,0,0 23520 DEFB 0,0,0,0,0,0,0,0 23528 DEFB 0,0,0,0,0,0,0,0 23536 DEFB 0,0,0,0,0,0,0,0 23544 DEFB 0,0,0,0,0,0,0,0 23552 DEFB 0,0,0,0,0,0,0,0 23560 DEFB 0,0,0,0,0,0,0,0 23568 DEFB 0,0,0,0,0,0,0,0 23576 DEFB 0,0,0,0,0,0,0,0 23584 DEFB 0,0,0,0,0,0,0,0 23592 DEFB 0,0,0,0,0,0,0,0 23600 DEFB 0,0,0,0,0,0,0,0 23608 DEFB 0,0,0,0,0,0,0,0 23616 DEFB 0,0,0,0,0,0,0,0 23624 DEFB 0,0,0 ; VARS system variable @ssub=DEFW 23909 b23627 DEFW 0 23629 DEFB 0,0,0,0,0,0 ; PROG system variable @ssub=DEFW 23755 b23635 DEFW 0 23637 DEFB 0,0,0,0,0,0,0,0 23645 DEFB 0,0,0,0,0,0,0,0 23653 DEFB 0,0,0,0,0,0,0,0 23661 DEFB 0,0,0,0,0,0,0,0 23669 DEFB 0,0,0,0,0,0,0,0 23677 DEFB 0,0,0,0,0,0,0,0 23685 DEFB 0,0,0,0,0,0,0,0 23693 DEFB 0,0,0,0,0,0,0,0 23701 DEFB 0,0,0,0,0,0,0,0 23709 DEFB 0,0,0,0,0,0,0,0 23717 DEFB 0,0,0,0,0,0,0,0 23725 DEFB 0,0,0,0,0,0,0,0 23733 DEFB 0,0,0,0,0,0,0,0 23741 DEFB 0,0,0,0,0,0,0,0 23749 DEFB 0,0,0,0,0,0 ; Basic loader ; ; The basic loader is set to auto-run from line 1. The POKE statement sets the border colour to blue, and the ; attribute for the lower part of the screen to 9 (blue INK, blue PAPER). Following this, the program loads a block ; of code of length 50 bytes to address #R63000. This code block contains the rest of the loading routine, and is ; jumped to after it is loaded. b23755 DEFB 0,0,0,0,0,0,0,0 ; 1 REM {0x00}TtTRAPDOOR{UDG-K}{0x00}{0x01}{0x00}{UDG-K}{0x00}*** 10 PAPER 1: INK 1:: ; BORDER 1: CLEAR 26998: POKE 23624,9 20 LOAD ""CODE 63000: RANDOMIZE USR 63000 200 LOAD ; ""CODE : LOAD ""SCREEN$ : RANDOMIZE USR 34200 23763 DEFB 0,0,0,0,0,0,0,0 23771 DEFB 0,0,0,0,0,0,0,0 23779 DEFB 0,0,0,0,0,0,0,0 23787 DEFB 0,0,0,0,0,0,0,0 23795 DEFB 0,0,0,0,0,0,0,0 23803 DEFB 0,0,0,0,0,0,0,0 23811 DEFB 0,0,0,0,0,0,0,0 23819 DEFB 0,0,0,0,0,0,0,0 23827 DEFB 0,0,0,0,0,0,0,0 23835 DEFB 0,0,0,0,0,0,0,0 23843 DEFB 0,0,0,0,0,0,0,0 23851 DEFB 0,0,0,0,0,0,0,0 23859 DEFB 0,0,0,0,0,0,0,0 23867 DEFB 0,0,0,0,0,0,0,0 23875 DEFB 0,0,0,0,0,0,0,0 23883 DEFB 0,0,0,0,0,0,0,0 23891 DEFB 0,0,0,0,0,0,0,0 23899 DEFB 0,0,0,0,0,0,0,0 23907 DEFB 0,0 ; Variables b23909 DEFB 0,0,0 23912 DEFB 0,0,0,0,0,0,0,0 23920 DEFB 0,0,0,0,0,0,0,0 23928 DEFB 0,0,0,0,0,0,0,0 23936 DEFB 0,0,0,0,0,0,0,0 23944 DEFB 0,0,0,0,0,0,0,0 23952 DEFB 0,0,0,0,0,0,0,0 23960 DEFB 0,0,0,0,0,0,0,0 23968 DEFB 0,0,0,0,0,0,0,0 23976 DEFB 0,0,0,0,0,0,0,0 23984 DEFB 0,0,0,0,0,0,0,0 23992 DEFB 0,0,0,0,0,0,0,0 24000 DEFB 0,0,0,0,0,0,0,0 24008 DEFB 0,0,0,0,0,0,0,0 24016 DEFB 0,0,0,0,0,0,0,0 24024 DEFB 0,0,0,0,0,0,0,0 24032 DEFB 0,0,0,0,0,0,0,0 24040 DEFB 0,0,0,0,0,0,0,0 24048 DEFB 0,0,0,0,0,0,0,0 24056 DEFB 0,0,0,0,0,0,0,0 24064 DEFB 0,0,0,0,0,0,0,0 24072 DEFB 0,0,0,0,0,0,0,0 24080 DEFB 0,0,0,0,0,0,0,0 24088 DEFB 0,0,0,0,0,0,0,0 24096 DEFB 0,0,0,0,0,0,0,0 24104 DEFB 0,0,0,0,0,0,0,0 24112 DEFB 0,0,0,0,0,0,0,0 24120 DEFB 0,0,0,0,0,0,0,0 24128 DEFB 0,0,0,0,0,0,0,0 24136 DEFB 0,0,0,0,0,0,0,0 24144 DEFB 0,0,0,0,0,0,0,0 24152 DEFB 0,0,0,0,0,0,0,0 24160 DEFB 0,0,0,0,0,0,0,0 24168 DEFB 0,0,0,0,0,0,0,0 24176 DEFB 0,0,0,0,0,0,0,0 24184 DEFB 0,0,0,0,0,0,0,0 24192 DEFB 0,0,0,0,0,0,0,0 24200 DEFB 0,0,0,0,0,0,0,0 24208 DEFB 0,0,0,0,0,0,0,0 24216 DEFB 0,0,0,0,0,0,0,0 24224 DEFB 0,0,0,0,0,0,0,0 24232 DEFB 0,0,0,0,0,0,0,0 24240 DEFB 0,0,0,0,0,0,0,0 24248 DEFB 0,0,0,0,0,0,0,0 24256 DEFB 0,0,0,0,0,0,0,0 24264 DEFB 0,0,0,0,0,0,0,0 24272 DEFB 0,0,0,0,0,0,0,0 24280 DEFB 0,0,0,0,0,0,0,0 24288 DEFB 0,0,0,0,0,0,0,0 24296 DEFB 0,0,0,0,0,0,0,0 24304 DEFB 0,0,0,0,0,0,0,0 24312 DEFB 0,0,0,0,0,0,0,0 24320 DEFB 0,0,0,0,0,0,0,0 24328 DEFB 0,0,0,0,0,0,0,0 24336 DEFB 0,0,0,0,0,0,0,0 24344 DEFB 0,0,0,0,0,0,0,0 24352 DEFB 0,0,0,0,0,0,0,0 24360 DEFB 0,0,0,0,0,0,0,0 24368 DEFB 0,0,0,0,0,0,0,0 24376 DEFB 0,0,0,0,0,0,0,0 24384 DEFB 0,0,0,0,0,0,0,0 24392 DEFB 0,0,0,0,0,0,0,0 24400 DEFB 0,0,0,0,0,0,0,0 24408 DEFB 0,0,0,0,0,0,0,0 24416 DEFB 0,0,0,0,0,0,0,0 24424 DEFB 0,0,0,0,0,0,0,0 24432 DEFB 0,0,0,0,0,0,0,0 24440 DEFB 0,0,0,0,0,0,0,0 24448 DEFB 0,0,0,0,0,0,0,0 24456 DEFB 0,0,0,0,0,0,0,0 24464 DEFB 0,0,0,0,0,0,0,0 24472 DEFB 0,0,0,0,0,0,0,0 24480 DEFB 0,0,0,0,0,0,0,0 24488 DEFB 0,0,0,0,0,0,0,0 24496 DEFB 0,0,0,0,0,0,0,0 24504 DEFB 0,0,0,0,0,0,0,0 24512 DEFB 0,0,0,0,0,0,0,0 24520 DEFB 0,0,0,0,0,0,0,0 24528 DEFB 0,0,0,0,0,0,0,0 24536 DEFB 0,0,0,0,0,0,0,0 24544 DEFB 0,0,0,0,0,0,0,0 24552 DEFB 0,0,0,0,0,0,0,0 24560 DEFB 0,0,0,0,0,0,0,0 24568 DEFB 0,0,0,0,0,0,0,0 24576 DEFB 0,0,0,0,0,0,0,0 24584 DEFB 0,0,0,0,0,0,0,0 24592 DEFB 0,0,0,0,0,0,0,0 24600 DEFB 0,0,0,0,0,0,0,0 24608 DEFB 0,0,0,0,0,0,0,0 24616 DEFB 0,0,0,0,0,0,0,0 24624 DEFB 0,0,0,0,0,0,0,0 24632 DEFB 0,0,0,0,0,0,0,0 24640 DEFB 0,0,0,0,0,0,0,0 24648 DEFB 0,0,0,0,0,0,0,0 24656 DEFB 0,0,0,0,0,0,0,0 24664 DEFB 0,0,0,0,0,0,0,0 24672 DEFB 0,0,0,0,0,0,0,0 24680 DEFB 0,0,0,0,0,0,0,0 24688 DEFB 0,0,0,0,0,0,0,0 24696 DEFB 0,0,0,0,0,0,0,0 24704 DEFB 0,0,0,0,0,0,0,0 24712 DEFB 0,0,0,0,0,0,0,0 24720 DEFB 0,0,0,0,0,0,0,0 24728 DEFB 0,0,0,0,0,0,0,0 24736 DEFB 0,0,0,0,0,0,0,0 24744 DEFB 0,0,0,0,0,0,0,0 24752 DEFB 0,0,0,0,0,0,0,0 24760 DEFB 0,0,0,0,0,0,0,0 24768 DEFB 0,0,0,0,0,0,0,0 24776 DEFB 0,0,0,0,0,0,0,0 24784 DEFB 0,0,0,0,0,0,0,0 24792 DEFB 0,0,0,0,0,0,0,0 24800 DEFB 0,0,0,0,0,0,0,0 24808 DEFB 0,0,0,0,0,0,0,0 24816 DEFB 0,0,0,0,0,0,0,0 24824 DEFB 0,0,0,0,0,0,0,0 24832 DEFB 0,0,0,0,0,0,0,0 24840 DEFB 0,0,0,0,0,0,0,0 24848 DEFB 0,0,0,0,0,0,0,0 24856 DEFB 0,0,0,0,0,0,0,0 24864 DEFB 0,0,0,0,0,0,0,0 24872 DEFB 0,0,0,0,0,0,0,0 24880 DEFB 0,0,0,0,0,0,0,0 24888 DEFB 0,0,0,0,0,0,0,0 24896 DEFB 0,0,0,0,0,0,0,0 24904 DEFB 0,0,0,0,0,0,0,0 24912 DEFB 0,0,0,0,0,0,0,0 24920 DEFB 0,0,0,0,0,0,0,0 24928 DEFB 0,0,0,0,0,0,0,0 24936 DEFB 0,0,0,0,0,0,0,0 24944 DEFB 0,0,0,0,0,0,0,0 24952 DEFB 0,0,0,0,0,0,0,0 24960 DEFB 0,0,0,0,0,0,0,0 24968 DEFB 0,0,0,0,0,0,0,0 24976 DEFB 0,0,0,0,0,0,0,0 24984 DEFB 0,0,0,0,0,0,0,0 24992 DEFB 0,0,0,0,0,0,0,0 25000 DEFB 0,0,0,0,0,0,0,0 25008 DEFB 0,0,0,0,0,0,0,0 25016 DEFB 0,0,0,0,0,0,0,0 25024 DEFB 0,0,0,0,0,0,0,0 25032 DEFB 0,0,0,0,0,0,0,0 25040 DEFB 0,0,0,0,0,0,0,0 25048 DEFB 0,0,0,0,0,0,0,0 25056 DEFB 0,0,0,0,0,0,0,0 25064 DEFB 0,0,0,0,0,0,0,0 25072 DEFB 0,0,0,0,0,0,0,0 25080 DEFB 0,0,0,0,0,0,0,0 25088 DEFB 0,0,0,0,0,0,0,0 25096 DEFB 0,0,0,0,0,0,0,0 25104 DEFB 0,0,0,0,0,0,0,0 25112 DEFB 0,0,0,0,0,0,0,0 25120 DEFB 0,0,0,0,0,0,0,0 25128 DEFB 0,0,0,0,0,0,0,0 25136 DEFB 0,0,0,0,0,0,0,0 25144 DEFB 0,0,0,0,0,0,0,0 25152 DEFB 0,0,0,0,0,0,0,0 25160 DEFB 0,0,0,0,0,0,0,0 25168 DEFB 0,0,0,0,0,0,0,0 25176 DEFB 0,0,0,0,0,0,0,0 25184 DEFB 0,0,0,0,0,0,0,0 25192 DEFB 0,0,0,0,0,0,0,0 25200 DEFB 0,0,0,0,0,0,0,0 25208 DEFB 0,0,0,0,0,0,0,0 25216 DEFB 0,0,0,0,0,0,0,0 25224 DEFB 0,0,0,0,0,0,0,0 25232 DEFB 0,0,0,0,0,0,0,0 25240 DEFB 0,0,0,0,0,0,0,0 25248 DEFB 0,0,0,0,0,0,0,0 25256 DEFB 0,0,0,0,0,0,0,0 25264 DEFB 0,0,0,0,0,0,0,0 25272 DEFB 0,0,0,0,0,0,0,0 25280 DEFB 0,0,0,0,0,0,0,0 25288 DEFB 0,0,0,0,0,0,0,0 25296 DEFB 0,0,0,0,0,0,0,0 25304 DEFB 0,0,0,0,0,0,0,0 25312 DEFB 0,0,0,0,0,0,0,0 25320 DEFB 0,0,0,0,0,0,0,0 25328 DEFB 0,0,0,0,0,0,0,0 25336 DEFB 0,0,0,0,0,0,0,0 25344 DEFB 0,0,0,0,0,0,0,0 25352 DEFB 0,0,0,0,0,0,0,0 25360 DEFB 0,0,0,0,0,0,0,0 25368 DEFB 0,0,0,0,0,0,0,0 25376 DEFB 0,0,0,0,0,0,0,0 25384 DEFB 0,0,0,0,0,0,0,0 25392 DEFB 0,0,0,0,0,0,0,0 25400 DEFB 0,0,0,0,0,0,0,0 25408 DEFB 0,0,0,0,0,0,0,0 25416 DEFB 0,0,0,0,0,0,0,0 25424 DEFB 0,0,0,0,0,0,0,0 25432 DEFB 0,0,0,0,0,0,0,0 25440 DEFB 0,0,0,0,0,0,0,0 25448 DEFB 0,0,0,0,0,0,0,0 25456 DEFB 0,0,0,0,0,0,0,0 25464 DEFB 0,0,0,0,0,0,0,0 25472 DEFB 0,0,0,0,0,0,0,0 25480 DEFB 0,0,0,0,0,0,0,0 25488 DEFB 0,0,0,0,0,0,0,0 25496 DEFB 0,0,0,0,0,0,0,0 25504 DEFB 0,0,0,0,0,0,0,0 25512 DEFB 0,0,0,0,0,0,0,0 25520 DEFB 0,0,0,0,0,0,0,0 25528 DEFB 0,0,0,0,0,0,0,0 25536 DEFB 0,0,0,0,0,0,0,0 25544 DEFB 0,0,0,0,0,0,0,0 25552 DEFB 0,0,0,0,0,0,0,0 25560 DEFB 0,0,0,0,0,0,0,0 25568 DEFB 0,0,0,0,0,0,0,0 25576 DEFB 0,0,0,0,0,0,0,0 25584 DEFB 0,0,0,0,0,0,0,0 25592 DEFB 0,0,0,0,0,0,0,0 25600 DEFB 0,0,0,0,0,0,0,0 25608 DEFB 0,0,0,0,0,0,0,0 25616 DEFB 0,0,0,0,0,0,0,0 25624 DEFB 0,0,0,0,0,0,0,0 25632 DEFB 0,0,0,0,0,0,0,0 25640 DEFB 0,0,0,0,0,0,0,0 25648 DEFB 0,0,0,0,0,0,0,0 25656 DEFB 0,0,0,0,0,0,0,0 25664 DEFB 0,0,0,0,0,0,0,0 25672 DEFB 0,0,0,0,0,0,0,0 25680 DEFB 0,0,0,0,0,0,0,0 25688 DEFB 0,0,0,0,0,0,0,0 25696 DEFB 0,0,0,0,0,0,0,0 25704 DEFB 0,0,0,0,0,0,0,0 25712 DEFB 0,0,0,0,0,0,0,0 25720 DEFB 0,0,0,0,0,0,0,0 25728 DEFB 0,0,0,0,0,0,0,0 25736 DEFB 0,0,0,0,0,0,0,0 25744 DEFB 0,0,0,0,0,0,0,0 25752 DEFB 0,0,0,0,0,0,0,0 25760 DEFB 0,0,0,0,0,0,0,0 25768 DEFB 0,0,0,0,0,0,0,0 25776 DEFB 0,0,0,0,0,0,0,0 25784 DEFB 0,0,0,0,0,0,0,0 25792 DEFB 0,0,0,0,0,0,0,0 25800 DEFB 0,0,0,0,0,0,0,0 25808 DEFB 0,0,0,0,0,0,0,0 25816 DEFB 0,0,0,0,0,0,0,0 25824 DEFB 0,0,0,0,0,0,0,0 25832 DEFB 0,0,0,0,0,0,0,0 25840 DEFB 0,0,0,0,0,0,0,0 25848 DEFB 0,0,0,0,0,0,0,0 25856 DEFB 0,0,0,0,0,0,0,0 25864 DEFB 0,0,0,0,0,0,0,0 25872 DEFB 0,0,0,0,0,0,0,0 25880 DEFB 0,0,0,0,0,0,0,0 25888 DEFB 0,0,0,0,0,0,0,0 25896 DEFB 0,0,0,0,0,0,0,0 25904 DEFB 0,0,0,0,0,0,0,0 25912 DEFB 0,0,0,0,0,0,0,0 25920 DEFB 0,0,0,0,0,0,0,0 25928 DEFB 0,0,0,0,0,0,0,0 25936 DEFB 0,0,0,0,0,0,0,0 25944 DEFB 0,0,0,0,0,0,0,0 25952 DEFB 0,0,0,0,0,0,0,0 25960 DEFB 0,0,0,0,0,0,0,0 25968 DEFB 0,0,0,0,0,0,0,0 25976 DEFB 0,0,0,0,0,0,0,0 25984 DEFB 0,0,0,0,0,0,0,0 25992 DEFB 0,0,0,0,0,0,0,0 26000 DEFB 0,0,0,0,0,0,0,0 26008 DEFB 0,0,0,0,0,0,0,0 26016 DEFB 0,0,0,0,0,0,0,0 26024 DEFB 0,0,0,0,0,0,0,0 26032 DEFB 0,0,0,0,0,0,0,0 26040 DEFB 0,0,0,0,0,0,0,0 26048 DEFB 0,0,0,0,0,0,0,0 26056 DEFB 0,0,0,0,0,0,0,0 26064 DEFB 0,0,0,0,0,0,0,0 26072 DEFB 0,0,0,0,0,0,0,0 26080 DEFB 0,0,0,0,0,0,0,0 26088 DEFB 0,0,0,0,0,0,0,0 26096 DEFB 0,0,0,0,0,0,0,0 26104 DEFB 0,0,0,0,0,0,0,0 26112 DEFB 0,0,0,0,0,0,0,0 26120 DEFB 0,0,0,0,0,0,0,0 26128 DEFB 0,0,0,0,0,0,0,0 26136 DEFB 0,0,0,0,0,0,0,0 26144 DEFB 0,0,0,0,0,0,0,0 26152 DEFB 0,0,0,0,0,0,0,0 26160 DEFB 0,0,0,0,0,0,0,0 26168 DEFB 0,0,0,0,0,0,0,0 26176 DEFB 0,0,0,0,0,0,0,0 26184 DEFB 0,0,0,0,0,0,0,0 26192 DEFB 0,0,0,0,0,0,0,0 26200 DEFB 0,0,0,0,0,0,0,0 26208 DEFB 0,0,0,0,0,0,0,0 26216 DEFB 0,0,0,0,0,0,0,0 26224 DEFB 0,0,0,0,0,0,0,0 26232 DEFB 0,0,0,0,0,0,0,0 26240 DEFB 0,0,0,0,0,0,0,0 26248 DEFB 0,0,0,0,0,0,0,0 26256 DEFB 0,0,0,0,0,0,0,0 26264 DEFB 0,0,0,0,0,0,0,0 26272 DEFB 0,0,0,0,0,0,0,0 26280 DEFB 0,0,0,0,0,0,0,0 26288 DEFB 0,0,0,0,0,0,0,0 26296 DEFB 0,0,0,0,0,0,0,0 26304 DEFB 0,0,0,0,0,0,0,0 26312 DEFB 0,0,0,0,0,0,0,0 26320 DEFB 0,0,0,0,0,0,0,0 26328 DEFB 0,0,0,0,0,0,0,0 26336 DEFB 0,0,0,0,0,0,0,0 26344 DEFB 0,0,0,0,0,0,0,0 26352 DEFB 0,0,0,0,0,0,0,0 26360 DEFB 0,0,0,0,0,0,0,0 26368 DEFB 0,0,0,0,0,0,0,0 26376 DEFB 0,0,0,0,0,0,0,0 26384 DEFB 0,0,0,0,0,0,0,0 26392 DEFB 0,0,0,0,0,0,0,0 26400 DEFB 0,0,0,0,0,0,0,0 26408 DEFB 0,0,0,0,0,0,0,0 26416 DEFB 0,0,0,0,0,0,0,0 26424 DEFB 0,0,0,0,0,0,0,0 26432 DEFB 0,0,0,0,0,0,0,0 26440 DEFB 0,0,0,0,0,0,0,0 26448 DEFB 0,0,0,0,0,0,0,0 26456 DEFB 0,0,0,0,0,0,0,0 26464 DEFB 0,0,0,0,0,0,0,0 26472 DEFB 0,0,0,0,0,0,0,0 26480 DEFB 0,0,0,0,0,0,0,0 26488 DEFB 0,0,0,0,0,0,0,0 26496 DEFB 0,0,0,0,0,0,0,0 26504 DEFB 0,0,0,0,0,0,0,0 26512 DEFB 0,0,0,0,0,0,0,0 26520 DEFB 0,0,0,0,0,0,0,0 26528 DEFB 0,0,0,0,0,0,0,0 26536 DEFB 0,0,0,0,0,0,0,0 26544 DEFB 0,0,0,0,0,0,0,0 26552 DEFB 0,0,0,0,0,0,0,0 26560 DEFB 0,0,0,0,0,0,0,0 26568 DEFB 0,0,0,0,0,0,0,0 26576 DEFB 0,0,0,0,0,0,0,0 26584 DEFB 0,0,0,0,0,0,0,0 26592 DEFB 0,0,0,0,0,0,0,0 26600 DEFB 0,0,0,0,0,0,0,0 26608 DEFB 0,0,0,0,0,0,0,0 26616 DEFB 0,0,0,0,0,0,0,0 26624 DEFB 0,0,0,0,0,0,0,0 26632 DEFB 0,0,0,0,0,0,0,0 26640 DEFB 0,0,0,0,0,0,0,0 26648 DEFB 0,0,0,0,0,0,0,0 26656 DEFB 0,0,0,0,0,0,0,0 26664 DEFB 0,0,0,0,0,0,0,0 26672 DEFB 0,0,0,0,0,0,0,0 26680 DEFB 0,0,0,0,0,0,0,0 26688 DEFB 0,0,0,0,0,0,0,0 26696 DEFB 0,0,0,0,0,0,0,0 26704 DEFB 0,0,0,0,0,0,0,0 26712 DEFB 0,0,0,0,0,0,0,0 26720 DEFB 0,0,0,0,0,0,0,0 26728 DEFB 0,0,0,0,0,0,0,0 26736 DEFB 0,0,0,0,0,0,0,0 26744 DEFB 0,0,0,0,0,0,0,0 26752 DEFB 0,0,0,0,0,0,0,0 26760 DEFB 0,0,0,0,0,0,0,0 26768 DEFB 0,0,0,0,0,0,0,0 26776 DEFB 0,0,0,0,0,0,0,0 26784 DEFB 0,0,0,0,0,0,0,0 26792 DEFB 0,0,0,0,0,0,0,0 26800 DEFB 0,0,0,0,0,0,0,0 26808 DEFB 0,0,0,0,0,0,0,0 26816 DEFB 0,0,0,0,0,0,0,0 26824 DEFB 0,0,0,0,0,0,0,0 26832 DEFB 0,0,0,0,0,0,0,0 26840 DEFB 0,0,0,0,0,0,0,0 26848 DEFB 0,0,0,0,0,0,0,0 26856 DEFB 0,0,0,0,0,0,0,0 26864 DEFB 0,0,0,0,0,0,0,0 26872 DEFB 0,0,0,0,0,0,0,0 26880 DEFB 0,0,0,0,0,0,0,0 26888 DEFB 0,0,0,0,0,0,0,0 26896 DEFB 0,0,0,0,0,0,0,0 26904 DEFB 0,0,0,0,0,0,0,0 26912 DEFB 0,0,0,0,0,0,0,0 26920 DEFB 0,0,0,0,0,0,0,0 26928 DEFB 0,0,0,0,0,0,0,0 26936 DEFB 0,0,0,0,0,0,0,0 26944 DEFB 0,0,0,0,0,0,0,0 26952 DEFB 0,0,0,0,0,0,0,0 26960 DEFB 0,0,0,0,0,0,0,0 26968 DEFB 0,0,0,0,0,0,0,0 26976 DEFB 0,0,0,0,0,0,0,0 26984 DEFB 0,0,0,0,0,0,0,0 26992 DEFB 0,0,0,0,0,0,0,0 ; Table of Graphic Sets' Start Addresses ; ; These addresses represent the location that would be occupied by the zeroth eight-byte graphic in each graphic ; set. However as zero is not an allowed value for a graphic index, the actual start of the graphic data for each ; set is eight bytes further on than the address given here. For example, Graphic Set 03 has a start address here of ; 27278, however the UDG with an index of 1 (which is the true start of the graphic data for Set 03) is at #R27286. ; The address given here (#R27278) is actually an address in the previous data block at #R27030. b27000 DEFW 0 ; Graphic Set 0 (unused) 27002 DEFW 3850 ; Graphic Set 1 (uses ROM data) 27004 DEFW 32334 ; Graphic Set 2 27006 DEFW 27278 ; Graphic Set 3 27008 DEFW 28070 ; Graphic Set 4 27010 DEFW 27782 ; Graphic Set 5 27012 DEFW 28838 ; Graphic Set 6 27014 DEFW 28366 ; Graphic Set 7 27016 DEFW 29718 ; Graphic Set 8 27018 DEFW 29350 ; Graphic Set 9 27020 DEFW 29990 ; Graphic Set 10 27022 DEFW 30662 ; Graphic Set 11 27024 DEFW 31246 ; Graphic Set 12 ; Unused b27026 DEFB 0,0,0,0 ; Bitmap Data Mirror Image Lookup Table ; ; A byte of graphic data (e.g. 1, with set pixel at right of character block) is the lookup index, and the retrieved ; value is the mirror image (e.g. 128, with set pixel at left of character block) b27030 DEFB 0,128,64,192,32,160,96,224 27038 DEFB 16,144,80,208,48,176,112,240 27046 DEFB 8,136,72,200,40,168,104,232 27054 DEFB 24,152,88,216,56,184,120,248 27062 DEFB 4,132,68,196,36,164,100,228 27070 DEFB 20,148,84,212,52,180,116,244 27078 DEFB 12,140,76,204,44,172,108,236 27086 DEFB 28,156,92,220,60,188,124,252 27094 DEFB 2,130,66,194,34,162,98,226 27102 DEFB 18,146,82,210,50,178,114,242 27110 DEFB 10,138,74,202,42,170,106,234 27118 DEFB 26,154,90,218,58,186,122,250 27126 DEFB 6,134,70,198,38,166,102,230 27134 DEFB 22,150,86,214,54,182,118,246 27142 DEFB 14,142,78,206,46,174,110,238 27150 DEFB 30,158,94,222,62,190,126,254 27158 DEFB 1,129,65,193,33,161,97,225 27166 DEFB 17,145,81,209,49,177,113,241 27174 DEFB 9,137,73,201,41,169,105,233 27182 DEFB 25,153,89,217,57,185,121,249 27190 DEFB 5,133,69,197,37,165,101,229 27198 DEFB 21,149,85,213,53,181,117,245 27206 DEFB 13,141,77,205,45,173,109,237 27214 DEFB 29,157,93,221,61,189,125,253 27222 DEFB 3,131,67,195,35,163,99,227 27230 DEFB 19,147,83,211,51,179,115,243 27238 DEFB 11,139,75,203,43,171,107,235 27246 DEFB 27,155,91,219,59,187,123,251 27254 DEFB 7,135,71,199,39,167,103,231 27262 DEFB 23,151,87,215,55,183,119,247 27270 DEFB 15,143,79,207,47,175,111,239 27278 DEFB 31,159,95,223,63,191,127,255 ; Graphics Set 03 b27286 DEFB 0,0,0,24,24,0,0,0 ; (01) 27294 DEFB 0,0,60,36,36,60,0,0 ; (02) 27302 DEFB 0,126,66,66,66,66,126,0 ; (03) 27310 DEFB 255,129,129,129,129,129,129,255 ; (04) 27318 DEFB 0,0,0,24,24,0,0,0 ; (05) 27326 DEFB 0,0,60,36,36,60,0,0 ; (06) 27334 DEFB 0,126,66,66,66,66,126,0 ; (07) 27342 DEFB 255,129,129,129,129,129,129,255 ; (08) 27350 DEFB 188,102,147,196,41,54,44,244 ; (09) 27358 DEFB 0,0,128,192,96,48,144,182 ; (10) 27366 DEFB 1,2,6,5,8,19,28,7 ; (11) 27374 DEFB 108,51,91,13,166,82,42,188 ; (12) 27382 DEFB 55,120,48,224,192,0,0,0 ; (13) 27390 DEFB 218,53,27,15,6,0,0,0 ; (14) 27398 DEFB 109,152,180,97,202,149,168,123 ; (15) 27406 DEFB 0,128,192,96,48,144,112,192 ; (16) 27414 DEFB 57,78,83,131,168,134,206,127 ; (17) 27422 DEFB 184,240,96,128,192,64,192,128 ; (18) 27430 DEFB 43,30,13,1,3,2,2,1 ; (19) 27438 DEFB 60,102,215,129,43,77,175,252 ; (20) 27446 DEFB 0,63,68,43,84,65,110,63 ; (21) 27454 DEFB 0,63,71,80,71,122,97,63 ; (22) 27462 DEFB 0,190,65,130,113,101,163,254 ; (23) 27470 DEFB 0,246,73,193,119,137,69,254 ; (24) 27478 DEFB 0,62,75,115,69,75,91,71 ; (25) 27486 DEFB 0,62,81,89,81,79,107,81 ; (26) 27494 DEFB 89,67,85,107,85,123,95,62 ; (27) 27502 DEFB 85,99,73,87,81,99,111,62 ; (28) 27510 DEFB 0,119,200,192,225,127,156,13 ; (29) 27518 DEFB 0,222,35,1,77,254,0,49 ; (30) 27526 DEFB 140,45,14,142,6,135,64,63 ; (31) 27534 DEFB 32,37,33,101,72,197,11,182 ; (32) 27542 DEFB 240,31,50,14,1,16,56,128 ; (33) 27550 DEFB 126,131,68,44,184,35,96,208 ; (34) 27558 DEFB 206,33,144,12,0,192,0,0 ; (35) 27566 DEFB 238,3,102,13,8,88,36,100 ; (36) 27574 DEFB 223,32,192,3,0,28,0,0 ; (37) 27582 DEFB 184,69,2,148,12,10,16,16 ; (38) 27590 DEFB 223,32,0,0,28,112,0,0 ; (39) 27598 DEFB 124,133,67,34,86,5,12,24 ; (40) 27606 DEFB 239,56,128,3,0,8,48,32 ; (41) 27614 DEFB 239,17,131,2,130,70,5,12 ; (42) 27622 DEFB 62,225,2,0,0,14,0,0 ; (43) 27630 DEFB 254,2,3,2,26,6,5,14 ; (44) 27638 DEFB 255,128,255,192,255,128,255,255 ; (45) 27646 DEFB 255,126,129,189,165,126,255,255 ; (46) 27654 DEFB 255,0,255,0,255,0,255,255 ; (47) 27662 DEFB 255,125,192,125,253,64,253,255 ; (48) 27670 DEFB 31,31,31,31,31,31,31,31 ; (49) 27678 DEFB 0,128,128,192,96,176,144,0 ; (50) 27686 DEFB 31,159,159,159,223,223,223,255 ; (51) 27694 DEFB 124,131,4,2,0,36,24,0 ; (52) 27702 DEFB 224,31,1,5,3,194,34,66 ; (53) 27710 DEFB 247,28,8,0,16,128,64,0 ; (54) 27718 DEFB 252,2,1,1,65,33,65,131 ; (55) 27726 DEFB 0,0,0,0,0,0,14,27 ; (56) 27734 DEFB 109,82,164,130,168,153,230,66 ; (57) 27742 DEFB 220,38,82,66,42,118,238,140 ; (58) 27750 DEFB 0,0,0,0,0,0,192,160 ; (59) 27758 DEFB 0,0,3,6,12,24,18,217 ; (60) 27766 DEFB 115,205,147,71,9,153,120,95 ; (61) 27774 DEFB 68,72,99,92,107,162,170,159 ; (62) 27782 DEFB 85,181,157,109,173,187,250,241 ; (63) ; Graphics Set 05 b27790 DEFB 55,120,48,224,192,0,3,12 ; (01) 27798 DEFB 64,64,64,32,63,224,32,32 ; (02) 27806 DEFB 1,2,2,4,4,252,10,17 ; (03) 27814 DEFB 184,240,96,128,192,65,194,244 ; (04) 27822 DEFB 144,97,102,152,152,22,33,66 ; (05) 27830 DEFB 127,144,16,16,31,113,145,146 ; (06) 27838 DEFB 224,56,68,67,224,19,12,20 ; (07) 27846 DEFB 193,38,24,104,132,130,66,65 ; (08) 27854 DEFB 15,4,4,4,4,4,4,4 ; (09) 27862 DEFB 194,122,135,129,129,129,142,112 ; (10) 27870 DEFB 74,45,218,63,246,169,72,136 ; (11) 27878 DEFB 100,132,127,132,8,176,65,50 ; (12) 27886 DEFB 64,63,225,66,132,132,8,8 ; (13) 27894 DEFB 190,192,0,0,0,0,0,0 ; (14) 27902 DEFB 5,6,25,97,16,8,8,4 ; (15) 27910 DEFB 129,2,4,8,151,96,64,128 ; (16) 27918 DEFB 116,11,8,8,232,23,8,8 ; (17) 27926 DEFB 12,247,1,0,0,192,63,0 ; (18) 27934 DEFB 16,32,160,64,48,12,242,1 ; (19) 27942 DEFB 3,2,4,8,16,32,64,0 ; (20) 27950 DEFB 64,48,12,2,0,0,0,0 ; (21) 27958 DEFB 0,0,0,0,1,3,6,12 ; (22) 27966 DEFB 60,126,255,255,255,255,255,90 ; (23) 27974 DEFB 0,0,0,15,31,25,25,14 ; (24) 27982 DEFB 126,255,153,195,189,255,195,126 ; (25) 27990 DEFB 102,102,66,66,36,0,0,0 ; (26) 27998 DEFB 102,102,195,129,129,66,0,0 ; (27) 28006 DEFB 0,0,0,15,31,27,31,14 ; (28) 28014 DEFB 24,144,144,200,76,102,50,29 ; (29) 28022 DEFB 16,8,16,8,16,8,16,8 ; (30) 28030 DEFB 16,16,8,8,16,16,8,8 ; (31) 28038 DEFB 1,2,2,4,4,8,8,48 ; (32) 28046 DEFB 16,8,8,4,4,2,3,1 ; (33) 28054 DEFB 7,28,16,24,12,6,3,1 ; (34) 28062 DEFB 90,255,255,255,255,126,126,60 ; (35) 28070 DEFB 7,15,15,6,0,0,0,0 ; (36) ; Graphics Set 04 b28078 DEFB 7,31,63,121,113,225,193,193 ; (01) 28086 DEFB 224,248,252,62,30,15,7,7 ; (02) 28094 DEFB 195,194,230,252,124,126,63,31 ; (03) 28102 DEFB 135,135,207,127,126,254,252,248 ; (04) 28110 DEFB 31,31,31,27,53,46,110,110 ; (05) 28118 DEFB 240,240,240,176,88,232,236,236 ; (06) 28126 DEFB 32,0,64,110,110,85,59,31 ; (07) 28134 DEFB 8,0,4,236,236,84,184,240 ; (08) 28142 DEFB 0,0,0,7,31,63,121,113 ; (09) 28150 DEFB 0,0,0,224,248,252,62,30 ; (10) 28158 DEFB 225,193,193,195,194,230,252,124 ; (11) 28166 DEFB 15,7,7,135,135,207,127,126 ; (12) 28174 DEFB 126,63,31,31,31,31,27,53 ; (13) 28182 DEFB 254,252,248,240,240,240,176,88 ; (14) 28190 DEFB 46,110,110,17,110,85,59,31 ; (15) 28198 DEFB 232,236,236,16,236,84,184,240 ; (16) 28206 DEFB 15,159,95,255,127,223,159,15 ; (17) 28214 DEFB 240,249,250,255,247,234,27,241 ; (18) 28222 DEFB 195,219,219,255,255,255,0,0 ; (19) 28230 DEFB 28,62,119,227,227,247,62,28 ; (20) 28238 DEFB 0,0,0,0,3,4,4,4 ; (21) 28246 DEFB 2,2,2,2,2,3,0,0 ; (22) 28254 DEFB 0,0,0,24,24,0,0,0 ; (23) 28262 DEFB 0,0,60,36,36,60,0,0 ; (24) 28270 DEFB 0,126,66,66,66,66,126,0 ; (25) 28278 DEFB 255,129,129,129,129,129,129,255 ; (26) 28286 DEFB 15,63,125,91,23,7,62,126 ; (27) 28294 DEFB 0,60,126,126,126,126,63,3 ; (28) 28302 DEFB 0,60,126,102,102,126,63,3 ; (29) 28310 DEFB 0,60,102,102,126,126,63,3 ; (30) 28318 DEFB 0,60,126,126,102,102,63,3 ; (31) 28326 DEFB 0,60,126,114,114,126,63,3 ; (32) 28334 DEFB 0,60,126,78,78,126,63,3 ; (33) 28342 DEFB 3,15,27,62,109,127,187,254 ; (34) 28350 DEFB 224,240,236,236,244,170,247,189 ; (35) 28358 DEFB 182,211,73,3,5,3,3,7 ; (36) 28366 DEFB 127,170,194,224,144,64,224,240 ; (37) ; Graphics Set 07 b28374 DEFB 0,0,0,0,231,189,189,255 ; (01) 28382 DEFB 0,0,0,0,0,231,231,231 ; (02) 28390 DEFB 126,60,126,189,60,60,60,60 ; (03) 28398 DEFB 60,60,60,60,60,126,126,126 ; (04) 28406 DEFB 0,0,0,7,11,11,7,0 ; (05) 28414 DEFB 0,0,0,0,240,248,252,60 ; (06) 28422 DEFB 0,0,30,39,39,39,39,30 ; (07) 28430 DEFB 56,56,56,56,60,31,15,3 ; (08) 28438 DEFB 0,0,0,0,0,128,224,240 ; (09) 28446 DEFB 0,0,0,0,191,255,255,240 ; (10) 28454 DEFB 126,255,255,247,231,231,231,195 ; (11) 28462 DEFB 0,0,0,0,0,0,0,0 ; (12) 28470 DEFB 0,0,0,0,0,0,0,0 ; (13) 28478 DEFB 0,0,0,0,0,0,0,0 ; (14) 28486 DEFB 0,0,0,0,0,0,0,0 ; (15) 28494 DEFB 0,0,0,0,0,0,0,0 ; (16) 28502 DEFB 0,0,0,0,0,0,0,0 ; (17) 28510 DEFB 0,0,0,0,0,0,0,0 ; (18) 28518 DEFB 0,0,0,0,0,0,0,0 ; (19) 28526 DEFB 0,0,0,0,0,0,0,0 ; (20) 28534 DEFB 0,0,0,0,0,0,0,0 ; (21) 28542 DEFB 0,0,0,0,0,0,0,0 ; (22) 28550 DEFB 0,0,0,0,0,0,0,0 ; (23) 28558 DEFB 0,0,0,0,0,0,0,0 ; (24) 28566 DEFB 0,0,0,0,0,0,0,0 ; (25) 28574 DEFB 0,0,0,0,0,0,0,0 ; (26) 28582 DEFB 0,0,0,0,0,0,0,0 ; (27) 28590 DEFB 0,0,0,0,0,0,0,0 ; (28) 28598 DEFB 0,0,0,0,0,0,0,0 ; (29) 28606 DEFB 0,0,0,0,0,0,0,0 ; (30) 28614 DEFB 0,0,0,0,0,0,0,0 ; (31) 28622 DEFB 0,0,0,0,0,0,0,0 ; (32) 28630 DEFB 0,0,0,0,0,0,0,0 ; (33) 28638 DEFB 102,255,153,153,255,102,0,0 ; (34) 28646 DEFB 0,0,0,231,231,60,60,255 ; (35) 28654 DEFB 0,0,0,231,231,255,255,255 ; (36) 28662 DEFB 0,0,0,0,1,3,3,1 ; (37) 28670 DEFB 1,3,7,15,15,15,15,7 ; (38) 28678 DEFB 0,0,0,24,60,60,24,0 ; (39) 28686 DEFB 0,0,0,0,2,126,112,0 ; (40) 28694 DEFB 0,0,0,0,64,126,14,0 ; (41) 28702 DEFB 0,0,129,195,255,126,60,0 ; (42) 28710 DEFB 0,0,0,0,0,0,126,24 ; (43) 28718 DEFB 0,0,0,0,0,126,126,24 ; (44) 28726 DEFB 11,29,23,21,23,27,11,57 ; (45) 28734 DEFB 7,3,6,12,8,14,2,14 ; (46) 28742 DEFB 255,126,0,0,0,0,0,0 ; (47) 28750 DEFB 0,0,0,60,126,114,114,126 ; (48) 28758 DEFB 255,252,251,247,237,219,250,251 ; (49) 28766 DEFB 128,192,96,96,96,96,192,0 ; (50) 28774 DEFB 0,0,0,0,0,3,2,3 ; (51) 28782 DEFB 219,24,48,96,192,128,0,0 ; (52) 28790 DEFB 219,24,15,1,3,126,64,64 ; (53) 28798 DEFB 219,24,15,0,0,0,0,0 ; (54) 28806 DEFB 0,0,128,128,128,192,0,0 ; (55) 28814 DEFB 255,189,129,0,0,0,0,129 ; (56) 28822 DEFB 129,195,66,66,195,129,0,0 ; (57) 28830 DEFB 7,1,1,3,3,3,3,1 ; (58) 28838 DEFB 24,24,56,240,240,224,192,128 ; (59) ; Graphics Set 06 b28846 DEFB 241,28,15,34,29,18,13,18 ; (01) 28854 DEFB 13,3,7,12,17,8,9,48 ; (02) 28862 DEFB 1,0,1,1,2,4,0,0 ; (03) 28870 DEFB 0,112,15,0,0,0,3,28 ; (04) 28878 DEFB 0,0,128,96,16,8,232,20 ; (05) 28886 DEFB 32,64,64,0,0,1,2,4 ; (06) 28894 DEFB 12,4,5,58,194,2,2,2 ; (07) 28902 DEFB 1,13,16,32,16,0,0,0 ; (08) 28910 DEFB 0,0,0,0,7,10,52,73 ; (09) 28918 DEFB 0,128,64,64,128,192,96,48 ; (10) 28926 DEFB 0,1,2,4,8,8,16,16 ; (11) 28934 DEFB 145,17,33,33,64,64,64,64 ; (12) 28942 DEFB 24,12,4,5,130,0,0,0 ; (13) 28950 DEFB 1,60,239,34,29,18,13,18 ; (14) 28958 DEFB 0,0,0,0,2,4,2,1 ; (15) 28966 DEFB 0,0,3,14,56,96,192,128 ; (16) 28974 DEFB 6,10,10,18,18,36,36,36 ; (17) 28982 DEFB 0,192,32,16,12,2,0,0 ; (18) 28990 DEFB 68,66,66,65,64,32,0,0 ; (19) 28998 DEFB 32,32,64,64,32,0,0,0 ; (20) 29006 DEFB 1,3,15,63,255,63,15,1 ; (21) 29014 DEFB 255,104,107,107,9,107,104,255 ; (22) 29022 DEFB 255,177,182,182,177,183,151,255 ; (23) 29030 DEFB 240,216,220,220,220,252,216,240 ; (24) 29038 DEFB 16,24,12,4,12,12,24,24 ; (25) 29046 DEFB 56,48,112,112,120,252,222,223 ; (26) 29054 DEFB 223,207,199,193,193,225,243,255 ; (27) 29062 DEFB 127,127,63,191,159,207,239,236 ; (28) 29070 DEFB 241,227,231,231,207,223,223,255 ; (29) 29078 DEFB 63,7,3,3,1,1,1,1 ; (30) 29086 DEFB 243,70,62,124,102,66,66,4 ; (31) 29094 DEFB 0,0,0,0,1,99,78,123 ; (32) 29102 DEFB 6,27,55,239,159,127,255,255 ; (33) 29110 DEFB 0,0,0,1,1,2,5,11 ; (34) 29118 DEFB 55,111,223,175,111,238,108,100 ; (35) 29126 DEFB 11,27,55,47,111,95,95,223 ; (36) 29134 DEFB 116,116,124,114,96,32,160,160 ; (37) 29142 DEFB 191,191,176,160,160,192,104,56 ; (38) 29150 DEFB 208,239,60,0,0,0,0,0 ; (39) 29158 DEFB 0,0,0,0,2,2,6,6 ; (40) 29166 DEFB 0,0,0,0,0,192,128,192 ; (41) 29174 DEFB 0,0,1,15,63,96,64,96 ; (42) 29182 DEFB 0,31,245,95,255,255,31,7 ; (43) 29190 DEFB 31,245,94,251,247,238,222,190 ; (44) 29198 DEFB 252,87,122,127,127,255,255,255 ; (45) 29206 DEFB 0,240,158,235,252,255,255,255 ; (46) 29214 DEFB 7,3,2,3,2,4,0,0 ; (47) 29222 DEFB 190,126,255,31,3,1,1,0 ; (48) 29230 DEFB 255,255,127,127,127,127,191,191 ; (49) 29238 DEFB 183,97,32,0,0,0,0,0 ; (50) 29246 DEFB 255,255,127,127,127,127,255,255 ; (51) 29254 DEFB 254,139,196,67,1,0,0,0 ; (52) 29262 DEFB 0,128,240,28,231,249,254,127 ; (53) 29270 DEFB 0,0,0,0,0,128,224,56 ; (54) 29278 DEFB 127,127,252,243,207,63,255,255 ; (55) 29286 DEFB 230,131,120,246,247,247,239,239 ; (56) 29294 DEFB 224,160,128,224,112,184,220,238 ; (57) 29302 DEFB 23,47,48,32,0,0,0,0 ; (58) 29310 DEFB 255,255,127,15,3,3,1,1 ; (59) 29318 DEFB 239,223,223,223,223,223,223,223 ; (60) 29326 DEFB 247,251,253,253,255,255,255,255 ; (61) 29334 DEFB 191,191,191,191,191,191,191,160 ; (62) 29342 DEFB 63,31,31,31,31,31,31,31 ; (63) 29350 DEFB 31,31,63,63,63,127,127,127 ; (64) ; Graphics Set 09 b29358 DEFB 1,7,15,15,31,31,31,31 ; (01) 29366 DEFB 240,248,252,252,252,254,254,191 ; (02) 29374 DEFB 15,15,7,7,3,3,15,14 ; (03) 29382 DEFB 191,191,207,231,231,199,6,14 ; (04) 29390 DEFB 28,56,127,127,112,0,0,0 ; (05) 29398 DEFB 14,6,7,231,227,0,0,0 ; (06) 29406 DEFB 0,15,31,63,127,127,127,255 ; (07) 29414 DEFB 0,224,240,248,252,124,126,127 ; (08) 29422 DEFB 0,0,1,3,7,7,7,14 ; (09) 29430 DEFB 254,253,240,240,240,224,0,0 ; (10) 29438 DEFB 223,223,47,15,15,30,28,14 ; (11) 29446 DEFB 0,0,0,224,224,0,0,0 ; (12) 29454 DEFB 224,241,255,251,251,247,247,206 ; (13) 29462 DEFB 3,3,2,7,15,30,28,28 ; (14) 29470 DEFB 188,112,240,115,63,28,0,0 ; (15) 29478 DEFB 3,14,56,63,126,124,254,255 ; (16) 29486 DEFB 255,255,252,240,240,112,120,126 ; (17) 29494 DEFB 192,224,32,0,16,16,48,112 ; (18) 29502 DEFB 63,31,15,224,160,0,0,0 ; (19) 29510 DEFB 14,31,25,57,126,192,0,0 ; (20) (see bugs) 29518 DEFB 14,25,25,31,126,192,0,0 ; (21) (see bugs) 29526 DEFB 255,153,0,102,102,0,153,255 ; (22) 29534 DEFB 255,153,0,51,51,0,153,255 ; (23) 29542 DEFB 255,153,0,204,204,0,153,255 ; (24) 29550 DEFB 153,102,102,0,0,153,255,255 ; (25) 29558 DEFB 255,187,17,187,255,129,126,255 ; (26) 29566 DEFB 7,3,1,1,0,0,0,0 ; (27) 29574 DEFB 129,255,255,255,255,255,255,255 ; (28) 29582 DEFB 1,1,3,7,15,31,63,127 ; (29) 29590 DEFB 127,255,255,255,255,255,255,127 ; (30) 29598 DEFB 240,224,128,0,0,0,0,0 ; (31) 29606 DEFB 6,7,3,3,0,0,0,0 ; (32) 29614 DEFB 3,7,15,15,15,15,7,7 ; (33) 29622 DEFB 255,255,255,60,153,195,255,255 ; (34) 29630 DEFB 64,63,127,223,183,175,47,15 ; (35) 29638 DEFB 255,60,219,102,165,165,165,129 ; (36) 29646 DEFB 255,255,255,255,129,60,255,255 ; (37) 29654 DEFB 63,15,3,1,3,7,31,127 ; (38) 29662 DEFB 1,3,7,15,15,15,7,1 ; (39) 29670 DEFB 0,0,1,7,15,31,31,63 ; (40) 29678 DEFB 0,126,255,255,255,255,255,255 ; (41) 29686 DEFB 63,127,127,127,127,127,127,63 ; (42) 29694 DEFB 60,126,255,255,255,255,126,60 ; (43) 29702 DEFB 255,15,3,3,3,7,31,127 ; (44) 29710 DEFB 63,31,31,15,7,1,0,0 ; (45) 29718 DEFB 255,255,255,255,255,255,126,0 ; (46) ; Graphics Set 08 b29726 DEFB 60,126,243,225,225,243,126,60 ; (01) 29734 DEFB 60,126,255,231,195,195,102,60 ; (02) 29742 DEFB 60,126,207,135,135,207,126,60 ; (03) 29750 DEFB 60,102,195,195,231,255,126,60 ; (04) 29758 DEFB 60,102,195,195,231,255,126,60 ; (05) 29766 DEFB 60,126,207,135,135,207,126,60 ; (06) 29774 DEFB 60,126,255,231,195,195,102,60 ; (07) 29782 DEFB 60,126,243,225,225,243,126,60 ; (08) 29790 DEFB 255,255,255,255,253,189,136,0 ; (09) 29798 DEFB 255,255,255,239,143,159,135,2 ; (10) 29806 DEFB 255,126,68,64,0,0,0,0 ; (11) 29814 DEFB 255,127,127,63,63,25,0,0 ; (12) 29822 DEFB 255,255,255,255,223,15,7,0 ; (13) 29830 DEFB 255,255,255,255,255,247,199,1 ; (14) 29838 DEFB 1,3,27,31,63,63,127,63 ; (15) 29846 DEFB 127,127,63,31,31,63,63,127 ; (16) 29854 DEFB 127,127,63,31,7,3,3,1 ; (17) 29862 DEFB 5,31,31,63,127,127,127,63 ; (18) 29870 DEFB 31,15,47,127,127,127,63,63 ; (19) 29878 DEFB 63,31,15,31,31,15,3,1 ; (20) 29886 DEFB 3,7,31,63,31,7,15,3 ; (21) 29894 DEFB 1,3,135,215,255,255,127,126 ; (22) 29902 DEFB 126,126,126,126,60,60,126,126 ; (23) 29910 DEFB 126,126,124,124,124,124,60,56 ; (24) 29918 DEFB 56,56,56,56,56,48,48,48 ; (25) 29926 DEFB 48,48,16,16,16,16,16,0 ; (26) 29934 DEFB 255,255,255,255,255,223,141,1 ; (27) 29942 DEFB 255,255,255,255,235,107,200,128 ; (28) 29950 DEFB 255,255,255,255,231,207,23,7 ; (29) 29958 DEFB 255,255,255,227,197,225,225,129 ; (30) 29966 DEFB 255,255,255,243,227,231,227,128 ; (31) 29974 DEFB 255,255,255,255,239,231,131,1 ; (32) 29982 DEFB 255,254,254,254,252,252,156,24 ; (33) 29990 DEFB 3,15,15,7,7,1,1,0 ; (34) ; Graphics Set 10 b29998 DEFB 0,0,0,31,31,24,24,24 ; (01) 30006 DEFB 0,0,0,248,248,24,24,24 ; (02) 30014 DEFB 24,24,24,31,31,0,0,0 ; (03) 30022 DEFB 24,24,24,248,248,0,0,0 ; (04) 30030 DEFB 24,24,24,248,248,0,0,0 ; (05) 30038 DEFB 24,24,24,31,31,0,0,0 ; (06) 30046 DEFB 0,0,0,248,248,24,24,24 ; (07) 30054 DEFB 0,0,0,31,31,24,24,24 ; (08) 30062 DEFB 84,84,76,174,170,170,178,180 ; (09) 30070 DEFB 180,52,44,76,74,82,82,82 ; (10) 30078 DEFB 84,84,148,164,84,82,146,74 ; (11) 30086 DEFB 82,82,84,20,34,34,18,18 ; (12) 30094 DEFB 17,17,17,17,18,34,33,33 ; (13) 30102 DEFB 33,34,34,18,20,20,20,20 ; (14) 30110 DEFB 18,36,36,36,34,2,2,4 ; (15) 30118 DEFB 4,4,4,4,0,0,0,0 ; (16) 30126 DEFB 82,74,74,42,52,82,82,82 ; (17) 30134 DEFB 146,164,148,84,84,82,82,74 ; (18) 30142 DEFB 74,42,41,41,69,41,42,42 ; (19) 30150 DEFB 74,74,82,82,146,84,76,76 ; (20) 30158 DEFB 44,44,50,50,42,42,74,66 ; (21) 30166 DEFB 68,68,66,66,34,66,66,66 ; (22) 30174 DEFB 66,68,68,68,68,36,36,36 ; (23) 30182 DEFB 34,34,34,36,36,32,32,32 ; (24) 30190 DEFB 56,199,128,140,147,80,83,82 ; (25) 30198 DEFB 224,30,2,226,18,210,84,84 ; (26) 30206 DEFB 16,239,128,60,195,224,31,240 ; (27) 30214 DEFB 198,17,238,0,239,16,195,60 ; (28) 30222 DEFB 7,248,2,125,128,30,225,57 ; (29) 30230 DEFB 3,63,199,31,255,7,255,3 ; (30) 30238 DEFB 231,248,255,198,249,240,251,252 ; (31) 30246 DEFB 60,60,96,60,60,96,60,60 ; (32) 30254 DEFB 96,60,60,96,60,60,96,60 ; (33) 30262 DEFB 60,96,60,60,96,60,60,96 ; (34) 30270 DEFB 60,60,64,189,189,96,254,255 ; (35) 30278 DEFB 0,1,1,3,7,30,61,123 ; (36) 30286 DEFB 192,224,224,254,124,49,135,255 ; (37) 30294 DEFB 126,126,84,255,255,255,255,255 ; (38) 30302 DEFB 251,251,251,113,17,113,49,17 ; (39) 30310 DEFB 255,252,240,224,192,192,192,224 ; (40) 30318 DEFB 255,126,0,0,0,0,0,0 ; (41) 30326 DEFB 11,3,3,1,0,0,0,0 ; (42) 30334 DEFB 224,224,224,192,32,96,48,8 ; (43) 30342 DEFB 0,0,0,0,0,0,5,27 ; (44) 30350 DEFB 0,3,7,7,3,1,1,0 ; (45) 30358 DEFB 115,231,223,190,190,190,159,231 ; (46) 30366 DEFB 231,153,0,0,0,0,0,129 ; (47) 30374 DEFB 251,125,125,125,57,4,12,4 ; (48) 30382 DEFB 195,231,231,231,195,36,102,36 ; (49) 30390 DEFB 255,126,96,189,189,96,60,60 ; (50) 30398 DEFB 60,126,255,255,255,126,60,24 ; (51) 30406 DEFB 0,6,9,9,15,15,6,0 ; (52) 30414 DEFB 60,126,255,255,255,219,231,126 ; (53) 30422 DEFB 126,124,252,248,248,252,124,126 ; (54) 30430 DEFB 62,31,95,207,239,254,254,124 ; (55) 30438 DEFB 0,0,0,0,35,31,23,27 ; (56) 30446 DEFB 36,24,24,255,189,189,219,153 ; (57) 30454 DEFB 29,30,15,15,7,3,1,0 ; (58) 30462 DEFB 0,129,195,129,129,129,129,66 ; (59) 30470 DEFB 0,0,0,7,127,47,55,26 ; (60) 30478 DEFB 66,36,195,129,129,0,0,24 ; (61) 30486 DEFB 30,31,27,23,31,49,32,0 ; (62) 30494 DEFB 36,219,255,255,219,189,90,90 ; (63) 30502 DEFB 0,0,8,7,1,0,0,0 ; (64) 30510 DEFB 6,27,251,247,237,125,70,4 ; (65) 30518 DEFB 36,24,255,255,219,188,90,153 ; (66) 30526 DEFB 219,189,219,219,90,60,24,36 ; (67) 30534 DEFB 36,36,102,102,102,231,231,195 ; (68) 30542 DEFB 1,7,3,0,0,0,0,0 ; (69) 30550 DEFB 126,62,63,31,31,63,62,126 ; (70) 30558 DEFB 124,248,250,243,247,127,127,62 ; (71) 30566 DEFB 255,255,170,85,170,85,170,0 ; (72) 30574 DEFB 234,212,234,212,234,212,234,212 ; (73) 30582 DEFB 0,0,0,0,24,60,118,235 ; (74) 30590 DEFB 1,3,7,14,29,58,117,234 ; (75) 30598 DEFB 213,170,84,168,80,160,64,128 ; (76) 30606 DEFB 129,195,102,24,24,36,0,0 ; (77) 30614 DEFB 0,0,36,24,24,102,195,129 ; (78) 30622 DEFB 0,0,0,1,3,0,0,0 ; (79) 30630 DEFB 0,0,36,255,24,36,0,0 ; (80) 30638 DEFB 60,126,231,195,219,251,122,24 ; (81) 30646 DEFB 15,31,31,31,31,31,63,63 ; (82) 30654 DEFB 63,63,63,63,127,127,127,127 ; (83) 30662 DEFB 127,127,255,255,255,255,255,127 ; (84) ; Graphics Set 11 b30670 DEFB 7,31,63,113,96,224,224,241 ; (01) 30678 DEFB 241,224,224,96,113,63,31,7 ; (02) 30686 DEFB 7,31,63,127,127,255,255,255 ; (03) 30694 DEFB 255,255,255,127,127,63,31,7 ; (04) 30702 DEFB 1,1,3,7,31,32,31,255 ; (05) 30710 DEFB 254,248,243,231,143,63,127,127 ; (06) 30718 DEFB 7,31,63,125,124,254,248,8 ; (07) 30726 DEFB 224,240,248,252,252,126,126,63 ; (08) 30734 DEFB 9,51,55,119,115,121,255,255 ; (09) 30742 DEFB 0,0,0,0,0,15,63,255 ; (10) 30750 DEFB 63,63,63,31,31,31,31,31 ; (11) 30758 DEFB 3,31,127,127,135,51,123,255 ; (12) 30766 DEFB 0,17,99,195,135,199,71,71 ; (13) 30774 DEFB 0,128,192,192,224,224,224,224 ; (14) 30782 DEFB 160,168,168,168,168,104,72,72 ; (15) 30790 DEFB 7,31,63,127,127,127,255,255 ; (16) 30798 DEFB 0,112,88,207,12,8,120,216 ; (17) 30806 DEFB 71,199,135,135,3,3,7,15 ; (18) 30814 DEFB 224,224,224,224,192,193,129,3 ; (19) 30822 DEFB 72,216,152,152,152,152,56,56 ; (20) 30830 DEFB 1,1,1,1,3,7,31,255 ; (21) 30838 DEFB 28,17,27,62,32,51,30,0 ; (22) 30846 DEFB 136,140,7,15,24,48,96,64 ; (23) 30854 DEFB 31,120,224,0,0,7,28,48 ; (24) 30862 DEFB 255,127,15,0,14,155,241,32 ; (25) 30870 DEFB 254,252,240,2,12,27,241,2 ; (26) 30878 DEFB 2,6,12,8,8,12,7,0 ; (27) 30886 DEFB 120,248,240,112,0,62,225,0 ; (28) 30894 DEFB 15,7,3,3,1,1,1,0 ; (29) 30902 DEFB 0,0,1,3,2,3,1,0 ; (30) 30910 DEFB 64,225,231,60,1,1,131,194 ; (31) 30918 DEFB 224,128,4,3,240,48,31,25 ; (32) 30926 DEFB 32,96,192,8,8,24,48,224 ; (33) 30934 DEFB 0,0,28,62,127,127,255,255 ; (34) 30942 DEFB 255,255,255,255,135,3,1,0 ; (35) 30950 DEFB 0,0,0,0,0,112,248,248 ; (36) 30958 DEFB 251,125,29,61,123,119,51,1 ; (37) 30966 DEFB 99,48,16,48,57,31,0,0 ; (38) 30974 DEFB 144,16,48,96,192,0,0,0 ; (39) 30982 DEFB 255,252,240,224,192,128,128,128 ; (40) 30990 DEFB 255,127,127,127,63,63,31,31 ; (41) 30998 DEFB 248,248,248,248,240,240,112,0 ; (42) 31006 DEFB 255,127,63,63,63,63,63,127 ; (43) 31014 DEFB 57,127,127,127,127,63,63,63 ; (44) 31022 DEFB 254,248,224,224,224,192,224,224 ; (45) 31030 DEFB 224,224,224,192,192,192,192,128 ; (46) 31038 DEFB 63,127,254,253,251,99,3,3 ; (47) 31046 DEFB 255,15,247,251,253,252,252,252 ; (48) 31054 DEFB 192,224,224,224,192,0,0,0 ; (49) 31062 DEFB 29,62,127,255,255,255,255,127 ; (50) 31070 DEFB 251,247,15,255,255,255,255,255 ; (51) 31078 DEFB 128,224,240,240,248,248,248,252 ; (52) 31086 DEFB 63,31,3,3,7,30,28,0 ; (53) 31094 DEFB 255,255,255,255,7,3,3,1 ; (54) 31102 DEFB 252,254,254,255,255,255,255,255 ; (55) 31110 DEFB 0,0,0,0,192,224,240,252 ; (56) 31118 DEFB 62,62,62,126,127,127,127,255 ; (57) 31126 DEFB 255,127,63,31,15,7,3,1 ; (58) 31134 DEFB 224,248,255,255,255,255,255,255 ; (59) 31142 DEFB 255,255,127,62,0,0,0,0 ; (60) 31150 DEFB 0,192,255,255,255,255,255,255 ; (61) 31158 DEFB 255,63,95,111,55,56,48,64 ; (62) 31166 DEFB 255,255,255,255,255,255,127,1 ; (63) 31174 DEFB 15,31,255,255,255,255,255,255 ; (64) 31182 DEFB 252,253,253,249,251,243,247,247 ; (65) 31190 DEFB 255,255,255,255,255,143,7,1 ; (66) 31198 DEFB 63,127,254,193,184,127,255,255 ; (67) 31206 DEFB 247,7,247,239,31,255,255,255 ; (68) 31214 DEFB 252,252,240,224,192,192,192,192 ; (69) 31222 DEFB 255,62,30,30,28,28,56,224 ; (70) 31230 DEFB 255,255,127,31,7,3,0,0 ; (71) 31238 DEFB 255,255,255,255,255,254,0,0 ; (72) 31246 DEFB 224,224,224,224,192,0,0,0 ; (73) ; Graphics Set 12 b31254 DEFB 1,130,69,170,85,186,125,254 ; (001) 31262 DEFB 170,85,43,23,15,23,43,85 ; (002) 31270 DEFB 127,190,93,170,85,162,65,128 ; (003) 31278 DEFB 170,212,232,240,232,212,170,85 ; (004) 31286 DEFB 170,85,43,23,15,23,43,85 ; (005) 31294 DEFB 127,190,93,170,85,162,65,128 ; (006) 31302 DEFB 170,212,232,240,232,212,170,85 ; (007) 31310 DEFB 1,130,69,170,85,186,125,254 ; (008) 31318 DEFB 0,63,106,64,96,64,96,63 ; (009) 31326 DEFB 0,255,170,0,0,0,0,255 ; (010) 31334 DEFB 0,252,170,2,2,2,2,252 ; (011) 31342 DEFB 15,1,0,0,0,0,0,0 ; (012) 31350 DEFB 240,128,0,0,0,0,0,0 ; (013) 31358 DEFB 255,255,126,0,0,0,0,0 ; (014) 31366 DEFB 255,255,255,126,0,0,0,0 ; (015) 31374 DEFB 255,255,255,255,126,60,0,0 ; (016) 31382 DEFB 255,255,126,60,60,126,126,126 ; (017) 31390 DEFB 126,60,0,0,0,0,0,0 ; (018) 31398 DEFB 255,255,60,24,60,126,255,255 ; (019) 31406 DEFB 255,255,126,60,0,0,0,0 ; (020) 31414 DEFB 255,255,60,24,24,24,24,24 ; (021) 31422 DEFB 60,126,255,255,255,255,126,60 ; (022) 31430 DEFB 112,248,252,255,127,127,63,15 ; (023) 31438 DEFB 1,1,1,3,3,7,31,255 ; (024) 31446 DEFB 6,15,30,62,62,124,248,240 ; (025) 31454 DEFB 0,0,192,240,120,28,4,4 ; (026) 31462 DEFB 0,0,0,0,0,1,3,63 ; (027) 31470 DEFB 3,7,15,31,63,255,255,255 ; (028) 31478 DEFB 195,129,0,6,6,0,129,195 ; (029) 31486 DEFB 224,192,128,128,128,128,128,128 ; (030) 31494 DEFB 255,255,255,255,255,255,248,224 ; (031) 31502 DEFB 128,128,128,192,192,224,224,224 ; (032) 31510 DEFB 255,63,1,0,0,0,0,0 ; (033) 31518 DEFB 224,240,248,252,124,63,31,0 ; (034) 31526 DEFB 0,128,192,192,224,240,248,254 ; (035) 31534 DEFB 255,255,255,124,1,255,255,254 ; (036) 31542 DEFB 255,129,63,126,254,240,192,0 ; (037) 31550 DEFB 0,255,0,0,0,0,0,0 ; (038) 31558 DEFB 120,128,124,0,0,0,0,0 ; (039) 31566 DEFB 120,128,112,0,0,0,0,0 ; (040) 31574 DEFB 31,31,31,31,31,63,63,63 ; (041) 31582 DEFB 63,63,63,127,127,127,127,127 ; (042) 31590 DEFB 255,255,129,129,0,0,24,60 ; (043) 31598 DEFB 127,127,63,63,63,31,31,15 ; (044) 31606 DEFB 60,24,66,60,0,0,0,0 ; (045) 31614 DEFB 127,255,224,238,223,219,31,14 ; (046) 31622 DEFB 255,255,255,126,126,126,0,0 ; (047) 31630 DEFB 0,0,0,0,0,0,112,254 ; (048) 31638 DEFB 1,1,3,3,7,7,15,15 ; (049) 31646 DEFB 192,248,255,255,255,255,255,255 ; (050) 31654 DEFB 0,0,0,192,192,128,128,128 ; (051) 31662 DEFB 31,31,63,63,127,127,127,127 ; (052) 31670 DEFB 128,128,128,0,0,0,0,0 ; (053) 31678 DEFB 127,127,127,127,63,63,31,15 ; (054) 31686 DEFB 254,254,254,254,252,252,248,240 ; (055) 31694 DEFB 1,1,3,15,31,63,127,127 ; (056) 31702 DEFB 99,65,65,193,193,193,193,227 ; (057) 31710 DEFB 127,63,159,135,192,224,248,255 ; (058) 31718 DEFB 2,6,12,28,28,60,62,127 ; (059) 31726 DEFB 127,255,255,255,255,255,255,127 ; (060) 31734 DEFB 129,255,255,255,255,255,255,255 ; (061) 31742 DEFB 127,127,63,31,15,3,0,0 ; (062) 31750 DEFB 255,255,255,255,255,255,31,0 ; (063) 31758 DEFB 0,0,3,15,31,63,127,127 ; (064) 31766 DEFB 0,31,255,255,255,255,255,255 ; (065) 31774 DEFB 127,255,255,255,255,255,255,127 ; (066) 31782 DEFB 255,255,255,255,255,255,255,129 ; (067) 31790 DEFB 127,62,60,28,28,12,6,2 ; (068) 31798 DEFB 127,63,63,63,63,63,63,127 ; (069) 31806 DEFB 127,127,127,127,63,31,15,15 ; (070) 31814 DEFB 15,15,15,15,7,3,1,1 ; (071) 31822 DEFB 127,63,31,31,31,31,63,63 ; (072) 31830 DEFB 63,63,63,63,63,31,31,31 ; (073) 31838 DEFB 31,31,7,3,1,1,0,0 ; (074) 31846 DEFB 0,15,31,63,127,127,255,255 ; (075) 31854 DEFB 0,192,248,252,254,254,255,255 ; (076) 31862 DEFB 255,255,255,207,135,7,7,7 ; (077) 31870 DEFB 255,255,255,255,255,255,254,254 ; (078) 31878 DEFB 76,127,127,255,255,171,86,214 ; (079) 31886 DEFB 126,126,240,128,112,118,206,221 ; (080) 31894 DEFB 192,23,215,223,255,126,0,0 ; (081) 31902 DEFB 192,1,23,215,239,188,248,96 ; (082) 31910 DEFB 155,134,141,131,31,47,118,116 ; (083) 31918 DEFB 0,128,192,192,224,224,96,192 ; (084) 31926 DEFB 0,0,0,0,0,8,52,244 ; (085) 31934 DEFB 0,0,1,1,1,1,1,3 ; (086) 31942 DEFB 243,239,222,185,135,190,125,3 ; (087) 31950 DEFB 247,119,120,248,176,96,216,184 ; (088) 31958 DEFB 236,140,12,12,12,24,24,20 ; (089) 31966 DEFB 32,254,35,1,1,35,254,32 ; (090) 31974 DEFB 0,0,0,255,255,0,0,0 ; (091) 31982 DEFB 0,12,114,255,188,94,47,24 ; (092) 31990 DEFB 0,0,0,255,192,191,255,193 ; (093) 31998 DEFB 3,7,6,222,22,234,240,254 ; (094) 32006 DEFB 127,124,1,255,126,0,195,126 ; (095) 32014 DEFB 112,224,208,239,111,192,192,64 ; (096) 32022 DEFB 56,60,84,167,175,168,80,0 ; (097) 32030 DEFB 0,1,3,6,12,24,24,49 ; (098) 32038 DEFB 243,143,62,113,71,190,125,3 ; (099) 32046 DEFB 247,119,120,248,176,97,219,187 ; (100) 32054 DEFB 0,224,126,7,124,224,0,0 ; (101) 32062 DEFB 0,0,195,127,254,0,0,0 ; (102) 32070 DEFB 0,1,252,253,14,3,0,0 ; (103) 32078 DEFB 113,224,193,65,0,193,0,0 ; (104) 32086 DEFB 254,252,1,255,126,0,195,126 ; (105) 32094 DEFB 118,238,210,227,111,196,200,64 ; (106) 32102 DEFB 1,14,31,127,255,255,121,22 ; (107) 32110 DEFB 0,0,0,0,0,31,95,68 ; (108) 32118 DEFB 0,0,3,15,254,248,128,0 ; (109) 32126 DEFB 60,252,248,132,12,12,12,14 ; (110) 32134 DEFB 0,0,0,0,0,0,0,0 ; (111) 32142 DEFB 0,0,0,0,0,0,0,0 ; (112) 32150 DEFB 47,15,6,14,12,28,58,118 ; (113) 32158 DEFB 0,1,3,3,7,14,94,70 ; (114) 32166 DEFB 230,198,134,131,3,3,3,5 ; (115) 32174 DEFB 40,60,60,24,24,24,24,24 ; (116) 32182 DEFB 4,3,1,0,0,0,0,0 ; (117) 32190 DEFB 128,128,128,192,192,192,224,96 ; (118) 32198 DEFB 24,48,48,48,48,48,48,48 ; (119) 32206 DEFB 96,96,96,96,96,96,96,96 ; (120) 32214 DEFB 0,0,11,53,246,0,0,0 ; (121) 32222 DEFB 80,232,120,184,24,0,0,0 ; (122) 32230 DEFB 6,6,6,7,3,3,3,5 ; (123) 32238 DEFB 0,0,0,0,1,7,30,248 ; (124) 32246 DEFB 22,56,125,225,195,131,3,1 ; (125) 32254 DEFB 0,0,0,0,0,128,128,128 ; (126) 32262 DEFB 2,2,1,1,1,1,1,1 ; (127) 32270 DEFB 240,160,64,128,0,128,192,192 ; (128) 32278 DEFB 1,1,0,0,0,0,0,0 ; (129) 32286 DEFB 192,192,192,192,224,160,64,184 ; (130) 32294 DEFB 192,192,192,192,224,96,96,96 ; (131) 32302 DEFB 252,30,7,1,0,0,0,0 ; (132) 32310 DEFB 0,0,128,224,120,31,3,0 ; (133) 32318 DEFB 0,0,0,0,0,176,240,160 ; (134) 32326 DEFB 0,0,1,11,0,0,0,0 ; (135) 32334 DEFB 192,192,128,128,0,0,0,0 ; (136) ; Graphics Set 02 b32342 DEFB 60,126,251,241,241,251,126,60 ; (001) 32350 DEFB 60,126,255,249,241,243,126,60 ; (002) 32358 DEFB 60,126,243,241,249,255,126,60 ; (003) 32366 DEFB 0,0,0,0,0,1,3,3 ; (004) 32374 DEFB 0,1,7,15,31,63,127,255 ; (005) 32382 DEFB 1,1,3,7,7,15,31,31 ; (006) 32390 DEFB 31,63,63,127,127,127,127,255 ; (007) 32398 DEFB 0,128,192,224,240,3,255,255 ; (008) 32406 DEFB 7,15,31,63,126,252,248,255 ; (009) 32414 DEFB 240,248,248,240,0,6,14,30 ; (010) 32422 DEFB 255,63,159,199,241,252,255,255 ; (011) 32430 DEFB 255,255,255,255,255,255,127,63 ; (012) 32438 DEFB 255,255,255,255,254,255,255,255 ; (013) 32446 DEFB 254,252,240,196,28,252,252,248 ; (014) 32454 DEFB 159,207,231,241,252,255,255,255 ; (015) 32462 DEFB 255,252,255,255,127,0,0,0 ; (016) 32470 DEFB 0,112,240,224,192,0,0,0 ; (017) 32478 DEFB 127,63,159,207,231,243,249,253 ; (018) 32486 DEFB 152,204,224,255,255,255,255,255 ; (019) 32494 DEFB 3,31,127,255,255,254,254,255 ; (020) 32502 DEFB 192,248,252,252,252,0,0,0 ; (021) 32510 DEFB 255,255,127,127,127,63,191,191 ; (022) 32518 DEFB 255,255,255,255,252,255,239,231 ; (023) 32526 DEFB 252,254,252,248,0,240,240,240 ; (024) 32534 DEFB 159,223,207,224,255,255,254,254 ; (025) 32542 DEFB 224,255,255,126,0,0,0,0 ; (026) 32550 DEFB 255,255,255,255,255,127,127,127 ; (027) 32558 DEFB 255,248,224,192,192,128,128,128 ; (028) 32566 DEFB 255,63,31,15,15,7,7,7 ; (029) 32574 DEFB 255,255,255,254,254,254,254,254 ; (030) 32582 DEFB 63,63,31,15,7,3,1,0 ; (031) 32590 DEFB 128,128,128,128,128,192,224,240 ; (032) 32598 DEFB 7,15,15,31,31,63,127,255 ; (033) 32606 DEFB 252,252,248,248,224,224,128,0 ; (034) 32614 DEFB 0,63,127,127,0,0,0,0 ; (035) 32622 DEFB 0,255,255,255,0,0,0,0 ; (036) 32630 DEFB 192,224,224,224,0,0,0,0 ; (037) 32638 DEFB 255,255,255,254,252,252,248,248 ; (038) 32646 DEFB 240,128,0,0,0,0,0,0 ; (039) 32654 DEFB 128,224,224,224,224,224,192,128 ; (040) 32662 DEFB 63,63,31,15,7,3,9,12 ; (041) 32670 DEFB 240,240,240,240,240,240,248,252 ; (042) 32678 DEFB 255,254,252,248,240,224,192,128 ; (043) 32686 DEFB 0,192,224,224,0,0,0,0 ; (044) 32694 DEFB 255,255,252,249,243,231,207,159 ; (045) 32702 DEFB 255,0,127,255,255,255,255,255 ; (046) 32710 DEFB 0,0,128,128,192,192,224,240 ; (047) 32718 DEFB 63,63,31,79,231,243,249,252 ; (048) 32726 DEFB 255,255,255,255,255,255,255,31 ; (049) 32734 DEFB 191,63,127,127,127,127,127,255 ; (050) 32742 DEFB 255,255,255,255,252,240,192,0 ; (051) 32750 DEFB 240,224,192,128,0,0,0,0 ; (052) 32758 DEFB 7,7,7,3,0,0,0,0 ; (053) 32766 DEFB 255,255,255,255,0,0,0,0 ; (054) 32774 DEFB 192,255,255,255,0,0,0,0 ; (055) 32782 DEFB 1,7,15,15,15,15,7,1 ; (056) 32790 DEFB 127,127,63,191,159,223,207,231 ; (057) 32798 DEFB 248,131,127,255,255,255,255,255 ; (058) 32806 DEFB 0,224,248,248,252,252,252,252 ; (059) 32814 DEFB 247,115,0,0,0,0,0,0 ; (060) 32822 DEFB 255,255,63,0,0,0,0,0 ; (061) 32830 DEFB 127,127,127,255,0,0,0,0 ; (062) 32838 DEFB 252,252,252,192,0,0,0,0 ; (063) 32846 DEFB 127,127,127,127,127,127,63,63 ; (064) 32854 DEFB 63,31,7,0,0,0,0,0 ; (065) 32862 DEFB 255,255,192,158,63,127,127,127 ; (066) 32870 DEFB 255,255,3,121,252,254,254,255 ; (067) 32878 DEFB 255,255,254,254,254,126,124,124 ; (068) 32886 DEFB 112,112,112,240,192,192,128,0 ; (069) 32894 DEFB 127,127,63,63,0,0,0,0 ; (070) 32902 DEFB 254,254,252,252,0,0,0,0 ; (071) 32910 DEFB 120,224,128,0,0,0,0,0 ; (072) 32918 DEFB 255,255,65,28,127,255,255,255 ; (073) 32926 DEFB 255,255,129,60,254,254,254,254 ; (074) 32934 DEFB 255,254,252,253,249,243,231,207 ; (075) 32942 DEFB 112,120,252,252,248,248,224,0 ; (076) 32950 DEFB 255,255,255,127,0,0,0,0 ; (077) 32958 DEFB 254,252,253,249,0,0,0,0 ; (078) 32966 DEFB 255,254,254,248,128,0,0,0 ; (079) 32974 DEFB 255,255,224,192,128,128,0,0 ; (080) 32982 DEFB 255,255,127,63,31,31,15,15 ; (081) 32990 DEFB 255,255,255,127,127,127,63,63 ; (082) 32998 DEFB 7,7,7,7,7,7,7,15 ; (083) 33006 DEFB 255,255,255,255,255,255,254,248 ; (084) 33014 DEFB 252,249,243,231,207,159,63,255 ; (085) 33022 DEFB 31,15,7,3,0,0,0,0 ; (086) 33030 DEFB 240,240,240,224,0,0,0,0 ; (087) 33038 DEFB 3,127,127,127,0,0,0,0 ; (088) 33046 DEFB 252,254,254,255,255,255,255,255 ; (089) 33054 DEFB 60,126,231,195,195,231,126,60 ; (090) 33062 DEFB 60,126,207,135,135,207,126,60 ; (091) 33070 DEFB 60,126,243,225,225,243,126,60 ; (092) 33078 DEFB 60,126,255,255,255,255,126,60 ; (093) 33086 DEFB 255,255,255,243,248,255,255,255 ; (094) 33094 DEFB 255,255,255,207,15,31,255,255 ; (095) 33102 DEFB 255,255,255,243,240,248,255,255 ; (096) 33110 DEFB 255,255,255,207,31,255,255,255 ; (097) 33118 DEFB 255,254,252,252,252,252,254,255 ; (098) 33126 DEFB 255,127,63,63,63,63,127,255 ; (099) 33134 DEFB 0,1,3,3,15,31,127,255 ; (100) 33142 DEFB 0,0,0,0,1,3,7,15 ; (101) 33150 DEFB 1,7,127,255,255,255,255,255 ; (102) 33158 DEFB 255,254,252,253,249,249,249,249 ; (103) 33166 DEFB 15,15,15,12,12,6,2,0 ; (104) 33174 DEFB 255,255,0,0,0,0,0,0 ; (105) 33182 DEFB 253,252,252,252,254,254,254,158 ; (106) 33190 DEFB 239,207,207,111,47,15,7,3 ; (107) 33198 DEFB 30,30,30,30,140,193,223,223 ; (108) 33206 DEFB 96,240,240,248,248,248,120,126 ; (109) 33214 DEFB 124,255,255,63,3,15,63,127 ; (110) 33222 DEFB 127,255,255,255,255,255,255,255 ; (111) 33230 DEFB 1,131,135,199,255,255,255,255 ; (112) 33238 DEFB 252,241,3,7,15,63,62,28 ; (113) 33246 DEFB 255,255,255,255,255,0,0,0 ; (114) 33254 DEFB 252,253,243,231,143,31,31,31 ; (115) 33262 DEFB 0,0,0,0,0,0,7,7 ; (116) 33270 DEFB 0,0,0,0,0,15,255,255 ; (117) 33278 DEFB 1,3,7,31,255,255,255,255 ; (118) 33286 DEFB 255,254,252,249,243,231,207,159 ; (119) 33294 DEFB 7,3,5,15,15,15,0,0 ; (120) 33302 DEFB 255,255,85,239,188,120,48,0 ; (121) 33310 DEFB 255,255,95,15,7,3,1,0 ; (122) 33318 DEFB 191,191,191,159,207,239,239,111 ; (123) 33326 DEFB 254,254,254,254,254,252,253,249 ; (124) 33334 DEFB 255,255,255,255,255,255,254,240 ; (125) 33342 DEFB 251,243,231,207,128,128,0,0 ; (126) 33350 DEFB 251,251,243,247,247,231,239,239 ; (127) 33358 DEFB 207,223,159,191,191,63,127,127 ; (128) 33366 DEFB 127,127,127,127,127,127,127,127 ; (129) 33374 DEFB 56,124,126,254,254,254,254,254 ; (130) 33382 DEFB 254,126,126,63,63,31,15,3 ; (131) 33390 DEFB 255,255,127,127,127,63,191,191 ; (132) 33398 DEFB 63,31,31,15,7,1,0,0 ; (133) 33406 DEFB 7,3,0,0,0,0,0,0 ; (134) 33414 DEFB 1,15,63,127,255,255,240,231 ; (135) 33422 DEFB 60,126,255,231,195,195,102,60 ; (136) 33430 DEFB 14,31,63,63,63,63,63,31 ; (137) 33438 DEFB 15,159,254,253,248,195,255,255 ; (138) 33446 DEFB 31,15,15,7,7,3,3,0 ; (139) 33454 DEFB 62,192,252,254,126,158,236,193 ; (140) 33462 DEFB 15,255,255,255,255,255,255,255 ; (141) 33470 DEFB 248,244,246,230,238,206,223,31 ; (142) 33478 DEFB 0,0,0,31,255,255,240,231 ; (143) 33486 DEFB 3,31,255,255,255,255,255,255 ; (144) 33494 DEFB 0,3,15,31,31,63,127,255 ; (145) 33502 DEFB 1,3,7,15,15,15,31,31 ; (146) 33510 DEFB 31,15,15,39,55,115,123,120 ; (147) 33518 DEFB 15,255,255,255,0,0,0,0 ; (148) 33526 DEFB 96,240,240,224,224,0,224,224 ; (149) 33534 DEFB 29,29,61,59,59,119,127,127 ; (150) 33542 DEFB 224,224,224,192,192,192,224,240 ; (151) 33550 DEFB 127,127,63,31,31,15,7,7 ; (152) 33558 DEFB 195,129,0,126,255,255,255,255 ; (153) 33566 DEFB 3,3,3,1,1,1,3,3 ; (154) 33574 DEFB 1,1,5,11,27,55,103,239 ; (155) 33582 DEFB 1,7,31,63,127,255,255,255 ; (156) 33590 DEFB 191,159,223,207,231,240,252,248 ; (157) 33598 DEFB 1,7,15,31,31,63,63,127 ; (158) 33606 DEFB 255,255,127,63,0,0,0,0 ; (159) 33614 DEFB 240,224,192,128,0,0,0,0 ; (160) 33622 DEFB 0,0,0,0,0,120,252,254 ; (161) 33630 DEFB 1,1,0,0,1,3,7,15 ; (162) 33638 DEFB 240,135,63,127,255,255,255,255 ; (163) 33646 DEFB 0,0,0,1,3,7,15,30 ; (164) 33654 DEFB 31,95,191,63,127,127,127,127 ; (165) 33662 DEFB 62,62,62,30,30,14,6,0 ; (166) 33670 DEFB 239,207,223,223,159,191,191,63 ; (167) 33678 DEFB 127,126,126,62,62,30,6,0 ; (168) 33686 DEFB 127,127,255,255,255,255,255,255 ; (169) 33694 DEFB 0,0,1,3,7,7,14,13 ; (170) 33702 DEFB 255,255,255,255,255,255,240,231 ; (171) 33710 DEFB 0,0,0,0,0,1,3,7 ; (172) 33718 DEFB 0,0,3,31,127,255,255,255 ; (173) 33726 DEFB 15,127,253,251,243,231,239,207 ; (174) 33734 DEFB 248,243,247,247,247,247,247,247 ; (175) 33742 DEFB 15,15,31,63,63,127,127,127 ; (176) 33750 DEFB 223,223,223,223,207,231,240,254 ; (177) 33758 DEFB 231,143,63,255,255,254,252,0 ; (178) 33766 DEFB 15,227,251,249,252,252,252,252 ; (179) 33774 DEFB 255,252,248,192,0,0,0,0 ; (180) 33782 DEFB 0,0,0,0,0,0,0,0 ; (181) 33790 DEFB 31,31,15,0,0,0,0,0 ; (182) 33798 DEFB 15,255,255,255,255,255,255,255 ; (183) 33806 DEFB 192,248,252,254,255,255,255,255 ; (184) 33814 DEFB 60,126,255,231,231,255,126,60 ; (185) 33822 DEFB 0,128,128,192,192,192,192,192 ; (186) 33830 DEFB 192,192,192,192,192,128,128,0 ; (187) 33838 DEFB 0,0,0,99,249,252,255,63 ; (188) 33846 DEFB 7,31,255,255,255,126,0,255 ; (189) 33854 DEFB 248,252,254,159,63,127,255,255 ; (190) 33862 DEFB 199,31,255,255,121,1,243,231 ; (191) 33870 DEFB 255,255,255,255,255,254,254,254 ; (192) 33878 DEFB 255,247,199,159,63,127,255,255 ; (193) 33886 DEFB 207,223,223,222,192,255,255,255 ; (194) 33894 DEFB 254,158,30,30,190,188,184,185 ; (195) 33902 DEFB 255,255,255,255,255,0,63,63 ; (196) 33910 DEFB 255,249,227,143,63,127,255,255 ; (197) 33918 DEFB 224,225,241,251,255,255,255,255 ; (198) 33926 DEFB 0,0,0,28,127,255,255,255 ; (199) 33934 DEFB 255,255,127,63,31,7,1,0 ; (200) 33942 DEFB 255,255,255,255,255,255,252,0 ; (201) 33950 DEFB 254,253,249,243,199,159,63,31 ; (202) 33958 DEFB 6,15,15,15,15,15,15,7 ; (203) 33966 DEFB 31,159,191,191,191,191,191,191 ; (204) 33974 DEFB 7,3,3,3,3,1,1,0 ; (205) 33982 DEFB 191,223,223,207,231,251,248,240 ; (206) 33990 DEFB 0,0,0,0,0,15,63,255 ; (207) 33998 DEFB 0,1,3,3,3,7,7,6 ; (208) 34006 DEFB 240,248,247,207,207,159,63,127 ; (209) 34014 DEFB 0,0,0,0,1,63,255,252 ; (210) 34022 DEFB 0,0,0,0,225,255,127,0 ; (211) 34030 DEFB 12,9,3,15,255,255,255,31 ; (212) 34038 DEFB 255,255,255,255,255,247,231,131 ; (213) 34046 DEFB 60,102,195,195,231,255,126,60 ; (214) 34054 DEFB 60,126,255,231,195,195,102,60 ; (215) 34062 DEFB 191,191,191,160,206,254,252,0 ; (216) 34070 DEFB 0,0,0,0,0,224,240,247 ; (217) 34078 DEFB 0,0,0,0,0,15,31,63 ; (218) 34086 DEFB 127,127,255,255,0,192,248,252 ; (219) 34094 DEFB 254,254,255,255,255,255,0,0 ; (220) ; Unused b34102 DEFB 0,0,0,0,0,0,0,0 34110 DEFB 0,0,0,0,0,0,0,0 34118 DEFB 0,0,0,0,0,0,0,0 34126 DEFB 0,0,0,0,0,0,0,0 34134 DEFB 0,0,0,0,0,0,0,0 34142 DEFB 0,0,0,0,0,0,0,0 34150 DEFB 0,0,0,0,0,0,0,0 34158 DEFB 0,0,0,0,0,0,0,0 34166 DEFB 0,0,0,0,0,0,0,0 34174 DEFB 0,0,0,0,0,0,0,0 34182 DEFB 0,0,0,0,0,0,0,0 34190 DEFB 0,0,0,0,0,0,0,0 34198 DEFB 0,0 ; Jump to Start of Initialisation Code ; ; Used by the routines at #R59543 and #R63000. c34200 JP 34428 ; Jump to start of initialisation code ; Unused b34203 DEFB 190,133,173,233 ; Index of Current Level b34207 DEFB 1 ; Game Flags ; ; #TABLE(default,centre,:w) ; { =h Bit | =h Effect } ; { 0 | Drutt Mode Flag (Set = Drutt mode / Reset = Berk mode) } ; { 1 | Characters Already Swapped Flag } ; { 2 | "Berk Has Been Killed" Flag } ; { 3 | "Reset Spiders to Initial State" Flag } ; { 4 | Level Exit Door Unlocked Flag } ; { 5 | Update Scores and Display Flag (Reset = draw timer figures / Set = calculate/update scores and display) } ; { 6 | Character Swap Pending Flag } ; { 7 | Show Score Flag (Reset = draw Timer Figures / Set = Display Score / Hi Score) } ; TABLE# b34208 DEFB 0 ; Cannon's (Level 4) Ammunition Counter ; ; Number of shots Cannon can fire before returning to its dormant state. Increases by 10 for each drip the Cannon ; catches. b34209 DEFB 0 ; Current Time / Lives b34210 DEFB 16 ; Score Data b34211 DEFW 0 ; Timer Tick Counter / Score penalty (current level) 34213 DEFW 0 ; Score (Current Level) 34215 DEFW 0 ; Current Total Score ; Current Border Colour b34217 DEFB 1 ; Index of Current Character's Current Room b34218 DEFB 0 ; Control Input Bitmap ; ; #TABLE(default,centre,:w) ; { =h Bit | =h Effect } ; { 0 | Right } ; { 1 | Left } ; { 2 | Forward (i.e. DOWN - makes Drutt swap depth levels) } ; { 3 | Back (i.e. UP - makes Drutt jump higher) } ; { 4 | Berk / Drutt } ; { 5 | Pause } ; { 6 | Restart } ; { 7 | Unused } ; TABLE# b34219 DEFB 0 ; Berk's Current Power ; ; #TABLE(default,centre,:w) ; { =h Value | =h Effect } ; { 0 | None } ; { 1 | Jumping (Level 1) } ; { 2 | Jumping (Level 2) } ; { 3 | Jumping (Level 4) } ; { 4 | Flying (Level 1) } ; { 5 | Flying (Level 3, 1) } ; { 6 | Flying (Level 3, 2) } ; { 7 | Flying (Level 4, 1) } ; { 8 | Flying (Level 4, 2) } ; { 9 | Immunity to Bubo (Level 2) } ; { 10 | Floating (Level 3) } ; { 11 | Invisibility (Level 3) } ; TABLE# b34220 DEFB 0 ; Interaction Data for Berk b34221 DEFB 0 ; Class of entity currently held by Berk (e.g. Drutt = 18), or zero for none 34222 DEFB 0 ; y-coordinate minus one for top edge of coloured creature slot with which Berk is interacting 34223 DEFB 0 ; Number of times Berk has been killed by a spider on Level 1 ; Remaining Duration of Berk's Current Power ; ; For each game-cycle that a power is in use, the byte at #R34224 is increased. When this reaches 16, it is reset to ; zero and the value at #R34225 is decreased by one. b34224 DEFB 0 ; Number of elapsed game-cycles in current group of 16 34225 DEFB 0 ; Number of groups of 16 game-cycles remaining ; Attribute of Current Character ; ; This is 1 (blue) for Berk, or 6 (yellow) for Drutt. b34226 DEFB 1 ; Timer Figure Blink Duration Counter b34227 DEFB 0 ; Data for Clawed Foot (Level 3) ; ; Location #R34229 holds the index of the action performed by Clawed Foot after it picks Berk up. This value is ; incremented when the Clawed Foot reaches the top of its vertical range of travel while carrying Berk. If the ; incremented value exceeds six, then it is reset to one. After incrementing (and resetting if appropriate), the ; value is used to determine what the Clawed Foot does with Berk: b34228 DEFB 0 ; Time (cycles) until Clawed Foot (Level 3) attacks 34229 DEFB 0 ; Clawed Foot's Action Index ; Temporary Store for Room Dimension Data ; ; Contains an entry from one of the room dimension data blocks (at #R43815, #R44436, #R45116 or #R45860) for the ; current room of interest (see also #R34262). b34230 DEFB 0,0,0,0,0 ; Temporary Store for Width of Entity's Current Room ; ; This location holds the width of an entity's current room (in characters, plus + 99). b34235 DEFB 0 ; Table of Data Addresses (Current Level) b34236 DEFW 99 ; State Data for Simple Entities 34238 DEFW 99 ; State Data for Complex Entities 34240 DEFW 99 ; Address of Berk's state data 34242 DEFW 99 ; Address of Drutt's state data 34244 DEFW 99 ; Address of worm's state data 34246 DEFW 99 ; Start address for reverse-order collision checks 34248 DEFW 99 ; Room Dimension Data 34250 DEFW 99 ; Horizontal Room Connectivity Map 34252 DEFW 99 ; Unused Data Block (09) 34254 DEFW 99 ; Vertical Room Connectivity Map ; Miscellaneous Data 1 b34256 DEFW 0 ; Address of complex state data for entity Berk is interacting with 34258 DEFW 0 ; Address of complex state data for entity involved in last collision check 34260 DEFW 0 ; Address of complex state data for entity last held by Berk 34262 DEFW 0 ; Pointer to entry in room dimension data for an entity's room (See also data in this entry ; copied to #R34230) 34264 DEFW 0 ; Attribute File address of eyes of currently blinking timer figure 34266 DEFW 0 ; Temporary store for script data to execute upon arrival on new level 34268 DEFB 0 ; Current Graphic Set Index 34269 DEFB 0 ; Attribute for text printing 34270 DEFB 0 ; Current Attribute 34271 DEFB 0 ; "Display Buffer 2 is Primary" Flag 34272 DEFB 0 ; Width of entity carried by Berk (characters), minus 1 34273 DEFB 0 ; Index of pending sound (used by playback routine at #R59722) 34274 DEFB 0 ; Store for current value of loop counter in graphic layout data processing (instructions 238 ; and 239) 34275 DEFB 0 ; Store for current value of loop counter in graphic layout data processing (instructions 240 ; and 241) ; Unused b34276 DEFB 0 ; Position (Address) in Script Data Currently Running b34277 DEFW 0 ; Data for Drawing to Display b34279 DEFW 0 ; Start address of Primary Display Buffer 34281 DEFB 0 ; Base y-coordinate for graphic drawing 34282 DEFB 0 ; Base x-coordinate for graphic drawing ; Unused b34283 DEFB 0,0 ; Store for Script Instruction Loop Data b34285 DEFB 0,0,1 ; Repeat count and loop start address for script instructions 23 and 24 34288 DEFB 0,0,1 ; Repeat count and loop start address for script instructions 25 and 26 34291 DEFB 0,0,1 ; Repeat count and loop start address for script instructions 27 and 28 ; Store for Graphic Layout Loop Data b34294 DEFW 0 ; Store for address of start of current loop in graphic layout data processing (instructions ; 238 and 239) 34296 DEFW 0 ; Store for address of start of current loop in graphic layout data processing (instructions ; 240 and 241) ; Joystick Mode Flag ; ; #TABLE(default,centre,:w) ; { =h Value | =h Effect } ; { 0 | Joystick Mode off } ; { 1 | Joystick Mode on } ; TABLE# b34298 DEFB 0 ; Current High Score b34299 DEFW 999 ; Table of Data Addresses (Level 1) b34301 DEFW 43146 ; State Data for Simple Entities (Level 1) 34303 DEFW 43333 ; State Data for Complex Entities (Level 1) 34305 DEFW 43593 ; Address of Berk's state data (Level 1) 34307 DEFW 43671 ; Address of Drutt's state data (Level 1) 34309 DEFW 43684 ; Address of worm's state data (Level 1) 34311 DEFW 43736 ; Start address for reverse-order collision checks (Level 1) 34313 DEFW 43815 ; Room Dimension Data (Level 1) 34315 DEFW 43871 ; Horizontal Room Connectivity Map (Level 1) 34317 DEFW 43881 ; Unused Data Block (09) (Level 1) 34319 DEFW 43882 ; Vertical Room Connectivity Map (Level 1) ; Table of Data Addresses (Level 2) b34321 DEFW 43896 ; State Data for Simple Entities (Level 2) 34323 DEFW 43993 ; State Data for Complex Entities (Level 2) 34325 DEFW 44149 ; Address of Berk's state data (Level 2) 34327 DEFW 44396 ; Address of Drutt's state data (Level 2) 34329 DEFW 44409 ; Address of Worm's state data (Level 2) 34331 DEFW 44422 ; Start address for reverse-order collision checks (Level 2) 34333 DEFW 44436 ; Room Dimension Data (Level 2) 34335 DEFW 44472 ; Horizontal Room Connectivity Map (Level 2) 34337 DEFW 44482 ; Unused Data Block (09) (Level 2) 34339 DEFW 44483 ; Vertical Room Connectivity Map (Level 2) ; Table of Data Addresses (Level 3) b34341 DEFW 44487 ; State Data for Simple Entities (Level 3) 34343 DEFW 44608 ; State Data for Complex Entities (Level 3) 34345 DEFW 44855 ; Address of Berk's state data (Level 3) 34347 DEFW 44998 ; Address of Drutt's state data (Level 3) 34349 DEFW 45024 ; Address of worm's state data (Level 3) 34351 DEFW 45102 ; Start address for reverse-order collision checks (Level 3) 34353 DEFW 45116 ; Room Dimension Data (Level 3) 34355 DEFW 45152 ; Horizontal Room Connectivity Map (Level 3) 34357 DEFW 45164 ; Unused Data Block (09) (Level 3) 34359 DEFW 45165 ; Vertical Room Connectivity Map (Level 3) ; Table of Data Addresses (Level 4) b34361 DEFW 45171 ; State Data for Simple Entities (Level 4) 34363 DEFW 45274 ; State Data for Complex Entities (Level 4) 34365 DEFW 45391 ; Address of Berk's state data (Level 4) 34367 DEFW 45443 ; Address of Drutt's state data (Level 4) 34369 DEFW 45469 ; Address of worm's state data (Level 4) 34371 DEFW 45846 ; Start address for reverse-order collision checks (Level 4) 34373 DEFW 45860 ; Room Dimension Data (Level 4) 34375 DEFW 45886 ; Horizontal Room Connectivity Map (Level 4) 34377 DEFW 45894 ; Unused Data Block (09) (Level 4) 34379 DEFW 45895 ; Vertical Room Connectivity Map (Level 4) ; Stack Space b34381 DEFB 78,79,87,32,73,83,32,84 34389 DEFB 72,69,32,87,73,78,84,69 34397 DEFB 82,32,79,70,32,79,85,82 34405 DEFB 32,68,73,83,67,79,78,84 34413 DEFB 69,78,84,32,77,65,68,69 34421 DEFB 32,71,76,79,82 ; Unused b34426 DEFB 0,0 ; Set Up Random Seed and Disable Interrupts ; ; Used by the routine at #R34200. c34428 CALL 59831 ; Do nothing (see trivia) 34431 LD A,(23672) ; Store the least significant byte of the system variable FRAMES... 34434 LD (54219),A ; ...at 54219 as the seed for the pseudo-random number generator 34437 DI ; Disable interrupts ; Display Main Menu and Handle Main Game Loop c34438 LD SP,34426 ; Set Stack Pointer 34441 CALL 34695 ; Copy State Data for all resettable complex entities into Table of Initial-State Data 34444 LD A,1 ; Set current level to 1... 34446 LD (34207),A ; ... 34449 CALL 46830 ; Display and handle Main Menu 34452 LD A,(34217) ; Load current border colour into A 34455 OUT (254),A ; Set border colour 34457 CALL 34864 ; Copy start addresses of current level's data blocks to #R34236 and clean up old data 34460 CALL 53887 ; Paint red areas outside accessible areas of current character's current room 34463 CALL 47241 ; Reset Show Score Flag and draw timer figures bar ; Start of main loop *34466 CALL 53723 ; If Berk has been killed then reset his state, flash screen and decrease time / lives 34469 CALL 35689 ; Update state of Berk and store current position in script data 34472 CALL 51739 ; Update states of Drutt and worm and store current positions in script data 34475 LD A,(34207) ; If current level is not Level 1... 34478 CP 1 ; ... 34480 JR NZ,34527 ; ...then skip ahead to #R34527 ; Level 1 34482 CALL 36791 ; Update states of all Level 1 entities 34485 LD IX,(34240) ; Load IX with address of complex state data (current level) for Berk 34489 BIT 2,(IX+10) ; If "Back to Level 1" Flag is reset... 34493 JR Z,34557 ; ...then skip ahead to #R34557 ; Back to Level 1 Flag is set 34495 LD A,(43612) ; If y-coordinate of Boni's bottom edge is not 121... 34498 CP 121 ; ... 34500 JR NZ,34557 ; ...then skip ahead to #R34557 34502 LD A,(43677) ; If y-coordinate of Drutt's bottom edge is not 121... 34505 CP 121 ; ... 34507 JR NZ,34557 ; ...then skip ahead to #R34557 34509 LD A,(43671) ; If Drutt's room is not 1... 34512 CP 1 ; ... 34514 JR NZ,34557 ; ...then skip ahead to #R34557 34516 LD A,2 ; Set depth of "Home Sweet Home" brickwork to 2... 34518 LD (43159),A ; ... 34521 SET 3,(IX+10) ; Set "All Home" Flag 34525 JR 34557 ; Skip ahead to #R34557 *34527 LD A,(34207) ; If current level is not Level 2... 34530 CP 2 ; ... 34532 JR NZ,34537 ; ...then skip ahead to #R34537 ; Level 2 34534 CALL 38009 ; Update states of all Level 2 entities *34537 LD A,(34207) ; If current level is not Level 3... 34540 CP 3 ; ... 34542 JR NZ,34547 ; ...then skip ahead to #R34547 ; Level 3 34544 CALL 39137 ; Update states of all Level 3 entities *34547 LD A,(34207) ; If current level is not Level 4... 34550 CP 4 ; ... 34552 JR NZ,34557 ; ...then skip ahead to #R34557 ; Level 4 34554 CALL 41211 ; Update states of all Level 4 entities ; All levels *34557 CALL 47893 ; Check for control input and store at #R34219 34560 CALL 55525 ; Move all falling entities down by distances appropriate to their current velocity factors 34563 CALL 34916 ; If Fire Pressed, or Character Swap Pending Flag set, then swap characters 34566 CALL 53782 ; Set each value in Primary Display Buffer within play area to zero 34569 CALL 45899 ; Populate Primary Display Buffer with layout data for current character's current room 34572 CALL 54034 ; Draw contents of Primary Display Buffer to display 34575 CALL 59725 ; Play and clear pending sound (index as stored at #R34273) 34578 LD A,(34210) ; Load remaining time / lives into A 34581 OR A ; If no time / lives are left... 34582 JR Z,34645 ; ...then jump to #R34645 34584 LD A,(43603) ; If "All Home" Flag is set... 34587 BIT 3,A ; ... 34589 JR NZ,34658 ; ...then skip ahead to #R34658 34591 CALL 47363 ; Update eyes of a randomly selected timer figure, increase Timer Tick Counter and process ; timer figure blinking 34594 LD HL,34208 ; If Update Scores and Display Flag is reset... 34597 BIT 5,(HL) ; ... 34599 JR Z,34606 ; ...then skip ahead to #R34606 34601 RES 5,(HL) ; Reset Update Scores and Display Flag 34603 CALL 47499 ; Update scores and display *34606 LD HL,61312 ; Point HL at Display Buffer 1 34609 LD DE,63424 ; Point DE at Display Buffer 2 34612 LD A,(34271) ; Invert "Display Buffer 2 is Primary" Flag... 34615 XOR 1 ; ... 34617 LD (34271),A ; ... 34620 JR Z,34623 ; If "Display Buffer 2 is Primary" Flag is reset then skip ahead to #R34623 (Display Buffer 1 ; is Primary, Display Buffer 2 is Secondary) 34622 EX DE,HL ; Switch DE and HL (Display Buffer 1 is Secondary, Display Buffer 2 is Primary) *34623 LD (34279),HL ; Store address of Primary Display Buffer at #R34279 34626 LD A,(34219) ; Load A with control input 34629 BIT 6,A ; If Restart hasn't been pressed... 34631 JP Z,34466 ; ...then jump to #R34466 (start of main loop) ; Restart has been pressed 34634 LD A,1 ; Set sound 1 as pending if appropriate, then play and clear pending sound... 34636 CALL 59722 ; ... 34639 CALL 34751 ; Reset all game data in preparation for new game 34642 JP 34438 ; Jump back to #R34438 (return to Main Menu) ; No time/lives left *34645 CALL 47499 ; Update scores and display 34648 CALL 47185 ; Print "SORRY BERK, BUT YOUR TIME IS UP" string 34651 LD A,1 ; Set sound 1 as pending if appropriate, then play and clear pending sound... 34653 CALL 59722 ; ... 34656 JR 34666 ; Skip ahead to #R34666 ; "All Home" Flag is set *34658 CALL 47213 ; Print "HOME SWEET HOME" string 34661 LD A,3 ; Set sound 3 as pending if appropriate, then play and clear pending sound... 34663 CALL 59722 ; ... *34666 CALL 47942 ; Wait for current key to be released and another to be pressed, storing in A 34669 CALL 34751 ; Reset all game data in preparation for new game 34672 JP 34438 ; Jump back to #R34438 (return to Main Menu) ; Pause ; ; Used by the routine at #R53649. Input: B Repeat count for outer loop C Additional repeat count for inner loop c34675 PUSH BC ; Store BC 34676 LD B,10 ; Set B to 10 *34678 DEC BC ; Decrease BC 34679 LD A,B ; If BC is not zero... 34680 OR C ; ... 34681 JR NZ,34678 ; ...then loop back to #R34678 34683 POP BC ; Restore BC 34684 DJNZ 34675 ; Loop back for next pass 34686 RET ; Return ; Table of Start Addresses of Levels' State Data for Complex Entities b34687 DEFW 43333 ; Level 1 34689 DEFW 43993 ; Level 2 34691 DEFW 44608 ; Level 3 34693 DEFW 45274 ; Level 4 ; Copy State Data for all Resettable Complex Entities into Table of Initial-State Data for Complex Entities ; ; Used by the routine at #R34438. c34695 LD IY,34687 ; Point IY at start of Table of Start Addresses of Levels' State Data for Complex Entities 34699 LD DE,59821 ; Point DE at start of Table of Initial-State Data for Complex Entities 34702 LD B,4 ; Set B to 4 (as there are 4 levels) *34704 PUSH BC ; Store BC (B = remaining number of levels to process) 34705 LD L,(IY+0) ; Load start address of current level's complex state data into HL... 34708 LD H,(IY+1) ; ... 34711 INC IY ; Advance IY to next entry in list of addresses of complex state data... 34713 INC IY ; ... 34715 PUSH HL ; Transfer start address of current level's complex state data into IX... 34716 POP IX ; ... *34718 LD A,(IX+0) ; If first byte in current complex state data entry is 255 (End Marker)... 34721 CP 255 ; ... 34723 JR Z,34747 ; ...then skip ahead to #R34747 34725 LD A,(IX+10) ; If entity's Can Be Reset Flag is reset... 34728 AND 128 ; ... 34730 JR Z,34740 ; ...then advance IX by 13 bytes to next entry and loop back to #R34718 34732 PUSH IX ; Transfer start address of current entry in complex state data into HL... 34734 POP HL ; ... 34735 LD BC,13 ; Load BC with 13 (as entries in complex state data are 13 bytes wide) 34738 LDIR ; Copy current entry in complex state data into Table of Initial-State Data for Complex ; Entities at #R59821 *34740 LD BC,13 ; Load BC with 13 (as entries in complex state data are 13 bytes wide) 34743 ADD IX,BC ; Advance IX to next entry in complex state data 34745 JR 34718 ; Loop back to #R34718 *34747 POP BC ; Restore BC (B = remaining number of levels to process) 34748 DJNZ 34704 ; Decrease B and loop back to #R34704 to process next level 34750 RET ; Return ; Reset All Game Data in Preparation for New Game ; ; Used by the routine at #R34438. c34751 LD IY,34687 ; Point IY at start of Table of Start Addresses of Levels' State Data for Complex Entities 34755 LD HL,59821 ; Point HL at start of Table of Initial-State Data for Complex Entities 34758 LD B,4 ; Set B to 4 (as there are 4 levels) *34760 PUSH BC ; Store BC (B = remaining number of levels to process) 34761 LD E,(IY+0) ; Load start address of current level's complex state data into DE... 34764 LD D,(IY+1) ; ... 34767 INC IY ; Advance IY to next entry in list of addresses of complex state data... 34769 INC IY ; ... 34771 PUSH DE ; Transfer start address of current level's complex state data into IX... 34772 POP IX ; ... *34774 LD A,(IX+0) ; If first byte in current complex state data entry is 255 (End Marker)... 34777 CP 255 ; ... 34779 JR Z,34803 ; ...then skip ahead to #R34803 34781 LD A,(IX+10) ; If entity's Can Be Reset Flag is reset... 34784 AND 128 ; ... 34786 JR Z,34796 ; ...then advance IX by 13 bytes to next entry and loop back to #R34774 34788 PUSH IX ; Transfer start address of current entry in complex state data into DE... 34790 POP DE ; ... 34791 LD BC,13 ; Load BC with 13 (as entries in complex state data are 13 bytes wide) 34794 LDIR ; Copy current entry in Table of Initial-State Data for Complex Entities at #R59821 into ; complex state data *34796 LD BC,13 ; Load BC with 13 (as entries in complex state data are 13 bytes wide) 34799 ADD IX,BC ; Advance IX to next entry in complex state data 34801 JR 34774 ; Loop back to #R34774 *34803 POP BC ; Restore BC (B = remaining number of levels to process) 34804 DJNZ 34760 ; Decrease B and loop back to #R34760 to process next level 34806 LD HL,34298 ; Point HL at Joystick Mode Flag 34809 LD DE,34207 ; Point DE at store for current level number 34812 XOR A ; Set A to zero and reset Carry Flag 34813 SBC HL,DE ; Subtract DE from HL to leave HL = 91 34815 LD B,L ; Load B with 91 34816 LD HL,34207 ; Point HL at store for current level number... *34819 LD (HL),A ; ...and set 91 bytes from here onwards to zero... 34820 INC HL ; ... 34821 DJNZ 34819 ; ... 34823 LD A,16 ; Set time / lives to 16... 34825 LD (34210),A ; ... 34828 LD A,1 ; Set current level to Level 1... 34830 LD (34207),A ; ... 34833 CALL 36778 ; Initialise script data positions for Flying Skeleton Creature and Bat (Level 1) 34836 CALL 38468 ; Reset current positions in apebeasts' script data to initial values 34839 CALL 41354 ; Reset Skeleton to initial state 34842 CALL 51732 ; Reset Drutt to initial state 34845 LD A,1 ; Set room of "Closed Trap Door" and impassable marker to 1 (i.e. starting room)... 34847 LD (43188),A ; ... 34850 LD (43450),A ; ... 34853 LD (34226),A ; Set attribute of current character to 1 (blue, Berk) 34856 DEC A ; Set room of "Open Trap Door" and "Home Sweet Home" brickwork to 0... 34857 LD (43437),A ; ...i.e. remove from game... 34860 LD (43159),A ; ... 34863 RET ; Return ; Copy Start Addresses of Current Level's Data Blocks to 34236 and Clean Up Old Data ; ; Used by the routines at #R34438 and #R36753. c34864 PUSH DE ; Store DE 34865 PUSH HL ; Store HL 34866 LD HL,(34244) ; Load HL with address of complex state data (current level) for worm 34869 LD (HL),0 ; Set worm's current room to zero 34871 LD A,(34207) ; Load current level into A 34874 LD HL,34281 ; Point HL at position 20 bytes before start of list of start addresses of level 1's data ; blocks 34877 LD BC,20 ; Set data length to 20, as there are 10 data blocks per level (so 10 addresses) *34880 ADD HL,BC ; Advance HL to start of data block address list for next level 34881 DEC A ; Decrease level counter 34882 JR NZ,34880 ; Loop back if we have not reached data for required level ; At this point, HL points to the start of the list of start addresses of the current level's data blocks 34884 LD DE,34236 ; Copy this level's data block start addresses to #R34236... 34887 LDIR ; ... 34889 LD B,9 ; Clear Store for Script Instruction Loop Data... 34891 LD HL,34285 ; ... *34894 LD (HL),A ; ... 34895 INC HL ; ... 34896 DJNZ 34894 ; ... 34898 POP HL ; Restore HL 34899 POP DE ; Restore DE 34900 RET ; Return ; Script Routine (48, 49) Return ; ; This script routine terminates the script data currently under execution until the next game cycle. c34901 RET ; Return ; Unused routine ; ; This routine floods the Attribute File with value 9 (Blue INK, Blue PAPER) c34902 LD HL,22528 ; Set all Attribute File contents to blue INK, blue PAPER... 34905 LD DE,22529 ; ... 34908 LD (HL),9 ; ... 34910 LD BC,767 ; ... 34913 LDIR ; ... 34915 RET ; Return ; If Fire Pressed, or Character Swap Pending Flag Set, then Swap Characters ; ; Used by the routine at #R34438. c34916 LD HL,34208 ; If Character Swap Pending Flag is reset... 34919 BIT 6,(HL) ; ... 34921 JR Z,34927 ; ...then skip ahead to #R34927 34923 RES 6,(HL) ; Reset Character Swap Pending Flag 34925 JR 34944 ; Skip ahead to #R34944 *34927 LD A,(34219) ; Load A with control input 34930 BIT 4,A ; If fire was pressed... 34932 JR NZ,34940 ; ...then skip ahead to #R34940 34934 RES 1,(HL) ; Reset Characters Already Swapped Flag *34936 CALL 53825 ; Copy room dimension data entry for current character's current room to temporary store ; location (#R34230) 34939 RET ; Return ; [Fire pressed] *34940 BIT 1,(HL) ; If Characters Already Swapped Flag set (i.e. FIRE hasn't been released since last swap)... 34942 JR NZ,34936 ; ...then jump back to #R34936 *34944 SET 1,(HL) ; Set Characters Already Swapped Flag 34946 LD A,(HL) ; Load Game Flags into A 34947 XOR 1 ; Flip bit 7 (Berk / Drutt flag)... 34949 LD (HL),A ; ... 34950 BIT 0,(HL) ; If current character is now Berk (0)... 34952 JR Z,34958 ; ...then jump ahead to #R34958 34954 LD A,6 ; Load A with 6 (attribute for Drutt's timer indicator figures) 34956 JR 34960 ; Skip ahead to #R34960 *34958 LD A,1 ; Load A with 1 (attribute for Berk's timer indicator figures) *34960 LD (34226),A ; Set attribute of timer indicator figures to value in A 34963 CALL 53887 ; Paint red areas outside accessible areas of current character's current room 34966 LD HL,34208 ; If Show Score Flag is set... 34969 BIT 7,(HL) ; ... 34971 JP NZ,47628 ; ...then print SCORE / TOTAL / HI-SC string in current character's colours and return 34974 JP 47241 ; Reset Show Score Flag, draw timer figures bar and return ; Script Data Berk Turning to Face Left b34977 DEFB 8,0 ; Set Must Process Current Script Data Flag 34979 DEFB 19,0 ; Move carried entity to Berk's left as he faces left 34981 DEFB 184,219 ; #R56248 (Berk, stepping left, left foot out, arm and eye animated) 34983 DEFB 193,219 ; #R56257 (Berk, stepping left, left foot out and forward, arm and eye animated) ; At this point, Berk has made the turn (i.e. already moved his feet) 34985 DEFB 13,0 ; Set Berk's Facing Left Flag, and reset his Facing Into Screen and Facing Right flags 34987 DEFB 19,0 ; Move carried entity to Berk's left as he faces left 34989 DEFB 9,0 ; Reset Must Process Current Script Data Flag 34991 DEFB 202,219 ; #R56266 (Berk, facing left, arm and eye animated) 34993 DEFB 1,0,169,136 ; Jump back to #R34985 ; Script Data Berk Turning to Face Right b34997 DEFB 8,0 ; Set Must Process Current Script Data Flag 34999 DEFB 20,0 ; Move carried entity to Berk's right as he faces right 35001 DEFB 158,217 ; #R55710 (Berk, stepping right, right foot out, arm and eye animated) 35003 DEFB 146,217 ; #R55698 (Berk, stepping right, right foot out and forward, arm and eye animated) ; At this point, Berk has made the turn (i.e. already moved his feet) 35005 DEFB 14,0 ; Set Berk's Facing Right Flag, and reset his Facing Into Screen and Facing Left flags 35007 DEFB 20,0 ; Move carried entity to Berk's right as he faces right 35009 DEFB 9,0 ; Reset Must Process Current Script Data Flag 35011 DEFB 170,217 ; #R55722 (Berk, facing right, arm and eye animated) 35013 DEFB 1,0,189,136 ; Jump back to #R35005 ; Script Data Berk Interacting with a Door Behind Him b35017 DEFB 8,0 ; Set Must Process Current Script Data Flag 35019 DEFB 6,0 ; Set Berk's Facing Into Screen Flag, and reset his Facing Left and Facing Right flags 35021 DEFB 10,0 ; Reset Berk's Walking Left and Walking Right flags 35023 DEFB 22,0 ; Move carried entity behind Berk as he faces into screen 35025 DEFB 84,224 ; #R57428 (Berk facing into screen, holding something) 35027 DEFB 84,224 ; #R57428 (Berk facing into screen, holding something) 35029 DEFB 59,0 ; Have Berk interact appropriately with a door behind him 35031 DEFB 57,0 ; Cycle attributes (full-screen), clear display buffers and paint red areas outside current ; room 35033 DEFB 23,0,5,0 ; Start loop (1) for 5 iterations 35037 DEFB 250,223 ; #R57338 (Berk facing into screen, arms out to the sides) 35039 DEFB 24,0 ; End loop (1) 35041 DEFB 1,0,41,137 ; Jump to #R35113 (Berk facing into screen, ready to respond to control input) ; Script Data Berk Interacting with a Door in Front of Him b35045 DEFB 8,0 ; Set Must Process Current Script Data Flag 35047 DEFB 7,0 ; Reset Berk's Facing Into Screen, Facing Left and Facing Right flags 35049 DEFB 10,0 ; Reset Berk's Walking Left and Walking Right flags 35051 DEFB 21,0 ; Move carried entity in front of Berk as he faces out of screen 35053 DEFB 226,222 ; #R57058 (Berk, facing out of screen, holding something, animated) 35055 DEFB 226,222 ; #R57058 (Berk, facing out of screen, holding something, animated) 35057 DEFB 58,0 ; Have Berk interact appropriately with a door in front of him 35059 DEFB 57,0 ; Cycle attributes (full-screen), clear display buffers and paint red areas outside current ; room 35061 DEFB 23,0,5,0 ; Start loop (1) for 5 iterations 35065 DEFB 155,221 ; #R56731 (Berk, facing out of screen, arms outstretched, animated) 35067 DEFB 24,0 ; End loop (1) 35069 DEFB 1,0,9,137 ; Jump to #R35081 (Berk facing out of screen, ready to respond to control input) ; Script Data Berk Turning (Facing into Screen to Facing Out of Screen) b35073 DEFB 8,0 ; Set Must Process Current Script Data Flag 35075 DEFB 20,0 ; Move carried entity to Berk's right as he faces right 35077 DEFB 146,217 ; #R55698 (Berk, stepping right, right foot out and forward, arm and eye animated) 35079 DEFB 158,217 ; #R55710 (Berk, stepping right, right foot out, arm and eye animated) ; Berk facing out of screen, ready to respond to control input 35081 DEFB 10,0 ; Reset Berk's Walking Left and Walking Right flags 35083 DEFB 9,0 ; Reset Must Process Current Script Data Flag 35085 DEFB 7,0 ; Reset Berk's Facing Into Screen, Facing Left and Facing Right flags 35087 DEFB 15,0,25,137 ; If Berk is carrying something then jump to #R35097 (Berk facing out of screen, holding ; something) ; Berk holding nothing 35091 DEFB 228,221 ; #R56804 (Berk, facing out of screen, arms down at sides, animated) 35093 DEFB 1,0,19,137 ; Jump to #R35091 ; Berk holding something 35097 DEFB 21,0 ; Move carried entity in front of Berk as he faces out of screen 35099 DEFB 226,222 ; #R57058 (Berk, facing out of screen, holding something, animated) 35101 DEFB 1,0,25,137 ; Jump to #R35097 ; Script Data Berk Turning (Facing Out of Screen to Facing into Screen) b35105 DEFB 8,0 ; Set Must Process Current Script Data Flag 35107 DEFB 19,0 ; Move carried entity to Berk's left as he faces left 35109 DEFB 184,219 ; #R56248 (Berk, stepping left, left foot out, arm and eye animated) 35111 DEFB 193,219 ; #R56257 (Berk, stepping left, left foot out and forward, arm and eye animated) ; Berk facing into screen, ready to respond to control input 35113 DEFB 9,0 ; Reset Must Process Current Script Data Flag 35115 DEFB 6,0 ; Set Berk's Facing Into Screen Flag, and reset his Facing Left and Facing Right flags 35117 DEFB 10,0 ; Reset Berk's Walking Left and Walking Right flags 35119 DEFB 15,0,101,137 ; If Berk is carrying something then jump to #R35173 (Berk facing into screen, holding ; something) ; Berk holding nothing 35123 DEFB 23,0,8,0 ; Start loop (1) for 8 iterations 35127 DEFB 9,224 ; #R57353 (Berk, facing into screen, arms down) 35129 DEFB 24,0 ; End loop (1) 35131 DEFB 1,0,1,137 ; Jump to #R35073 (Berk turning from facing into screen to facing out of screen) ; Script Data Berk Picking Up an Entity on Floor Behind Him b35135 DEFB 10,0 ; Reset Berk's Walking Left and Walking Right flags 35137 DEFB 8,0 ; Set Must Process Current Script Data Flag 35139 DEFB 250,223 ; #R57338 (Berk facing into screen, arms out to the sides) 35141 DEFB 97,227 ; #R58209 (Berk facing into screen, bending down) 35143 DEFB 16,0 ; Have Berk hold an entity, and position it appropriately between his hands 35145 DEFB 1,0,101,137 ; Jump to #R35173 (Berk facing into screen, holding something) ; Script Data Berk Picking Up an Entity Above and Behind Him b35149 DEFB 10,0 ; Reset Berk's Walking Left and Walking Right flags 35151 DEFB 8,0 ; Set Must Process Current Script Data Flag 35153 DEFB 166,227 ; #R58278 (Berk, facing into screen, stretching upwards) 35155 DEFB 166,227 ; #R58278 (Berk, facing into screen, stretching upwards) 35157 DEFB 16,0 ; Have Berk hold an entity, and position it appropriately between his hands 35159 DEFB 1,0,101,137 ; Jump to #R35173 (Berk facing into screen, holding something) ; Script Data Berk Picking Up an Entity that is Above Floor and Below Berk's Top Edge and Behind Him b35163 DEFB 10,0 ; Reset Berk's Walking Left and Walking Right flags 35165 DEFB 8,0 ; Set Must Process Current Script Data Flag 35167 DEFB 250,223 ; #R57338 (Berk facing into screen, arms out to the sides) 35169 DEFB 84,224 ; #R57428 (Berk facing into screen, holding something) 35171 DEFB 16,0 ; Have Berk hold an entity, and position it appropriately between his hands 35173 DEFB 22,0 ; Move carried entity behind Berk as he faces into screen 35175 DEFB 84,224 ; #R57428 (Berk facing into screen, holding something) 35177 DEFB 84,224 ; #R57428 (Berk facing into screen, holding something) 35179 DEFB 84,224 ; #R57428 (Berk facing into screen, holding something) 35181 DEFB 84,224 ; #R57428 (Berk facing into screen, holding something) 35183 DEFB 1,0,1,137 ; Jump to #R35073 (Berk turning from facing into screen to facing out of screen) ; Script Data Berk Picking Up an Entity on Floor in Front of Him b35187 DEFB 8,0 ; Set Must Process Current Script Data Flag 35189 DEFB 10,0 ; Reset Berk's Walking Left and Walking Right flags 35191 DEFB 155,221 ; #R56731 (Berk, facing out of screen, arms outstretched, animated) 35193 DEFB 7,227 ; #R58119 (Berk, facing out of screen, bending down) 35195 DEFB 7,227 ; #R58119 (Berk, facing out of screen, bending down) 35197 DEFB 7,227 ; #R58119 (Berk, facing out of screen, bending down) 35199 DEFB 16,0 ; Have Berk hold an entity, and position it appropriately between his hands 35201 DEFB 1,0,9,137 ; Jump to #R35081 (Berk facing out of screen, ready to respond to control input) ; Script Data Berk Putting an Entity Down on Floor in Front of Him b35205 DEFB 8,0 ; Set Must Process Current Script Data Flag 35207 DEFB 21,0 ; Move carried entity in front of Berk as he faces out of screen 35209 DEFB 17,0 ; Have Berk put down an entity in front of him, if appropriate 35211 DEFB 7,227 ; #R58119 (Berk, facing out of screen, bending down) 35213 DEFB 7,227 ; #R58119 (Berk, facing out of screen, bending down) 35215 DEFB 1,0,9,137 ; Jump to #R35081 (Berk facing out of screen, ready to respond to control input) ; Script Data Berk Putting an Entity Down on Floor Behind Him b35219 DEFB 8,0 ; Set Must Process Current Script Data Flag 35221 DEFB 22,0 ; Move carried entity behind Berk as he faces into screen 35223 DEFB 18,0 ; Have Berk put down an entity behind him, if appropriate 35225 DEFB 97,227 ; #R58209 (Berk facing into screen, bending down) 35227 DEFB 97,227 ; #R58209 (Berk facing into screen, bending down) 35229 DEFB 250,223 ; #R57338 (Berk facing into screen, arms out to the sides) 35231 DEFB 1,0,41,137 ; Jump to #R35113 (Berk facing into screen, ready to respond to control input) ; Script Data Berk Putting an Entity Down Above Floor Behind Him b35235 DEFB 8,0 ; Set Must Process Current Script Data Flag 35237 DEFB 22,0 ; Move carried entity behind Berk as he faces into screen 35239 DEFB 84,224 ; #R57428 (Berk facing into screen, holding something) 35241 DEFB 18,0 ; Have Berk put down an entity behind him, if appropriate 35243 DEFB 166,227 ; #R58278 (Berk, facing into screen, stretching upwards) 35245 DEFB 166,227 ; #R58278 (Berk, facing into screen, stretching upwards) 35247 DEFB 1,0,1,137 ; Jump to #R35073 (Berk turning from facing into screen to facing out of screen) ; Script Data Berk Starting to Walk Right b35251 DEFB 12,0 ; Set Berk's Walking Right Flag 35253 DEFB 20,0 ; Move carried entity to Berk's right as he faces right 35255 DEFB 182,217 ; #R55734 (Berk walking right, animated) 35257 DEFB 3,0 ; Move Berk right one character 35259 DEFB 1,0,183,137 ; Jump to #R35255 ; Script Data Berk Starting to Walk Left b35263 DEFB 11,0 ; Set Berk's Walking Left Flag 35265 DEFB 19,0 ; Move carried entity to Berk's left as he faces left 35267 DEFB 211,219 ; #R56275 (Berk walking left, animated) 35269 DEFB 2,0 ; Move Berk left one character 35271 DEFB 1,0,195,137 ; Jump back to #R35267 ; Script Data Berk's Power Expiring b35275 DEFB 155,221 ; #R56731 (Berk, facing out of screen, arms outstretched, animated) 35277 DEFB 57,0 ; Cycle attributes (full-screen), clear display buffers and paint red areas outside current ; room 35279 DEFB 1,0,31,138 ; Jump to #R35359 (Berk starting to fall downwards) ; Script Data Berk Banging Head (While Jumping) b35283 DEFB 72,232 ; #R59464 (Berk, getting up / banging head, frame 2) 35285 DEFB 72,232 ; #R59464 (Berk, getting up / banging head, frame 2) 35287 DEFB 1,0,31,138 ; Jump to #R35359 (Berk starting to fall downwards) ; Script Data Berk Starting to Fall to the Left b35291 DEFB 8,0 ; Set Must Process Current Script Data Flag 35293 DEFB 23,0,3,0 ; Start loop (1) for 3 iterations 35297 DEFB 211,219 ; #R56275 (Berk walking left, animated) 35299 DEFB 2,0 ; Move Berk left one character 35301 DEFB 24,0 ; End loop (1) ; At this point, the fall is in progress 35303 DEFB 8,0 ; Set Must Process Current Script Data Flag 35305 DEFB 229,229 ; #R58853 (Berk, facing left, falling, arms to sides) 35307 DEFB 2,0 ; Move Berk left two characters... 35309 DEFB 2,0 ; ... 35311 DEFB 61,229 ; #R58685 (Berk, facing left, falling, arms forward) 35313 DEFB 2,0 ; Move Berk left one character 35315 DEFB 35,0 ; Move Berk down two characters... 35317 DEFB 35,0 ; ... 35319 DEFB 168,230 ; #R59048 (Berk being thrown left) 35321 DEFB 35,0 ; Move Berk down one character 35323 DEFB 1,0,31,138 ; Jump to #R35359 (Berk starting to fall downwards) ; Script Data Berk Starting to Fall to the Right b35327 DEFB 8,0 ; Set Must Process Current Script Data Flag 35329 DEFB 23,0,3,0 ; Start loop (1) for 3 iterations 35333 DEFB 182,217 ; #R55734 (Berk walking right, animated) 35335 DEFB 3,0 ; Move Berk right one character 35337 DEFB 24,0 ; End loop (1) ; At this point, the fall is in progress 35339 DEFB 8,0 ; Set Must Process Current Script Data Flag 35341 DEFB 154,229 ; #R58778 (Berk, facing right, falling, arms to sides) 35343 DEFB 3,0 ; Move Berk right two characters... 35345 DEFB 3,0 ; ... 35347 DEFB 224,228 ; #R58592 (Berk, facing right, falling, arms forward) 35349 DEFB 3,0 ; Move Berk right one character 35351 DEFB 35,0 ; Move Berk down two characters... 35353 DEFB 35,0 ; ... 35355 DEFB 48,230 ; #R58928 (Berk, being thrown right) 35357 DEFB 35,0 ; Move Berk down one character ; This is the start of the script data that controls Berk's vertical falls, e.g. when flying power expires, after ; initial sideways fall down Trap Door, etc. 35359 DEFB 8,0 ; Set Must Process Current Script Data Flag 35361 DEFB 29,0 ; Make Berk start falling, and drop his carried entity if appropriate 35363 DEFB 32,231 ; #R59168 (Floating / starting to fall, animated) 35365 DEFB 30,0 ; Check Berk's fall velocity, and react to landing 35367 DEFB 103,231 ; #R59239 (Berk, falling downwards) 35369 DEFB 30,0 ; Check Berk's fall velocity, and react to landing ; This is the start of the script data that controls Berk when he has landed from a fall. Initially he is lying on ; the floor stunned, and then he gets up. 35371 DEFB 175,231 ; #R59311 (Berk, lying on floor, animated) 35373 DEFB 4,0,5,0 ; If current character and target entity are in the same room then set pending sound to 5 ; (#R59666) 35377 DEFB 244,231 ; #R59380 (Berk, getting up, frame 1, animated) 35379 DEFB 23,0,15,0 ; Start loop (1) for 15 iterations 35383 DEFB 175,231 ; #R59311 (Berk, lying on floor, animated) 35385 DEFB 24,0 ; End loop (1) 35387 DEFB 23,0,4,0 ; Start loop (1) for 4 iterations 35391 DEFB 244,231 ; #R59380 (Berk, getting up, frame 1, animated) 35393 DEFB 24,0 ; End loop (1) 35395 DEFB 23,0,2,0 ; Start loop (1) for 2 iterations 35399 DEFB 175,231 ; #R59311 (Berk, lying on floor, animated) 35401 DEFB 175,231 ; #R59311 (Berk, lying on floor, animated) 35403 DEFB 244,231 ; #R59380 (Berk, getting up, frame 1, animated) 35405 DEFB 72,232 ; #R59464 (Berk, getting up / banging head, frame 2) 35407 DEFB 24,0 ; End loop (1) 35409 DEFB 155,221 ; #R56731 (Berk, facing out of screen, arms outstretched, animated) 35411 DEFB 155,221 ; #R56731 (Berk, facing out of screen, arms outstretched, animated) 35413 DEFB 1,0,9,137 ; Jump to #R35081 (Berk facing out of screen, ready to respond to control input) ; Script Data Berk Starting to Fly Holding nothing b35417 DEFB 21,0 ; Move carried entity in front of Berk as he faces out of screen 35419 DEFB 57,0 ; Cycle attributes (full-screen), clear display buffers and paint red areas outside current ; room 35421 DEFB 15,0,105,138 ; If Berk is carrying something then jump to #R35433 35425 DEFB 225,221 ; #R56801 (Berk with wings, animated) 35427 DEFB 32,0 ; Update Berk's position and state (flying) depending upon control input 35429 DEFB 1,0,97,138 ; Jump back to #R35425 ; Holding something 35433 DEFB 223,222 ; #R57055 (Berk with wings and holding something, animated) 35435 DEFB 32,0 ; Update Berk's position and state (flying) depending upon control input 35437 DEFB 1,0,105,138 ; Jump back to #R35433 ; Script Data Berk Jumping ; ; Berk Starting to Jump Straight Up b35441 DEFB 8,0 ; Set Must Process Current Script Data Flag 35443 DEFB 10,0 ; Reset Berk's Walking Left and Walking Right flags 35445 DEFB 7,227 ; #R58119 (Berk, facing out of screen, bending down) 35447 DEFB 7,227 ; #R58119 (Berk, facing out of screen, bending down) 35449 DEFB 155,221 ; #R56731 (Berk, facing out of screen, arms outstretched, animated) 35451 DEFB 33,0 ; Advance Berk's jump and select next phase if current phase complete 35453 DEFB 1,0,121,138 ; Jump back to #R35449 ; Berk Landing (After Jump) 35457 DEFB 8,0 ; Set Must Process Current Script Data Flag 35459 DEFB 10,0 ; Reset Berk's Walking Left and Walking Right flags 35461 DEFB 7,227 ; #R58119 (Berk, facing out of screen, bending down) 35463 DEFB 7,227 ; #R58119 (Berk, facing out of screen, bending down) 35465 DEFB 1,0,9,137 ; Jump to #R35081 (Berk facing out of screen, ready to respond to control input) ; Berk Jumping Left 35469 DEFB 8,0 ; Set Must Process Current Script Data Flag 35471 DEFB 11,0 ; Set Berk's Walking Left Flag 35473 DEFB 211,219 ; #R56275 (Berk walking left, animated) 35475 DEFB 33,0 ; Advance Berk's jump and select next phase if current phase complete 35477 DEFB 1,0,141,138 ; Jump to #R35469 ; Berk Jumping Right 35481 DEFB 8,0 ; Set Must Process Current Script Data Flag 35483 DEFB 12,0 ; Set Berk's Walking Right Flag 35485 DEFB 182,217 ; #R55734 (Berk walking right, animated) 35487 DEFB 33,0 ; Advance Berk's jump and select next phase if current phase complete 35489 DEFB 1,0,153,138 ; Jump to #R35481 ; Script Data Berk Eating an Entity b35493 DEFB 8,0 ; Set Must Process Current Script Data Flag 35495 DEFB 23,0,4,0 ; Start loop (1) for 4 iterations 35499 DEFB 167,221 ; #R56743 (Berk, arms raised, eating, animated) 35501 DEFB 24,0 ; End loop (1) 35503 DEFB 56,0 ; Give Berk power corresponding to entity eaten 35505 DEFB 155,221 ; #R56731 (Berk, facing out of screen, arms outstretched, animated) 35507 DEFB 155,221 ; #R56731 (Berk, facing out of screen, arms outstretched, animated) 35509 DEFB 57,0 ; Cycle attributes (full-screen), clear display buffers and paint red areas outside current ; room 35511 DEFB 1,0,9,137 ; Jump to #R35081 (Berk facing out of screen, ready to respond to control input) ; Script Data Berk Gaining Floating Power ; ; The current position in Berk's script data is set to #R35515 both when he gains the floating power (#R36536) and ; when the Clawed Foot on Level 3 grabs Berk (#R39391). In the former case, the script instruction at #R35515 will ; be executed however in the latter case that instruction will be skipped over. Therefore, when Berk is grabbed on ; Level 3, the cycle attributes effect does not occur. b35515 DEFB 57,0 ; Cycle attributes (full-screen), clear display buffers and paint red areas outside current ; room 35517 DEFB 32,231 ; #R59168 (Floating / starting to fall, animated) 35519 DEFB 1,0,189,138 ; Jump to #R35517 ; Script Data Berk Being Thrown Left by Hatch (Level 3) b35523 DEFB 168,230 ; #R59048 (Berk being thrown left) 35525 DEFB 23,0,5,0 ; Start loop (1) for 5 iterations 35529 DEFB 168,230 ; #R59048 (Berk being thrown left) 35531 DEFB 2,0 ; Move Berk left two characters... 35533 DEFB 2,0 ; ... 35535 DEFB 62,0 ; Move Berk into room to the left, if appropriate 35537 DEFB 34,0 ; Move Berk up two characters... 35539 DEFB 34,0 ; ... 35541 DEFB 24,0 ; End loop (1) 35543 DEFB 23,0,4,0 ; Start loop (1) for 4 iterations 35547 DEFB 168,230 ; #R59048 (Berk being thrown left) 35549 DEFB 2,0 ; Move Berk left two characters... 35551 DEFB 2,0 ; ... 35553 DEFB 35,0 ; Move Berk down two characters... 35555 DEFB 35,0 ; ... 35557 DEFB 24,0 ; End loop (1) 35559 DEFB 23,0,2,0 ; Start loop (1) for 2 iterations 35563 DEFB 32,231 ; #R59168 (Floating / starting to fall, animated) 35565 DEFB 2,0 ; Move Berk left one character 35567 DEFB 35,0 ; Move Berk down two characters... 35569 DEFB 35,0 ; ... 35571 DEFB 24,0 ; End loop (1) 35573 DEFB 1,0,43,138 ; Jump to #R35371 (Berk lying on floor stunned and getting up) ; Change Direction Berk is Facing Depending Upon Relative Position of Drutt ; ; Used by the routine at #R35735. Input: IX Address of complex state data (current level) for Berk c35577 LD A,(34218) ; If Drutt's current room... 35580 CP (IX+0) ; ...is not the same as Berk's current room... 35583 JP NZ,35786 ; ...then jump to #R35786 (terminate Berk's flight, or have him (turn to) face out of screen as ; appropriate) 35586 LD A,(IX+11) ; Reset Berk's Walking Right, Walking Left, Unused (11,2) and Unused (11,3) flags... 35589 AND 240 ; ... 35591 LD (IX+11),A ; ... 35594 LD E,(IX+9) ; Load Berk's Flags into E 35597 LD IY,(34242) ; Load IY with address of complex state data (current level) for Drutt 35601 LD A,(IY+7) ; Load A with x-coordinate of Drutt's right side... 35604 INC A ; ...and increase by one 35605 CP (IX+5) ; If x-coordinate of Berk's left side is greater than this (i.e. Drutt is to the left of ; Berk)... 35608 JR C,35653 ; ...then skip ahead to #R35653 35610 LD A,(IX+7) ; Load A with x-coordinate of Berk's right side 35613 INC A ; Increase A by one 35614 CP (IY+5) ; If x-coordinate of Drutt's left side is greater than this (i.e. Drutt is to the right of ; Berk)... 35617 JR C,35670 ; ...then skip ahead to #R35670 ; Drutt is between Berk's left and right sides 35619 LD A,(IY+1) ; If Drutt's depth is 1... 35622 CP 1 ; ... 35624 JP Z,35642 ; ...then skip ahead to #R35642 ; Drutt is behind Berk 35627 LD A,E ; Load A with Berk's flags 35628 AND 14 ; If Berk's Facing into Screen, Facing Left and Facing Right flags are all reset... 35630 JP Z,35636 ; ...then skip ahead to #R35636 ; Drutt is behind Berk and at least one of Berk's Facing into Screen, Facing Left and Facing Right flags is set 35633 JP 35815 ; Point HL at script data for Berk facing into screen, ready to respond to control input and ; execute ; Drutt is behind Berk and Berk's Facing into Screen, Facing Left and Facing Right flags are all reset *35636 LD HL,35105 ; Point HL at script data for Berk turning (facing out of screen to facing into screen)... 35639 JP 48098 ; ...and execute ; Drutt is in front of Berk *35642 BIT 1,E ; If Berk's Facing into Screen Flag is reset... 35644 JP Z,35821 ; ...then point HL at script data for Berk facing out of screen, ready to respond to control ; input and execute ; Drutt is in front of Berk and Berk's Facing into Screen Flag is set 35647 LD HL,35073 ; Point HL at script data for Berk turning (facing into screen to facing out of screen)... 35650 JP 48098 ; ...and execute ; Drutt is to the left of Berk *35653 LD A,E ; Load A with Berk's flags 35654 AND 6 ; If either of Berk's Facing into Screen or Facing Left flags are set... 35656 JR NZ,35664 ; ...then skip ahead to #R35664 ; Drutt is to the left of Berk, and Berk's Facing into Screen and Facing Left flags are both reset 35658 LD HL,34977 ; Point HL at script data for Berk turning to face left... 35661 JP 48098 ; ...and execute ; Drutt is to the left of Berk and either of Berk's Facing into Screen or Facing Left flags are set *35664 LD HL,34985 ; Point HL at script data for Berk facing left... 35667 JP 48098 ; ...and execute ; Drutt is to the right of Berk *35670 LD A,E ; Load A with Berk's flags 35671 AND 10 ; If either of Berk's Facing into Screen or Facing Right flags are set... 35673 JR NZ,35681 ; ...then skip ahead to #R35681 ; Drutt is to the right of Berk, and Berk's Facing into Screen and Facing Right flags are both reset 35675 LD HL,34997 ; Point HL at script data for Berk turning to face right... 35678 JP 48098 ; ...and execute ; Drutt is to the right of Berk and either of Berk's Facing into Screen or Facing Right flags are set *35681 LD HL,35005 ; Point HL at script data for Berk facing right... 35684 JP 48098 ; ...and execute ; Current Position in Berk's Script Data b35687 DEFW 35081 ; Berk facing out of screen, ready to respond to control input ; Update State of Berk and Store Current Position in Script Data ; ; Used by the routine at #R34438. c35689 LD IX,(34240) ; Load IX with address of complex state data (current level) for Berk 35693 CALL 53848 ; Store room size data for Berk's current room 35696 BIT 5,(IX+9) ; If Berk's "Do Not Update State" Flag is set... 35700 RET NZ ; ...then return 35701 LD HL,(35687) ; Load current position in Berk's script data from #R35687 into HL... 35704 LD (34277),HL ; ...and store at #R34277 as position in script currently running 35707 CALL 35735 ; Update state of Berk depending upon currently selected character, control input and currently ; active power 35710 LD HL,(34277) ; Store address (current position in script data) stored at #R34277... 35713 LD (35687),HL ; ...at #R35687 as current position in Berk's script data 35716 LD A,(34220) ; If Berk's current power is not invisibility (level 3)... 35719 CP 11 ; ... 35721 RET NZ ; ...then return ; Current power is invisibility (Level 3) 35722 LD BC,50800 ; Load BC with address of blank graphic layout data... 35725 LD (IX+2),C ; ...and set this as Berk's current graphic layout data address... 35728 LD (IX+3),B ; ... 35731 CALL 48388 ; Decrease remaining time for current power and if zero, exit this routine and run script data ; for removal of power 35734 RET ; Return ; Update State of Berk Depending Upon Currently Selected Character, Control Input and Currently Active Power ; ; Used by the routine at #R35689. Input: IX Address of complex state data (current level) for Berk c35735 BIT 7,(IX+9) ; If Berk's Moving Upwards Flag (floating power) is set... 35739 JP NZ,36542 ; ...then jump to #R36542 (update state of Berk, floating power active) 35742 BIT 0,(IX+9) ; If Berk's Must Process Current Script Data Flag is set... 35746 JP NZ,48096 ; ...then jump to #R48096 (advance HL to next script instruction and execute) 35749 LD A,(34208) ; If Drutt Mode Flag is set... 35752 BIT 0,A ; ... 35754 JP NZ,35577 ; ...then jump to #R35577 (change direction Berk is facing depending upon relative position of ; Drutt) ; Drutt Mode Flag is reset (i.e. Berk Mode) 35757 LD A,(34219) ; Load A with control input 35760 BIT 0,A ; If right has been pressed... 35762 JP NZ,36214 ; ...then skip ahead to #R36214 (move Berk right if appropriate) 35765 BIT 1,A ; If left has been pressed... 35767 JP NZ,36137 ; ...then skip ahead to #R36137 (move Berk left if appropriate) 35770 CALL 54283 ; Move Berk into new room (left or right) if he is at the edge of his current room 35773 LD A,(34219) ; Load A with control input 35776 BIT 2,A ; If forward has been pressed... 35778 JP NZ,36036 ; ...then skip ahead to #R36036 (update state of Berk, forward pressed) 35781 BIT 3,A ; If back has been pressed... 35783 JP NZ,35827 ; ...then skip ahead to #R35827 ; At this point, no control has been pressed. This entry point is used by the routines at #R35577, #R36036 and ; #R36116. *35786 BIT 6,(IX+9) ; If Berk is not flying... 35790 JR Z,35802 ; ...then skip ahead to #R35802 ; Berk is flying 35792 RES 6,(IX+9) ; Reset Berk's Is Flying Flag 35796 LD HL,35359 ; Point HL at script data for Berk starting to fall downwards... 35799 JP 48098 ; ...and execute ; No control pressed and Berk not flying *35802 BIT 1,(IX+9) ; If Berk's Facing Into Screen Flag is reset... 35806 JR Z,35821 ; ...then skip ahead to #R35821 ; No control pressed, Berk not flying and Berk's Facing Into Screen Flag is set 35808 BIT 3,(IX+11) ; If Berk's Unused (11,3) Flag is reset... 35812 JP Z,48096 ; ...then jump to #R48096 (advance HL to next script instruction and execute) ; No control pressed, Berk not flying, Berk's Facing Into Screen and Unused (11,3) flags are set This entry point is ; used by the routine at #R35577. *35815 LD HL,35113 ; Point HL at script data for Berk facing into screen, ready to respond to control input... 35818 JP 48098 ; ...and execute ; No control pressed, Berk not flying and Berk's Facing Into Screen Flag is reset This entry point is used by the ; routine at #R35577. *35821 LD HL,35081 ; Point HL at script data for Berk facing out of screen, ready to respond to control input... 35824 JP 48098 ; ...and execute ; Back Pressed *35827 BIT 6,(IX+9) ; If Berk is flying... 35831 JP NZ,48096 ; ...then jump to #R48096 (advance HL to next script instruction and execute) 35834 CALL 36008 ; If Berk is holding an edible entity them make him eat it, process appropriate script data ; and return to calling routine 35837 DEC (IX+4) ; Temporarily decrease y-coordinate of Berk's top edge 35840 CALL 54890 ; Check entity at IX for collision with another entity (in reverse order) at next depth level ; into screen whose Interaction (11,7) Flag is set 35843 PUSH AF ; Store AF 35844 INC (IX+4) ; Restore y-coordinate of Berk's top edge 35847 POP AF ; Restore AF 35848 JR C,35953 ; If no collision occurred, then skip ahead to #R35953 35850 CP 33 ; If collision was not with an entity of class 33 (door)... 35852 JR NZ,35870 ; ...then skip ahead #R35870 ; Collision with door 35854 CALL 36116 ; If Berk is not horizontally aligned with door then move him closer and exit this routine ; Berk is now horizontally aligned with door 35857 CALL 36367 ; If Berk is neither facing into the screen nor walking then exit this routine and have Berk ; turn into screen 35860 LD (34256),IY ; Store address of complex state data for door at #R34256 35864 LD HL,35017 ; Point HL at script data for Berk interacting with a door behind him... 35867 JP 48098 ; ...and execute ; Collision with something other than door *35870 CP 22 ; If collision was with an entity of class of 22 or greater (can't be picked up)... 35872 JR NC,35924 ; ...then skip ahead to #R35924 ; Collision with entity that can be picked up 35874 BIT 4,(IX+9) ; If Berk is already carrying something... 35878 JP NZ,35953 ; ...then skip ahead to #R35953 35881 CALL 36116 ; If Berk is not horizontally aligned with entity then move him closer and exit this routine ; Berk is now horizontally aligned with entity pointed to by IY 35884 CALL 36367 ; If Berk is neither facing into the screen nor walking then exit this routine and have Berk ; turn into screen 35887 LD (34256),IY ; Store address of complex state data for entity at #R34256 35891 LD B,(IX+6) ; Load B with y-coordinate of Berk's bottom edge... 35894 DEC B ; ...minus 1 (to take into account different depth) 35895 LD A,(IY+6) ; Load A with y-coordinate of entity's bottom edge... 35898 CP (IX+4) ; ...and if this is less than the y-coordinate of Berk's top edge... 35901 JR C,35918 ; ...then skip ahead to #R35918 ; Entity is not above Berk 35903 CP B ; If entity's bottom edge is level with Berk's (taking into account different depth)... 35904 JR Z,35912 ; ...then skip ahead to #R35912 ; Entity is above floor and below Berk's top edge 35906 LD HL,35163 ; Point HL at script data for Berk picking up an entity that is above floor and below Berk's ; top edge and behind him... 35909 JP 48098 ; ...and execute ; Entity is on floor behind Berk *35912 LD HL,35135 ; Point HL at script data for Berk picking up an entity on floor behind him... 35915 JP 48098 ; ...and execute ; Entity is above Berk *35918 LD HL,35149 ; Point HL at script data for Berk picking up an entity above and behind him... 35921 JP 48098 ; ...and execute ; Collision with something that can't be picked up *35924 CP 32 ; If collision was not with entity of class 32 (coloured creatures' slots, Level 3)... 35926 JR NZ,35953 ; ...then skip ahead to #R35953 ; Collision with a coloured creature slot 35928 BIT 4,(IX+9) ; If Berk is not carrying anything... 35932 JR Z,35953 ; ...then skip ahead to #R35953 ; Berk is carrying something 35934 CALL 36116 ; If Berk is not horizontally aligned with coloured creature slot then move him closer and ; exit this routine ; Berk is now horizontally aligned with coloured creature slot and carrying something 35937 CALL 36367 ; If Berk is neither facing into the screen nor walking then exit this routine and have Berk ; turn into screen 35940 LD A,(IY+4) ; Load A with y-coordinate of top edge of coloured creature slot... (see trivia) 35943 DEC A ; ...minus 1... 35944 LD (34222),A ; ...and store at #R34222 35947 LD HL,35235 ; Point HL at script data for Berk putting an entity down above floor behind him... 35950 JP 48098 ; ...and execute ; No collision, collision with non-interactive entity or interaction conditions not met *35953 LD A,(34220) ; If Berk has no current power... 35956 OR A ; ... 35957 JR Z,35969 ; ...then skip ahead to #R35969 35959 CP 4 ; If Berk's current power is 1-3 (jumping)... 35961 JP C,35995 ; ...then skip ahead to #R35995 35964 CP 9 ; If Berk's current power is 4-8 (flying)... 35966 JP C,35985 ; ...then skip ahead to #R35985 ; Berk has neither jumping nor flying power *35969 BIT 4,(IX+9) ; If Berk is not carrying anything... 35973 JP Z,35786 ; ...then jump to #R35786 (terminate Berk's flight, or have him (turn to) face out of screen ; as appropriate) ; Berk is carrying something 35976 CALL 36367 ; If Berk is neither facing into the screen nor walking then exit this routine and have Berk ; turn into screen 35979 LD HL,35219 ; Point HL at script data for Berk putting an entity down on floor behind him... 35982 JP 48098 ; ...and execute ; Berk's current power is flying *35985 SET 6,(IX+9) ; Set Berk's Is Flying Flag 35989 LD HL,35417 ; Point HL at script data for Berk starting to fly... 35992 JP 48098 ; ...and execute ; Berk's current power is jumping *35995 CALL 36296 ; Make Berk drop the entity he is holding and load IY with its complex state data address 35998 LD (IX+12),129 ; Set Berk's Is Jumping Flag and set initial jump velocity to 1 36002 LD HL,35441 ; Point HL at script data for Berk starting to jump straight up... 36005 JP 48098 ; ...and execute ; Make Berk Eat the Entity He is Holding, if Edible, and Exit Calling Routine ; ; Used by the routine at #R35735. c36008 LD A,(34221) ; If Berk is not holding anything... 36011 OR A ; ... 36012 RET Z ; ...then return 36013 CP 12 ; If class value of entity held by Berk is greater than 12... 36015 RET NC ; ...then return 36016 POP BC ; Remove top value from stack (i.e. return address to routine that called this routine) 36017 CALL 48710 ; Move carried entity in front of Berk as he faces out of screen 36020 LD IY,(34260) ; Load IY with address of complex state data for entity held by Berk 36024 DEC (IY+4) ; Move entity up one character to level of Berk's mouth... 36027 DEC (IY+6) ; ... 36030 LD HL,35493 ; Point HL at script data for Berk eating an entity... 36033 JP 48098 ; ...and execute ; Update State of Berk (Forward Pressed) ; ; Used by the routine at #R35735. Input: IX Address of complex state data (current level) for Berk c36036 BIT 1,(IX+9) ; If Berk's Facing Into Screen Flag is reset... 36040 JP Z,36049 ; ...then skip ahead to #R36049 ; Berk's Facing Into Screen Flag is set 36043 LD HL,35073 ; Point HL at script data for Berk turning (facing into screen to facing out of screen)... 36046 JP 48098 ; ...and execute ; Berk's Facing Into Screen Flag is reset *36049 LD DE,0 ; Clear pointer to complex state data for entity involved in last collision check... 36052 LD (34258),DE ; ... 36056 CALL 54768 ; Check entity at IX for collision with another entity at same depth whose Interaction (11,6) ; Flag is set... 36059 JR C,36103 ; ...and if no collision occurred, then skip ahead to #R36103 ; Collision occurred 36061 CP 33 ; If collision was not with an entity of class 33 (door)... 36063 JR NZ,36078 ; ...then skip ahead to #R36078 ; Collision with door 36065 CALL 36116 ; If Berk is not horizontally aligned with door then move him closer and exit this routine ; Berk is now horizontally aligned with door 36068 LD (34256),IY ; Store address of door's complex state data at #R34256 36072 LD HL,35045 ; Point HL at script data for Berk interacting with a door in front of him... 36075 JP 48098 ; ...and execute ; Collision with something other than door *36078 BIT 4,(IX+9) ; If Berk's Carrying Something Flag is set... 36082 JP NZ,35786 ; ...then jump to #R35786 (terminate Berk's flight, or have him (turn to) face out of screen as ; appropriate) 36085 CP 22 ; If collision was with an entity of class of 22 or greater (can't be picked up)... 36087 JP NC,35786 ; ...then jump to #R35786 (terminate Berk's flight, or have him (turn to) face out of screen as ; appropriate) ; At this point, Berk is not carrying anything, and the entity he is colliding with is one which can be picked up 36090 CALL 36116 ; If Berk is not horizontally aligned with entity at IY then move him closer and exit this ; routine ; Berk is now horizontally aligned with entity pointed to by IY 36093 LD (34256),IY ; Store address of entity's complex state data at #R34256 36097 LD HL,35187 ; Point HL at script data for Berk picking up an entity on floor in front of him... 36100 JP 48098 ; ...and execute ; No collision occurred *36103 BIT 4,(IX+9) ; If Berk is not carrying anything... 36107 JP Z,35786 ; ...then jump to #R35786 (terminate Berk's flight, or have him (turn to) face out of screen as ; appropriate) ; Berk is carrying something 36110 LD HL,35205 ; Point HL at script data for Berk putting an entity down on floor in front of him... 36113 JP 48098 ; ...and execute ; If Berk is Not Horizontally Aligned with Entity at IY then Move Berk Closer and Exit Calling Routine ; ; Used by the routines at #R35735 and #R36036. Input: IX Address of complex state data (current level) for Berk IY ; Address of complex state data for entity with which Berk has collided c36116 LD A,(IY+7) ; Load A with width of entity at IY, minus 1... 36119 SUB (IY+5) ; ... 36122 SRL A ; ...divide value by 2... 36124 SUB 2 ; ...and subtract 2 36126 ADD A,(IY+5) ; Add result to x-coordinate of entity's left edge ; At this point, A holds the x-coordinate of the middle of the entity at IY, minus two 36129 CP (IX+5) ; If x-coordinate in A is the same as Berk's left side x-coordinate... 36132 RET Z ; ...then return 36133 POP BC ; Remove top value from stack (i.e. return address to routine that called this routine) 36134 JP NC,36214 ; If x-coordinate in A is the less than Berk's left side x-coordinate then skip ahead to ; #R36214 ; This entry point is used by the routine at #R35735. Attempt to move Berk left *36137 BIT 6,(IX+9) ; If Berk is flying... 36141 JR NZ,36200 ; ...then skip ahead to #R36200 ; Attempt to move Berk left (not flying) (see bugs) 36143 RES 1,(IX+9) ; Reset Berk's Facing Into Screen Flag 36147 CALL 54666 ; Check Berk for collision with another impassable / pushable entity immediately to the left... 36150 JR NC,36171 ; ...and if a collision occurred, then skip ahead to #R36171 ; No collision 36152 CALL 54348 ; Move Berk into room to the left, if appropriate... 36155 JP NC,35786 ; ...and if Berk can't enter new room then jump to #R35786 (terminate Berk's flight, or have ; him (turn to) face out of screen as appropriate) *36158 BIT 1,(IX+11) ; If Berk's Walking Left Flag is already set... 36162 JP NZ,48096 ; ...then jump to #R48096 (advance HL to next script instruction and execute) 36165 LD HL,35263 ; Point HL at script data for Berk starting to walk left... 36168 JP 48098 ; ...and execute ; Collision occurred with entity to the left *36171 CP 129 ; If collision was not with entity of class 129 (causes other entities to start falling)... 36173 JR NZ,36184 ; ...then skip ahead to #R36184 36175 CALL 36296 ; Make Berk drop the entity he is holding and load IY with its complex state data address 36178 LD HL,35291 ; Point HL at script data for Berk starting to fall to the left... 36181 JP 48098 ; ...and execute *36184 CP 22 ; If collision was with an entity of class of less than 22 (can be picked up)... 36186 JR C,36158 ; ...then jump back to #R36158 36188 CP 50 ; If collision was with entity of class 50 (causes Drutt to swap depth levels)... 36190 JR Z,36158 ; ...then jump back to #R36158 36192 CP 25 ; If collision was with entity of class 25 (Green Apebeast, Level 2)... 36194 CALL Z,53667 ; ...then set "Berk Has Been Killed" Flag 36197 JP 35786 ; Jump to #R35786 (terminate Berk's flight, or have him (turn to) face out of screen as ; appropriate) ; Attempt to move Berk left (flying) *36200 CALL 54666 ; Check Berk for collision with another impassable / pushable entity immediately to the left... 36203 JP C,48096 ; ...and if a collision has not occurred, then jump to #R48096 (advance HL to next script ; instruction and execute) 36206 CP 129 ; If collision was with entity of class 129 (causes other entities to start falling)... 36208 JP Z,48096 ; ...then jump to #R48096 (advance HL to next script instruction and execute) 36211 JP 35786 ; Jump to #R35786 (terminate Berk's flight, or have him (turn to) face out of screen as ; appropriate) ; This entry point is used by the routine at #R35735. Attempt to move Berk right *36214 BIT 6,(IX+9) ; If Berk is flying... 36218 JP NZ,36282 ; ...then skip ahead to #R36282 ; Attempt to move Berk right (not flying) (see bugs) 36221 RES 1,(IX+9) ; Reset Berk's Facing Into Screen Flag 36225 CALL 54569 ; Check Berk for collision with another impassable / pushable entity immediately to the ; right... 36228 JR NC,36249 ; ...and if a collision occurred, then skip ahead to #R36249 ; No collision 36230 CALL 54313 ; Move Berk into room to the right, if appropriate... 36233 JP NC,35786 ; ...and if Berk can't enter new room then jump to #R35786 (terminate Berk's flight, or have ; him (turn to) face out of screen as appropriate) *36236 BIT 0,(IX+11) ; If Berk's Walking Right Flag is already set... 36240 JP NZ,48096 ; ...then jump to #R48096 (advance HL to next script instruction and execute) 36243 LD HL,35251 ; Point HL at script data for Berk starting to walk right... 36246 JP 48098 ; ...and execute ; Collision occurred with entity to the right *36249 CP 129 ; If collision was not with entity of class 129 (causes other entities to start falling)... 36251 JR NZ,36266 ; ...then skip ahead to #R36266 36253 CALL 36296 ; Make Berk drop the entity he is holding and load IY with its complex state data address 36256 LD IY,(34260) ; Load IY with address of complex state data for entity last held by Berk (see trivia) 36260 LD HL,35327 ; Point HL at script data for Berk starting to fall to the right... 36263 JP 48098 ; ...and execute *36266 CP 22 ; If collision was with an entity of class of less than 22 (can be picked up)... 36268 JR C,36236 ; ...then jump back to #R36236 36270 CP 50 ; If collision was with entity of class 50 (causes Drutt to swap depth levels)... 36272 JR Z,36236 ; ...then jump back to #R36236 36274 CP 25 ; If collision was with entity of class 25 (Green Apebeast, Level 2)... 36276 CALL Z,53667 ; ...then set "Berk Has Been Killed" Flag 36279 JP 35786 ; Jump to #R35786 (terminate Berk's flight, or have him (turn to) face out of screen as ; appropriate) ; Attempt to move Berk right (flying) *36282 CALL 54569 ; Check Berk for collision with another impassable / pushable entity immediately to the ; right... 36285 JP C,48096 ; ...and if a collision has not occurred, then jump to #R48096 (advance HL to next script ; instruction and execute) 36288 CP 129 ; If collision was with entity of class 129 (causes other entities to start falling)... 36290 JP Z,48096 ; ...then jump to #R48096 (advance HL to next script instruction and execute) 36293 JP 35786 ; Jump to #R35786 (terminate Berk's flight, or have him (turn to) face out of screen as ; appropriate) ; Make Berk Drop the Entity He is Holding and Load IY with its Complex State Data Address ; ; Used by the routines at #R35735, #R36116, #R36390, #R36638, #R39151, #R39278, #R39776, #R48920 and #R53723. Input: ; IX Address of complex state data (current level) for Berk Output: IY Address of complex state data for entity ; dropped by Berk c36296 LD A,(34221) ; If Berk is not holding anything... 36299 OR A ; ... 36300 RET Z ; ...then return 36301 XOR A ; Set class of entity held by Berk to zero (i.e. nothing)... 36302 LD (34221),A ; ... 36305 LD IY,(34260) ; Load IY with address of complex state data for entity last held by Berk 36309 LD (IY+12),2 ; Set this dropped entity's velocity factor to 2... 36313 RES 5,(IY+10) ; ...reset its Is Being Carried Flag... 36317 SET 6,(IY+10) ; ...and set its Can Fall Flag 36321 RES 4,(IX+9) ; Reset Berk's Carrying Something Flag 36325 BIT 0,(IX+11) ; If Berk's Walking Right Flag is reset... 36329 JR Z,36339 ; ...then skip ahead to #R36339 *36331 INC (IY+7) ; Move dropped entity right one character... 36334 INC (IY+5) ; ... 36337 JR 36351 ; Skip ahead to #R36351 *36339 BIT 1,(IX+11) ; If Berk's Walking Left Flag is reset... 36343 JR Z,36351 ; ...then skip ahead to #R36351 *36345 DEC (IY+7) ; Move dropped entity left one character... 36348 DEC (IY+5) ; ... *36351 LD A,(IY+5) ; If entity at IY has the x-coordinate of its left side less than 100... 36354 CP 100 ; ... 36356 JR C,36331 ; ...then move right until left x-coordinate is 100 36358 LD A,(34235) ; Load A with width of current room (chars) + 99 36361 CP (IY+7) ; If entity at IY has the x-coordinate of its right side greater than the width of the current ; room... 36364 JR C,36345 ; ...then move right until left x-coordinate is less than room width 36366 RET ; Return ; If Berk is Neither Facing into the Screen nor Walking then Exit Calling Routine and Have Berk Turn into Screen ; ; Used by the routine at #R35735. Input: IX Address of complex state data (current level) for Berk c36367 BIT 1,(IX+9) ; If Berk's Facing Into Screen Flag is set... 36371 RET NZ ; ...then return 36372 LD A,(IX+11) ; If either of Berk's Walking Left or Walking Right flags is set... 36375 AND 3 ; ... 36377 RET NZ ; ...then return 36378 POP BC ; Remove top value from stack (i.e. return address to routine that called this routine) 36379 LD HL,35105 ; Point HL at script data for Berk turning (facing out of screen to facing into screen)... 36382 JP 48098 ; ...and execute ; Script Routine (59) Have Berk Interact Appropriately with a Door Behind Him Output: BC Address of script data to ; execute upon arrival of new level c36385 LD BC,35113 ; Load BC with address of script data for Berk facing into screen, ready to respond to control ; input 36388 JR 36393 ; Have Berk interact appropriately with a door ; Script Routine (58) Have Berk Interact Appropriately with a Door in Front of Him Input: BC (entry at #R36393 ; only) Address of script data to execute upon arrival of new level c36390 LD BC,35081 ; Load BC with address of script data for Berk facing out of screen, ready to respond to ; control input ; This entry point is used by the routine at #R36385. *36393 LD (34266),BC ; Store script data address in BC at #R34266 36397 LD A,(34208) ; Load E with Game Flags... 36400 LD E,A ; ... 36401 LD A,(34221) ; Load A with class of entity currently held by Berk... 36404 CP 17 ; ... and if this is not 17 (Key)... 36406 JR NZ,36429 ; ...then skip ahead to #R36429 ; Berk is holding a key 36408 LD A,7 ; Set door colour to 7 (white, i.e. unlocked)... 36410 LD (50712),A ; ... 36413 CALL 36296 ; Make Berk drop the key and load IY with its complex state data address 36416 LD (IY+1),0 ; Set depth of key to 0 (i.e. out of display) 36420 SET 4,E ; Set Level Exit Door Unlocked Flag... 36422 LD A,E ; ... 36423 LD (34208),A ; ... 36426 JP 48096 ; Advance HL to next script instruction and execute ; Berk is not holding a key *36429 BIT 4,E ; If Level Exit Door Unlocked Flag is reset... 36431 JR Z,36462 ; ...then skip ahead to #R36462 36433 LD D,A ; Load D with class of entity currently held by Berk 36434 LD A,(34207) ; Set Zero Flag if current level is Level 4... 36437 CP 4 ; ... 36439 LD A,D ; Load A with class of entity currently held by Berk 36440 JR NZ,36446 ; If Zero Flag is not set (i.e. we are not on Level 4) then skip ahead to #R36446 ; Level 4 36442 CP 19 ; Set Zero Flag if class of entity currently held by Berk is 19 (Boni) 36444 JR 36448 ; Skip ahead to #R36448 ; Not Level 4 *36446 CP 18 ; Set Zero Flag if class of entity currently held by Berk is 18 (Drutt) *36448 JR NZ,36462 ; If Zero Flag is not set (i.e. Berk is not holding Drutt on Levels 1-3 or Boni on Level 4) ; then skip ahead to #R36462 ; Berk is holding the correct character 36450 CALL 48417 ; Remove Berk's current power and reset sweet / mushroom / edible eyes / sausage to its ; original state 36453 CALL 36638 ; Advance to next level and if back to Level 1 then exit this routine and make Berk start ; falling ; New level is not Level 1 36456 LD HL,(34266) ; Load HL with script data address stored at #R34266... 36459 JP 48098 ; ...and execute ; Door is locked or Berk is not holding the correct character *36462 CALL 36296 ; Make Berk drop the entity he is holding and load IY with its complex state data address 36465 CALL 53667 ; Set "Berk Has Been Killed" Flag 36468 JP 48096 ; Advance HL to next script instruction and execute ; Script Routine (56) Give Berk Power Corresponding to Entity Eaten Input: IX Address of complex state data ; (current level) for Berk c36471 CALL 48417 ; Remove Berk's current power and reset sweet / mushroom / edible eyes / sausage to its ; original state 36474 LD A,(34221) ; Set current power value to class of entity currently held by Berk... 36477 LD (34220),A ; ... 36480 XOR A ; Set class of entity held by Berk to zero (i.e. none)... 36481 LD (34221),A ; ... 36484 LD (34224),A ; Set number of elapsed game-cycles in current block to zero 36487 RES 4,(IX+9) ; Reset Berk's Carrying Something Flag 36491 LD IY,(34260) ; Load IY with address of complex state data for entity last held by Berk... 36495 LD (IY+1),A ; ...and set its depth to zero (i.e. outside room) 36498 LD A,(IY+10) ; Initialise remaining duration of power to value encoded entity's complex state data (bits ; 0-4)... 36501 AND 31 ; ... 36503 LD (34225),A ; ... 36506 LD A,(34220) ; If Berk's current power is not floating (Level 3)... 36509 CP 10 ; ... 36511 JP NZ,48096 ; ...then jump to #R48096 (advance HL to next script instruction and execute) ; Power is floating 36514 LD (IX+12),12 ; Set distance Berk will be pushed by Drutt while floating to 12 36518 SET 7,(IX+9) ; Set Berk's Moving Upwards Flag 36522 LD (IX+11),240 ; Reset Berk's Walking Right, Walking Left, Unused (11,2) and Unused (11,3) flags, and set his ; Impassable Leftwards, Impassable Rightwards, Interaction (11,6) and Interaction (11,7) flags 36526 SET 7,(IX+8) ; Set bit 7 of Berk's class value (i.e. set "Spans Full Depth" Flag) 36530 INC (IX+6) ; Increase y-coordinate of Berk's bottom edge by two characters... 36533 INC (IX+6) ; ... 36536 LD HL,35515 ; Point HL at script data for Berk gaining floating power... 36539 JP 48098 ; ...and execute ; Update State of Berk (Floating Power Active) ; ; Used by the routine at #R35735. Input: IX Address of complex state data (current level) for Berk c36542 CALL 54768 ; Check entity at IX for collision with another entity at same depth whose Interaction (11,6) ; Flag is set... 36545 CP 130 ; ...and if collision was with entity of class 130 (causes Berk and Drutt to bounce off or bang ; head)... 36547 JR Z,36558 ; ...then skip ahead to #R36558 ; No collision with entity of class 130 36549 DEC (IX+4) ; Move Berk up one character... 36552 DEC (IX+6) ; ... 36555 CALL 55433 ; Change Berk's room up one if appropriate *36558 BIT 1,(IX+11) ; If Berk's Walking Left Flag is set... 36562 JR NZ,36587 ; ...then skip ahead to #R36587 36564 BIT 0,(IX+11) ; If Berk's Walking Right Flag is set... 36568 JR NZ,36576 ; ...then skip ahead to #R36576 36570 CALL 48388 ; Decrease remaining time for current power and if zero, exit this routine and run script data ; for removal of power 36573 JP 48096 ; Advance HL to next script instruction and execute ; Berk's Walking Right Flag is set (i.e. Drutt has pushed Berk right) *36576 INC (IX+5) ; Move Berk's left and right sides right by one character... 36579 INC (IX+7) ; ... 36582 CALL 54313 ; Move Berk at IX into room to the right, if appropriate 36585 JR 36596 ; Skip ahead to #R36596 ; Berk's Walking Left Flag is set (i.e. Drutt has pushed Berk left) *36587 DEC (IX+5) ; Move Berk's left and right sides left by one character... 36590 DEC (IX+7) ; ... 36593 CALL 54348 ; Move Berk at IX into room to the left, if appropriate *36596 DEC (IX+12) ; Decrease remaining horizontal distance from Drutt's push... 36599 JP NZ,48096 ; ...and if not zero then jump to #R48096 (advance HL to next script instruction and execute) 36602 LD A,1 ; Set remaining power duration to 1... 36604 LD (34225),A ; ... 36607 JP 48212 ; Reset Berk's Walking Left and Walking Right flags, advance HL to next script instruction and ; execute ; Script Routine (57) Cycle Attributes (Full-Screen), Clear Display Buffers and Paint Red Areas Outside Current Room c36610 CALL 36616 ; Cycle attributes (full-screen), clear display buffers and paint red areas outside current ; room 36613 JP 48096 ; Advance HL to next script instruction and execute ; Cycle Attributes (Full-Screen), Clear Display Buffers and Paint Red Areas Outside Current Room ; ; Used by the routines at #R36610, #R39584 and #R39760. c36616 PUSH HL ; Store HL 36617 CALL 53581 ; Cycle Attributes (Full-Screen) and Clear Display Buffers 36620 CALL 53887 ; Paint red areas outside accessible areas of current character's current room 36623 POP HL ; Restore HL 36624 RET ; Return ; State Data for Drutt Upon Returning to Level 1 ; ; After completing Level 4, the data here is written into Drutt's slot in Level 1's State Data for Complex Entities ; block (#R43333). This ensures that Drutt follows Berk and Boni through the final door. b36625 DEFB 10,1,193,204,30,119,30,119,18,0,192,192,2 ; Advance to Next Level and if Back to Level 1 then Exit Calling Routine and Make Berk Start Falling ; ; Used by the routine at #R36390. c36638 LD A,(34208) ; Set Update Scores and Display Flag... 36641 SET 5,A ; ... 36643 LD (34208),A ; ... 36646 LD IY,(34256) ; Load IY with address of complex state data for Door just interacted with 36650 LD A,(IY+9) ; Load A with destination level from Door's state data... 36653 LD (34207),A ; ...and set current level to this value 36656 CP 1 ; If destination level is not Level 1... 36658 JR NZ,36725 ; ...then skip ahead to #R36725 ; Destination level is Level 1 (i.e. Level 4 completed) 36660 CALL 36753 ; Load IX with address of Berk's complex state data and set his horizontal position to match ; Level 1's entry door 36663 SET 2,(IX+10) ; Set "Back to Level 1" Flag 36667 LD (IX+0),10 ; Set Berk's room to 10 36671 LD (IX+4),103 ; Set y-coordinate of Berk's top edge to 103 36675 LD (IX+6),109 ; Set y-coordinate of Berk's bottom edge to 109 36679 LD IY,43606 ; Load IY with address of Boni's entry in Level 1's State Data for Complex Entities... 36683 LD (34256),IY ; ...and store at #R34256 36687 CALL 48850 ; Have Berk hold Boni, and position him appropriately between Berk's hands 36690 LD (IY+1),1 ; Set Boni's depth to 1 36694 LD (IY+0),10 ; Set Boni's room to 10 36698 CALL 36296 ; Make Berk drop the entity he is holding and load IY with its complex state data address 36701 CALL 55516 ; Set Berk's Can Fall Flag and set his initial velocity factor to 2 36704 CALL 36739 ; Lock Level 1's exit door and cycle attributes (full-screen) 36707 POP BC ; Remove top value from stack (i.e. return address to routine that called this routine) 36708 LD HL,36625 ; Overwrite Drutt's entry in Level 1's State Data for Complex Entities with data at #R36625... 36711 LD DE,43671 ; ... 36714 LD BC,13 ; ... 36717 LDIR ; ... 36719 LD HL,35359 ; Point HL at script data for Berk starting to fall downwards... 36722 JP 48098 ; ...and execute ; Destination level is not Level 1 *36725 CALL 36753 ; Set Berk's horizontal position to match Level 1's entry door 36728 LD IY,(34242) ; Load IY with address of current level's complex state data for Drutt... 36732 LD (34256),IY ; ...and store at #R34256 36736 CALL 48850 ; Have Berk hold Drutt, and position him appropriately between Berk's hands *36739 LD HL,34208 ; Reset Level Exit Door Unlocked Flag... 36742 RES 4,(HL) ; ... 36744 LD A,5 ; Set door colour to 5 (cyan, i.e. locked)... 36746 LD (50712),A ; ... 36749 CALL 36616 ; Cycle attributes (full-screen), clear display buffers and paint red areas outside current ; room 36752 RET ; Return ; Set Berk's Horizontal Position to Match Level 1's Entry Door ; ; Used by the routine at #R36638. c36753 CALL 34864 ; Copy start addresses of current level's data blocks to #R34236 and clean up old data 36756 LD A,33 ; Load IY with address of complex state data for first entity that has class of 33 (Entry ; Door)... 36758 CALL 54019 ; ... 36761 LD IX,(34240) ; Load IX with start address of current level's complex state data for Berk 36765 LD A,(IY+5) ; Load A with x-coordinate of left of Entry Door... 36768 INC A ; ...and add one 36769 LD (IX+5),A ; Adjust Berk's horizontal position so that his left side is at coordinate in A... 36772 ADD A,5 ; ...and his right side is 5 characters to the right of this... 36774 LD (IX+7),A ; ... 36777 RET ; Return ; Initialise Script Data Positions for Flying Skeleton Creature and Bat (Level 1) ; ; Used by the routine at #R34751. c36778 LD HL,36803 ; Load HL with start address of script data for Boni's kidnap... 36781 LD (36801),HL ; ...and store this as the current script data position at #R36801 36784 LD HL,37018 ; Load HL with start address of script data for Bat (not attacking)... 36787 LD (37016),HL ; ...and store this as the current script data position at #R37016 36790 RET ; Return ; Update States of All Level 1 Entities ; ; Used by the routine at #R34438. c36791 CALL 36887 ; Execute script data for Boni's kidnap and handle Trap Door opening and closing 36794 CALL 37062 ; Update state of Bat (Level 1) and store current position in script data 36797 CALL 37586 ; Update states of the Spiders (Level 1) and store current positions in script data 36800 RET ; Return ; Current Position in Script Data for Boni's Kidnap b36801 DEFW 36803 ; Script Data Boni's Kidnap b36803 DEFB 114,200 ; #R51314 (Flying Skeleton Creature, animated) 36805 DEFB 25,0,6,0 ; Start loop (2) for 6 iterations 36809 DEFB 114,200 ; #R51314 (Flying Skeleton Creature, animated) 36811 DEFB 26,0 ; End loop (2) 36813 DEFB 39,0 ; Open the Trap Door 36815 DEFB 25,0,10,0 ; Start loop (2) for 10 iterations 36819 DEFB 114,200 ; #R51314 (Flying Skeleton Creature, animated) 36821 DEFB 114,200 ; #R51314 (Flying Skeleton Creature, animated) 36823 DEFB 34,0 ; Move creature up one character 36825 DEFB 26,0 ; End loop (2) 36827 DEFB 25,0,10,0 ; Start loop (2) for 10 iterations 36831 DEFB 114,200 ; #R51314 (Flying Skeleton Creature, animated) 36833 DEFB 2,0 ; Move creature left one character 36835 DEFB 26,0 ; End loop (2) 36837 DEFB 25,0,10,0 ; Start loop (2) for 10 iterations 36841 DEFB 114,200 ; #R51314 (Flying Skeleton Creature, animated) 36843 DEFB 3,0 ; Move creature right one character 36845 DEFB 26,0 ; End loop (2) 36847 DEFB 25,0,4,0 ; Start loop (2) for 4 iterations 36851 DEFB 114,200 ; #R51314 (Flying Skeleton Creature, animated) 36853 DEFB 114,200 ; #R51314 (Flying Skeleton Creature, animated) 36855 DEFB 114,200 ; #R51314 (Flying Skeleton Creature, animated) 36857 DEFB 114,200 ; #R51314 (Flying Skeleton Creature, animated) 36859 DEFB 34,0 ; Move creature up one character 36861 DEFB 26,0 ; End loop (2) 36863 DEFB 36,0 ; Remove Boni from Level 1 36865 DEFB 25,0,16,0 ; Start loop (2) for 16 iterations 36869 DEFB 86,200 ; #R51286 (Boni being kidnapped, shouting for help, animated) 36871 DEFB 26,0 ; End loop (2) 36873 DEFB 25,0,12,0 ; Start loop (2) for 12 iterations 36877 DEFB 108,200 ; #R51308 (Boni being kidnapped, mouth closed) 36879 DEFB 35,0 ; Move creature down one character 36881 DEFB 26,0 ; End loop (2) 36883 DEFB 38,0 ; Close the Trap Door 36885 DEFB 37,0 ; Remove Flying Skeleton Creature from Level 1 ; Execute Script Data for Boni's Kidnap and Handle Trap Door Opening and Closing ; ; Used by the routine at #R36791. c36887 LD IX,43619 ; Load IX with address of complex state data for Flying Skeleton Creature 36891 LD A,(43628) ; If Berk and Drutt Through Trap Door Flag is set... 36894 BIT 3,A ; ... 36896 RET NZ ; ...then return 36897 BIT 2,A ; If Trap Door Opened Flag is set... 36899 JR NZ,36966 ; ...then jump to #R36966 (close the Trap Door if Berk is not in room 1 and Drutt is in room 4) 36901 BIT 1,A ; If creature's Inactive Flag is set... 36903 JR NZ,36921 ; ...then jump to #R36921 (open the Trap Door if Berk is near the left side of the Trap Door ; room) 36905 LD HL,(36801) ; Load current position in script data for Boni's kidnap from #R36801 into HL... 36908 LD (34277),HL ; ...and store at #R34277 as position in script currently running 36911 CALL 36947 ; Advance HL to next script instruction and start executing 36914 LD HL,(34277) ; Store address (current position in script data) stored at #R34277... 36917 LD (36801),HL ; ...at #R36801 as current position in script data for Boni's kidnap 36920 RET ; Return ; Open Trap Door if Berk is Near the Left Side of the Trap Door Room ; ; Used by the routine at #R36887. Input: IX Address of complex state data for Flying Skeleton Creature (Level 1) c36921 LD IY,43593 ; Load IY with address of complex state data for Berk (Level 1) 36925 LD A,(IY+5) ; If x-coordinate of Berk's left side is 104 or greater... 36928 CP 104 ; ... 36930 RET NC ; ...then return 36931 SET 2,(IX+9) ; Set Trap Door Opened Flag 36935 XOR A ; Set room of "Closed Trap Door" to 0 (i.e. remove from Trap Door Room)... 36936 LD (43188),A ; ... 36939 INC A ; Increase A to 1 (index of Trap Door Room)... 36940 LD (43437),A ; ...and set this as the current room of "Open Trap Door"... 36943 LD (43450),A ; ...and marker (preventing Berk and Drutt passing door lid) 36946 RET ; Return ; Advance HL to Next Script Instruction and Start Executing ; ; Used by the routine at #R36887. c36947 JP 48096 ; Advance HL to next script instruction and execute ; Script Routine (36) Remove Boni from Level 1 c36950 XOR A ; Set Boni's room (Level 1) to zero... 36951 LD (43606),A ; ... 36954 JP 48096 ; Advance HL to next script instruction and execute ; Script Routine (37) Remove Flying Skeleton Creature from Level 1, and Terminate Script Processing Input: IX ; Address of complex state data for an entity c36957 XOR A ; Set current room of Flying Skeleton Creature (Level 1) to zero... 36958 LD (43619),A ; ... 36961 SET 1,(IX+9) ; Set Flying Skeleton Creature's Inactive Flag 36965 RET ; Return (i.e. terminate further script processing) ; Close the Trap Door if Berk is Not in Room 1 and Drutt is in Room 4 (Level 1) ; ; See bugs. c36966 LD A,(43593) ; If Berk's current room (Level 1) is 1 (i.e. Trap Door Room)... 36969 CP 1 ; ... 36971 RET Z ; ...then return 36972 LD A,(43671) ; If Drutt's current room is not 4 (room at bottom of Trap Door Shaft)... 36975 CP 4 ; ... 36977 RET NZ ; ...then return 36978 SET 3,(IX+9) ; Set Berk and Drutt Through Trap Door Flag 36982 JR 36996 ; Close the Trap Door and return ; Script Routine (38) Close the Trap Door c36984 CALL 36996 ; Close the Trap Door 36987 JP 48096 ; Advance HL to next script instruction and execute ; Script Routine (39) Open the Trap Door c36990 CALL 37004 ; Open the Trap Door 36993 JP 48096 ; Advance HL to next script instruction and execute ; Close the Trap Door ; ; Used by the routines at #R36966 and #R36984. c36996 LD A,1 ; Set room of "Closed Trap Door" to 1 (i.e. Trap Door Room)... 36998 LD (43188),A ; ... 37001 DEC A ; Decrease A to zero 37002 JR 37009 ; Set room of "Open Trap Door" to 0 ; Open the Trap Door ; ; Used by the routine at #R36990. c37004 XOR A ; Set room of "Closed Trap Door" to 0 (i.e. remove from Trap Door Room)... 37005 LD (43188),A ; ... 37008 INC A ; Increase A to 1 (index of Trap Door Room) ; This entry point is used by the routine at #R36996. *37009 LD (43437),A ; Set value in A as the current room of "Open Trap Door"... 37012 LD (43450),A ; ...and marker (preventing Berk and Drutt passing door lid) 37015 RET ; Return ; Current Position in Bat's Script Data b37016 DEFW 37018 ; Script Data Bat (Level 1) ; ; Stationary (off top of screen) b37018 DEFB 85,145 ; #R37205 (Flying, full wing flap) 37020 DEFB 1,0,154,144 ; Jump to #R37018 ; Attacking 37024 DEFB 8,0 ; Set Must Process Current Script Data Flag 37026 DEFB 27,0,8,0 ; Start loop (3) for 8 iterations 37030 DEFB 96,145 ; #R37216 (Flying, half wing flap) 37032 DEFB 35,0 ; Move Bat down two characters... 37034 DEFB 35,0 ; ... 37036 DEFB 28,0 ; End loop (3) 37038 DEFB 27,0,8,0 ; Start loop (3) for 8 iterations 37042 DEFB 85,145 ; #R37205 (Flying, full wing flap) 37044 DEFB 28,0 ; End loop (3) 37046 DEFB 27,0,17,0 ; Start loop (3) for 17 iterations 37050 DEFB 85,145 ; #R37205 (Flying, full wing flap) 37052 DEFB 34,0 ; Move Bat up one character 37054 DEFB 28,0 ; End loop (3) 37056 DEFB 9,0 ; Reset Must Process Current Script Data Flag 37058 DEFB 1,0,154,144 ; Jump to #R37018 ; Update State of Bat (Level 1) and Store Current Position in Script Data ; ; Used by the routine at #R36791. c37062 LD IX,43463 ; Point IX at position data for Bat (Level 1) 37066 CALL 53848 ; Store room size data for Bat's room 37069 LD HL,(37016) ; Load current position in Bat's script data from #R37016 into HL... 37072 LD (34277),HL ; ...and store at #R34277 as position in script currently running 37075 CALL 37085 ; Update state of Bat 37078 LD HL,(34277) ; Store address (current position in script data) stored at #R34277... 37081 LD (37016),HL ; ...at #R37016 as current position in Bat's script data 37084 RET ; Return ; Update State of Bat (Level 1) ; ; Used by the routine at #R37062. Input: IX (always #R43463, entry in Level 1 complex state data for Bat) HL ; Current position in Bat's script data c37085 CALL 54768 ; Check entity at IX for collision with another entity at same depth whose Interaction (11,6) ; Flag is set... 37088 JR C,37104 ; ...and if no collision occurred, then skip ahead to #R37104 37090 CP 31 ; If collision was not with entity of class 31 (Berk)... 37092 JR NZ,37100 ; ...then skip ahead to #R37100 37094 CALL 53667 ; Set "Berk Has Been Killed" Flag 37097 JP 48096 ; Advance HL to next script instruction and execute *37100 CP 18 ; If collision was with entity of class 18 (Drutt)... 37102 JR Z,37111 ; ...then skip ahead to #R37111 *37104 CALL 54890 ; Check entity at IX for collision with another entity (in reverse order) at next depth level ; into screen whose Interaction (11,7) Flag is set... 37107 CP 18 ; ...and if collision was not with entity of class 18 (Drutt)... 37109 JR NZ,37128 ; ...then skip ahead to #R37128 *37111 BIT 6,(IY+10) ; If Drutt's Can Fall Flag is set... 37115 JR NZ,37128 ; ...then skip ahead to #R37128 37117 SET 6,(IY+10) ; Set Drutt's Can Fall Flag 37121 LD (IY+12),2 ; Set Drutt's Velocity Factor to 2 37125 JP 48096 ; Advance HL to next script instruction and execute *37128 BIT 0,(IX+9) ; If Bat's Paralysed Flag is set... 37132 JP NZ,48096 ; ...then jump to #R48096 (advance HL to next script instruction and execute) 37135 LD A,(34208) ; If Drutt Mode Flag is set... 37138 BIT 0,A ; ... 37140 JR NZ,37148 ; ...then skip ahead to #R37148 37142 LD IY,(34240) ; Load IY with address of current level's complex state data for Berk 37146 JR 37152 ; Skip ahead to #R37152 *37148 LD IY,(34242) ; Load IY with address of current level's complex state data for Drutt ; At this point, IY points to the complex state data entry for the current character. *37152 LD A,(IY+0) ; If current character's current room is not the same as the Bat's... 37155 CP (IX+0) ; ... 37158 JP NZ,48096 ; ...then jump to #R48096 (advance HL to next script instruction and execute) 37161 LD A,(IY+7) ; If the current character's right side... 37164 CP (IX+5) ; ...is to the left of the Bat's left side... 37167 JR C,37194 ; ...then skip ahead to #R37194 37169 LD A,(IX+7) ; If the Bat's right side... 37172 CP (IY+5) ; ...is to the left of the current character's left side... 37175 JR C,37183 ; ...then skip ahead to #R37183 37177 LD HL,37024 ; Point HL at script data for Bat attacking... 37180 JP 48098 ; ...and execute *37183 LD A,(IX+7) ; If the x-coordinate of the Bat's right side is less than 130... 37186 CP 130 ; ... 37188 JP C,48615 ; ...then move Bat right by one character 37191 JP 48096 ; Advance HL to next script instruction and execute *37194 LD A,101 ; If the x-coordinate of the Bat's left side is greater than 101... 37196 CP (IX+5) ; ... 37199 JP C,48660 ; ...then move Bat left by one character 37202 JP 48096 ; Advance HL to next script instruction and execute ; Graphic Layout Data Bat (Level 1) Flying, full wing flap - 3 stages, i.e. hovering at floor-level / going up b37205 DEFB 243,0,4 ; Increase current state value n (initially 0), up to maximum of 4, resetting to zero if ; maximum reached and jump to n-th address in following list: 37208 DEFB 202,145 ; #R37322 (Bat, full, wings raised, eyes animated) 37210 DEFB 49,146 ; #R37425 (Bat, full, wings level, eyes animated) 37212 DEFB 131,146 ; #R37507 (Bat, full, wings down, eyes animated) 37214 DEFB 49,146 ; #R37425 (Bat, full, wings level, eyes animated) ; Flying, half wing flap - 2 stages, i.e. going down 37216 DEFB 243,0,2 ; Increase current state value n (initially 0), up to maximum of 2, resetting to zero if ; maximum reached and jump to n-th address in following list: 37219 DEFB 202,145 ; #R37322 (Bat, full, wings raised, eyes animated) 37221 DEFB 49,146 ; #R37425 (Bat, full, wings level, eyes animated) ; Head, body and claws only, eyes animated 37223 DEFB 244,6 ; Set current graphic set to 6 37225 DEFB 251,151,145 ; Process graphic layout data at #R37271 and upon returning, move cursor to base coordinates 37228 DEFB 250,0,1 ; Change cursor's x- and y-coordinates by +1 and 0 characters respectively 37231 DEFB 25,4,33 37234 DEFB 25,132,31 37237 DEFB 26,4,33 37240 DEFB 26,132,31 37243 DEFB 250,1,0 ; Change cursor's x- and y-coordinates by 0 and +1 characters respectively 37246 DEFB 28,68,161 37249 DEFB 28,196,159 37252 DEFB 29,124,161 37255 DEFB 29,252,158 37258 DEFB 31,4,33 37261 DEFB 30,4,33 37264 DEFB 30,132,33 37267 DEFB 31,132,33 37270 DEFB 255 ; End Marker ; Eyes, animated 37271 DEFB 250,2,1 ; Change cursor's x- and y-coordinates by +1 and +2 characters respectively 37274 DEFB 243,0,5 ; Increase current state value n (initially 0), up to maximum of 5, resetting to zero if ; maximum reached and jump to n-th address in following list: 37277 DEFB 167,145 ; #R37287 (Bat's eyes, white) 37279 DEFB 174,145 ; #R37294 (Bat's eyes, yellow) 37281 DEFB 181,145 ; #R37301 (Bat's eyes, cyan) 37283 DEFB 188,145 ; #R37308 (Bat's eyes, magenta) 37285 DEFB 195,145 ; #R37315 (Bat's eyes, red) ; Eyes, white 37287 DEFB 27,124,33 37290 DEFB 27,252,33 37293 DEFB 255 ; End Marker ; Eyes, yellow 37294 DEFB 27,116,33 37297 DEFB 27,244,33 37300 DEFB 255 ; End Marker ; Eyes, cyan 37301 DEFB 27,108,33 37304 DEFB 27,236,33 37307 DEFB 255 ; End Marker ; Eyes, magenta 37308 DEFB 27,92,33 37311 DEFB 27,220,33 37314 DEFB 255 ; End Marker ; Eyes, red 37315 DEFB 27,84,33 37318 DEFB 27,212,33 37321 DEFB 255 ; End Marker ; Full, wings raised, eyes animated 37322 DEFB 254,1,0 ; Change cursor's x- and y-coordinates by 0 and +1 characters respectively and store as new ; base coordinates 37325 DEFB 251,103,145 ; Process graphic layout data at #R37223 and upon returning, move cursor to base coordinates 37328 DEFB 250,255,253 ; Change cursor's x- and y-coordinates by -3 and -1 characters respectively 37331 DEFB 52,4,33 37334 DEFB 53,68,33 37337 DEFB 54,4,30 37340 DEFB 34,4,33 37343 DEFB 55,68,161 37346 DEFB 56,68,161 37349 DEFB 57,68,29 37352 DEFB 58,4,33 37355 DEFB 59,4,33 37358 DEFB 60,68,161 37361 DEFB 61,68,159 37364 DEFB 62,68,161 37367 DEFB 0,36,32 37370 DEFB 63,68,32 37373 DEFB 64,68,33 37376 DEFB 250,251,3 ; Change cursor's x- and y-coordinates by +3 and -5 characters respectively 37379 DEFB 54,132,33 37382 DEFB 53,196,33 37385 DEFB 52,132,29 37388 DEFB 57,132,33 37391 DEFB 56,196,161 37394 DEFB 55,196,161 37397 DEFB 34,132,29 37400 DEFB 61,196,161 37403 DEFB 60,196,161 37406 DEFB 59,132,33 37409 DEFB 58,132,29 37412 DEFB 0,36,33 37415 DEFB 62,196,159 37418 DEFB 63,196,32 37421 DEFB 64,196,33 37424 DEFB 255 ; End Marker ; Full, wings level, eyes animated 37425 DEFB 251,103,145 ; Process graphic layout data at #R37223 and upon returning, move cursor to base coordinates 37428 DEFB 250,1,255 ; Change cursor's x- and y-coordinates by -1 and +1 characters respectively 37431 DEFB 41,4,29 37434 DEFB 42,4,33 37437 DEFB 43,68,33 37440 DEFB 44,68,161 37443 DEFB 45,68,161 37446 DEFB 46,68,29 37449 DEFB 47,4,33 37452 DEFB 48,68,33 37455 DEFB 49,68,161 37458 DEFB 0,36,31 37461 DEFB 50,4,33 37464 DEFB 51,68,33 37467 DEFB 250,253,3 ; Change cursor's x- and y-coordinates by +3 and -3 characters respectively 37470 DEFB 41,132,31 37473 DEFB 46,196,33 37476 DEFB 45,196,161 37479 DEFB 44,196,161 37482 DEFB 43,196,33 37485 DEFB 42,132,28 37488 DEFB 0,36,33 37491 DEFB 49,196,161 37494 DEFB 48,196,33 37497 DEFB 47,132,29 37500 DEFB 51,196,33 37503 DEFB 50,132,33 37506 DEFB 255 ; End Marker ; Full, wings down, eyes animated 37507 DEFB 254,255,0 ; Change cursor's x- and y-coordinates by 0 and -1 characters respectively and store as new ; base coordinates 37510 DEFB 251,103,145 ; Process graphic layout data at #R37223 and upon returning, move cursor to base coordinates 37513 DEFB 250,2,0 ; Change cursor's x- and y-coordinates by 0 and +2 characters respectively 37516 DEFB 40,4,31 37519 DEFB 32,4,33 37522 DEFB 33,68,30 37525 DEFB 34,4,33 37528 DEFB 35,68,33 37531 DEFB 0,36,30 37534 DEFB 36,68,33 37537 DEFB 37,68,31 37540 DEFB 38,4,33 37543 DEFB 39,4,33 37546 DEFB 250,252,3 ; Change cursor's x- and y-coordinates by +3 and -4 characters respectively 37549 DEFB 40,132,32 37552 DEFB 33,196,33 37555 DEFB 32,132,31 37558 DEFB 0,36,33 37561 DEFB 35,196,161 37564 DEFB 34,132,31 37567 DEFB 37,132,33 37570 DEFB 36,196,31 37573 DEFB 39,132,33 37576 DEFB 38,132,33 37579 DEFB 255 ; End Marker ; Table of Current Positions in Spiders' Script Data b37580 DEFW 37792 ; Spider 1 37582 DEFW 37792 ; Spider 2 37584 DEFW 37792 ; Spider 3 ; Update the States of the Spiders (Level 1) and Store Current Positions in Script Data ; ; Used by the routine at #R36791. c37586 LD IX,43749 ; Load IX with address of complex state data for Spider 1 (Level 1) 37590 LD IY,37580 ; Load IY with start address of Table of Current Positions in Spiders' Script Data 37594 LD B,3 ; Load B with 3 as there are 3 spiders *37596 LD L,(IY+0) ; Load HL with current position in script data for current spider... 37599 LD H,(IY+1) ; ... 37602 LD (34277),HL ; ...and store at #R34277 as position in script currently running 37605 PUSH IX ; Store IX 37607 PUSH IY ; Store IY 37609 PUSH BC ; Store BC 37610 CALL 37639 ; Update the state of the current spider (Level 1) 37613 POP BC ; Restore BC 37614 POP IY ; Restore IY 37616 POP IX ; Restore IX 37618 LD HL,(34277) ; Store address (current position in script data for current spider) stored at #R34277... 37621 LD (IY+0),L ; ...in table at #R37580 as current position in this spider's script data... 37624 LD (IY+1),H ; ... 37627 INC IY ; Advance IY to next entry in table (i.e. position in next spider's script data)... 37629 INC IY ; ... 37631 LD DE,13 ; Advance IX by 13 bytes (i.e. to entry for next spider)... 37634 ADD IX,DE ; ... 37636 DJNZ 37596 ; Decrease B (remaining number of spiders to process) and loop back to #R37596 37638 RET ; Return ; Update the State of a Spider (Level 1) ; ; Used by the routine at #R37586. Input: IX Address of complex state data for a (Level 1) spider (#R43749, #R43762 ; or #R43775) c37639 LD A,(34208) ; If "Reset Spiders to Initial State" Flag is reset... 37642 BIT 3,A ; ... 37644 JR Z,37662 ; ...then skip ahead to #R37662 37646 LD A,27 ; Reset complex state data for right-hand spider to that stored in Initial-State Table... 37648 CALL 53987 ; ... 37651 LD A,28 ; Reset complex state data for middle spider to that stored in Initial-State Table... 37653 CALL 53987 ; ... 37656 LD A,29 ; Reset complex state data for left-hand spider to that stored in Initial-State Table... 37658 CALL 53987 ; ... 37661 RET ; Return *37662 BIT 2,A ; If Berk Has Been Killed Flag is set... 37664 RET NZ ; ...then return 37665 CALL 54764 ; Check entity at IX for collision with another entity at next depth level out of screen whose ; Interaction (11,6) Flag is set... 37668 CP 31 ; ...and if collision was not with entity of class 31 (Berk)... 37670 JR NZ,37685 ; ...then skip ahead to #R37685 37672 CALL 53667 ; Set "Berk Has Been Killed" Flag 37675 LD A,(34223) ; Increase count of number of times a spider has killed Berk... 37678 INC A ; ... 37679 LD (34223),A ; ... 37682 JP 48096 ; Advance HL to next script instruction and execute *37685 LD IY,(34240) ; Load IY with address of current level's complex state data for Berk 37689 BIT 0,(IX+9) ; If spider's Must Process Current Script Data Flag is set... 37693 JP NZ,48096 ; ...then jump to #R48096 (advance HL to next script instruction and execute) 37696 LD A,(IX+0) ; If the spider and Berk are in different rooms... 37699 CP (IY+0) ; ... 37702 RET NZ ; ...then return 37703 LD A,(IX+7) ; Load A with the x-coordinate of the spider's right side... 37706 ADD A,4 ; ...plus 4... 37708 CP (IY+5) ; ...and if the x-coordinate of Berk's left side is greater than this... 37711 RET C ; ...then return 37712 LD HL,37800 ; Point HL at script data for spider moving down... 37715 JP 48098 ; ...and execute ; Script Routine (41) Move Spider Up One Character and, if Home, Reset its Timer and Make it Wait Input: IX Address ; of complex state data for an entity Output: HL Address of next script instruction to execute c37718 LD A,(IX+6) ; If y-coordinate of bottom of entity IX (spider) is not 106... 37721 CP 106 ; ... 37723 JP NZ,48541 ; ...then move entity up one character and return 37726 LD C,20 ; Load C with 20 37728 LD A,(IX+8) ; If entity class is not 27 (right-most spider, Level 1)... 37731 CP 27 ; ... 37733 JR NZ,37744 ; ...then skip ahead to #R37744 ; The following code affects the behaviour of the right-most spider depending upon how many times Berk has been ; killed by a spider. See (trivia) and (pokes). 37735 LD A,(34223) ; Load number of times Berk has been killed by a spider into A... 37738 SRL A ; ...and divide by four, discarding remainder... 37740 SRL A ; ... 37742 ADD A,C ; Add this value to C, in C... 37743 LD C,A ; ... *37744 LD (IX+12),C ; Load spider's timer with this value 37747 LD HL,37792 ; Point HL at script data for spider waiting... 37750 JP 48098 ; ...and execute ; Script Routine (42) Decrease Remaining Time Until Spider Next Descends and if Zero, Start Descent Input: IX ; Address of complex state data for an entity Output: HL Address of next script instruction to execute c37753 BIT 0,(IX+9) ; If spider's Must Process Current Script Data Flag is reset... 37757 JP Z,48096 ; ...then jump to #R48096 (advance HL to next script instruction and execute) 37760 LD A,(IX+12) ; If Spider's timer is zero... 37763 OR A ; ... 37764 JR Z,37772 ; ...then skip ahead to #R37772 37766 DEC (IX+12) ; Decrease remaining time on spider's timer 37769 JP 48096 ; Advance HL to next script instruction and execute *37772 LD HL,37800 ; Point HL at script data for spider moving down... 37775 JP 48098 ; ...and execute ; Script Routine (40) Move Spider Down One Character, and if at Bottom, Advance it to Bounce / Climb Up Mode Input: ; IX Address of complex state data for an entity Output: HL Address of next script instruction to execute c37778 LD A,(IX+6) ; If entity's bottom y-coordinate is less than 119... 37781 CP 119 ; ... 37783 JP C,48567 ; ...then move entity down one character and process next script data 37786 LD HL,37816 ; Point HL at script data for bounce / climb up mode... 37789 JP 48098 ; ...and execute ; Script Data Spiders (Level 1) ; ; Waiting b37792 DEFB 0,148 ; #R37888 (Spider, web trail slack) 37794 DEFB 42,0 ; Decrease remaining time until spider next descends and if zero, start descent 37796 DEFB 1,0,160,147 ; Jump to #R37792 ; Moving down 37800 DEFB 8,0 ; Set Must Process Current Script Data Flag 37802 DEFB 0,148 ; #R37888 (Spider, web trail slack) 37804 DEFB 4,0,7,0 ; If current character and target entity are in the same room then set pending sound to 7 ; (spider sound) 37808 DEFB 40,0 ; Move spider down one character, and if at bottom, advance it to bounce / climb up mode 37810 DEFB 40,0 ; Move spider down one character, and if at bottom, advance it to bounce / climb up mode 37812 DEFB 1,0,168,147 ; Jump to #R37800 ; Bounce / climb up mode 37816 DEFB 240,147 ; #R37872 (Spider, web trail stretched) 37818 DEFB 34,0 ; Move Spider up one character 37820 DEFB 0,148 ; #R37888 (Spider, web trail slack) 37822 DEFB 34,0 ; Move Spider up one character 37824 DEFB 0,148 ; #R37888 (Spider, web trail slack) 37826 DEFB 34,0 ; Move Spider up one character 37828 DEFB 0,148 ; #R37888 (Spider, web trail slack) 37830 DEFB 35,0 ; Move Spider down one character 37832 DEFB 0,148 ; #R37888 (Spider, web trail slack) 37834 DEFB 35,0 ; Move Spider down one character 37836 DEFB 240,147 ; #R37872 (Spider, web trail stretched) 37838 DEFB 240,147 ; #R37872 (Spider, web trail stretched) 37840 DEFB 34,0 ; Move Spider up one character 37842 DEFB 0,148 ; #R37888 (Spider, web trail slack) 37844 DEFB 0,148 ; #R37888 (Spider, web trail slack) 37846 DEFB 35,0 ; Move Spider down one character 37848 DEFB 240,147 ; #R37872 (Spider, web trail stretched) 37850 DEFB 240,147 ; #R37872 (Spider, web trail stretched) 37852 DEFB 34,0 ; Move Spider up one character 37854 DEFB 0,148 ; #R37888 (Spider, web trail slack) 37856 DEFB 0,148 ; #R37888 (Spider, web trail slack) 37858 DEFB 0,148 ; #R37888 (Spider, web trail slack) 37860 DEFB 0,148 ; #R37888 (Spider, web trail slack) 37862 DEFB 62,148 ; #R37950 (Spider climbing up web trail) 37864 DEFB 62,148 ; #R37950 (Spider climbing up web trail) 37866 DEFB 41,0 ; Move spider up one character and, if home, reset its timer and make it wait 37868 DEFB 1,0,232,147 ; Jump to #R37864 ; Graphic Layout Data Spiders (Level 1) Spider, web trail stretched b37872 DEFB 244,5 ; Set current graphic set to 5 37874 DEFB 237,7 ; Set sound 7 (spider sound) as pending 37876 DEFB 250,246,1 ; Change cursor's x- and y-coordinates by +1 and -10 characters respectively 37879 DEFB 238,11 ; Set Repeat Counter A to 11 37881 DEFB 31,7,32 37884 DEFB 239 ; Decrement Repeat Counter A and loop back to #R37881 if not zero 37885 DEFB 248,11,148 ; Jump to #R37899 (spider, facing down) ; Spider, web trail slack 37888 DEFB 244,5 ; Set current graphic set to 5 37890 DEFB 250,246,1 ; Change cursor's x- and y-coordinates by +1 and -10 characters respectively 37893 DEFB 238,11 ; Set Repeat Counter A to 11 37895 DEFB 30,7,32 37898 DEFB 239 ; Decrement Repeat Counter A and loop back to #R37895 if not zero ; Spider, facing down 37899 DEFB 250,255,255 ; Change cursor's x- and y-coordinates by -1 and -1 characters respectively 37902 DEFB 22,2,34 37905 DEFB 22,130,30 37908 DEFB 29,2,33 37911 DEFB 23,66,33 37914 DEFB 29,130,31 37917 DEFB 25,2,32 37920 DEFB 236,2,26,27 ; Modify following instruction to display graphic of random index, chosen from 26 and 27 37924 DEFB 26,7,33 37927 DEFB 250,255,254 ; Change cursor's x- and y-coordinates by -2 and -1 characters respectively 37930 DEFB 247,2 ; Jump to one of the 2 addresses in the following list, chosen at random: 37932 DEFB 48,148 ; #R37936 (Spider's eyes, large pupils) 37934 DEFB 55,148 ; #R37943 (Spider's eyes, small pupils) ; Spider's eyes, large pupils 37936 DEFB 24,7,34 37939 DEFB 24,135,33 37942 DEFB 255 ; End Marker ; Spider's eyes, small pupils 37943 DEFB 28,7,34 37946 DEFB 28,135,33 37949 DEFB 255 ; End Marker ; Spider climbing up web trail 37950 DEFB 244,5 ; Set current graphic set to 5 37952 DEFB 250,246,1 ; Change cursor's x- and y-coordinates by +1 and -10 characters respectively 37955 DEFB 238,12 ; Set Repeat Counter A to 12 37957 DEFB 30,7,32 37960 DEFB 239 ; Decrement Repeat Counter A and loop back to #R37957 if not zero 37961 DEFB 250,0,255 ; Change cursor's x- and y-coordinates by -1 and 0 characters respectively 37964 DEFB 36,7,33 37967 DEFB 25,2,33 37970 DEFB 36,135,31 37973 DEFB 35,2,33 37976 DEFB 243,0,2 ; Increase current state value n (initially 0), up to maximum of 2, resetting to zero if ; maximum reached and jump to n-th address in following list: 37979 DEFB 95,148 ; #R37983 (Spider's legs, left extended, right not, climbing up web trail) 37981 DEFB 108,148 ; #R37996 (Spider's legs, right extended, left not, climbing up web trail) ; Spider's legs (left extended, right not), climbing up web trail 37983 DEFB 250,253,254 ; Change cursor's x- and y-coordinates by -2 and -3 characters respectively 37986 DEFB 32,2,32 37989 DEFB 33,2,34 37992 DEFB 34,130,33 37995 DEFB 255 ; End Marker ; Spider's legs (right extended, left not), climbing up web trail 37996 DEFB 250,253,0 ; Change cursor's x- and y-coordinates by 0 and -3 characters respectively 37999 DEFB 32,130,30 38002 DEFB 34,2,34 38005 DEFB 33,130,33 38008 DEFB 255 ; End Marker ; Update States of All Level 2 Entities ; ; Used by the routine at #R34438. c38009 CALL 38592 ; Update states of stalactites (Level 2) 38012 CALL 38480 ; Update states of apebeasts (Level 2) and store current positions in script data 38015 CALL 38054 ; Update state of Bubo (Level 2) and store current position in script data 38018 CALL 38219 ; Update state of Bubo's projectile 38021 RET ; Return ; Current Position in Bubo's Script Data b38022 DEFW 38024 ; Script Data Bubo b38024 DEFB 9,0 ; Reset Must Process Current Script Data Flag 38026 DEFB 84,152 ; #R38996 (Bubo, normal, animated) 38028 DEFB 1,0,136,148 ; Jump to #R38024 ; Firing 38032 DEFB 8,0 ; Set Must Process Current Script Data Flag 38034 DEFB 25,0,4,0 ; Start loop (2) for 4 iterations 38038 DEFB 126,152 ; #R39038 (Bubo, pre/post firing) 38040 DEFB 26,0 ; End loop (2) 38042 DEFB 158,152 ; #R39070 (Bubo, squashed, firing) 38044 DEFB 194,152 ; #R39106 (Bubo, squashed, firing, with explosion) 38046 DEFB 61,0 ; Fire Bubo's projectile 38048 DEFB 126,152 ; #R39038 (Bubo, pre/post firing) 38050 DEFB 1,0,136,148 ; Jump to #R38024 ; Update State of Bubo (Level 2) and Store Current Position in Script Data ; ; Used by the routine at #R38009. c38054 LD IX,44227 ; Load IX with address of complex state data for Bubo (Level 2) 38058 LD HL,(38022) ; Load HL with current position in Bubo's script data from #R38022... 38061 LD (34277),HL ; ...and store at #R34277 as position in script currently running 38064 CALL 38074 ; Update state of Bubo 38067 LD HL,(34277) ; Store address (current position in script data) stored at #R34277... 38070 LD (38022),HL ; ...at #R38022 as current position in Bubo's script data 38073 RET ; Return ; Update State of Bubo ; ; Used by the routine at #R38054. Input: IX Address of complex state data for Bubo (Level 2) c38074 BIT 3,(IX+9) ; If Bubo's Harmless Flag is set... 38078 JR NZ,38101 ; ...then skip ahead to #R38101 38080 LD A,(34220) ; If Berk's current power is not immunity to Bubo (Level 2)... 38083 CP 9 ; ... 38085 JR NZ,38093 ; ...then skip ahead to #R38093 38087 SET 3,(IX+9) ; Set Bubo's Harmless Flag 38091 JR 38101 ; Skip ahead to #R38101 *38093 CALL 54768 ; Check entity at IX for collision with another entity at same depth whose Interaction (11,6) ; Flag is set... 38096 CP 31 ; ...and if collision was with entity of class 31 (Berk)... 38098 CALL Z,53667 ; ...then set "Berk Has Been Killed" Flag *38101 LD IY,44214 ; Load IY with address of complex state data for Bubo's Projectile (Level 2) 38105 BIT 0,(IX+9) ; If Bubo's Must Process Current Script Data Flag is set (Bubo firing)... 38109 JP NZ,48096 ; ...then jump to #R48096 (advance HL to next script instruction and execute) 38112 BIT 1,(IY+9) ; If Projectile's Fired Flag is set... 38116 JP NZ,48096 ; ...then jump to #R48096 (advance HL to next script instruction and execute) 38119 BIT 5,(IX+10) ; If Bubo is not being carried... 38123 JR Z,38132 ; ...then skip ahead to #R38132 38125 SET 2,(IX+9) ; Set Bubo's Waiting to Fire Flag 38129 JP 48096 ; Advance HL to next script instruction and execute ; The code block below is only entered if Bubo's Must Process Current Script Data Flag is reset (i.e. he is not ; firing), the Projectile's Fired Flag is reset and Bubo is not being carried. *38132 LD A,(IX+1) ; If Bubo has a depth of 2... 38135 CP 2 ; ... 38137 JP Z,48096 ; ...then jump to #R48096 (advance HL to next script instruction and execute) 38140 BIT 2,(IX+9) ; If Bubo's Waiting to Fire Flag is set, i.e. he has just been dropped... 38144 JR NZ,38155 ; ...then skip ahead to #R38155 (make Bubo fire) 38146 LD A,60 ; Load A with a random number, 0-59... 38148 CALL 54222 ; ... 38151 OR A ; ...and if this is not zero (59 in 60 chance)... 38152 JP NZ,48096 ; ...then jump to #R48096 (advance HL to next script instruction and execute) *38155 RES 2,(IX+9) ; Reset Bubo's Waiting to Fire Flag 38159 LD HL,38032 ; Point HL at script data for Bubo firing... 38162 JP 48098 ; ...and execute ; Script Routine (61) Fire Bubo's Projectile ; ; Note that Bubo normally can't fire when being carried (see instructions at #R38119), however if he starts to fire ; immediately before being picked up, then his Being Carried Flag will be set by the time execution reaches this ; routine. Input: IX Address of complex state data for Bubo (Level 2) IY Address of complex state data for Bubo's ; projectile c38165 SET 1,(IY+9) ; Set projectile's Fired Flag 38169 BIT 5,(IX+10) ; If Bubo is being carried... 38173 JR NZ,38181 ; ...then skip ahead to #R38181 38175 LD (IY+12),251 ; Set projectile's Velocity Factor to -5 38179 JR 38185 ; Skip ahead to #R38185 *38181 LD (IY+12),246 ; Set projectile's Velocity Factor to -10 *38185 LD A,(IX+5) ; Set projectile's x-coordinate to one more than Bubo's... 38188 INC A ; ... 38189 LD (IY+5),A ; ... 38192 LD (IY+7),A ; ... 38195 LD A,(IX+4) ; Set projectile's y-coordinate to be three less than Bubo's... 38198 SUB 3 ; ... 38200 LD (IY+4),A ; ... 38203 LD (IY+6),A ; ... 38206 LD A,(IX+0) ; Set projectile's room to be same as Bubo's... 38209 LD (IY+0),A ; ... 38212 LD (IY+1),1 ; Set projectile's depth to zero 38216 JP 48096 ; Advance HL to next script instruction and execute ; Update State of Bubo's Projectile ; ; Used by the routine at #R38009. c38219 LD IX,44214 ; Load IX with address of complex state data for Bubo's Projectile (Level 2) 38223 BIT 1,(IX+9) ; If projectile's Fired Flag is reset... 38227 RET Z ; ...then return 38228 BIT 2,(IX+9) ; If projectile's Has Hit Target Flag is reset... 38232 JR Z,38252 ; ...then update position of projectile and knock key down if appropriate 38234 LD BC,39131 ; Point BC at graphic layout data for Bubo's Projectile... 38237 LD (IX+2),C ; ...and set this as the Graphic Lookup Address for the projectile's complex state data ; entry... 38240 LD (IX+3),B ; ... 38243 LD (IX+9),0 ; Reset projectile's Has Hit Target Flag and Fired Flag 38247 LD (IX+1),0 ; Set projectile's depth to zero 38251 RET ; Return *38252 LD IY,44227 ; Point IY at complex state data for Bubo (Level 2) 38256 LD A,(IX+12) ; If projectile's velocity factor is not zero... 38259 OR A ; ... 38260 JR NZ,38267 ; ...then skip ahead to #R38267 38262 CALL 38377 ; Start level 2 key falling if Bubo's projectile is in place below it 38265 JR 38361 ; Jump to #R38361 (increase velocity and handle landing if appropriate) *38267 BIT 7,A ; If bit 7 of projectile's velocity factor is set (i.e. negative, moving upwards)... 38269 JR NZ,38336 ; ...then skip ahead to #R38336 38271 CP 6 ; If projectile's velocity factor is less than 6... 38273 JR C,38277 ; ...then skip ahead to #R38277 38275 LD A,5 ; Load A with 5 (terminal velocity) *38277 LD B,A ; Load B with velocity value *38278 PUSH BC ; Store BC (B = remaining velocity value) 38279 CALL 54768 ; Check entity at IX for collision with another entity at same depth whose Interaction (11,6) ; Flag is set... 38282 JR C,38328 ; ...and if no collision occurred, then skip ahead to #R38328 38284 CP 31 ; If collision was not with entity of class 31 (Berk)... 38286 JR NZ,38293 ; ...then skip ahead to #R38293 38288 CALL 53667 ; Set "Berk Has Been Killed" Flag 38291 JR 38328 ; Skip ahead to #R38328 *38293 CP 25 ; If collision was not with entity of class 25 (Green Apebeast, Level 2)... 38295 JR NZ,38328 ; ...then skip ahead to #R38328 38297 LD A,(34218) ; Load A with current character's current room... 38300 CP (IX+0) ; ...and if this is not the same as the projectile's room... 38303 JR NZ,38328 ; ...then skip ahead to #R38328 38305 LD (IY+1),0 ; Set Ape Beast's depth to zero 38309 LD (IY+11),0 ; Reset Ape Beast's flags 38313 LD BC,51483 ; Point BC at graphic layout data for Explosion (Bubo's Projectile / Fallen Drips, Level 4)... 38316 LD (IX+2),C ; ...and set this as the Graphic Lookup Address for the projectile's complex state data ; entry... 38319 LD (IX+3),B ; ... 38322 SET 2,(IX+9) ; Set projectile's Has Hit Target Flag 38326 POP BC ; Restore BC (B = current velocity factor) 38327 RET ; Return *38328 CALL 38756 ; Move projectile down one character 38331 POP BC ; Restore BC (B = current velocity factor) 38332 DJNZ 38278 ; Decrease remaining velocity value and loop back to #R38278 if not zero 38334 JR 38361 ; Skip ahead to #R38361 (increase velocity and handle landing if appropriate) ; Projectile moving upwards *38336 NEG ; Multiply projectile's velocity factor by -1 38338 CP 6 ; If projectile's velocity factor is now less than 6... 38340 JR C,38344 ; ...then skip ahead to #R38344 (change projectile's y-coordinate based upon velocity) 38342 LD A,5 ; Load A with 5 (i.e. cap velocity magnitude at 5) *38344 NEG ; Multiply value in A by -1... 38346 LD E,A ; ...and load value (capped velocity) into E 38347 LD A,(IX+4) ; Decrease projectile's y-coordinate by value in E... 38350 ADD A,E ; ... 38351 LD (IX+4),A ; ... 38354 LD A,(IX+6) ; ... 38357 ADD A,E ; ... 38358 LD (IX+6),A ; ... *38361 LD A,(IX+4) ; If projectile's y-coordinate is at least 124... 38364 CP 124 ; ... 38366 JR NC,38372 ; ...then skip ahead to #R38372 (reset projectile's Fired Flag and return) 38368 INC (IX+12) ; Increase projectile's velocity factor by one 38371 RET ; Return *38372 RES 1,(IX+9) ; Reset projectile's Fired Flag 38376 RET ; Return ; Start Level 2 Key Falling if Bubo's Projectile is in Place Below it ; ; Used by the routine at #R38219. Input: IX Address of complex state data for Bubo's projectile (Level 2) c38377 LD A,(IX+0) ; If room of projectile is not 1... 38380 CP 1 ; ... 38382 RET NZ ; ...then return 38383 LD A,(IX+5) ; If projectile's left-side has an x-coordinate less than 114... 38386 CP 114 ; ... 38388 RET C ; ...then return 38389 CP 118 ; If projectile's left-side has an x-coordinate of 118 or more... 38391 RET NC ; ...then return 38392 LD IY,44240 ; Load IY with address of complex state data for Key (Level 2) 38396 LD A,(IY+0) ; If key's room is not 2... 38399 CP 2 ; ... 38401 RET NZ ; ...then return 38402 BIT 6,(IY+10) ; If key's Is Falling Flag is set... 38406 RET NZ ; ...then return 38407 SET 6,(IY+10) ; Set key's Is Falling Flag 38411 LD (IY+12),2 ; Set key's velocity factor to 2 38415 RET ; Return ; Table of Initial Positions in Apebeasts' Script Data b38416 DEFW 38432 ; Apebeast 1 (Level 2) 38418 DEFW 38450 ; Apebeast 2 (Level 2) 38420 DEFW 38432 ; Apebeast 3 (Level 2) 38422 DEFW 38450 ; Apebeast 4 (Level 2) ; Table of Current Positions in Apebeasts' Script Data b38424 DEFW 38432 ; Apebeast 1 (Level 2) 38426 DEFW 38450 ; Apebeast 2 (Level 2) 38428 DEFW 38432 ; Apebeast 3 (Level 2) 38430 DEFW 38450 ; Apebeast 4 (Level 2) ; Script Data Apebeast Walking Right b38432 DEFB 12,0 ; Set Apebeast's Walking Right Flag 38434 DEFB 60,0 ; Check position of apebeast and turn if appropriate 38436 DEFB 3,0 ; Move apebeast right one character 38438 DEFB 166,151 ; #R38822 (Apebeast, walking right, frame 3) 38440 DEFB 110,151 ; #R38766 (Apebeast, walking right, frame 1) 38442 DEFB 138,151 ; #R38794 (Apebeast, walking right, frame 2) 38444 DEFB 138,151 ; #R38794 (Apebeast, walking right, frame 2) 38446 DEFB 1,0,32,150 ; Jump back to #R38432 ; Script Data Apebeast Walking Left b38450 DEFB 11,0 ; Set Apebeast's Walking Left Flag 38452 DEFB 60,0 ; Check position of apebeast and turn if appropriate 38454 DEFB 2,0 ; Move apebeast left one character 38456 DEFB 25,152 ; #R38937 (Apebeast, walking left, frame 3) 38458 DEFB 225,151 ; #R38881 (Apebeast, walking left, frame 1) 38460 DEFB 253,151 ; #R38909 (Apebeast, walking left, frame 2) 38462 DEFB 253,151 ; #R38909 (Apebeast, walking left, frame 2) 38464 DEFB 1,0,50,150 ; Jump back to #R38450 ; Reset Current Positions in Apebeasts' Script Data to Initial Values ; ; Used by the routine at #R34751. c38468 LD DE,38424 ; Point DE at Table of Current Positions in Apebeasts' Script Data 38471 LD HL,38416 ; Point HL at Table of Initial Positions in Apebeasts' Script Data 38474 LD BC,8 ; Load BC with 8 (as there are eight bytes to copy) 38477 LDIR ; Overwrite addresses in Table of Current Positions with those from Table of Initial Positions 38479 RET ; Return ; Update States of Apebeasts (Level 2) and Store Current Positions in Script Data ; ; Used by the routine at #R38009. c38480 LD IX,44162 ; Load IX with address of complex state data for Green Apebeast 1 (Level 2) 38484 LD IY,38424 ; Point IY at Table of Current Positions in Apebeasts' Script Data *38488 LD A,(IX+1) ; If depth of Apebeast is zero (i.e. Apebeast killed by Bubo)... 38491 OR A ; ... 38492 JR Z,38523 ; ...then skip ahead to #R38523 (i.e. move onto next apebeast) 38494 LD L,(IY+0) ; Load HL with current position in script data for current apebeast... 38497 LD H,(IY+1) ; ... 38500 LD (34277),HL ; ...and store at #R34277 as position in script currently running 38503 PUSH IX ; Store IX 38505 PUSH IY ; Store IY 38507 CALL 38540 ; Update the state of the current apebeast 38510 POP IY ; Restore IY 38512 POP IX ; Restore IX 38514 LD HL,(34277) ; Store address (current position in script data for current apebeast) stored at #R34277... 38517 LD (IY+0),L ; ...in table at #R38424 as current position in this apebeast's script data... 38520 LD (IY+1),H ; ... *38523 INC IY ; Advance IY to next entry in table (i.e. position in next apebeast's script data)... 38525 INC IY ; ... 38527 LD DE,13 ; Advance IX by 13 bytes (i.e. to entry for next apebeast)... 38530 ADD IX,DE ; ... 38532 LD A,(IX+8) ; If class of this next entry is 25 (i.e. Apebeast)... 38535 CP 25 ; ... 38537 JR Z,38488 ; ...then loop back to #R38488 38539 RET ; Return ; Update State of an Apebeast ; ; Used by the routine at #R38480. c38540 CALL 54768 ; Check entity at IX for collision with another entity at same depth whose Interaction (11,6) ; Flag is set... 38543 JP C,48096 ; ...and if no collision occurred, then jump to #R48096 (advance HL to next script instruction ; and execute) 38546 CP 31 ; If collision was with entity of class 31 (Berk)... 38548 CALL Z,53667 ; ...then set "Berk Has Been Killed" Flag 38551 JP 48096 ; Advance HL to next script instruction and execute ; Script Routine (60) Check Position of Apebeast and Turn If Appropriate Input: IX Address of complex state data ; for an entity Output: HL Address of next script instruction to execute c38554 BIT 0,(IX+11) ; If Apebeast's Walking Right Flag is set... 38558 JR NZ,38575 ; ...then skip ahead to #R38575 ; Apebeast walking left 38560 LD A,(IX+12) ; If minimum allowed x-coordinate of Apebeast... 38563 CP (IX+5) ; ...is less than x-coordinate of left edge of Apebeast... 38566 JP C,48096 ; ...then jump to #R48096 (advance HL to next script instruction and execute) 38569 LD HL,38432 ; Point HL at script data for Apebeast walking right... 38572 JP 48098 ; ...and execute ; Apebeast walking right *38575 LD A,(IX+12) ; If minimum allowed x-coordinate of Apebeast... 38578 ADD A,13 ; ...plus 13... 38580 CP (IX+7) ; ...is equal to or greater than x-coordinate of right edge of Apebeast... 38583 JP NC,48096 ; ...then jump to #R48096 (advance HL to next script instruction and execute) 38586 LD HL,38450 ; Point HL at script data for Apebeast walking left... 38589 JP 48098 ; ...and execute ; Update States of Stalactites (Level 2) ; ; Used by the routine at #R38009. c38592 LD IX,44305 ; Load IX with address of complex state data for first of seven falling stalactites (Level 2) *38596 LD A,(IX+8) ; If current entity class is not 34 (Stalactite, Level 2)... 38599 CP 34 ; ... 38601 RET NZ ; ...then return 38602 LD A,(IX+12) ; If velocity factor of stalactite is not zero (i.e. it is falling)... 38605 OR A ; ... 38606 JR NZ,38635 ; ...then skip ahead to #R38635 38608 LD A,40 ; Load A with a random number, 0-39... 38610 CALL 54222 ; ... 38613 OR A ; ...and if this is not zero (39 in 40 chance)... 38614 JP NZ,38748 ; ...then advance IX to next entry in complex state data and loop back to #R38596 38617 CALL 38756 ; Move stalactite down one character and load A with new top y-coordinate 38620 LD A,(IX+4) ; Load A with top y-coordinate of stalactite (see trivia) 38623 CP 101 ; If new top y-coordinate is not 101 38625 JP NZ,38748 ; ...then advance IX to next entry in complex state data and loop back to #R38596 38628 LD (IX+12),1 ; Set stalactite's velocity factor to 1 38632 JP 38748 ; Advance IX to next entry in complex state data and loop back to #R38596 *38635 CP 1 ; If velocity factor is not 1... 38637 JR NZ,38707 ; ...then check for collision with Berk killing him if so, ensure stalactite is falling and ; update its vertical position (#R38707) 38639 LD E,(IX+5) ; Load E with x-coordinate of left of stalactite 38642 LD IY,(34240) ; Load IY with address of current level's complex state data for Berk 38646 LD A,(IY+0) ; If Berk's current room is not the same as the stalactite's... 38649 CP (IX+0) ; ... 38652 JR NZ,38679 ; ...then skip ahead to #R38679 to check Drutt's position 38654 LD A,(IY+11) ; If Berk's Walking Left Flag is set... 38657 BIT 1,A ; ... 38659 JR NZ,38673 ; ...then skip ahead to #R38673 38661 BIT 0,A ; If Berk's Walking Right Flag is not set... 38663 JR Z,38679 ; ...then skip ahead to #R38679 to check Drutt's position 38665 LD A,(IY+7) ; If Berk's right-side x-coordinate is the same as the stalactite's left-side x-coordinate... 38668 CP E ; ... 38669 JR Z,38707 ; ...then check for collision with Berk killing him if so, ensure stalactite is falling and ; update its vertical position (#R38707) 38671 JR 38679 ; Skip ahead to #R38679 to check Drutt's position *38673 LD A,(IY+5) ; If Berk's left-side x-coordinate is the same as the stalactite's left-side x-coordinate... 38676 CP E ; ... 38677 JR Z,38707 ; ...then check for collision with Berk killing him if so, ensure stalactite is falling and ; update its vertical position (#R38707) *38679 LD IY,44396 ; Load IY with address of complex state data for Drutt (Level 2) 38683 LD A,(IY+0) ; If Drutt's current room is not the same as the stalactite's... 38686 CP (IX+0) ; ... 38689 JR NZ,38699 ; ...then skip ahead to #R38699 38691 LD A,(IY+5) ; If Drutt's left-side x-coordinate is the same as the stalactite's left-side x-coordinate... 38694 CP (IX+5) ; ... 38697 JR Z,38707 ; ...then check for collision with Berk killing him if so, ensure stalactite is falling and ; update its vertical position (#R38707) *38699 LD A,200 ; Load A with a random number, 0-199... 38701 CALL 54222 ; ... 38704 OR A ; ...and if this is not zero (199 in 200 chance)... 38705 JR NZ,38748 ; ...then advance IX to next entry in complex state data and loop back to #R38596 *38707 CALL 54768 ; Check entity at IX for collision with another entity at same depth whose Interaction (11,6) ; Flag is set... 38710 CP 31 ; ...and if collision was not with entity of class 31 (Berk)... 38712 JR NZ,38718 ; ...then skip ahead to #R38718 (start stalactite falling) 38714 CALL 53667 ; Set "Berk Has Been Killed" Flag 38717 RET ; Return *38718 LD B,(IX+12) ; Load B with stalactite's velocity factor... *38721 CALL 38756 ; ...and move stalactite down by this many characters... 38724 DJNZ 38721 ; ... 38726 INC (IX+12) ; Increase stalactite's velocity factor by one 38729 LD A,(IX+4) ; If y-coordinate of top of stalactite is less than 150... 38732 CP 150 ; ... 38734 JR C,38748 ; ...then advance IX to next entry in complex state data and loop back to #R38596 38736 LD (IX+4),98 ; Move stalactite back to top of room... 38740 LD (IX+6),100 ; ... 38744 LD (IX+12),0 ; ...and set its velocity factor to zero *38748 LD BC,13 ; Advance IX by 13 bytes to move to next complex state data entry... 38751 ADD IX,BC ; ... 38753 JP 38596 ; ...and loop back to #R38596 for next entity ; Move Entity at IX Down One Character ; ; Used by the routines at #R38219 and #R38592. Input: IX Address of complex state data for an entity Output: A New ; y-coordinate of entity's top c38756 INC (IX+4) ; Increase y-coordinates of top and bottom of entity by one character... 38759 INC (IX+6) ; ... 38762 LD A,(IX+4) ; Load new y-coordinate of entity's top into A 38765 RET ; Return ; Graphic Layout Data Green Apebeast (Level 2) Walking right (frame 1) b38766 DEFB 250,255,2 ; Change cursor's x- and y-coordinates by +2 and -1 characters respectively 38769 DEFB 251,200,151 ; Process graphic layout data at #R38856 and upon returning, move cursor to base coordinates 38772 DEFB 250,255,0 ; Change cursor's x- and y-coordinates by 0 and -1 characters respectively 38775 DEFB 1,68,33 38778 DEFB 2,68,31 38781 DEFB 3,4,33 38784 DEFB 4,68,31 38787 DEFB 5,4,33 38790 DEFB 6,4,33 38793 DEFB 255 ; End Marker ; Walking right (frame 2) 38794 DEFB 250,254,2 ; Change cursor's x- and y-coordinates by +2 and -2 characters respectively 38797 DEFB 251,200,151 ; Process graphic layout data at #R38856 and upon returning, move cursor to base coordinates 38800 DEFB 250,255,0 ; Change cursor's x- and y-coordinates by 0 and -1 characters respectively 38803 DEFB 33,68,33 38806 DEFB 13,68,31 38809 DEFB 14,4,33 38812 DEFB 15,4,31 38815 DEFB 5,4,33 38818 DEFB 12,4,33 38821 DEFB 255 ; End Marker ; Walking right (frame 3) 38822 DEFB 250,255,2 ; Change cursor's x- and y-coordinates by +2 and -1 characters respectively 38825 DEFB 251,200,151 ; Process graphic layout data at #R38856 and upon returning, move cursor to base coordinates 38828 DEFB 250,255,0 ; Change cursor's x- and y-coordinates by 0 and -1 characters respectively 38831 DEFB 7,68,33 38834 DEFB 8,68,30 38837 DEFB 9,4,33 38840 DEFB 10,4,33 38843 DEFB 11,4,30 38846 DEFB 5,4,33 38849 DEFB 12,4,33 38852 DEFB 32,4,33 38855 DEFB 255 ; End Marker ; Head (right-facing) 38856 DEFB 244,9 ; Set current graphic set to 9 38858 DEFB 16,68,33 38861 DEFB 236,2,20,21 ; Modify following instruction to display graphic of random index, chosen from 20 and 21 38865 DEFB 20,7,31 38868 DEFB 17,4,33 38871 DEFB 18,7,31 38874 DEFB 19,4,33 38877 DEFB 31,4,33 38880 DEFB 255 ; End Marker ; Walking left (frame 1) 38881 DEFB 250,255,0 ; Change cursor's x- and y-coordinates by 0 and -1 characters respectively 38884 DEFB 251,59,152 ; Process graphic layout data at #R38971 and upon returning, move cursor to base coordinates 38887 DEFB 250,255,2 ; Change cursor's x- and y-coordinates by +2 and -1 characters respectively 38890 DEFB 2,132,33 38893 DEFB 1,132,31 38896 DEFB 4,132,33 38899 DEFB 3,132,31 38902 DEFB 6,132,33 38905 DEFB 5,132,33 38908 DEFB 255 ; End Marker ; Walking left (frame 2) 38909 DEFB 250,254,0 ; Change cursor's x- and y-coordinates by 0 and -2 characters respectively 38912 DEFB 251,59,152 ; Process graphic layout data at #R38971 and upon returning, move cursor to base coordinates 38915 DEFB 250,255,2 ; Change cursor's x- and y-coordinates by +2 and -1 characters respectively 38918 DEFB 13,132,33 38921 DEFB 33,132,31 38924 DEFB 15,132,33 38927 DEFB 14,132,31 38930 DEFB 12,132,33 38933 DEFB 5,132,33 38936 DEFB 255 ; End Marker ; Walking left (frame 3) 38937 DEFB 250,255,0 ; Change cursor's x- and y-coordinates by 0 and -1 characters respectively 38940 DEFB 251,59,152 ; Process graphic layout data at #R38971 and upon returning, move cursor to base coordinates 38943 DEFB 250,255,2 ; Change cursor's x- and y-coordinates by +2 and -1 characters respectively 38946 DEFB 8,132,33 38949 DEFB 7,132,31 38952 DEFB 11,132,33 38955 DEFB 10,132,33 38958 DEFB 9,132,30 38961 DEFB 32,132,33 38964 DEFB 12,132,33 38967 DEFB 5,132,33 38970 DEFB 255 ; End Marker ; Head (left-facing) 38971 DEFB 244,9 ; Set current graphic set to 9 38973 DEFB 236,2,20,21 ; Modify following instruction to display graphic of random index, chosen from 20 and 21 38977 DEFB 20,135,33 38980 DEFB 16,132,31 38983 DEFB 18,135,33 38986 DEFB 17,132,31 38989 DEFB 31,132,33 38992 DEFB 19,132,33 38995 DEFB 255 ; End Marker ; Graphic Layout Data Bubo (Level 2) Normal, animated b38996 DEFB 244,9 ; Set current graphic set to 9 38998 DEFB 250,255,0 ; Change cursor's x- and y-coordinates by 0 and -1 characters respectively 39001 DEFB 27,6,33 39004 DEFB 28,70,33 39007 DEFB 27,134,30 39010 DEFB 29,6,33 39013 DEFB 245,2,10,3,22,23,24 ; Decrease timer value (initially 2) and if now zero then reset to 10 and ; load one of the 3 following values at random into the Graphic Index field ; of the following instruction 39020 DEFB 22,70,161 39023 DEFB 29,134,30 39026 DEFB 30,70,33 39029 DEFB 34,70,161 39032 DEFB 30,198,30 39035 DEFB 248,184,152 ; Jump to #R39096 (Bubo's feet) ; Pre/post firing 39038 DEFB 244,9 ; Set current graphic set to 9 39040 DEFB 250,254,1 ; Change cursor's x- and y-coordinates by +1 and -2 characters respectively 39043 DEFB 0,54,32 39046 DEFB 0,54,31 39049 DEFB 29,6,33 39052 DEFB 25,70,161 39055 DEFB 29,134,30 39058 DEFB 30,70,33 39061 DEFB 37,70,161 39064 DEFB 30,198,30 39067 DEFB 248,184,152 ; Jump to #R39096 (Bubo's feet) ; Squashed, firing 39070 DEFB 244,9 ; Set current graphic set to 9 39072 DEFB 44,6,33 39075 DEFB 0,54,33 39078 DEFB 44,134,29 39081 DEFB 39,6,33 39084 DEFB 0,54,33 39087 DEFB 26,70,161 39090 DEFB 0,54,33 39093 DEFB 39,134,29 ; Feet 39096 DEFB 35,70,161 39099 DEFB 36,70,161 39102 DEFB 35,198,33 39105 DEFB 255 ; End Marker ; Squashed, firing, with explosion 39106 DEFB 251,158,152 ; Process graphic layout data at #R39070 and upon returning, move cursor to ; base coordinates 39109 DEFB 250,254,0 ; Change cursor's x- and y-coordinates by 0 and -2 characters respectively 39112 DEFB 40,71,33,41,71,33,40,199,30 39121 DEFB 42,71,33,43,120,33,42,199,33 39130 DEFB 255 ; End Marker ; Graphic Layout Data Bubo's Projectile (Level 2) b39131 DEFB 244,9 ; Set current graphic set to 9 39133 DEFB 43,71,33 39136 DEFB 255 ; End Marker ; Update States of All Level 3 Entities ; ; Used by the routine at #R34438. c39137 CALL 39776 ; Update state of Large Yellow Creature 39140 CALL 39601 ; Update states of coloured creatures 39143 CALL 39278 ; Update state of Clawed Foot 39146 CALL 39151 ; Update state of Hatch 39149 RET ; Return ; Hatch State Index (Level 3) b39150 DEFB 0 ; Update State of Hatch (Level 3) ; ; Used by the routine at #R39137. c39151 LD IX,(34240) ; Load IX with address of current level's complex state data for Berk 39155 LD HL,39150 ; If Hatch State Index is zero... 39158 LD A,(HL) ; ... 39159 OR A ; ... 39160 JR Z,39176 ; ...then skip ahead to #R39176 ; Hatch State Index is not zero 39162 INC (HL) ; Increase Hatch State Index 39163 CP 2 ; If Hatch State Index is 2 (Berk was thrown 1 cycle ago)... 39165 JR Z,39264 ; ...then skip ahead to #R39264 39167 CP 10 ; If Hatch State Index is 10 (Berk was thrown 9 cycles ago)... 39169 JR Z,39259 ; ...then skip ahead to #R39259 39171 CP 11 ; If Hatch State Index is 11 (Berk was thrown 10 cycles ago)... 39173 JR Z,39269 ; ...then skip ahead to #R39269 39175 RET ; Return ; Hatch State Index is zero *39176 BIT 0,(IX+9) ; If Berk's Must Process Current Script Data Flag is set... 39180 RET NZ ; ...then return 39181 LD A,(IX+0) ; If Berk's room is not 4 (Hatch Room)... 39184 CP 4 ; ... 39186 RET NZ ; ...then return 39187 LD A,(IX+6) ; If y-coordinate of Berk's bottom edge is not 121... 39190 CP 121 ; ... 39192 RET NZ ; ...then return 39193 LD A,(IX+5) ; If x-coordinate of Berk's left edge is less than 109... 39196 CP 109 ; ... 39198 RET C ; ...then return 39199 LD A,(IX+7) ; If x-coordinate of Berk's right edge is 120 or greater... 39202 CP 120 ; ... 39204 RET NC ; ...then return ; At this point, Berk is standing on the hatch 39205 LD A,(34221) ; If Berk is holding the weight... 39208 CP 12 ; ... 39210 RET Z ; ...then return 39211 INC (HL) ; Increase Hatch State Index to 1 39212 CALL 36296 ; Make Berk drop the entity he is holding and load IY with its complex state data address 39215 LD A,(34220) ; If Berk's current power is not invisibility (Level 3)... 39218 CP 11 ; ... 39220 JR NZ,39225 ; ...then skip ahead to #R39225 39222 CALL 48417 ; Remove Berk's invisibility and reset corresponding edible eyes to their original position *39225 LD B,4 ; Move Berk up four characters... *39227 CALL 39442 ; ... 39230 DJNZ 39227 ; ... 39232 LD (IX+5),107 ; Set x-coordinate of Berk's left edge to 107 39236 LD (IX+7),112 ; Set x-coordinate of Berk's right edge to 112 39240 SET 0,(IX+9) ; Set Berk's Must Process Current Script Data Flag 39244 LD HL,59048 ; Set Berk's graphic layout data address to #R59048... 39247 LD (IX+2),L ; ...(Berk being thrown left)... 39250 LD (IX+3),H ; ... 39253 LD HL,35523 ; Set current position in Berk's script data to #R35523... 39256 LD (35687),HL ; (Berk being thrown left by Hatch) ; Hatch State Index is 10 (Berk was thrown 9 cycles ago) *39259 LD HL,41115 ; Load HL with graphic layout data address of Hatch half open with Bat (Animated) 39262 JR 39274 ; Skip ahead to #R39274 (set Hatch's GLD address to value in HL and return) ; Hatch State Index is 2 (Berk was thrown 1 cycle ago) *39264 LD HL,41099 ; Load HL with graphic layout data address of Hatch fully open With Bat (Animated) 39267 JR 39274 ; Skip ahead to #R39274 (set Hatch's GLD address to value in HL and return) ; Hatch State Index is 11 (Berk was thrown 10 cycles ago) *39269 LD (HL),0 ; Set Hatch State Index to zero 39271 LD HL,41090 ; Load HL with graphic layout data address of Hatch closed *39274 LD (44792),HL ; Set Hatch's graphic layout data address to value in HL 39277 RET ; Return ; Update State of Clawed Foot (Level 3) ; ; Used by the routine at #R39137. c39278 LD A,(34228) ; If Clawed Foot's Attack Timer is zero... 39281 OR A ; ... 39282 JR Z,39289 ; ...then skip ahead to #R39289 39284 DEC A ; Decrease Clawed Foot's Attack Timer... 39285 LD (34228),A ; ... 39288 RET ; Return ; Clawed Foot is attacking *39289 LD IY,44881 ; Load IY with address of complex state data for Clawed Foot (Level 3) 39293 LD IX,(34240) ; Load IX with address of current level's complex state data for Berk 39297 CALL 53848 ; Store room size data for Berk's current room 39300 LD A,(44890) ; Load A with Clawed Foot's flags... 39303 OR A ; ...and if any are set... 39304 JR NZ,39337 ; ...then skip ahead to #R39337 ; Clawed Foot attack not yet started 39306 LD A,(IY+0) ; If the Clawed Foot's room... 39309 CP (IX+0) ; ...is not the same as Berk's room... 39312 RET NZ ; ...then return 39313 LD A,(IX+11) ; If Berk's Walking Left Flag or Walking Right Flag is set... 39316 AND 3 ; ... 39318 RET NZ ; ...then return 39319 LD A,(IX+5) ; Set the Clawed Foot's left edge... 39322 INC A ; ...to be one character to the right of Berk's left edge... 39323 LD (IY+5),A ; ... 39326 ADD A,2 ; Set the Clawed Foot's right edge... 39328 LD (IY+7),A ; ...to be two characters to the right of its left edge 39331 SET 1,(IY+9) ; Set Clawed Foot's Moving Down Flag 39335 JR 39341 ; Skip ahead to #R39341 ; Clawed Foot attack underway *39337 BIT 1,A ; If Clawed Foot's Moving Down Flag is reset... 39339 JR Z,39420 ; ...then skip ahead to #R39420 *39341 LD B,3 ; Load B with 3 (as the Clawed Foot moves down three characters at time) *39343 INC (IY+4) ; Advance Clawed Foot one character down... 39346 INC (IY+6) ; ... 39349 LD A,(IY+6) ; If y-coordinate of bottom edge of Clawed Foot is 115... 39352 CP 115 ; ... 39354 JR Z,39359 ; ...then skip ahead to #R39359 39356 DJNZ 39343 ; Decrease remaining number of characters to move and loop back to #R39343 if not zero 39358 RET ; Return ; Clawed Foot attempting to grab Berk *39359 BIT 6,(IX+9) ; If Berk is flying... 39363 JR NZ,39386 ; ...then skip ahead to #R39386 (set Clawed Foot's Moving Up Flag and return) 39365 BIT 6,(IX+10) ; If Berk is falling... 39369 JR NZ,39386 ; ...then skip ahead to #R39386 (set Clawed Foot's Moving Up Flag and return) 39371 LD A,(IY+5) ; If Clawed Foot's left edge... 39374 DEC A ; ...is one character to the right of Berk's left edge... 39375 CP (IX+5) ; ... 39378 JR Z,39391 ; ...then skip ahead to #R39391 39380 DEC A ; If Clawed Foot's left edge... 39381 CP (IX+5) ; ...is two characters to the right of Berk's left edge... 39384 JR Z,39391 ; ...then skip ahead to #R39391 ; Berk is flying or falling, or Clawed Foot has missed *39386 LD (IY+9),4 ; Set Clawed Foot's Moving Up Flag 39390 RET ; Return ; Make Clawed Foot grab Berk (Clawed Foot is one or two characters to the right of Berk's left edge) *39391 LD BC,35515 ; Set current position in Berk's script data to... 39394 LD (35687),BC ; ...Berk in floating position 39398 SET 0,(IX+9) ; Set Berk's Must Process Current Script Data Flag 39402 LD A,12 ; Set Clawed Foot's Moving Up Flag and Holding Berk Flag... 39404 LD (IY+9),A ; ... 39407 LD BC,40368 ; Set Clawed Foot's graphic layout data address to point to #R40368 (Reaching, Closed)... *39410 LD (IY+2),C ; ... 39413 LD (IY+3),B ; ... 39416 CALL 36296 ; Make Berk drop the entity he is holding and load IY with its complex state data address 39419 RET ; Return ; Check Clawed Foot's Moving Up Flag *39420 BIT 2,A ; If Clawed Foot's Moving Up Flag is reset... 39422 JR Z,39532 ; ...then skip ahead to #R39532 39424 DEC (IY+4) ; Move Clawed Foot up one character... 39427 DEC (IY+6) ; ... 39430 LD A,(IY+6) ; If y-coordinate of bottom of Clawed Foot... 39433 CP 95 ; ...is 95... 39435 JR Z,39449 ; ...then skip ahead to #R39449 39437 BIT 3,(IY+9) ; If Clawed Foot's Holding Berk Flag is reset... 39441 RET Z ; ...then return ; This entry point is used by the routine at #R39151. *39442 DEC (IX+4) ; Move entity at IX (Berk) up one character... 39445 DEC (IX+6) ; ... 39448 RET ; Return *39449 BIT 3,(IY+9) ; If Clawed Foot's Holding Berk Flag is reset... 39453 JR Z,39527 ; ...then skip ahead to #R39527 (Reset Clawed Foot to inactive state and return) 39455 LD A,(34229) ; Increase Clawed Foot's Action Index... 39458 INC A ; ... *39459 LD (34229),A ; ... 39462 CP 7 ; ...and if less than 7... 39464 JR C,39470 ; ...then skip ahead to #R39470 39466 LD A,1 ; Set Clawed Foot's Action Index to 1... 39468 JR 39459 ; ...and jump to #R39470 (via #R39459) *39470 CP 3 ; If Clawed Foot's Action Index is less than 3... 39472 JR C,39501 ; ...then skip ahead to #R39501 (i.e. make clawed foot release Berk, and return) 39474 CP 5 ; If Clawed Foot's Action Index is less than 5... 39476 JR C,39482 ; ...then skip ahead to #R39482 39478 LD E,112 ; Load E with 112 (prepare to set Clawed Foot's destination x-coordinate) 39480 JR 39484 ; Skip ahead to #R39484 *39482 LD E,122 ; Load E with 122 (prepare to set Clawed Foot's destination x-coordinate) *39484 LD (IX+12),E ; Store destination x-coordinate in byte 12 of Berk's complex state data 39487 BIT 0,A ; If Clawed Foot's Action Index is even... 39489 JR Z,39496 ; ...then skip ahead to #R39496 39491 LD (IY+9),16 ; Set Clawed Foot's Move Left Flag 39495 RET ; Return *39496 LD (IY+9),32 ; Set Clawed Foot's Move Right Flag 39500 RET ; Return ; The instructions between #R39501 and #R39531 make the Clawed Foot release Berk. *39501 LD A,100 ; Set Clawed Foot's Attack Timer to 100... 39503 LD (34228),A ; ...i.e. Clawed Foot will attack again in 100 cycles 39506 SET 6,(IX+10) ; Set Berk's "Can Fall" flag 39510 LD (IX+12),2 ; Set Berk's velocity factor to 2 39514 LD BC,35359 ; Set current position in Berk's script data to... 39517 LD (35687),BC ; ...Berk starting to fall downwards 39521 LD BC,40320 ; Set Clawed Foot's graphic layout data address to point to #R40320 (Reaching, Open)... 39524 CALL 39410 ; ...make Berk drop the entity he is holding and load IY with its complex state data address ; Reset Clawed Foot to inactive state *39527 LD (IY+9),0 ; Reset Clawed Foot's Flags 39531 RET ; Return ; Check Clawed Foot's Moving Left Flag *39532 BIT 4,A ; If Clawed Foot's Move Left Flag is reset... 39534 JR Z,39552 ; ...then skip ahead to #R39552 39536 DEC (IX+5) ; Move Berk one character left... 39539 DEC (IX+7) ; ... 39542 CALL 54348 ; Move Berk into room to the left, if appropriate 39545 LD A,(IX+0) ; If Berk's room is 5 (room to the left of the Coloured Creatures' Room)... 39548 CP 5 ; ...then set Zero Flag 39550 JR 39569 ; Skip ahead to #R39569 ; Check Clawed Foot's Moving Right Flag *39552 BIT 5,A ; If Clawed Foot's Move Right Flag is reset... 39554 RET Z ; ...then return 39555 INC (IX+5) ; Move Berk one character right... 39558 INC (IX+7) ; ... 39561 CALL 54313 ; Move Berk into room to the right, if appropriate 39564 LD A,(IX+0) ; If Berk's room is 7 (room to the right of the Coloured Creatures' Room)... 39567 CP 7 ; ...then set Zero Flag *39569 RET NZ ; If Zero Flag is not set (i.e. Berk is not in Room 5 or Room 7) then return 39570 LD A,(IX+12) ; If the x-coordinate of Berk's left edge... 39573 CP (IX+5) ; ...is not the same as the Clawed Foot's destination x-coordinate... 39576 RET NZ ; ...then return 39577 LD IY,44881 ; Load IY with address of complex state data for Clawed Foot (Level 3) 39581 JP 39501 ; Make Clawed Foot release Berk, and return ; Table of Coloured Creatures' Properties ; ; This data is used to periodically change the identities of the three coloured creatures. Upon switching, a random ; number (i.e. a "Sequence ID") between 0 and 2 is generated. This Sequence ID is the index of the record, in the ; following table, whose data (entity class and graphic layout data address) will overwrite that of the first ; coloured creature at #R44894, as defined in the complex state data table. The second and third creatures' data ; will be likewise overwritten by the data from the following two records, respectively. As three records are always ; used, starting with the record whose index matches the generated Sequence ID, there will always be one red, one ; yellow and one white creature. b39584 DEFB 13,62,157 ; Red Coloured Creature 39587 DEFB 14,77,157 ; Yellow Coloured Creature 39590 DEFB 15,92,157 ; White Coloured Creature 39593 DEFB 13,62,157 ; Red Coloured Creature 39596 DEFB 14,77,157 ; Yellow Coloured Creature ; Miscellaneous Data (Coloured Creatures) b39599 DEFB 0 ; Creatures' current Sequence ID 39600 DEFB 0 ; Cycles elapsed since last swap of creatures ; Update States of Coloured Creatures ; ; Used by the routine at #R39137. c39601 LD A,(44903) ; Load A with first coloured creature's flags 39604 BIT 2,A ; If Coloured Creatures' Reward Given Flag is set... 39606 RET NZ ; ...then return 39607 BIT 1,A ; If All Coloured Creatures Home Flag is set... 39609 JP NZ,39760 ; ...then present reward for getting coloured creatures home, and return 39612 CALL 39699 ; Count coloured creatures in slots and return if all are home 39615 LD A,L ; If all three coloured creatures are in slots... 39616 CP 3 ; ... 39618 RET Z ; ...then return 39619 LD A,(34218) ; If current character's current room is not 6 (coloured creatures' room)... 39622 CP 6 ; ... 39624 RET NZ ; ...then return 39625 LD HL,39600 ; Increase cycles elapsed since last swap of creatures... 39628 INC (HL) ; ... 39629 LD A,(HL) ; ... 39630 CP 100 ; ...and if less than 100... 39632 RET C ; ...then return 39633 LD (HL),0 ; Set cycles elapsed since last swap of creatures to zero 39635 CALL 36616 ; Cycle attributes (full-screen), clear display buffers and paint red areas outside current ; room 39638 LD HL,39599 ; Point HL at current Sequence ID *39641 LD A,3 ; Load A with a random number, 0-2... 39643 CALL 54222 ; ... 39646 CP (HL) ; ...and if this is the same as the current Sequence ID... 39647 JR Z,39641 ; ...then jump back to #R39641 to generate a new random number 39649 LD (HL),A ; Set new Sequence ID to generated number 39650 ADD A,A ; Load BC with three times Sequence ID... 39651 ADD A,(HL) ; ... 39652 LD C,A ; ... 39653 LD B,0 ; ... 39655 LD IY,39584 ; Load IY with start address of Table of Coloured Creatures' Properties... 39659 ADD IY,BC ; ...and add three times Sequence ID to get address of first entry in new sequence 39661 LD IX,44894 ; Load IX with address of complex state data for first coloured creature (Level 3) 39665 LD B,3 ; Load B with 3 (as there are three coloured creatures) *39667 LD A,(IY+0) ; Set class of current coloured creature... 39670 LD (IX+8),A ; ... 39673 LD A,(IY+1) ; ...and address of graphic layout data... 39676 LD (IX+2),A ; ... 39679 LD A,(IY+2) ; ... 39682 LD (IX+3),A ; ...to values in current record in Table of Coloured Creatures' Properties 39685 INC IY ; Advance IY to next entry in properties table... 39687 INC IY ; ... 39689 INC IY ; ... 39691 LD DE,13 ; Advance IX to next coloured creature's properties... 39694 ADD IX,DE ; ... 39696 DJNZ 39667 ; Decrease remaining number of coloured creatures to update and loop back to #R39667 if not ; zero 39698 RET ; Return ; Count Coloured Creatures in Slots and Return if All Are Home ; ; Used by the routine at #R39601. Output: H Number of coloured creatures in correct slots L Number of coloured ; creatures in slots c39699 LD IX,44894 ; Load IX with address of complex state data for first coloured creature (Level 3) 39703 LD HL,0 ; Load HL with zero 39706 LD B,3 ; Load B with 3 (as there are 3 creatures) *39708 LD A,(IX+6) ; If y-coordinate of bottom of current creature is not 114... 39711 CP 114 ; ... 39713 RET NZ ; ...then return 39714 INC L ; Increase L (number of creatures in slots) 39715 LD A,(IX+8) ; If current entity class is not 13 (Red Coloured Creature, Level 3)... 39718 CP 13 ; ... 39720 JR NZ,39726 ; ...then skip ahead to #R39726 39722 LD A,108 ; Load A with 108 (x-coordinate of left-most slot) 39724 JR 39736 ; Skip ahead to #R39736 *39726 CP 14 ; If current entity class is not 14 (Yellow Coloured Creature, Level 3)... 39728 JR NZ,39734 ; ...then skip ahead to #R39734 39730 LD A,115 ; Load A with 115 (x-coordinate of middle slot) 39732 JR 39736 ; Skip ahead to #R39736 *39734 LD A,122 ; Load A with 122 (x-coordinate of right-most slot) *39736 CP (IX+5) ; If x-coordinate of slot in A is not the same as x-coordinate of current creature's left... 39739 JR NZ,39742 ; ...then skip ahead to #R39742 39741 INC H ; Increase H (number of creatures at correct x-coordinate for their respective coloured slots) *39742 LD DE,13 ; Advance IX to next entity... 39745 ADD IX,DE ; ... 39747 DJNZ 39708 ; Loop back to #R39708 for next creature 39749 LD A,H ; If H is not 3 (i.e. at least one creature not at correct x-coordinates)... 39750 CP 3 ; ... 39752 RET NZ ; ...then return 39753 LD A,2 ; Set All Coloured Creatures Home Flag 39755 LD (44903),A ; ... 39758 POP BC ; Return to routine that called the calling routine... 39759 RET ; ... ; Present Reward for Getting Coloured Creatures Home ; ; Used by the routine at #R39601. c39760 CALL 36616 ; Cycle attributes (full-screen), clear display buffers and paint red areas outside current ; room 39763 LD IX,44972 ; Load IX with address of complex state data for edible eyes (normally hidden off-screen)... 39767 CALL 55516 ; ...and set their "Can Fall" Flag and set initial velocity factor to 2 39770 LD A,4 ; Set Coloured Creatures' Reward Given Flag... 39772 LD (44903),A ; ... 39775 RET ; Return ; Update State of Large Yellow Creature (Level 3) ; ; Used by the routine at #R39137. c39776 LD IY,44868 ; Load IY with address of complex state data for Large Yellow Creature (Level 3) 39780 LD IX,(34240) ; Load IX with address of current level's complex state data for Berk 39784 LD HL,44877 ; Load HL with address of Large Yellow Creature's flags... 39787 LD A,(HL) ; ...and load flags into A 39788 CP 2 ; If creature is in "Rising From Floor" mode... 39790 JR Z,39831 ; ...then skip ahead to #R39831 39792 CP 4 ; If creature is in "Hunting" mode... 39794 JR Z,39845 ; ...then skip ahead to #R39845 39796 CP 8 ; If creature is in "Attacking" mode... 39798 JR Z,39918 ; ...then skip ahead to #R39918 39800 CP 16 ; If creature is in "Just Attacked" mode... 39802 JP Z,39934 ; ...then set creature's mode to "Returning Home", set Berk's "Has Been Killed" Flag and return 39805 LD A,(IX+0) ; If Berk's current room is not 3 (Yellow Creature's Room)... 39808 CP 3 ; ... 39810 JP NZ,39998 ; ...then set creature's mode to "Returning Home", move one step closer to home and return ; "Returning Home" mode 39813 LD A,(IY+5) ; If x-coordinate of creature's left side... 39816 CP (IX+5) ; ...is the same as that of Berk's left side... 39819 JR Z,39828 ; ...then skip ahead to #R39828 39821 INC A ; If x-coordinate of creature's left side... 39822 CP (IX+5) ; ...is not one character to the right of Berk's left side... 39825 JP NZ,39998 ; ...then set creature's mode to "Returning Home", move one step closer to home and return *39828 LD A,2 ; Set creature's mode to "Rising from Floor"... 39830 LD (HL),A ; ... ; "Rising from Floor" mode *39831 CALL 39971 ; Move creature such that its left edge is up to two characters closer to Berk's 39834 CALL 39961 ; Move creature up by two characters 39837 LD A,(IY+4) ; If y-coordinate of creature's top... 39840 CP 108 ; ...is 108 or greater... 39842 RET NC ; ...then return 39843 LD (HL),4 ; Set creature's mode to "Hunting" ; "Hunting" mode *39845 LD A,(IX+0) ; If Berk's current room is not 3 (Yellow Creature's Room)... 39848 CP 3 ; ... 39850 JP NZ,39998 ; ...then set creature's mode to "Returning Home", move one step closer to home and return 39853 LD A,(34220) ; If Berk's current power is invisibility (Level 3)... 39856 CP 11 ; ... 39858 JR Z,39909 ; ...then skip ahead to #R39909 ("confused" mode) 39860 LD A,(IX+4) ; If y-coordinate of Berk's top... 39863 CP 103 ; ...is less than 103... 39865 JR C,39909 ; ...then skip ahead to #R39909 ("confused" mode) 39867 CALL 39971 ; Move creature such that its left edge is up to two characters closer to Berk's 39870 LD A,(IY+4) ; If creature's top... 39873 ADD A,4 ; ...is four characters above Berk's top... 39875 CP (IX+4) ; ... 39878 JR Z,39890 ; ...then skip ahead to #R39890 (set "Attacking" mode) 39880 JR NC,39961 ; If creature's top is less than 4 characters above Berk's top then move creature up by two ; characters and return 39882 INC A ; If creature's top is five characters above Berk's top... 39883 CP (IX+4) ; ... 39886 JR Z,39890 ; ...then skip ahead to #R39890 (set "Attacking" mode) 39888 JR C,39951 ; If creature's top is more than five characters above Berk's top then move creature down two ; characters and return *39890 LD (HL),8 ; Set creature's mode to "Attacking" 39892 LD (IY+1),1 ; Set creature's depth to 1 39896 SET 5,(IX+9) ; Set Berk's "Do Not Update State" Flag 39900 LD BC,40442 ; Set graphic layout data address for creature to #R40442 (Large Yellow Creature with mouth ; open)... 39903 CALL 39944 ; ... 39906 JP 36296 ; Make Berk drop the entity he is holding, load IY with its complex state data address and ; return ; "Confused" mode *39909 LD BC,40485 ; Set graphic layout data address for creature to #R40485 (Large Yellow Creature, animated, ; confused)... 39912 CALL 39944 ; ... 39915 JP 40008 ; Move creature one step closer to x (left) = 113, y (top) > 111 if not already there, and ; return ; "Attacking" mode *39918 CALL 39951 ; Move creature down two characters 39921 LD (IX+1),0 ; Set Berk's depth to zero 39925 LD (HL),16 ; Set creature's mode to "Just Attacked" 39927 LD BC,40451 ; Set graphic layout data address for creature to #R40451 (Large Yellow Creature with mouth ; closed)... 39930 JP 39944 ; ...and return ; Unused routine c39933 RET ; Return ; Set Large Yellow Creature's Mode to "Returning Home", and Set Berk's "Has Been Killed" Flag ; ; Used by the routine at #R39776. c39934 CALL 53667 ; Set "Berk Has Been Killed" Flag 39937 RES 5,(IX+9) ; Reset Berk's "Do Not Update State" Flag 39941 LD (HL),0 ; Set creature's mode to "Returning Home" 39943 RET ; Return ; Set Graphic Layout Data Address for Entity at IY to BC ; ; Used by the routine at #R39776. Input: BC Graphic layout data address IY Address of complex state data for an ; entity c39944 LD (IY+2),C ; Set graphic layout data address for entity to address in BC... 39947 LD (IY+3),B ; ... 39950 RET ; Return ; Move Entity at IY Down Two Characters ; ; Used by the routine at #R39776. Input: IY Address of complex state data for an entity c39951 CALL 39954 ; Move entity at IY down one character ; This entry point is used by the routine at #R40008. *39954 INC (IY+4) ; Increase y-coordinates of entity's top and bottom edges... 39957 INC (IY+6) ; ... 39960 RET ; Return ; Move Entity at IY Up Two Characters ; ; Used by the routine at #R39776. Input: IY Address of complex state data for an entity c39961 CALL 39964 ; Move entity at IY up one character *39964 DEC (IY+4) ; Decrease y-coordinates of entity's top and bottom edges... 39967 DEC (IY+6) ; ... 39970 RET ; Return ; Move Entity IY Such that its Left Edge is Up to Two Characters Closer to Entity IX's ; ; Used by the routine at #R39776. Input: IX Address of complex state data for Entity A IY Address of complex ; state data for Entity B c39971 CALL 39975 ; Move Entity B one character closer (horizontally) to Entity A... 39974 RET Z ; ...and if left edges now both at same x-coordinate then return ; If entities' left edges are not at the same x-coordinate, then proceed into the code block below and move entity B ; by one additional character. *39975 LD A,(IX+5) ; If x-coordinates of both entities' left edges are the same... 39978 CP (IY+5) ; ... 39981 RET Z ; ...then return 39982 JR C,39991 ; If Entity B's left edge is to the right of Entity A's then move Entity B left by one ; character 39984 INC (IY+5) ; Move Entity B right by one character... 39987 INC (IY+7) ; ... 39990 RET ; Return *39991 DEC (IY+5) ; Move Entity B left by one character... 39994 DEC (IY+7) ; ... 39997 RET ; Return ; Set Large Yellow Creature's Mode to "Returning Home", Move One Step Closer to Home and Return ; ; Used by the routine at #R39776. Input: HL Address of creature's flags IY Address of complex state data for ; creature c39998 LD (HL),0 ; Set creature's mode to "Returning Home" 40000 LD (IY+1),2 ; Set creature's depth to 2 40004 LD A,122 ; Move creature one step closer to x (Left) = 113, y (Top) > 122... 40006 JR 40010 ; ...and return ; Move Entity at IY One Step Closer to Home Position ; ; This routine moves an entity (whose complex state data is pointed to by IY) one character left or right, if such a ; move would take the x-coordinate of that entity's left edge closer to a value of 113. The entity will also be ; moved down by one character if the y-coordinate of its top edge is less than or equal to 111 (or the input value ; in A if we are entering this routine via #R40010). Input: A (Entry at #R40010 only) Minimum allowed y-coordinate ; for entity's top edge IY Address of complex state data for an entity c40008 LD A,111 ; Load A with 111 (minimum allowed y-coordinate) ; This entry point is used by the routine at #R39998. *40010 CP (IY+4) ; If y-coordinate of entity's top edge is greater than value in A... 40013 JR C,40018 ; ...then skip ahead to #R40018 40015 CALL 39954 ; Move entity at IY down one character *40018 LD A,(IY+5) ; If x-coordinate of entity's left edge... 40021 CP 113 ; ...is 113... 40023 RET Z ; ...then return 40024 JR C,40033 ; ...else if greater than 113 then skip ahead to #R40033 40026 DEC (IY+5) ; Move entity left one character... 40029 DEC (IY+7) ; ... 40032 RET ; Return *40033 INC (IY+5) ; Move entity right one character... 40036 INC (IY+7) ; ... 40039 RET ; Return ; Graphic Layout Data Architecture (Level 3) Vertical wall b40040 DEFB 244,10 ; Set current graphic set to 10 40042 DEFB 238,3 ; Set Repeat Counter A to 3 40044 DEFB 251,116,156 ; Process graphic layout data at #R40052 and upon returning, move cursor to base coordinates 40047 DEFB 254,8,0 ; Change cursor's x- and y-coordinates by 0 and +8 characters respectively and store as new ; base coordinates 40050 DEFB 239 ; Decrement Repeat Counter A and loop back to #R40044 if not zero 40051 DEFB 255 ; End Marker ; Vertical wall section 40052 DEFB 242,4 ; Set current attribute to 4 40054 DEFB 17,160 40056 DEFB 18,160 40058 DEFB 19,160 40060 DEFB 20,160 40062 DEFB 9,160 40064 DEFB 10,160 40066 DEFB 11,160 40068 DEFB 12,160 40070 DEFB 18,160 40072 DEFB 255 ; End Marker ; Door Archway 40073 DEFB 244,10 ; Set current graphic set to 10 40075 DEFB 250,1,0 ; Change cursor's x- and y-coordinates by 0 and +1 characters respectively 40078 DEFB 251,116,156 ; Process graphic layout data at #R40052 and upon returning, move cursor to base coordinates 40081 DEFB 250,1,9 ; Change cursor's x- and y-coordinates by +9 and +1 characters respectively 40084 DEFB 251,116,156 ; Process graphic layout data at #R40052 and upon returning, move cursor to base coordinates 40087 DEFB 242,4 ; Set current attribute to 4 40089 DEFB 25,33 40091 DEFB 28,33 40093 DEFB 27,33 40095 DEFB 29,33 40097 DEFB 28,33 40099 DEFB 29,33 40101 DEFB 27,33 40103 DEFB 28,33 40105 DEFB 27,33 40107 DEFB 26,33 40109 DEFB 255 ; End Marker ; Platform 40110 DEFB 244,10 ; Set current graphic set to 10 40112 DEFB 242,4 ; Set current attribute to 4 40114 DEFB 250,1,0 ; Change cursor's x- and y-coordinates by 0 and +1 characters respectively 40117 DEFB 31,33 40119 DEFB 29,33 40121 DEFB 28,33 40123 DEFB 27,33 40125 DEFB 30,28 40127 DEFB 31,33 40129 DEFB 29,33 40131 DEFB 28,33 40133 DEFB 27,33 40135 DEFB 30,33 40137 DEFB 255 ; End Marker ; Red Coloured Creature's Slot (see trivia) 40138 DEFB 242,2 ; Set current attribute to 2 (red) 40140 DEFB 248,214,156 ; Jump to #R40150 (draw slot) ; Yellow Coloured Creature's Slot (see trivia) 40143 DEFB 242,6 ; Set current attribute to 6 (yellow) 40145 DEFB 248,214,156 ; Jump to #R40150 (draw slot) ; White Coloured Creature's Slot (see trivia) 40148 DEFB 242,7 ; Set current attribute to 7 (white) 40150 DEFB 244,10 ; Set current graphic set to 10 40152 DEFB 250,251,0 ; Change cursor's x- and y-coordinates by 0 and -5 characters respectively 40155 DEFB 25,33 40157 DEFB 27,33 40159 DEFB 28,33 40161 DEFB 29,33 40163 DEFB 26,28 40165 DEFB 9,36 40167 DEFB 10,28 40169 DEFB 10,36 40171 DEFB 9,28 40173 DEFB 11,36 40175 DEFB 11,28 40177 DEFB 9,36 40179 DEFB 10,28 40181 DEFB 31,33 40183 DEFB 28,33 40185 DEFB 27,33 40187 DEFB 29,33 40189 DEFB 30,33 40191 DEFB 255 ; End Marker ; Graphic Layout Data Edible Eyes (Level 3) b40192 DEFB 244,4 ; Set current graphic set to 4 40194 DEFB 247,7 ; Jump to one of the 7 addresses (see bugs) in the following list, chosen at random: 40196 DEFB 20,157 ; #R40212 (eyes, closed) 40198 DEFB 20,157 ; #R40212 (eyes, closed) 40200 DEFB 20,157 ; #R40212 (eyes, closed) 40202 DEFB 27,157 ; #R40219 (eyes, looking ahead) 40204 DEFB 34,157 ; #R40226 (eyes, looking up) 40206 DEFB 41,157 ; #R40233 (eyes, looking down) 40208 DEFB 48,157 ; #R40240 (eyes, looking right) 40210 DEFB 55,157 ; #R40247 (eyes, looking left) ; Closed 40212 DEFB 28,3,33 40215 DEFB 28,131,33 40218 DEFB 255 ; End Marker ; Looking Ahead 40219 DEFB 29,6,33 40222 DEFB 32,134,33 ; (see bugs) 40225 DEFB 255 ; End Marker ; Looking Up 40226 DEFB 30,6,33 40229 DEFB 30,134,33 40232 DEFB 255 ; End Marker ; Looking Down 40233 DEFB 31,6,33 40236 DEFB 31,134,33 40239 DEFB 255 ; End Marker ; Looking Right 40240 DEFB 32,6,33 40243 DEFB 33,134,33 40246 DEFB 255 ; End Marker ; Looking Left 40247 DEFB 33,6,33 40250 DEFB 32,134,33 40253 DEFB 255 ; End Marker ; Graphic Layout Data Coloured Creatures (Level 3) Red b40254 DEFB 244,10 ; Set current graphic set to 10 40256 DEFB 246,4,5,3,66,66,1 ; Decrease timer value (initially 4) and if now zero then reset to 5 and load one of ; the 3 following values at random into the Attribute field of the following ; instruction 40263 DEFB 51,66,31 40266 DEFB 248,104,157 ; Jump to #R40296 (draw creature) ; Yellow 40269 DEFB 244,10 ; Set current graphic set to 10 40271 DEFB 246,4,5,3,70,70,1 ; Decrease timer value (initially 4) and if now zero then reset to 5 and load one of ; the 3 following values at random into the Attribute field of the following ; instruction 40278 DEFB 51,70,31 40281 DEFB 248,104,157 ; Jump to #R40296 (draw creature) ; White 40284 DEFB 244,10 ; Set current graphic set to 10 40286 DEFB 246,4,5,3,71,71,1 ; Decrease timer value (initially 4) and if now zero then reset to 5 and load one of ; the 3 following values at random into the Attribute field of the following ; instruction 40293 DEFB 51,71,31 40296 DEFB 52,6,33 40299 DEFB 53,69,33 40302 DEFB 52,134,31 40305 DEFB 236,2,54,70 ; Modify following instruction to display graphic of random index, chosen from 54 and ; 70 40309 DEFB 54,69,32 40312 DEFB 236,2,55,71 ; Modify following instruction to display graphic of random index, chosen from 55 and ; 71 40316 DEFB 55,69,33 40319 DEFB 255 ; End Marker ; Graphic Layout Data Clawed Foot (Level 3) Reaching, Open b40320 DEFB 244,10 ; Set current graphic set to 10 40322 DEFB 251,212,157 ; Process graphic layout data at #R40404 and upon returning, move cursor to base coordinates 40325 DEFB 250,0,255 ; Change cursor's x- and y-coordinates by 0 and -1 characters respectively 40328 DEFB 36,6,33 40331 DEFB 37,70,34 40334 DEFB 37,198,33 40337 DEFB 36,134,28 40340 DEFB 39,70,33 40343 DEFB 40,70,33 40346 DEFB 41,6,33 40349 DEFB 40,198,33 40352 DEFB 39,134,28 40355 DEFB 42,6,33 40358 DEFB 43,6,34 40361 DEFB 43,134,33 40364 DEFB 42,134,33 40367 DEFB 255 ; End Marker ; Reaching, Closed 40368 DEFB 244,10 ; Set current graphic set to 10 40370 DEFB 251,212,157 ; Process graphic layout data at #R40404 and upon returning, move cursor to base coordinates 40373 DEFB 44,6,34 40376 DEFB 44,134,29 40379 DEFB 45,6,33 40382 DEFB 46,70,33 40385 DEFB 47,6,33 40388 DEFB 46,198,33 40391 DEFB 45,134,29 40394 DEFB 48,70,33 40397 DEFB 49,70,33 40400 DEFB 48,198,33 40403 DEFB 255 ; End Marker ; Leg 40404 DEFB 250,241,1 ; Change cursor's x- and y-coordinates by 1 and -15 characters respectively 40407 DEFB 242,70 ; Set current attribute to 70 40409 DEFB 50,32 40411 DEFB 32,32 40413 DEFB 33,32 40415 DEFB 34,32 40417 DEFB 32,32 40419 DEFB 33,32 40421 DEFB 34,32 40423 DEFB 35,32 40425 DEFB 50,32 40427 DEFB 33,32 40429 DEFB 34,32 40431 DEFB 32,32 40433 DEFB 33,32 40435 DEFB 34,32 40437 DEFB 32,32 40439 DEFB 38,33 40441 DEFB 255 ; End Marker ; Graphic Layout Data Large Yellow Creature (Level 3) Mouth Open b40442 DEFB 251,141,158 ; Process graphic layout data at #R40589 and upon returning, move cursor to base ; coordinates 40445 DEFB 251,154,159 ; Process graphic layout data at #R40858 and upon returning, move cursor to base ; coordinates 40448 DEFB 248,9,158 ; Jump to #R40457 ; Mouth Closed 40451 DEFB 251,141,158 ; Process graphic layout data at #R40589 and upon returning, move cursor to base ; coordinates 40454 DEFB 251,15,160 ; Process graphic layout data at #R40975 and upon returning, move cursor to base ; coordinates 40457 DEFB 250,2,255 ; Change cursor's x- and y-coordinates by -1 and +2 characters respectively 40460 DEFB 3,79,33 40463 DEFB 3,207,37 40466 DEFB 3,79,33 40469 DEFB 3,207,25 40472 DEFB 4,79,33 40475 DEFB 2,207,37 40478 DEFB 2,79,33 40481 DEFB 4,207,33 40484 DEFB 255 ; End Marker ; Animated, confused 40485 DEFB 251,141,158 ; Process graphic layout data at #R40589 and upon returning, move cursor to base ; coordinates 40488 DEFB 251,143,159 ; Process graphic layout data at #R40847 and upon returning, move cursor to base ; coordinates 40491 DEFB 250,2,255 ; Change cursor's x- and y-coordinates by -1 and +2 characters respectively 40494 DEFB 249,4,1 ; If state n (initially 1) has remaining time of zero then reset its time to ; maximum and randomly select a new state, n, from the 4 in the following list. ; Jump to the address specified in the current state and decrease its remaining ; time: 40497 DEFB 3,3,65,158 ; #R40513 (Eyes looking up-left, for 3 ticks) 40501 DEFB 3,3,84,158 ; #R40532 (Eyes looking up-right, for 3 ticks) 40505 DEFB 6,6,103,158 ; #R40551 (Eyes looking down-left, for 6 ticks) 40509 DEFB 6,6,122,158 ; #R40570 (Eyes looking down-right, for 6 ticks) ; Eyes Looking Up-Left 40513 DEFB 238,2 ; Set Repeat Counter A to 2 40515 DEFB 1,79,33,3,207,31 40521 DEFB 4,79,33,4,207,33 40527 DEFB 250,255,4 ; Change cursor's x- and y-coordinates by +4 and -1 characters respectively 40530 DEFB 239 ; Decrement Repeat Counter A and loop back to #R40515 if not zero 40531 DEFB 255 ; End Marker ; Eyes Looking Up-Right 40532 DEFB 238,2 ; Set Repeat Counter A to 2 40534 DEFB 3,79,33,1,207,31 40540 DEFB 4,79,33,4,207,33 40546 DEFB 250,255,4 ; Change cursor's x- and y-coordinates by +4 and -1 characters respectively 40549 DEFB 239 ; Decrement Repeat Counter A and loop back to #R40534 if not zero 40550 DEFB 255 ; End Marker ; Eyes Looking Down-Left 40551 DEFB 238,2 ; Set Repeat Counter A to 2 40553 DEFB 3,79,33,3,207,31 40559 DEFB 2,79,33,4,207,33 40565 DEFB 250,255,4 ; Change cursor's x- and y-coordinates by +4 and -1 characters respectively 40568 DEFB 239 ; Decrement Repeat Counter A and loop back to #R40553 if not zero 40569 DEFB 255 ; End Marker ; Eyes Looking Down-Right 40570 DEFB 238,2 ; Set Repeat Counter A to 2 40572 DEFB 3,79,33,3,207,31 40578 DEFB 4,79,33,2,207,33 40584 DEFB 250,255,4 ; Change cursor's x- and y-coordinates by +4 and -1 characters respectively 40587 DEFB 239 ; Decrement Repeat Counter A and loop back to #R40572 if not zero 40588 DEFB 255 ; End Marker ; Top Part of Face 40589 DEFB 244,11 ; Set current graphic set to 11 40591 DEFB 250,0,255 ; Change cursor's x- and y-coordinates by -1 and 0 characters respectively 40594 DEFB 5,6,33,5,134,33 40600 DEFB 7,6,33,8,6,33 40606 DEFB 8,134,33,7,134,33 40612 DEFB 5,6,33,5,134,24 40618 DEFB 9,70,33,10,49,33 40624 DEFB 10,177,33,16,198,33 40630 DEFB 11,70,33,11,198,33 40636 DEFB 16,70,33,10,49,33 40642 DEFB 10,177,33,9,198,22 40648 DEFB 12,70,33,13,49,35 40654 DEFB 14,49,33,15,48,161 40660 DEFB 15,176,33,14,177,35 40666 DEFB 13,177,33,12,198,20 40672 DEFB 16,70,33,17,49,33 40678 DEFB 18,49,35,19,49,33 40684 DEFB 20,48,161,20,176,161 40690 DEFB 19,177,35,18,177,33 40696 DEFB 17,177,33,16,198,18 40702 DEFB 21,6,33,22,49,33 40708 DEFB 23,49,33,24,49,33 40714 DEFB 25,49,33,26,49,33 40720 DEFB 27,48,161,28,48,161 40726 DEFB 28,176,161,27,176,161 40732 DEFB 26,177,33,25,177,33 40738 DEFB 24,177,33,23,177,33 40744 DEFB 22,177,33,21,134,17 40750 DEFB 29,6,33,30,49,33 40756 DEFB 31,49,33,32,49,33 40762 DEFB 33,49,33,34,55,33 40768 DEFB 35,70,33,36,55,33 40774 DEFB 36,183,33,35,198,33 40780 DEFB 34,183,33,33,177,33 40786 DEFB 32,177,33,31,177,33 40792 DEFB 30,177,33,29,134,18 40798 DEFB 37,70,33,38,49,33 40804 DEFB 39,49,33,40,6,33 40810 DEFB 41,71,34,42,71,33 40816 DEFB 42,199,34,41,199,33 40822 DEFB 40,134,33,39,177,33 40828 DEFB 38,177,33,37,198,20 40834 DEFB 43,70,43,43,198,20 40840 DEFB 44,70,45,44,198,33 40846 DEFB 255 ; End Marker ; Jaw (Animated) 40847 DEFB 249,2,1 ; If state n (initially 1) has remaining time of zero then reset its time to ; maximum and randomly select a new state, n, from the 2 in the following list. ; Jump to the address specified in the current state and decrease its remaining ; time: 40850 DEFB 3,3,154,159 ; #R40858 (Jaw open, for 3 ticks) 40854 DEFB 3,3,15,160 ; #R40975 (Jaw closed, for 3 ticks) ; Jaw (Open) 40858 DEFB 250,7,254 ; Change cursor's x- and y-coordinates by -2 and +7 characters respectively 40861 DEFB 45,6,41,45,134,22 40867 DEFB 0,54,33,46,6,41 40873 DEFB 46,134,33,0,54,20 40879 DEFB 47,70,33,48,70,33 40885 DEFB 49,6,41,49,134,33 40891 DEFB 48,198,33,47,198,19 40897 DEFB 50,70,33,51,70,33 40903 DEFB 52,70,41,52,198,33 40909 DEFB 51,198,33,50,198,19 40915 DEFB 53,6,33,54,70,33 40921 DEFB 55,70,33,56,6,39 40927 DEFB 56,134,33,55,198,33 40933 DEFB 54,198,33,53,134,21 40939 DEFB 58,70,33,0,54,33 40945 DEFB 59,70,37,59,198,33 40951 DEFB 0,54,33,58,198,24 40957 DEFB 62,70,33,63,70,37 40963 DEFB 63,198,33,62,198,33 40969 DEFB 250,254,250 ; Change cursor's x- and y-coordinates by -5 and -2 characters respectively 40972 DEFB 248,105,160 ; Jump to #R41065 ; Jaw (Closed) 40975 DEFB 250,7,254 ; Change cursor's x- and y-coordinates by -2 and +7 characters respectively 40978 DEFB 6,70,33,64,70,33 40984 DEFB 64,198,37,64,70,33 40990 DEFB 64,198,33,6,198,22 40996 DEFB 65,70,33,0,54,33 41002 DEFB 0,54,33,66,70,37 41008 DEFB 66,198,33,0,54,33 41014 DEFB 0,54,33,65,198,20 41020 DEFB 67,70,33,68,70,33 41026 DEFB 69,6,33,70,6,39 41032 DEFB 70,134,33,69,134,33 41038 DEFB 68,198,33,67,198,19 41044 DEFB 71,70,33,72,70,33 41050 DEFB 73,6,41,73,134,33 41056 DEFB 72,198,33,71,198,33 41062 DEFB 250,252,247 ; Change cursor's x- and y-coordinates by -9 and -4 characters respectively 41065 DEFB 57,71,35,57,199,29 41071 DEFB 60,55,33,61,70,33 41077 DEFB 61,198,33,60,55,29 41083 DEFB 238,4 ; Set Repeat Counter A to 4 41085 DEFB 0,54,33 41088 DEFB 239 ; Decrement Repeat Counter A and loop back to #R41085 if not zero 41089 DEFB 255 ; End Marker ; Graphic Layout Data Hatch (Level 3) Closed b41090 DEFB 244,10 ; Set current graphic set to 10 41092 DEFB 238,8 ; Set Repeat Counter A to 8 41094 DEFB 72,5,33 41097 DEFB 239 ; Decrement Repeat Counter A and loop back to #R41094 if not zero 41098 DEFB 255 ; End Marker ; Fully Open With Small Bat (Animated) 41099 DEFB 250,251,4 ; Change cursor's x- and y-coordinates by +4 and -4 characters respectively 41102 DEFB 251,181,160 ; Process graphic layout data at #R41141 and upon returning, move cursor to base coordinates 41105 DEFB 250,249,0 ; Change cursor's x- and y-coordinates by 0 and -7 characters respectively 41108 DEFB 238,8 ; Set Repeat Counter A to 8 41110 DEFB 73,5,32 41113 DEFB 239 ; Decrement Repeat Counter A and loop back to #R41110 if not zero 41114 DEFB 255 ; End Marker ; Half Open With Small Bat (Animated) 41115 DEFB 250,254,4 ; Change cursor's x- and y-coordinates by +4 and -2 characters respectively 41118 DEFB 251,181,160 ; Process graphic layout data at #R41141 and upon returning, move cursor to base coordinates 41121 DEFB 242,5 ; Set current attribute to 5 41123 DEFB 250,250,5 ; Change cursor's x- and y-coordinates by +5 and -5 characters respectively 41126 DEFB 74,31 41128 DEFB 238,5 ; Set Repeat Counter A to 5 41130 DEFB 75,33,76,30 41134 DEFB 239 ; Decrement Repeat Counter A and loop back to #R41130 if not zero 41135 DEFB 250,0,1 ; Change cursor's x- and y-coordinates by +1 and 0 characters respectively 41138 DEFB 73,33 41140 DEFB 255 ; End Marker ; Small Bat (Animated) 41141 DEFB 244,10 ; Set current graphic set to 10 41143 DEFB 243,0,4 ; Increase current state value n (initially 0), up to maximum of 4, resetting to zero if ; maximum reached and jump to n-th address in following list: 41146 DEFB 194,160 ; #R41154 (Small Bat, wings up) 41148 DEFB 198,160 ; #R41158 (Small Bat, wings level) 41150 DEFB 211,160 ; #R41171 (Small Bat, wings down) 41152 DEFB 198,160 ; #R41158 (Small Bat, wings level) ; Small Bat (Wings Up) 41154 DEFB 77,7,33 41157 DEFB 255 ; End Marker ; Small Bat (Wings Level) 41158 DEFB 250,0,255 ; Change cursor's x- and y-coordinates by -1 and 0 characters respectively 41161 DEFB 79,7,33 41164 DEFB 80,7,33 41167 DEFB 79,135,33 41170 DEFB 255 ; End Marker ; Small Bat (Wings Down) 41171 DEFB 78,7,33 41174 DEFB 255 ; End Marker ; Graphic Layout Data Weight (Level 3) b41175 DEFB 244,10 ; Set current graphic set to 10 41177 DEFB 250,255,1 ; Change cursor's x- and y-coordinates by +1 and -1 characters respectively 41180 DEFB 81,66,31,82,66,33 41186 DEFB 0,18,33,82,194,30 41192 DEFB 83,66,33,0,18,33 41198 DEFB 83,194,30,84,66,33 41204 DEFB 0,18,33,84,194,33 41210 DEFB 255 ; End Marker ; Update States of All Level 4 Entities ; ; Used by the routine at #R34438. c41211 CALL 42266 ; Update state of Flying Skeleton Creature 41214 CALL 42381 ; Update state of Snake 41217 CALL 42064 ; Update states of drips 41220 CALL 41767 ; Update state of Cannon and Projectile 41223 CALL 41633 ; Update state of Ghost 41226 CALL 41381 ; Update state of Skeleton (Level 4) and store current position in script data 41229 RET ; Return ; Current Position in Skeleton's Script Data b41230 DEFW 41232 ; (#R41232, Skeleton Idling) ; Script Data Skeleton (Level 4) Idling b41232 DEFB 149,167 ; #R42901 (Skeleton, Standing, Full, Animated) 41234 DEFB 63,0 ; Have Skeleton advance or retreat based upon positions of Berk and Fake Boni 41236 DEFB 1,0,16,161 ; Jump to #R41232 (Skeleton Idling) ; Unused ; ; This block contains unused script data: Skeleton (level 4) threatening. Input: Facts#unusedskeletonscript(See ; trivia). b41240 DEFB 149,167 ; #R42901 (Skeleton, Standing, Full, Animated) 41242 DEFB 64,0 ; Set number of iterations in following loop script instruction to random number, 1-10 41244 DEFB 27,0,1,0 ; Start loop (3) for random number (1-10) of iterations 41248 DEFB 149,167 ; #R42901 (Skeleton, Standing, Full, Animated) 41250 DEFB 28,0 ; End loop (3) 41252 DEFB 185,167 ; #R42937 (Skeleton, Stepping Forward, Frame 1, Full, Animated) 41254 DEFB 185,167 ; #R42937 (Skeleton, Stepping Forward, Frame 1, Full, Animated) 41256 DEFB 2,0 ; Move Skeleton left two characters... 41258 DEFB 2,0 ; ... 41260 DEFB 223,167 ; #R42975 (Skeleton, Stepping Forward, Frame 2, Full, Animated) 41262 DEFB 64,0 ; Set number of iterations in following loop script instruction to random number, 1-10 41264 DEFB 27,0,1,0 ; Start loop (3) for random number (1-10) of iterations 41268 DEFB 223,167 ; #R42975 (Skeleton, Stepping Forward, Frame 2, Full, Animated) 41270 DEFB 28,0 ; End loop (3) 41272 DEFB 3,0 ; Move Skeleton right two characters... 41274 DEFB 3,0 ; ... 41276 DEFB 1,0,16,161 ; Jump to #R41232 (Skeleton Idling) ; Script Data Skeleton (Level 4) Stepping Forward (Left) b41280 DEFB 149,167 ; #R42901 (Skeleton, Standing, Full, Animated) 41282 DEFB 64,0 ; Set number of iterations in following loop script instruction to random number, 1-10 41284 DEFB 27,0,1,0 ; Start loop (3) for random number (1-10) of iterations 41288 DEFB 149,167 ; #R42901 (Skeleton, Standing, Full, Animated) 41290 DEFB 28,0 ; End loop (3) 41292 DEFB 185,167 ; #R42937 (Skeleton, Stepping Forward, Frame 1, Full, Animated) 41294 DEFB 2,0 ; Move Skeleton left two characters... 41296 DEFB 2,0 ; ... 41298 DEFB 223,167 ; #R42975 (Skeleton, Stepping Forward, Frame 2, Full, Animated) 41300 DEFB 223,167 ; #R42975 (Skeleton, Stepping Forward, Frame 2, Full, Animated) 41302 DEFB 149,167 ; #R42901 (Skeleton, Standing, Full, Animated) 41304 DEFB 64,0 ; Set number of iterations in following loop script instruction to random number, 1-10 41306 DEFB 27,0,1,0 ; Start loop (3) for random number (1-10) of iterations 41310 DEFB 149,167 ; #R42901 (Skeleton, Standing, Full, Animated) 41312 DEFB 28,0 ; End loop (3) 41314 DEFB 1,0,16,161 ; Jump to #R41232 (Skeleton Idling) ; Script Data Skeleton (Level 4) Stepping Back (Right) b41318 DEFB 149,167 ; #R42901 (Skeleton, Standing, Full, Animated) 41320 DEFB 64,0 ; Set number of iterations in following loop script instruction to random number, 1-10 41322 DEFB 27,0,1,0 ; Start loop (3) for random number (1-10) of iterations 41326 DEFB 149,167 ; #R42901 (Skeleton, Standing, Full, Animated) 41328 DEFB 28,0 ; End loop (3) 41330 DEFB 223,167 ; #R42975 (Skeleton, Stepping Forward, Frame 2, Full, Animated) 41332 DEFB 223,167 ; #R42975 (Skeleton, Stepping Forward, Frame 2, Full, Animated) 41334 DEFB 3,0 ; Move Skeleton right two characters... 41336 DEFB 3,0 ; ... 41338 DEFB 149,167 ; #R42901 (Skeleton, Standing, Full, Animated) 41340 DEFB 64,0 ; Set number of iterations in following loop script instruction to random number, 1-10 41342 DEFB 27,0,1,0 ; Start loop (3) for random number (1-10) of iterations 41346 DEFB 149,167 ; #R42901 (Skeleton, Standing, Full, Animated) 41348 DEFB 28,0 ; End loop (3) 41350 DEFB 1,0,16,161 ; Jump to #R41232 (Skeleton Idling) ; Reset Skeleton to Initial State ; ; Used by the routine at #R34751. c41354 LD HL,41232 ; Set current position in Skeleton's script data... 41357 LD (41230),HL ; ...to #R41232 (Skeleton Idling) 41360 LD IX,41412 ; Load IX with address of Table of Addresses of Attribute Data in Skeleton's GLD Blocks 41364 LD B,6 ; Load B with 6 (as there are six blocks of graphic layout data to modify) *41366 LD L,(IX+0) ; Load HL with address of attribute data in current block... 41369 LD H,(IX+1) ; ... 41372 LD (HL),7 ; Set the attribute value to 7 (white) 41374 INC IX ; Advance IX to next address... 41376 INC IX ; ... 41378 DJNZ 41366 ; Decrease remaining number of blocks to modify and loop back to #R41366 if not zero 41380 RET ; Return ; Update State of Skeleton (Level 4) and Store Current Position in Script Data ; ; Used by the routine at #R41211. c41381 LD IX,45404 ; Load IX with address of complex state data for Skeleton (Level 4) 41385 BIT 2,(IX+9) ; If Skeleton's Removed From Game Flag is set... 41389 RET NZ ; ...then return 41390 BIT 1,(IX+9) ; If Skeleton's Is Dying Flag is set... 41394 JR NZ,41424 ; ...then update state of Skeleton (dying) and return 41396 LD HL,(41230) ; Load current position in Skeleton's script data from #R41230 into HL... 41399 LD (34277),HL ; ...and store at #R34277 as position in script currently running 41402 CALL 41498 ; Kill Berk if he collides with Skeleton 41405 LD HL,(34277) ; Store address (current position in script data) stored at #R34277... 41408 LD (41230),HL ; ...at #R41230 as current position in Skeleton's script data 41411 RET ; Return ; Table of Addresses of Attribute Data in Skeleton's Graphic Layout Data Blocks ; ; Each of the addresses in this table is of the "operand" of a "set attribute" instruction (i.e. 242) in the ; Skeleton's graphic layout data blocks. These are initially 7 (i.e. white). When the skeleton is killed, the ; routine at #R41424 (instructions starting at #R41473) decreases this attribute by one per game cycle. When the ; attribute values reach 1 (blue), the skeleton is removed from the game and replaced by Boni. b41412 DEFW 42911 ; (#R42910) Standing, Full, Animated 41414 DEFW 42947 ; (#R42946) Stepping Forward, Frame 1, Full, Animated 41416 DEFW 42988 ; (#R42987) Stepping Forward, Frame 2, Full, Animated 41418 DEFW 43023 ; (#R43022) Head, Animated 41420 DEFW 43062 ; (#R43061) Torso and Spear, Extended 41422 DEFW 43096 ; (#R43095) Torso and Spear, Retracted ; Update State of Skeleton (Dying) ; ; Used by the routine at #R41381. Input: IX Address of complex state data for Skeleton (Level 4) c41424 LD A,(42911) ; If current attribute in Skeleton's graphic layout data is not 1... 41427 CP 1 ; ... 41429 JR NZ,41473 ; ...then skip ahead to #R41473 41431 LD (IX+1),0 ; Set Skeleton's room to 0 41435 LD IY,45417 ; Load IY with address of complex state data for Boni (Level 4) 41439 LD A,(IX+4) ; Set y-coordinate of Boni's top edge... 41442 LD (IY+4),A ; ...to same as that of skeleton 41445 ADD A,3 ; Set y-coordinate of Boni's bottom edge... 41447 LD (IY+6),A ; ...to three characters below this 41450 LD A,(IX+5) ; Set x-coordinate of Boni's left edge... 41453 LD (IY+5),A ; ...to same as that of skeleton 41456 INC A ; Set x-coordinate of Boni's right edge... 41457 LD (IY+7),A ; ...to one to the right of this 41460 LD (IY+1),1 ; Set Boni's depth to 1 41464 SET 6,(IY+10) ; Set Boni's Can Fall Flag 41468 SET 2,(IX+9) ; Set Skeleton's Removed From Game Flag 41472 RET ; Return ; Current attribute in Skeleton's graphic layout data is not 1 *41473 LD IX,41412 ; Load IX with address of Table of Addresses of Attribute Data in Skeleton's GLD Blocks 41477 LD B,6 ; Load B with 6 (as there are six blocks of graphic layout data to modify) *41479 LD L,(IX+0) ; Load HL with address of attribute data in current block... 41482 LD H,(IX+1) ; ... 41485 DEC (HL) ; Decrease the attribute value 41486 INC IX ; Advance IX to next address... 41488 INC IX ; ... 41490 DJNZ 41479 ; Decrease remaining number of blocks to modify and loop back to #R41479 if not zero 41492 LD A,11 ; Set sound 11 as pending if appropriate, then play and clear pending sound... 41494 CALL 59722 ; ... 41497 RET ; Return ; Kill Berk if He Collides with Skeleton ; ; See trivia Input: IX Address of complex state data for Skeleton (Level 4) (#R45404) c41498 CALL 54768 ; Check entity at IX for collision with another entity at same depth whose Interaction (11,6) ; Flag is set... 41501 JR C,41513 ; ...and if no collision occurred, then skip ahead to #R41513 41503 CP 31 ; If collision was not with entity of class 31 (Berk)... 41505 JR NZ,41513 ; ...then skip ahead to #R41513 41507 CALL 53667 ; Set "Berk Has Been Killed" Flag 41510 JP 48096 ; Advance HL to next script instruction and execute ; The instructions below do a "manual" check for a collision between the Skeleton and Berk. See trivia *41513 LD IY,(34240) ; Load IY with address of current level's complex state data for Berk 41517 LD A,(IY+0) ; If Berk's current room is not 3 (Skeleton's room)... 41520 CP 3 ; ... 41522 JP NZ,48096 ; ...then jump to #R48096 (advance HL to next script instruction and execute) 41525 LD A,(IX+5) ; If x-coordinate of Skeleton's left edge... 41528 SUB 5 ; ...is at least five characters to the right of Berk's right edge... 41530 CP (IY+7) ; ... 41533 JP NC,48096 ; ...then jump to #R48096 (advance HL to next script instruction and execute) 41536 LD A,(IY+6) ; If y-coordinate of Berk's bottom edge... 41539 CP 116 ; ...is less than 116... 41541 JP C,48096 ; ...then jump to #R48096 (advance HL to next script instruction and execute) 41544 CALL 53667 ; Set "Berk Has Been Killed" Flag 41547 JP 48096 ; Advance HL to next script instruction and execute ; Script Routine (63) Have Skeleton Advance or Retreat Based Upon Positions of Berk and Fake Boni ; ; The skeleton will step forward once, and then step back, if Berk is close enough and Fake Boni is in a room to the ; right. If Fake Boni is in the Skeleton's room, or a room to the left of this, then the Skeleton will step forward ; repeatedly while Berk is close enough and will only back off when Berk moves out of range. The range is nine, so ; if the distance between Berk's right edge and the Skeleton's left edge is less than nine then the Skeleton will ; advance. A distance of nine or more will see the Skeleton retreat. Note that the calculated range is based upon ; the Skeleton's state data at #R45404, in which the x-coordinates of his left and right edges do not match his ; apparent position or width graphically. Input: IX Address of complex state data for an entity Output: HL Address ; of next script instruction to execute c41550 LD IY,(34240) ; Load IY with address of current level's complex state data for Berk 41554 LD A,(IY+0) ; If Berk's current room is 3 (Skeleton's room)... 41557 CP 3 ; ... 41559 JR Z,41580 ; ...then jump to #R41580 ; Berk is not in Skeleton's room, or Fake Boni is in a room right of the Skeleton's room *41561 LD A,(IX+5) ; If x-coordinate of Skeleton's left edge is at least 128... 41564 CP 128 ; ... 41566 JR NC,41574 ; ...then skip ahead to #R41574 41568 LD HL,41318 ; Point HL at script data for Skeleton stepping back (right)... 41571 JP 48098 ; ...and execute *41574 LD HL,41232 ; Point HL at script data for Skeleton Idling... 41577 JP 48098 ; ...and execute ; Berk is in Skeleton's room *41580 BIT 0,(IX+9) ; If Skeleton's Must Process Current Script Data Flag is reset... 41584 JR Z,41597 ; ...then skip ahead to #R41597 41586 RES 0,(IX+9) ; Reset Skeleton's Must Process Current Script Data Flag 41590 LD A,(45430) ; If Fake Boni is in a room with index of 4 or more (room above Pit, or Pit)... 41593 CP 4 ; ... 41595 JR NC,41561 ; ...then jump back to #R41561 (move Skeleton back) *41597 LD A,(IX+5) ; If x-coordinate of Skeleton's left edge... 41600 SUB 9 ; ...is at least nine characters to the right of Berk's right edge... 41602 CP (IY+7) ; ... 41605 JR NC,41561 ; ...then jump back to #R41561 (move Skeleton back) 41607 SET 0,(IX+9) ; Set Skeleton's Must Process Current Script Data Flag 41611 LD HL,41280 ; Point HL at script data for Skeleton stepping forward (left)... 41614 JP 48098 ; ...and execute ; Script Routine (64) Set Random (1 to 10) Number of Iterations in Following Loop Script Instruction c41617 LD A,10 ; Load A with a random number, 1-10... 41619 CALL 54222 ; ... 41622 INC A ; ... 41623 PUSH HL ; Store HL (current position in script data) 41624 LD BC,4 ; Advance HL by four bytes... 41627 ADD HL,BC ; ...to number of iterations in next (loop) instruction... 41628 LD (HL),A ; ...and set number of iterations to number generated 41629 POP HL ; Restore HL (current position in script data) 41630 JP 48096 ; Advance HL to next script instruction and execute ; Update State of Ghost ; ; Used by the routine at #R41211. c41633 LD IX,45794 ; Load IX with address of complex state data for Ghost (Level 4) 41637 CALL 54768 ; Check entity at IX for collision with another entity at same depth whose Interaction (11,6) ; Flag is set... 41640 CP 31 ; ...and if collision was not with entity of class 31 (Berk)... 41642 JR NZ,41653 ; ...then skip ahead to #R41653 ; If collision was with Berk, then IY will point to Berk's complex state data 41644 BIT 6,(IY+9) ; If Berk is not flying... 41648 JR Z,41653 ; ...then skip ahead to #R41653 41650 CALL 53667 ; Set "Berk Has Been Killed" Flag *41653 LD A,(34218) ; Load E with current character's current room index... 41656 LD E,A ; ... 41657 LD A,(IX+0) ; Load A with Ghost's current room index 41660 LD C,(IX+4) ; Load C with y-coordinate of Ghost's top edge 41663 LD B,(IX+6) ; Load B with y-coordinate of Ghost's bottom edge 41666 BIT 0,(IX+9) ; If Ghost's Moving Upwards Flag is set... 41670 JR NZ,41716 ; ...then skip ahead to #R41716 41672 CP 4 ; If Ghost's current room is 4 (room above pit)... 41674 JR Z,41687 ; ...then skip ahead to #R41687 41676 LD A,B ; If y-coordinate of Ghost's bottom edge... 41677 CP 119 ; ...is not 119... 41679 JP NZ,42360 ; ...then move Ghost down one character and return 41682 SET 0,(IX+9) ; Set Ghost's Moving Upwards Flag 41686 RET ; Return ; Ghost's current room is 4 (room above pit) *41687 CP E ; If current character is in the same room as the Ghost... 41688 JR Z,41703 ; ...then skip ahead to #R41703 41690 LD A,B ; If y-coordinate of Ghost's bottom edge... 41691 CP 119 ; ...is not 119... 41693 JP NZ,42360 ; ...then move Ghost down one character and return 41696 INC (IX+0) ; Increase index of Ghost's current room (to 5, pit) 41699 LD A,94 ; Position Ghost such that the y-coordinate of its top edge is 115... 41701 JR 41758 ; ...and return ; Current character and Ghost in same room (room above pit) *41703 LD A,C ; If y-coordinate of Ghost's top edge... 41704 CP 121 ; ...is not 121... 41706 JP NZ,42360 ; ...then move Ghost down one character and return 41709 INC (IX+0) ; Increase index of Ghost's current room (to 5, pit) 41712 LD A,100 ; Position Ghost such that the y-coordinate of its top edge is 100... 41714 JR 41758 ; ...and return ; Ghost's Moving Upwards Flag is set *41716 CP 5 ; If Ghost's current room is 5 (pit)... 41718 JR Z,41731 ; ...then skip ahead to #R41731 41720 LD A,C ; If y-coordinate of Ghost's top edge... 41721 CP 101 ; ...is not 101... 41723 JP NZ,42374 ; ...then move Ghost up one character and return 41726 RES 0,(IX+9) ; Reset Ghost's Moving Upwards Flag (i.e. moving downwards) 41730 RET ; Return ; Ghost's current room is 5 (pit) *41731 CP E ; If current character is in the same room as the Ghost... 41732 JR Z,41747 ; ...then skip ahead to #R41747 41734 LD A,C ; If y-coordinate of Ghost's top edge... 41735 CP 101 ; ...is not 101... 41737 JP NZ,42374 ; ...then move Ghost up one character and return 41740 DEC (IX+0) ; Decrease index of Ghost's current room (to 4, room above pit) 41743 LD A,121 ; Position Ghost such that the y-coordinate of its top edge is 121... 41745 JR 41758 ; ...and return ; Current character and Ghost in same room (pit) *41747 LD A,B ; If y-coordinate of Ghost's bottom edge... 41748 CP 100 ; ...is not 100... 41750 JP NZ,42374 ; ...then move Ghost up one character and return 41753 DEC (IX+0) ; Decrease index of Ghost's current room (to 4, room above pit) 41756 LD A,115 ; Prepare to set y-coordinate of Ghost's top edge to 115 *41758 LD (IX+4),A ; Set y-coordinate of Ghost's top edge to value in A 41761 ADD A,6 ; Add 6 to value in A (as Ghost is 6 characters tall)... 41763 LD (IX+6),A ; ...and set y-coordinate of Ghost's bottom edge to value in A 41766 RET ; Return ; Update State of Cannon and Projectile ; ; Used by the routine at #R41211. c41767 CALL 41961 ; Update State of Cannon's Projectile 41770 LD IX,45508 ; Load IX with address of complex state data for Cannon (Level 4) 41774 BIT 2,(IX+9) ; If Cannon's Just Loaded Flag is reset... 41778 JR Z,41805 ; ...then skip ahead to #R41805 41780 DEC (IX+12) ; Decrease Cannon's Fire Timer... 41783 JR Z,41791 ; ...and if now zero then skip ahead to #R41791 41785 LD BC,42519 ; Set Cannon's graphic layout data address to point to graphic layout data for Cannon ; (Rocking) and return... 41788 JP 42512 ; ... *41791 RES 2,(IX+9) ; Reset Cannon's Just Loaded Flag 41795 LD (IX+12),50 ; Set Cannon's Fire Timer to 50 *41799 LD BC,42530 ; Set Cannon's graphic layout data address to point to graphic layout data for Cannon ; (Dormant) and return... 41802 JP 42512 ; ... ; Cannon's Just Loaded Flag is reset, so Cannon has finished its rocking phase. *41805 LD A,(34209) ; If Cannon has no ammunition... 41808 OR A ; ... 41809 JR Z,41799 ; ...then jump to #R41799 (Cannon dormant) 41811 BIT 5,(IX+10) ; If Cannon has its Is Being Carried Flag set... 41815 JR NZ,41799 ; ...then jump to #R41799 (Cannon dormant) 41817 LD IY,(34240) ; Load IY with address of current level's complex state data for Berk 41821 LD A,(IX+0) ; If Berk's current room is the same as the Cannon's room... 41824 CP (IY+0) ; ... 41827 JR Z,41833 ; ...then skip ahead to #R41833 41829 JR C,41860 ; If index of Berk's current room is greater than the index of the Cannon's room then skip ; ahead to #R41860 41831 JR 41871 ; Skip ahead to #R41871 ; Berk and Cannon in same room *41833 LD A,(IX+7) ; If x-coordinate of Cannon's right side is smaller than x-coordinate of Berk's left side ; (i.e. Cannon is to left of Berk)... 41836 CP (IY+5) ; ... 41839 JR C,41860 ; ...then skip ahead to #R41860 41841 LD A,(IY+7) ; If x-coordinate of Berk's right side is smaller than x-coordinate of Cannon's left side ; (i.e. Cannon is to right of Berk)... 41844 CP (IX+5) ; ... 41847 JR C,41871 ; ...then skip ahead to #R41871 ; Berk and Cannon overlapping horizontally 41849 LD E,1 ; Load E with 1 (as Projectile will appear one character to the right of the Cannon's ; coordinate position) 41851 LD (IX+9),0 ; Prepare to set Projectile's state to zero (fired vertically) 41855 LD BC,42530 ; Load BC with graphic layout data address for Cannon (Upright) 41858 JR 41880 ; Skip ahead to #R41880 ; Berk is to the right of the Cannon *41860 LD (IX+9),1 ; Prepare to set Projectile's state to 1 (fired left) 41864 LD E,2 ; Load E with 2 (as Projectile will appear two characters to the right of the Cannon's ; coordinate position) 41866 LD BC,42556 ; Load BC with graphic layout data address for Cannon (Tilted Right) 41869 JR 41880 ; Skip ahead to #R41880 ; Berk is to the left of the Cannon *41871 LD (IX+9),2 ; Prepare to set Projectile's state to 2 (fired right) 41875 LD BC,42594 ; Load BC with graphic layout data address for Cannon (Tilted Left) 41878 LD E,0 ; Load E with 0 (as Projectile will appear at the same x-coordinate as in the Cannon's ; coordinate position) *41880 CALL 42512 ; Set Cannon's graphic layout data address to value in BC 41883 LD A,(IX+1) ; If Cannon's depth is 2... 41886 CP 2 ; ... 41888 RET Z ; ...then return (Cannon won't fire if it is placed behind Berk) 41889 LD A,(IX+12) ; If Cannon's Fire Timer is at zero... 41892 OR A ; ... 41893 JR Z,41899 ; ...then skip ahead to #R41899 41895 DEC (IX+12) ; Decrease Cannon's Fire Timer 41898 RET ; Return ; Cannon's Fire Timer is at zero *41899 LD HL,34209 ; Decrease ammunition level of Cannon (Level 4) by one... 41902 DEC (HL) ; ... 41903 LD (IX+12),50 ; Set Cannon's Fire Timer to 50 41907 LD IY,45599 ; Load IY with address of complex state data for Cannon's Projectile 41911 LD A,(IX+5) ; Set x-coordinate of Projectile's left and right sides to E plus x-coordinate of Cannon's ; left side... 41914 ADD A,E ; ... 41915 LD (IY+5),A ; ... 41918 LD (IY+7),A ; ... 41921 LD A,(IX+4) ; Set y-coordinates of top and bottom of Projectile to be one less than Cannon's top ; y-coordinate... 41924 DEC A ; ... 41925 LD (IY+4),A ; ... 41928 LD (IY+6),A ; ... 41931 LD A,(IX+0) ; Set Projectile's room to same as Cannon's Room... 41934 LD (IY+0),A ; ... 41937 LD (IY+1),1 ; Set Projectile's depth to 1 41941 LD A,(IX+9) ; Set Projectile's state to value prepared previously... 41944 LD (IY+9),A ; ... 41947 LD (IY+12),251 ; Set Projectile's y-velocity to -5 41951 LD BC,51483 ; Set Projectile's graphic layout data address to that for Explosion (Bubo's Projectile / ; fallen drips, Level 4)... 41954 LD (IY+2),C ; ...as Projectile is launched from Cannon in an explosion... 41957 LD (IY+3),B ; ... 41960 RET ; Return ; Update State of Cannon's Projectile ; ; Used by the routine at #R41767. c41961 LD IX,45599 ; Load IX with address of complex state data for Cannon's Projectile 41965 LD A,(IX+1) ; If Projectile's depth is zero... 41968 OR A ; ... 41969 RET Z ; ...then return 41970 LD BC,49699 ; Set Projectile's graphic layout data address to that of drip stage 8, disconnected and ; falling (ball)... 41973 CALL 42512 ; ... 41976 LD A,(IX+9) ; If Projectile's state is zero (fired vertically)... 41979 OR A ; ... 41980 JR Z,42015 ; ...then skip ahead to #R42015 41982 CP 8 ; If Projectile's state is not 8 (finished)... 41984 JR NZ,41991 ; ...then skip ahead to #R41991 41986 LD (IX+1),0 ; Set Projectile's depth to 0 41990 RET ; Return *41991 CP 2 ; If Projectile's state is not 2 (fired right)... 41993 JR NZ,42006 ; ...then skip ahead to #R42006 ; Projectile flying left 41995 CALL 42447 ; Move entity left two characters... 41998 CALL 42447 ; ... 42001 CALL 54348 ; Move entity at IX into room to the left, if appropriate 42004 JR 42015 ; Skip ahead to #R42015 ; Projectile flying right *42006 CALL 42505 ; Move entity right two characters... 42009 CALL 42505 ; ... 42012 CALL 54313 ; Move entity at IX into room to the right, if appropriate ; Update Projectile's vertical velocity *42015 LD A,(IX+12) ; Load Projectile's velocity into A and E... 42018 LD E,A ; ... 42019 ADD A,(IX+4) ; Add velocity to y-coordinates of top and bottom of projectile... 42022 LD (IX+4),A ; ... 42025 LD (IX+6),A ; ... 42028 INC (IX+12) ; Increase velocity by one (initially negative so will accelerate downwards) 42031 LD A,E ; If velocity (before increase) was not 5... 42032 CP 5 ; ...i.e. projectile has not yet fallen back to floor-level... 42034 RET NZ ; ...then return 42035 LD (IX+9),8 ; Set Projectile's state to 8 (finished) 42039 LD BC,51483 ; Set Projectile's graphic layout data address to that of explosion (Bubo's Projectile / fallen ; drips, Level 4)... 42042 CALL 42512 ; ... 42045 CALL 54768 ; Check entity at IX for collision with another entity at same depth whose Interaction (11,6) ; Flag is set... 42048 RET C ; ...and if no collision occurred, then return 42049 CP 36 ; If collision was not with entity of class 36 (skeleton, Level 4)... 42051 JR NZ,42058 ; ...then skip ahead to #R42058 42053 LD HL,45413 ; Set Skeleton's Is Dying Flag... 42056 SET 1,(HL) ; ... *42058 CP 31 ; If collision was with entity of class 31 (Berk)... 42060 CALL Z,53667 ; ...then set "Berk Has Been Killed" Flag 42063 RET ; Return ; Update States of Drips (Level 4) ; ; Used by the routine at #R41211. c42064 LD IX,45521 ; Load IX with address of complex state data for first drip (Level 4) 42068 LD B,6 ; Load B with 6 (as there are 6 drips to process) *42070 PUSH BC ; Store BC (B = Remaining number of drips to process) 42071 LD A,(IX+12) ; If current drip's velocity factor is not zero... 42074 OR A ; ... 42075 JR NZ,42128 ; ...then skip ahead to #R42128 (handle drip's fall) 42077 LD A,(IX+9) ; If current drip's stage is not 8... 42080 CP 8 ; ... 42082 JR NZ,42092 ; ...then skip ahead to #R42092 *42084 LD A,(IX+8) ; Reset current drip's complex state data to values stored in Table of Initial-State Data... 42087 CALL 53994 ; ... 42090 JR 42119 ; Advance IX to next entry in complex state data and loop back to #R42070 *42092 CP 7 ; If drip's stage is not 7... 42094 JR NZ,42102 ; ...then skip ahead to #R42102 42096 LD (IX+12),1 ; Set current drip's velocity factor to 1 42100 JR 42119 ; Advance IX to next entry in complex state data and loop back to #R42070 *42102 LD C,A ; Load drip's stage into C 42103 LD A,15 ; Load A with a random number, 0-14... 42105 CALL 54222 ; ... 42108 OR A ; If A is not zero (14 in 15 chance)... 42109 JR NZ,42119 ; ...then advance IX to next entry in complex state data and loop back to #R42070 42111 LD A,C ; Load drip's stage back into A... 42112 INC A ; ...and add one 42113 LD (IX+9),A ; Store updated drip stage value 42116 CALL 42251 ; Set drip's graphic layout data pointer to stage A graphic *42119 LD DE,13 ; Load DE with 13 (as entries are 13 bytes wide) 42122 ADD IX,DE ; Advance IX to next drip's complex state data 42124 POP BC ; Restore BC (B = Remaining number of drips to process) 42125 DJNZ 42070 ; Loop back to #R42070 42127 RET ; Return ; Drip's velocity factor is not zero *42128 INC (IX+12) ; Increase drip's velocity factor 42131 LD (IX+1),1 ; Set drip's depth to 1 42135 LD IY,45508 ; Load IY with address of complex state data for Cannon (Level 4) 42139 LD B,A ; Load B with drip's velocity factor *42140 LD A,(IY+0) ; Load Cannon's current room 42143 CP (IX+0) ; If Cannon is in a different room to the drip... 42146 JR NZ,42190 ; ...then skip ahead to #R42190 42148 LD A,(IY+1) ; If Cannon's depth is not 1... 42151 CP 1 ; ... 42153 JR NZ,42190 ; ...then skip ahead to #R42190 42155 LD A,(IY+5) ; If x-coordinate of Cannon's left side... 42158 INC A ; ...plus one... 42159 CP (IX+5) ; ...is not the same as the x-coordinate of the drip's left side... 42162 JR NZ,42190 ; ...then skip ahead to #R42190 42164 LD A,(IY+4) ; If y-coordinate of top Cannon's top... 42167 CP (IX+4) ; ...is not the same as the y-coordinate of the drip's top... 42170 JR NZ,42215 ; ...then skip ahead to #R42215 42172 LD A,(34209) ; Increase Cannon's ammunition level by 10... 42175 ADD A,10 ; ... 42177 LD (34209),A ; ... 42180 SET 2,(IY+9) ; Set Cannon's Just Loaded Flag 42184 LD (IY+12),20 ; Set Cannon's Fire Timer to 20 42188 JR 42084 ; Reset current drip's state and loop back to #R42070 for next drip *42190 CALL 54768 ; Check entity at IX for collision with another entity at same depth whose Interaction (11,6) ; Flag is set... 42193 CP 31 ; ...and if collision was not with entity of class 31 (Berk)... 42195 JR NZ,42215 ; ...then skip ahead to #R42215 42197 CALL 53667 ; Set "Berk Has Been Killed" Flag *42200 LD A,8 ; Set drip's graphical stage to 8 (exploding on contact)... 42202 LD (IX+9),A ; ...and also set drip's stage to 8... 42205 CALL 42251 ; ... 42208 LD (IX+12),0 ; Set drip's velocity factor to zero 42212 JP 42119 ; Advance IX to next entry in complex state data and loop back to #R42070 *42215 LD A,(IX+4) ; If y-coordinate of top of drip is 120... 42218 CP 120 ; ... 42220 JR Z,42200 ; ...then loop back to #R42200 (make drip explode and process next drip) 42222 INC (IX+4) ; Move drip down one character... 42225 INC (IX+6) ; ... 42228 DJNZ 42140 ; Decrease B (velocity factor) and loop back to #R42140 if not zero 42230 JP 42119 ; Advance IX to next entry in complex state data and loop back to #R42070 ; Addresses of Graphic Layout Data for Drips (Level 4) ; ; Used by the routine at #R42251. b42233 DEFW 50800 ; Stage 0 - Blank 42235 DEFW 49600 ; Stage 1 - Green drip forming 42237 DEFW 49615 ; Stage 2 - Red drip enlarging 42239 DEFW 49630 ; Stage 3 - Magenta drip enlarging 42241 DEFW 49645 ; Stage 4 - Cyan drip enlarging 42243 DEFW 49663 ; Stage 5 - Yellow drip full size 42245 DEFW 49681 ; Stage 6 - Yellow drip extended 42247 DEFW 49699 ; Stage 7 - Drip disconnected and falling 42249 DEFW 51483 ; Stage 8 - Drip exploding on contact ; Set a Drip's (Level 4) Stage to A ; ; Used by the routine at #R42064. Input: A Index of drip state (0-8) IX Address of complex state data for a drip ; (level 4) c42251 ADD A,A ; Double index of drip state... 42252 LD C,A ; ...and load into BC... 42253 LD B,0 ; ... 42255 LD HL,42233 ; Point HL at start of table of Addresses of Graphic Layout Data for Drips (Level 4) 42258 ADD HL,BC ; Add BC to HL as offset 42259 LD C,(HL) ; Load address (of graphic layout data) at this location into BC... 42260 INC HL ; ... 42261 LD B,(HL) ; ... 42262 CALL 42512 ; Set drip's graphic layout data address to BC 42265 RET ; Return ; Update State of Flying Skeleton Creature (Level 4) ; ; Used by the routine at #R41211. c42266 LD IX,45482 ; Load IX with address of complex state data for Flying Skeleton Creature (Level 4) 42270 CALL 54768 ; Check entity at IX for collision with another entity at same depth whose Interaction (11,6) ; Flag is set... 42273 CP 31 ; ...and if collision was not with entity of class 31 (Berk)... 42275 JR NZ,42285 ; ...then skip ahead to #R42285 42277 LD A,(45401) ; If Berk's Can Fall Flag is reset... 42280 BIT 6,A ; ... 42282 CALL Z,53667 ; ...then set "Berk Has Been Killed" Flag *42285 LD HL,45491 ; Load HL with address of Flying Skeleton Creature's flags 42288 BIT 0,(HL) ; If creature's Horizontal Direction Flag is set (moving left)... 42290 JR NZ,42320 ; ...then skip ahead to #R42320 ; Horizontal Direction Flag reset (moving right) 42292 LD A,(IX+0) ; If creature's room is not 4 (Fake Boni's Room)... 42295 CP 4 ; ... 42297 JR NZ,42309 ; ...then skip ahead to #R42309 42299 LD A,(IX+7) ; If x-coordinate of creature's right edge is less than 126... 42302 CP 126 ; ... 42304 JR C,42309 ; ...then skip ahead to #R42309 42306 SET 0,(HL) ; Set creature's Horizontal Direction Flag (moving left) 42308 RET ; Return *42309 INC (IX+5) ; Move creature right one character... 42312 INC (IX+7) ; ... 42315 CALL 54313 ; ...and move into room to the right, if appropriate 42318 JR 42346 ; Skip ahead to #R42346 ; Horizontal Direction Flag set (moving left) *42320 LD A,(IX+0) ; If creature's room is not 1 (Door Room)... 42323 CP 1 ; ... 42325 JR NZ,42337 ; ...then skip ahead to #R42337 42327 LD A,(IX+5) ; If x-coordinate of creature's left edge is at least 108... 42330 CP 108 ; ... 42332 JR NC,42337 ; ...then skip ahead to #R42337 42334 RES 0,(HL) ; Reset creature's Horizontal Direction Flag (moving right) 42336 RET ; Return *42337 DEC (IX+5) ; Move creature left one character... 42340 DEC (IX+7) ; ... 42343 CALL 54348 ; ...and move into room to the left, if appropriate *42346 LD A,(IX+4) ; Load A with y-coordinate of creature's top edge 42349 BIT 1,(HL) ; If creature's Vertical Direction Flag is set (moving up)... 42351 JR NZ,42367 ; ...then skip ahead to #R42367 ; Vertical Direction Flag reset, moving down 42353 CP 108 ; If y-coordinate of creature's top edge is not 108... 42355 JR NZ,42360 ; ...then skip ahead to #R42360 42357 SET 1,(HL) ; Set creature's Vertical Direction Flag (moving up) 42359 RET ; Return ; This entry point is used by the routine at #R41633. *42360 INC (IX+4) ; Move creature down one character... 42363 INC (IX+6) ; ... 42366 RET ; Return ; Vertical Direction Flag set, moving up *42367 CP 100 ; If y-coordinate of creature's top edge is not 100... 42369 JR NZ,42374 ; ...then skip ahead to #R42374 42371 RES 1,(HL) ; Reset creature's Vertical Direction Flag (moving down) 42373 RET ; Return ; This entry point is used by the routine at #R41633. *42374 DEC (IX+4) ; Move creature up one character... 42377 DEC (IX+6) ; ... 42380 RET ; Return ; Update State of Snake (Level 4) ; ; Used by the routine at #R41211. c42381 LD IX,45495 ; Point IX at start of state data for Snake (Level 4) 42385 LD IY,(34240) ; Load IY with address of current level's complex state data for Berk 42389 LD HL,45507 ; Load HL with address of Snake's Attack Progress Index 42392 LD A,(HL) ; If Snake's Attack Progress Index is not zero... 42393 OR A ; ... 42394 JR NZ,42415 ; ...then skip ahead to #R42415 ; Snake's Attack Progress Index is zero 42396 LD A,(IY+0) ; If Berk's room is not 5 (Snake's room)... 42399 CP 5 ; ... 42401 RET NZ ; ...then return 42402 BIT 7,(IY+12) ; If Berk's Is Jumping Flag is set... 42406 JR NZ,42413 ; ...then skip ahead to #R42413 42408 BIT 0,(IY+9) ; If Snake's Must Process Current Script Data Flag is set... 42412 RET NZ ; ...then return *42413 INC (HL) ; Increase Snake's Attack Progress Index 42414 RET ; Return ; Snake's Attack Progress Index is not zero *42415 CP 8 ; If Snake's Attack Progress Index is less than 8... 42417 JR C,42454 ; ...then jump to #R42454 (Snake moving right) 42419 CP 15 ; If Snake's Attack Progress Index is less than 15... 42421 JR C,42459 ; ...then jump to #R42459 (Snake preparing to pounce) 42423 CP 17 ; If Snake's Attack Progress Index is less than 17... 42425 JR C,42461 ; ...then jump to #R42461 (Snake pouncing) 42427 JR Z,42480 ; If Snake's Attack Progress Index is 17 then jump to #R42480 (Snake finished pouncing) ; Snake's Attack Progress Index is greater than 17 *42429 LD (HL),20 ; Set Snake's Attack Progress Index to 20 42431 LD BC,42648 ; Set Snake's graphic layout data address to #R42648... 42434 CALL 42512 ; ...(Snake, mouth closed, with animated tongue) 42437 LD A,(IX+5) ; If x-coordinate of Snake's left edge is not 83... 42440 CP 83 ; ... 42442 JR NZ,42447 ; ...then move Snake left one character and return 42444 LD (HL),0 ; Set Snake's Attack Progress Index to 0 42446 RET ; Return ; This entry point is used by the routine at #R41961. *42447 DEC (IX+5) ; Decrease x-coordinates of left and right edges of entity at IX by one... 42450 DEC (IX+7) ; ... 42453 RET ; Return ; Snake's Attack Progress Index is less than 8 *42454 INC (HL) ; Increase Snake's Attack Progress Index 42455 CALL 42505 ; Move Snake right one character 42458 RET ; Return ; Snake's Attack Progress Index is 8 or more, but less than 15 *42459 INC (HL) ; Increase Snake's Attack Progress Index 42460 RET ; Return ; Snake's Attack Progress Index is 15 or more, but less than 17 *42461 LD A,(IY+6) ; If the y-coordinate of Berk's bottom edge is less than 116... 42464 CP 116 ; ... 42466 JR C,42429 ; ...then jump back to #R42429 42468 CALL 42486 ; Open Snake's mouth and set Berk Has Been Killed Flag if Snake and Berk have collided 42471 LD B,4 ; Move Snake right four characters... *42473 CALL 42505 ; ... 42476 DJNZ 42473 ; ... 42478 INC (HL) ; Increase Snake's Attack Progress Index 42479 RET ; Return ; Snake's Attack Progress Index is 17 *42480 CALL 42486 ; Open Snake's mouth and set Berk Has Been Killed Flag if Snake and Berk have collided 42483 LD (HL),20 ; Set Snake's Attack Progress Index to 20 42485 RET ; Return ; Open Snake's Mouth and Set Berk Has Been Killed Flag if Snake and Berk Have Collided ; ; Used by the routine at #R42381. Input: HL Address of Snake's Attack Progress Index IX Address of complex state ; data for Snake (Level 4) c42486 LD BC,42703 ; Set Snake's graphic layout data address to #R42703... 42489 CALL 42512 ; ...(Snake, mouth open, attacking) 42492 CALL 54768 ; Check entity at IX for collision with another entity at same depth whose Interaction (11,6) ; Flag is set... 42495 CP 31 ; ...and if collision was not with entity of class 31 (Berk)... 42497 RET NZ ; ...then return 42498 POP BC ; Remove top value from stack (i.e. return address to routine that called this routine) 42499 LD (HL),18 ; Set Snake's Attack Progress Index to 18 42501 CALL 53667 ; Set "Berk Has Been Killed" Flag 42504 RET ; Return ; Move Entity at IX Right One Character ; ; Used by the routines at #R41961 and #R42381. c42505 INC (IX+7) ; Increase x-coordinates of left and right edges of entity at IX by one... 42508 INC (IX+5) ; ... 42511 RET ; Return ; Set Graphic Layout Data Address for Entity at IX to BC ; ; Used by the routines at #R41767, #R41961, #R42251, #R42381 and #R42486. Input: BC Holds address of graphic ; layout data c42512 LD (IX+2),C ; Set current entity's graphic layout data address to BC... 42515 LD (IX+3),B ; ... 42518 RET ; Return ; Graphic Layout Data Cannon (Level 4) Loaded (Animated) b42519 DEFB 243,0,4 ; Increase current state value n (initially 0), up to maximum of 4, resetting to ; zero if maximum reached and jump to n-th address in following list: 42522 DEFB 34,166 ; #R42530 (Cannon, straight) 42524 DEFB 60,166 ; #R42556 (Cannon, tilted right) 42526 DEFB 34,166 ; #R42530 (Cannon, straight) 42528 DEFB 98,166 ; #R42594 (Cannon, tilted left) ; Straight 42530 DEFB 244,12 ; Set current graphic set to 12 42532 DEFB 41,66,33,0,18,33 42538 DEFB 41,194,30,42,66,34 42544 DEFB 42,194,30,44,66,34 42550 DEFB 44,194,33 42553 DEFB 248,133,166 ; Jump to #R42629 ; Tilted Right 42556 DEFB 244,12 ; Set current graphic set to 12 42558 DEFB 250,255,1 ; Change cursor's x- and y-coordinates by +1 and -1 characters respectively 42561 DEFB 48,2,31,49,2,33 42567 DEFB 0,18,33,50,66,33 42573 DEFB 51,2,29,52,66,34 42579 DEFB 0,18,33,53,2,29 42585 DEFB 54,66,34,55,66,33 42591 DEFB 248,133,166 ; Jump to #R42629 ; Tilted Left 42594 DEFB 244,12 ; Set current graphic set to 12 42596 DEFB 250,255,1 ; Change cursor's x- and y-coordinates by +1 and -1 characters respectively 42599 DEFB 48,130,30,51,130,33 42605 DEFB 50,194,33,0,18,33 42611 DEFB 49,130,29,53,130,33 42617 DEFB 0,18,34,52,194,30 42623 DEFB 55,194,34,54,194,33 42629 DEFB 250,255,254 ; Change cursor's x- and y-coordinates by -2 and -1 characters respectively 42632 DEFB 43,50,32,45,50,31 42638 DEFB 46,70,33,47,70,33 42644 DEFB 46,198,33 42647 DEFB 255 ; End Marker ; Graphic Layout Data Snake (Level 4) Mouth Closed, With Animated Tongue b42648 DEFB 244,12 ; Set current graphic set to 12 42650 DEFB 238,14 ; Set Repeat Counter A to 14 42652 DEFB 24,50,161 42655 DEFB 239 ; Decrement Repeat Counter A and loop back to #R42652 if not zero 42656 DEFB 250,255,0 ; Change cursor's x- and y-coordinates by 0 and -1 characters respectively 42659 DEFB 27,6,33,28,6,33 42665 DEFB 29,62,33,35,6,29 42671 DEFB 31,6,33,31,134,33 42677 DEFB 0,54,33,36,6,33 42683 DEFB 37,6,33 42686 DEFB 247,2 ; Jump to one of the 2 addresses in the following list, chosen at random: 42688 DEFB 112,198 ; #R50800 (blank) 42690 DEFB 196,166 ; #R42692 (tongue, animated) ; Tongue, animated 42692 DEFB 38,5,33 42695 DEFB 236,2,39,40 ; Modify following instruction to display graphic of random index, chosen from 39 and ; 40 42699 DEFB 39,5,33 42702 DEFB 255 ; End Marker ; Mouth Open, Attacking 42703 DEFB 244,12 ; Set current graphic set to 12 42705 DEFB 238,14 ; Set Repeat Counter A to 14 42707 DEFB 24,50,161 42710 DEFB 239 ; Decrement Repeat Counter A and loop back to #R42707 if not zero 42711 DEFB 250,254,2 ; Change cursor's x- and y-coordinates by +2 and -2 characters respectively 42714 DEFB 27,6,33,25,6,33 42720 DEFB 26,7,28,27,6,33 42726 DEFB 28,6,33,29,62,33 42732 DEFB 30,6,29,31,6,33 42738 DEFB 31,134,33,0,54,33 42744 DEFB 32,6,31,33,6,33 42750 DEFB 34,6,33 42753 DEFB 255 ; End Marker ; Graphic Layout Data Ghost (Level 4) Full, Fully Animated b42754 DEFB 244,12 ; Set current graphic set to 12 42756 DEFB 243,0,2 ; Increase current state value n (initially 0), up to maximum of 2, resetting to zero ; if maximum reached and jump to n-th address in following list: 42759 DEFB 11,167 ; #R42763 (Ghost, full, wings up, tail animated) 42761 DEFB 45,167 ; #R42797 (Ghost, full, wings down, tail animated) ; Full, Wings Up, Tail Animated 42763 DEFB 251,79,167 ; Process graphic layout data at #R42831 and upon returning, move cursor to base ; coordinates 42766 DEFB 250,0,254 ; Change cursor's x- and y-coordinates by -2 and 0 characters respectively 42769 DEFB 242,7 ; Set current attribute to 7 42771 DEFB 59,32,60,33 42775 DEFB 61,31,62,33 42779 DEFB 63,33 42781 DEFB 250,254,3 ; Change cursor's x- and y-coordinates by +3 and -2 characters respectively 42784 DEFB 242,135 ; Set current attribute to 135 42786 DEFB 59,31,61,33 42790 DEFB 60,31,63,33 42794 DEFB 62,33 42796 DEFB 255 ; End Marker ; Full, Wings Down, Tail Animated 42797 DEFB 251,79,167 ; Process graphic layout data at #R42831 and upon returning, move cursor to base ; coordinates 42800 DEFB 250,1,254 ; Change cursor's x- and y-coordinates by -2 and +1 characters respectively 42803 DEFB 242,7 ; Set current attribute to 7 42805 DEFB 64,33,65,31 42809 DEFB 66,33,67,31 42813 DEFB 68,33 42815 DEFB 250,254,3 ; Change cursor's x- and y-coordinates by +3 and -2 characters respectively 42818 DEFB 242,135 ; Set current attribute to 135 42820 DEFB 65,33,64,31 42824 DEFB 67,33,66,32 42828 DEFB 68,33 42830 DEFB 255 ; End Marker ; Body and Tail, Without Wings 42831 DEFB 250,255,0 ; Change cursor's x- and y-coordinates by 0 and -1 characters respectively 42834 DEFB 56,7,33,56,135,31 42840 DEFB 57,7,33,57,135,31 42846 DEFB 58,7,33,58,135,31 42852 DEFB 0,63,33,0,63,31 42858 DEFB 236,2,69,72 ; Modify following instruction to display graphic of random index, chosen from 69 and ; 72 42862 DEFB 69,7,33 42865 DEFB 236,2,69,72 ; Modify following instruction to display graphic of random index, chosen from 69 and ; 72 42869 DEFB 69,135,31 42872 DEFB 236,2,70,73 ; Modify following instruction to display graphic of random index, chosen from 70 and ; 73 42876 DEFB 73,7,33 42879 DEFB 236,2,70,73 ; Modify following instruction to display graphic of random index, chosen from 70 and ; 73 42883 DEFB 73,135,31 42886 DEFB 236,2,71,74 ; Modify following instruction to display graphic of random index, chosen from 71 and ; 74 42890 DEFB 74,7,33 42893 DEFB 236,2,71,74 ; Modify following instruction to display graphic of random index, chosen from 71 and ; 74 42897 DEFB 74,135,33 42900 DEFB 255 ; End Marker ; Graphic Layout Data Skeleton (Level 4) Standing, Full, Animated b42901 DEFB 251,12,168 ; Process graphic layout data at #R43020 and upon returning, move cursor to base ; coordinates 42904 DEFB 251,39,168 ; Process graphic layout data at #R43047 and upon returning, move cursor to base ; coordinates 42907 DEFB 250,7,1 ; Change cursor's x- and y-coordinates by +1 and +7 characters respectively 42910 DEFB 242,7 ; Set current attribute to 7 42912 DEFB 113,31,114,33 42916 DEFB 115,31,116,33 42920 DEFB 117,33,118,30 42924 DEFB 119,34,120,29 42928 DEFB 121,33,122,33 42932 DEFB 121,33,122,33 42936 DEFB 255 ; End Marker ; Stepping Forward, Frame 1, Full, Animated 42937 DEFB 251,12,168 ; Process graphic layout data at #R43020 and upon returning, move cursor to base ; coordinates 42940 DEFB 251,39,168 ; Process graphic layout data at #R43047 and upon returning, move cursor to base ; coordinates 42943 DEFB 250,7,255 ; Change cursor's x- and y-coordinates by -1 and +7 characters respectively 42946 DEFB 242,7 ; Set current attribute to 7 42948 DEFB 108,33,109,33 42952 DEFB 110,30,116,34 42956 DEFB 123,30,119,34 42960 DEFB 117,33,118,28 42964 DEFB 121,33,122,35 42968 DEFB 120,31,121,33 42972 DEFB 122,33 42974 DEFB 255 ; End Marker ; Stepping Forward, Frame 2, Full, Animated 42975 DEFB 254,1,0 ; Change cursor's x- and y-coordinates by 0 and +1 characters respectively and store as ; new base coordinates 42978 DEFB 251,12,168 ; Process graphic layout data at #R43020 and upon returning, move cursor to base ; coordinates 42981 DEFB 251,50,168 ; Process graphic layout data at #R43058 and upon returning, move cursor to base ; coordinates 42984 DEFB 250,7,0 ; Change cursor's x- and y-coordinates by 0 and +7 characters respectively 42987 DEFB 242,7 ; Set current attribute to 7 42989 DEFB 124,33,125,33 42993 DEFB 126,29,127,33 42997 DEFB 128,33,129,33 43001 DEFB 130,30,131,34 43005 DEFB 132,33,133,33 43009 DEFB 134,27,121,33 43013 DEFB 122,35,135,33 43017 DEFB 136,33 43019 DEFB 255 ; End Marker ; Head, Animated 43020 DEFB 244,12 ; Set current graphic set to 12 43022 DEFB 242,7 ; Set current attribute to 7 43024 DEFB 75,33,76,31 43028 DEFB 77,33,78,31 43032 DEFB 79,33,80,31 43036 DEFB 236,2,81,82 ; Modify following instruction to display graphic of random index, chosen from 81 and 82 43040 DEFB 81,33,83,33 43044 DEFB 84,33 43046 DEFB 255 ; End Marker ; Torso and Spear, Animated 43047 DEFB 249,2,1 ; If state n (initially 1) has remaining time of zero then reset its time to maximum and ; randomly select a new state, n, from the 2 in the following list. Jump to the address ; specified in the current state and decrease its remaining time: 43050 DEFB 3,3,50,168 ; #R43058 (Torso and spear, extended, for 3 ticks) 43054 DEFB 3,3,84,168 ; #R43092 (Torso and spear, retracted, for 3 ticks) ; Torso and Spear, Extended 43058 DEFB 250,4,0 ; Change cursor's x- and y-coordinates by 0 and +4 characters respectively 43061 DEFB 242,7 ; Set current attribute to 7 43063 DEFB 98,33,99,33 43067 DEFB 100,33,101,24 43071 DEFB 90,33,91,33 43075 DEFB 92,33,102,33 43079 DEFB 103,33,104,33 43083 DEFB 105,33,106,33 43087 DEFB 91,30,107,33 43091 DEFB 255 ; End Marker ; Torso and Spear, Retracted 43092 DEFB 250,3,3 ; Change cursor's x- and y-coordinates by +3 and +3 characters respectively 43095 DEFB 242,7 ; Set current attribute to 7 43097 DEFB 85,29,86,33 43101 DEFB 87,33,88,33 43105 DEFB 89,25,90,33 43109 DEFB 91,33,92,33 43113 DEFB 93,33,94,33 43117 DEFB 95,33,96,33 43121 DEFB 97,33,91,29 43125 DEFB 107,33 43127 DEFB 255 ; End Marker ; Graphic Layout Data Sausages (Level 4) Red Sausage b43128 DEFB 244,12 ; Set current graphic set to 12 43130 DEFB 23,2,33,23,130,33 43136 DEFB 255 ; End Marker ; Cyan Sausage 43137 DEFB 244,12 ; Set current graphic set to 12 43139 DEFB 23,5,33,23,133,33 43145 DEFB 255 ; End Marker ; State Data for Simple Entities (Level 1) ; ; #TABLE(default,centre,:w) ; { =h Offset | =h Meaning } ; { 0 | Room index } ; { 1 | Depth (distance from screen) } ; { 2 & 3 | Address of graphic layout data } ; { 4 | y-coordinate + 100 (chars) } ; { 5 | x-coordinate + 100 (chars) } ; TABLE# b43146 DEFB 1,2,213,196,107,100 ; (#R50389) Left brickwork 43152 DEFB 1,2,213,196,106,117 ; (#R50389) Right brickwork 43158 DEFB 1,0,47,197,107,107 ; (#R50479) "Home Sweet Home" brick border 43164 DEFB 1,2,196,195,100,100 ; (#R50116) Four arches 43170 DEFB 1,2,98,195,100,100 ; (#R50018) Spider's web 43176 DEFB 1,1,62,196,121,100 ; (#R50238) Left part of floor 43182 DEFB 1,1,35,196,121,120 ; (#R50211) Right part of floor 43188 DEFB 1,2,91,196,121,112 ; (#R50267) Closed Trap Door 43194 DEFB 1,2,227,195,112,115 ; (#R50147) Boni's shelf 43200 DEFB 2,1,183,196,100,100 ; (#R50359) Left wall 43206 DEFB 2,1,183,196,99,109 ; (#R50359) Right wall 43212 DEFB 3,1,183,196,100,100 ; (#R50359) Left wall 43218 DEFB 3,1,183,196,99,115 ; (#R50359) Right wall 43224 DEFB 4,1,240,195,121,100 ; (#R50160) Floor (full width) 43230 DEFB 4,2,206,195,101,100 ; (#R50126) Single arch, left 43236 DEFB 4,2,206,195,101,124 ; (#R50126) Single arch, right 43242 DEFB 4,2,183,196,97,108 ; (#R50359) Wall, vertical bricks, single row, left 43248 DEFB 4,2,183,196,97,123 ; (#R50359) Wall, vertical bricks, single row, right 43254 DEFB 5,1,240,195,121,100 ; (#R50126) Single arch 43260 DEFB 6,1,240,195,121,100 ; (#R50126) Single arch 43266 DEFB 6,2,196,195,100,100 ; (#R50116) Four arches 43272 DEFB 6,2,147,197,107,99 ; (#R50579) Wall, horizontal bricks 43278 DEFB 7,1,62,196,121,94 ; (#R50238) Left part of floor 43284 DEFB 7,1,35,196,121,126 ; (#R50211) Right part of floor 43290 DEFB 7,2,196,195,100,100 ; (#R50116) Four arches 43296 DEFB 8,1,240,195,121,100 ; (#R50126) Single arch 43302 DEFB 8,1,183,196,101,100 ; (#R50359) Wall, vertical bricks, single row, left 43308 DEFB 8,1,183,196,101,131 ; (#R50359) Wall, vertical bricks, single row, right 43314 DEFB 9,1,240,195,121,100 ; (#R50126) Single arch 43320 DEFB 9,2,196,195,100,100 ; (#R50116) Four arches 43326 DEFB 9,2,177,197,111,123 ; (#R50609) Row of five horizontal bricks 43332 DEFB 254 ; End Marker ; State Data for Complex Entities (Level 1) ; ; For more details on individual bits, see trivia. b43333 DEFB 10,2,231,197,100,112,108,119,33,0,0,0,0 ; (#R50663) Entry door (above Trap Door Room, where Berk ; emerges at the end of the game) 43346 DEFB 10,1,112,198,120,100,121,131,129,0,0,240,0 ; (#R50800) Marker (makes Berk and Drutt fall) 43359 DEFB 11,1,112,198,120,100,121,131,129,0,0,240,0 ; (#R50800) Marker (makes Berk and Drutt fall) 43372 DEFB 9,2,231,197,112,124,120,131,33,2,0,192,0 ; (#R50663) Exit door 43385 DEFB 9,2,147,197,107,123,120,124,30,0,0,48,0 ; (#R50579) Wall, horizontal bricks 43398 DEFB 9,2,147,197,107,131,120,132,30,0,0,48,0 ; (#R50579) Wall, horizontal bricks 43411 DEFB 6,2,147,197,107,107,120,108,30,0,0,48,0 ; (#R50579) Wall, horizontal bricks 43424 DEFB 6,1,112,198,121,102,121,102,50,0,0,48,0 ; (#R50800) Marker (makes Drutt swap depth levels) 43437 DEFB 0,1,107,196,114,112,121,119,129,0,0,240,0 ; (#R50283) Open Trap Door (also acts as marker, makes Berk ; and Drutt fall) 43450 DEFB 1,1,112,198,114,120,121,120,128,0,0,48,0 ; (#R50800) Marker (prevents Berk and Drutt passing) 43463 DEFB 6,1,85,145,93,115,98,118,30,0,128,192,0 ; (#R37205) Bat 43476 DEFB 7,1,112,198,120,106,121,125,129,0,0,240,0 ; (#R50800) Marker (makes Berk and Drutt fall) 43489 DEFB 8,1,177,197,100,96,100,105,130,0,0,240,0 ; (#R50609) Ceiling (left section) 43502 DEFB 8,1,177,197,100,126,100,135,130,0,0,240,0 ; (#R50609) Ceiling (right section) 43515 DEFB 8,2,210,197,107,119,108,122,35,0,0,240,0 ; (#R50642) Pit Platform 43528 DEFB 8,2,112,198,107,114,108,118,129,0,0,240,0 ; (#R50800) Marker (makes Berk and Drutt fall) 43541 DEFB 8,2,112,198,107,123,108,127,129,0,0,240,0 ; (#R50800) Marker (makes Berk and Drutt fall) 43554 DEFB 8,2,112,198,109,119,109,122,130,0,0,240,0 ; (#R50800) Marker (makes Berk and Drutt bounce off or bang ; head) 43567 DEFB 8,2,147,197,101,104,120,105,30,0,0,240,0 ; (#R50579) Wall, horizontal bricks 43580 DEFB 8,2,147,197,101,126,120,127,30,0,0,240,0 ; (#R50579) Wall, horizontal bricks 43593 DEFB 1,1,228,221,115,123,121,128,31,0,128,192,0 ; (#R56804) Berk 43606 DEFB 1,2,141,196,108,115,111,116,19,0,128,0,0 ; (#R50317) Boni 43619 DEFB 1,2,114,200,124,115,128,116,30,0,128,192,0 ; (#R51314) Flying Skeleton Creature 43632 DEFB 6,2,104,198,105,103,105,104,17,0,128,240,0 ; (#R50792) Key 43645 DEFB 9,2,128,197,105,103,105,104,4,0,131,240,0 ; (#R50560) Red Sweet (Flying, duration = 3) 43658 DEFB 8,1,133,197,121,104,121,105,1,0,128,240,0 ; (#R50565) Green Sweet (Jumping, duration = permanent) 43671 DEFB 1,1,193,204,121,129,121,129,18,0,128,192,0 ; (#R52417) Drutt 43684 DEFB 0,0,92,208,121,109,121,110,24,0,128,0,0 ; (#R53340) Worm 43697 DEFB 2,1,112,198,120,100,121,131,129,0,0,240,0 ; (#R50800) Marker (makes Berk and Drutt fall) 43710 DEFB 3,1,112,198,120,100,121,131,129,0,0,240,0 ; (#R50800) Marker (makes Berk and Drutt fall) 43723 DEFB 4,1,177,197,100,99,100,108,130,0,0,240,0 ; (#R50609) Ceiling, left section 43736 DEFB 4,1,177,197,100,123,100,132,130,0,0,240,0 ; (#R50609) Ceiling, right section 43749 DEFB 5,2,0,148,103,118,106,120,27,0,128,0,0 ; (#R37888) Spider 43762 DEFB 5,2,0,148,103,110,106,112,28,0,128,0,0 ; (#R37888) Spider 43775 DEFB 5,2,0,148,103,102,106,104,29,0,128,0,0 ; (#R37888) Spider 43788 DEFB 5,2,88,195,100,100,0,0,30,0,0,0,0 ; (#R50008) Spiders' Webs 43801 DEFB 5,2,196,195,100,100,0,0,30,0,0,0,0 ; (#R50116) Spiders' Arches 43814 DEFB 255 ; End Marker ; Room Dimension Data (Level 1) ; ; #TABLE(default,centre,:w) ; { =h Offset | =h Meaning } ; { 0 | Room depth (number of depth levels) } ; { 1 | Position of left edge of room (chars) } ; { 2 | Position of right edge of room (chars) } ; { 3 | Position of top edge of room (chars) } ; { 4 | Position of bottom edge of room (chars) } ; TABLE# b43815 DEFB 2,0,31,0,21 ; (01) Trap Door Room 43820 DEFB 2,11,20,0,21 ; (02) 1st room below Trap Door 43825 DEFB 2,8,23,0,21 ; (03) 2nd room below Trap Door 43830 DEFB 2,0,31,0,21 ; (04) Room at bottom of Trap Door Shaft 43835 DEFB 2,0,31,0,21 ; (05) Spider Room 43840 DEFB 2,0,31,0,21 ; (06) Bat Room 43845 DEFB 2,0,31,0,21 ; (07) Room at top of Pit 43850 DEFB 2,0,31,0,21 ; (08) Pit 43855 DEFB 2,0,31,0,21 ; (09) Door Room 43860 DEFB 2,0,31,0,21 ; (10) Entry Room 43865 DEFB 2,0,31,0,21 ; (11) Room above Trap Door Room 43870 DEFB 255 ; End Marker ; Horizontal Room Connectivity Map (Level 1) ; ; Each entry represents a link between two rooms. The first byte in the entry is the index of the room to the left ; and the second byte is the index of the room to the right. b43871 DEFB 6,5 ; Bat Room and Spider Room 43873 DEFB 5,4 ; Spider Room and room at bottom of Trap Door Shaft 43875 DEFB 4,7 ; Room at bottom of Trap Door Shaft and room at top of Pit 43877 DEFB 7,9 ; Room at top of Pit and Door Room 43879 DEFB 255,255 ; End Marker ; Unused ; ; Data Block (09) (Level 1) b43881 DEFB 255 ; Vertical Room Connectivity Map (Level 1) b43882 DEFB 1,2 ; Trap Door Room and 1st room below Trap Door 43884 DEFB 2,3 ; 1st room below Trap Door and 2nd room below Trap Door 43886 DEFB 3,4 ; 2nd room below Trap Door and room at bottom of Trap Door Shaft 43888 DEFB 7,8 ; Room at top of Pit and Pit 43890 DEFB 10,11 ; Entry Room and room above Trap Door Room 43892 DEFB 11,1 ; Room above Trap Door Room and Trap Door Room 43894 DEFB 255,255 ; End Marker ; State Data for Simple Entities (Level 2) b43896 DEFB 1,2,243,199,100,112 ; (#R51187) Sides of ceiling gap 43902 DEFB 1,1,118,198,121,100 ; (#R50806) Floor 43908 DEFB 1,2,53,200,100,103 ; (#R51253) Stalactite 43914 DEFB 1,2,53,200,100,110 ; (#R51253) Stalactite 43920 DEFB 1,2,53,200,100,120 ; (#R51253) Stalactite 43926 DEFB 2,2,220,198,100,100 ; (#R50908) Left wall 43932 DEFB 2,2,205,198,100,108 ; (#R50893) Right wall 43938 DEFB 2,2,235,198,100,100 ; (#R50923) Ceiling section (half) 43944 DEFB 3,1,118,198,121,100 ; (#R50806) Floor 43950 DEFB 3,2,2,200,101,92 ; (#R51202) Seven stalactites at various heights 43956 DEFB 4,1,118,198,121,100 ; (#R50806) Floor 43962 DEFB 4,2,2,200,101,95 ; (#R51202) Seven stalactites at various heights 43968 DEFB 5,1,118,198,121,100 ; (#R50806) Floor (see trivia) 43974 DEFB 6,1,118,198,121,100 ; (#R50806) Floor 43980 DEFB 7,1,118,198,121,100 ; (#R50806) Floor 43986 DEFB 7,2,2,200,100,92 ; (#R51202) Seven stalactites at various heights 43992 DEFB 254 ; End Marker ; State Data for Complex Entities (Level 2) b43993 DEFB 1,2,205,198,100,130,122,131,128,0,0,240,0 ; (#R50893) Right wall 44006 DEFB 1,2,235,198,100,96,101,112,130,0,0,192,0 ; (#R50923) Ceiling section (half) 44019 DEFB 1,2,235,198,100,120,101,131,130,0,0,192,0 ; (#R50923) Ceiling section (half) 44032 DEFB 1,2,112,198,120,99,120,114,50,0,0,48,0 ; (#R50800) Marker (makes Drutt swap depth levels) 44045 DEFB 1,2,112,198,120,117,120,132,50,0,0,48,0 ; (#R50800) Marker (makes Drutt swap depth levels) 44058 DEFB 2,1,112,198,120,100,121,109,129,0,0,240,0 ; (#R50800) Marker (makes Berk and Drutt fall) 44071 DEFB 3,2,187,198,100,100,101,131,130,0,0,192,0 ; (#R50875) Ceiling (complete 1) 44084 DEFB 4,2,196,198,100,100,101,131,130,0,0,192,0 ; (#R50884) Ceiling (complete 2) 44097 DEFB 5,2,187,198,100,100,101,131,130,0,0,192,0 ; (#R50875) Ceiling (complete 1) (see trivia) 44110 DEFB 6,2,196,198,100,100,101,131,130,0,0,192,0 ; (#R50884) Ceiling (complete 2) 44123 DEFB 7,2,187,198,100,100,101,131,130,0,0,192,0 ; (#R50875) Ceiling (complete 1) 44136 DEFB 7,2,220,198,101,100,121,101,128,0,0,240,0 ; (#R50908) Left wall 44149 DEFB 1,1,84,224,115,125,121,130,31,18,128,192,0 ; (#R57428) Berk 44162 DEFB 3,1,110,151,120,100,121,102,25,0,128,241,100 ; (#R38766) Green Apebeast 44175 DEFB 3,1,110,151,120,129,121,131,25,0,128,242,115 ; (#R38766) Green Apebeast 44188 DEFB 4,1,110,151,120,100,121,102,25,0,128,241,100 ; (#R38766) Green Apebeast 44201 DEFB 4,1,110,151,120,129,121,131,25,0,128,242,115 ; (#R38766) Green Apebeast 44214 DEFB 7,0,219,152,0,0,0,0,30,0,0,0,0 ; (#R39131) Bubo's projectile 44227 DEFB 7,1,84,152,119,115,121,117,16,0,128,192,0 ; (#R38996) Bubo 44240 DEFB 2,2,104,198,103,104,103,105,17,0,128,240,0 ; (#R50792) Key 44253 DEFB 2,2,71,200,119,104,120,105,2,0,128,240,0 ; (#R51271) Mushroom (Jumping, duration = permanent) 44266 DEFB 7,2,112,198,120,100,120,103,50,0,0,48,0 ; (#R50800) Marker (makes Drutt swap depth levels) 44279 DEFB 7,1,112,198,121,100,121,103,50,0,0,48,0 ; (#R50800) Marker (makes Drutt swap depth levels) 44292 DEFB 7,2,71,200,104,104,105,105,9,0,128,240,0 ; (#R51271) Mushroom (Immunity to Bubo, duration = ; permanent) 44305 DEFB 6,1,53,200,98,111,98,111,34,0,0,240,0 ; (#R51253) Stalactite 44318 DEFB 6,1,53,200,98,104,98,104,34,0,0,240,0 ; (#R51253) Stalactite 44331 DEFB 6,1,53,200,98,113,98,113,34,0,0,240,0 ; (#R51253) Stalactite 44344 DEFB 6,1,53,200,98,116,98,116,34,0,0,240,0 ; (#R51253) Stalactite 44357 DEFB 6,1,53,200,98,121,98,121,34,0,0,240,0 ; (#R51253) Stalactite 44370 DEFB 6,1,53,200,98,123,98,123,34,0,0,240,0 ; (#R51253) Stalactite 44383 DEFB 6,1,53,200,98,124,98,124,34,0,0,240,0 ; (#R51253) Stalactite 44396 DEFB 1,1,193,204,121,115,121,115,18,0,128,192,0 ; (#R52417) Drutt 44409 DEFB 0,0,92,208,121,109,121,110,24,0,128,0,0 ; (#R53340) Worm 44422 DEFB 1,1,236,197,113,122,121,129,33,3,0,192,0 ; (#R50668) Level 2 Door 44435 DEFB 255 ; End Marker ; Room Dimension Data (Level 2) b44436 DEFB 2,0,31,0,21 ; (01) Door Room 44441 DEFB 2,11,20,0,21 ; (02) Key Room 44446 DEFB 2,0,31,0,21 ; (03) First Apebeast Room 44451 DEFB 2,0,31,0,21 ; (04) Second Apebeast Room 44456 DEFB 2,0,31,0,21 ; (05) Unused (see trivia) 44461 DEFB 2,0,31,0,21 ; (06) Stalactite Room 44466 DEFB 2,0,31,0,21 ; (07) Bubo's Room 44471 DEFB 255 ; End Marker ; Horizontal Room Connectivity Map (Level 2) b44472 DEFB 7,4 ; Bubo's Room and Second Apebeast Room 44474 DEFB 4,3 ; Second Apebeast Room and First Apebeast Room 44476 DEFB 3,6 ; First Apebeast Room and Stalactite Room 44478 DEFB 6,1 ; Stalactite Room and Door Room 44480 DEFB 255,255 ; End Marker ; Unused ; ; Data Block (09) (Level 2) b44482 DEFB 255 ; Vertical Room Connectivity Map (Level 2) b44483 DEFB 2,1 ; Key Room and Door Room 44485 DEFB 255,255 ; End Marker ; State Data for Simple Entities (Level 3) b44487 DEFB 1,2,117,194,100,100 ; (#R49781) Fifteen glowing tangleweeds 44493 DEFB 1,2,137,156,111,101 ; (#R40073) Door Archway 44499 DEFB 1,1,113,198,121,100 ; (#R50801) Floor 44505 DEFB 2,1,113,198,121,100 ; (#R50801) Floor 44511 DEFB 2,2,125,194,100,96 ; (#R49789) Six glowing tangleweeds 44517 DEFB 2,2,117,194,100,121 ; (#R49781) Fifteen glowing tangleweeds 44523 DEFB 3,1,113,198,121,100 ; (#R50801) Floor 44529 DEFB 3,2,133,194,100,100 ; (#R49797) Twenty two glowing tangleweeds (full screen width) 44535 DEFB 4,1,113,198,121,79 ; (#R50801) Floor 44541 DEFB 4,1,113,198,121,119 ; (#R50801) Floor 44547 DEFB 4,2,125,194,100,100 ; (#R49789) Six glowing tangleweeds 44553 DEFB 4,2,117,194,100,119 ; (#R49781) Fifteen glowing tangleweeds 44559 DEFB 5,2,133,194,100,99 ; (#R49797) Twenty two glowing tangleweeds (full screen width) 44565 DEFB 5,1,113,198,121,73 ; (#R50801) Floor 44571 DEFB 5,1,113,198,121,121 ; (#R50801) Floor 44577 DEFB 6,2,133,194,100,100 ; (#R49797) Twenty two glowing tangleweeds (full screen width) 44583 DEFB 6,1,113,198,121,100 ; (#R50801) Floor 44589 DEFB 7,2,133,194,100,100 ; (#R49797) Twenty two glowing tangleweeds (full screen width) 44595 DEFB 7,1,113,198,121,119 ; (#R50801) Floor 44601 DEFB 7,1,113,198,121,79 ; (#R50801) Floor 44607 DEFB 254 ; End Marker ; State Data for Complex Entities (Level 3) b44608 DEFB 1,2,241,197,112,102,120,109,33,4,0,192,0 ; (#R50673) Level 3 Door 44621 DEFB 2,1,47,194,100,89,100,104,130,0,0,240,0 ; (#R49711) Ceiling (left section) 44634 DEFB 2,1,47,194,100,121,100,131,130,0,0,240,0 ; (#R49711) Ceiling (right section) 44647 DEFB 2,2,174,156,107,118,108,122,35,0,0,240,0 ; (#R40110) Platform 44660 DEFB 2,2,112,198,107,113,108,117,129,0,0,240,0 ; (#R50800) Marker (makes Berk and Drutt fall) 44673 DEFB 2,2,112,198,107,123,108,127,129,0,0,240,0 ; (#R50800) Marker (makes Berk and Drutt fall) 44686 DEFB 2,2,112,198,108,118,109,122,130,0,0,240,0 ; (#R50800) Marker (makes Berk and Drutt bounce off or bang ; head) 44699 DEFB 2,2,104,156,100,104,121,104,30,0,0,48,0 ; (#R40040) Vertical wall 44712 DEFB 3,1,41,194,100,100,100,131,130,0,0,240,0 ; (#R49705) Ceiling (full width) 44725 DEFB 4,1,47,194,100,95,100,110,130,0,0,240,0 ; (#R49711) Ceiling (left section) 44738 DEFB 4,1,47,194,100,119,100,131,130,0,0,240,0 ; (#R49711) Ceiling (right section) 44751 DEFB 4,2,104,156,100,119,121,119,30,0,0,48,0 ; (#R40040) Vertical wall 44764 DEFB 5,1,112,198,120,105,121,120,129,0,0,240,0 ; (#R50800) Marker (makes Berk and Drutt fall) 44777 DEFB 5,1,41,194,100,102,100,131,130,0,0,240,0 ; (#R49705) Ceiling (full width) 44790 DEFB 4,1,130,160,121,111,121,118,30,0,0,0,0 ; (#R41090) Hatch (closed) 44803 DEFB 6,2,202,156,115,106,115,110,32,0,0,128,0 ; (#R40138) Red coloured creature's slot (see trivia) 44816 DEFB 6,2,207,156,115,113,115,117,32,0,0,128,0 ; (#R40143) Yellow coloured creature's slot (see trivia) 44829 DEFB 6,2,212,156,115,120,115,124,32,0,0,128,0 ; (#R40148) White coloured creature's slot (see trivia) 44842 DEFB 7,1,112,198,120,111,121,118,129,0,0,240,0 ; (#R50800) Marker (makes Berk and Drutt fall) 44855 DEFB 1,1,226,222,115,102,121,107,31,18,128,192,0 ; (#R57058) Berk 44868 DEFB 3,2,3,158,122,113,135,118,26,0,128,0,0 ; (#R40451) Large yellow creature 44881 DEFB 6,1,128,157,93,125,95,29,30,0,128,240,0 ; (#R40320) Clawed foot 44894 DEFB 6,1,92,157,118,108,121,108,15,0,128,192,0 ; (#R40284) White coloured creature 44907 DEFB 6,1,62,157,118,115,121,115,13,0,128,192,0 ; (#R40254) Red coloured creature 44920 DEFB 6,1,77,157,118,122,121,122,14,0,128,192,0 ; (#R40269) Yellow coloured creature 44933 DEFB 2,2,215,160,118,121,120,123,12,0,128,240,0 ; (#R41175) Weight (see trivia) 44946 DEFB 3,2,0,157,120,109,120,110,10,0,148,240,0 ; (#R40192) Edible eyes (Floating, duration = 20) 44959 DEFB 7,2,0,157,120,126,120,127,5,0,130,240,0 ; (#R40192) Edible eyes (Flying, duration = 2) 44972 DEFB 6,1,0,157,90,127,90,128,6,0,131,240,0 ; (#R40192) Edible eyes (Flying, duration = 3) 44985 DEFB 4,2,0,157,120,122,120,123,11,0,131,240,0 ; (#R40192) Edible eyes (Invisibility, duration = 3) 44998 DEFB 1,1,193,204,121,115,121,115,18,0,160,192,0 ; (#R52417) Drutt 45011 DEFB 4,2,104,198,108,127,108,128,17,0,128,240,0 ; (#R50792) Key 45024 DEFB 0,0,92,208,121,109,121,110,24,0,128,0,0 ; (#R53340) Worm 45037 DEFB 5,1,104,156,100,100,121,100,128,0,0,240,0 ; (#R40040) Vertical wall 45050 DEFB 1,1,104,156,100,100,121,100,128,0,0,240,0 ; (#R40040) Vertical wall 45063 DEFB 4,1,104,156,100,131,121,131,128,0,0,240,0 ; (#R40040) Vertical wall 45076 DEFB 4,2,112,198,120,129,120,131,50,0,0,48,0 ; (#R50800) Marker (makes Drutt swap depth levels) 45089 DEFB 4,1,112,198,121,129,121,131,50,0,0,48,0 ; (#R50800) Marker (makes Drutt swap depth levels) 45102 DEFB 7,1,104,156,100,131,121,131,128,0,0,240,0 ; (#R40040) Vertical wall 45115 DEFB 255 ; End Marker ; Room Dimension Data (Level 3) b45116 DEFB 2,16,31,0,21 ; (01) Door Room 45121 DEFB 2,0,31,0,21 ; (02) Weight Room 45126 DEFB 2,0,31,0,21 ; (03) Large Yellow Creature Room 45131 DEFB 2,0,31,0,21 ; (04) Hatch Room 45136 DEFB 2,0,31,0,21 ; (05) Room above Weight Room 45141 DEFB 2,0,31,0,21 ; (06) Coloured Creatures' Room 45146 DEFB 2,0,31,0,21 ; (07) Room above Hatch Room 45151 DEFB 255 ; End Marker ; Horizontal Room Connectivity Map (Level 3) b45152 DEFB 1,2 ; Door Room and Weight Room 45154 DEFB 2,3 ; Weight Room and Large Yellow Creature Room 45156 DEFB 3,4 ; Large Yellow Creature Room and Hatch Room 45158 DEFB 5,6 ; Room above Weight Room and Coloured Creatures' Room 45160 DEFB 6,7 ; Coloured Creatures' Room and room above Hatch Room 45162 DEFB 255,255 ; End Marker ; Unused ; ; Data Block (09) (Level 3) b45164 DEFB 255 ; Vertical Room Connectivity Map (Level 3) b45165 DEFB 5,2 ; Room above Weight Room and Weight Room 45167 DEFB 7,4 ; Room above Hatch Room and Hatch Room 45169 DEFB 255,255 ; End Marker ; State Data for Simple Entities (Level 4) b45171 DEFB 1,2,26,192,100,126 ; (#R49178) Left brickwork 45177 DEFB 1,2,240,195,121,100 ; (#R50126) Single arch 45183 DEFB 2,1,240,195,121,100 ; (#R50126) Single arch 45189 DEFB 2,2,133,191,100,100 ; (#R49029) Double Row of Green Bricks (full width) 45195 DEFB 2,2,26,192,100,107 ; (#R49178) Left brickwork 45201 DEFB 2,2,26,192,100,125 ; (#R49178) Left brickwork 45207 DEFB 3,2,133,191,100,100 ; (#R49029) Double Row of Green Bricks (full width) 45213 DEFB 3,2,26,192,100,114 ; (#R49178) Left brickwork 45219 DEFB 3,1,240,195,121,100 ; (#R50126) Single arch 45225 DEFB 4,2,5,193,117,123 ; (#R49413) Single wide brick 45231 DEFB 4,2,133,191,100,100 ; (#R49029) Double Row of Green Bricks (full width) 45237 DEFB 4,1,62,196,121,99 ; (#R50238) Left part of floor 45243 DEFB 4,1,35,196,121,121 ; (#R50211) Right part of floor 45249 DEFB 5,1,240,195,121,100 ; (#R50126) Single arch 45255 DEFB 5,1,176,193,97,100 ; (#R49584) Vertical red bar (outside normal game area) 45261 DEFB 5,1,176,193,102,127 ; (#R49584) Vertical red bar (outside normal game area) 45267 DEFB 5,1,81,193,117,100 ; (#R49489) Snake's Brickwork 45273 DEFB 254 ; End Marker ; State Data for Complex Entities (Level 4) b45274 DEFB 1,1,112,198,100,100,101,111,130,0,0,240,0 ; (#R50800) Marker (makes Berk and Drutt bounce off or bang ; head) 45287 DEFB 1,1,112,198,100,119,101,131,130,0,0,240,0 ; (#R50800) Marker (makes Berk and Drutt bounce off or bang ; head) 45300 DEFB 5,1,208,191,100,95,101,110,130,0,0,240,0 ; (#R49104) Two rows of horizontal brickwork (half-width, 1) 45313 DEFB 5,1,139,191,100,121,101,131,130,0,0,240,0 ; (#R49035) Two rows of horizontal brickwork (half-width, 2) 45326 DEFB 5,1,112,198,120,100,121,109,50,0,0,48,0 ; (#R50800) Marker (makes Drutt swap depth levels) 45339 DEFB 5,1,112,198,121,122,121,131,50,0,0,48,0 ; (#R50800) Marker (makes Drutt swap depth levels) 45352 DEFB 5,2,112,198,120,107,120,109,50,0,0,48,0 ; (#R50800) Marker (makes Drutt swap depth levels) 45365 DEFB 5,2,112,198,120,120,120,124,50,0,0,48,0 ; (#R50800) Marker (makes Drutt swap depth levels) 45378 DEFB 4,1,112,198,121,127,121,131,50,0,0,48,0 ; (#R50800) Marker (makes Drutt swap depth levels) 45391 DEFB 1,1,84,224,115,102,121,107,31,18,128,192,0 ; (#R57428) Berk 45404 DEFB 3,1,149,167,110,128,121,129,36,0,128,192,0 ; (#R42901) Skeleton 45417 DEFB 3,0,141,196,0,0,0,0,19,0,128,240,2 ; (#R50317) Boni 45430 DEFB 4,2,128,196,113,125,116,126,21,0,128,240,0 ; (#R50304) Fake Boni 45443 DEFB 1,1,193,204,121,115,121,115,18,0,160,192,0 ; (#R52417) Drutt 45456 DEFB 4,2,104,198,114,118,114,119,17,0,128,240,0 ; (#R50792) Key 45469 DEFB 0,0,92,208,121,109,121,110,24,0,128,0,0 ; (#R53340) Worm 45482 DEFB 3,1,114,200,110,108,114,110,30,0,0,48,0 ; (#R51314) Flying Skeleton Creature 45495 DEFB 5,1,152,166,119,83,119,101,30,0,128,0,0 ; (#R42648) Snake 45508 DEFB 1,1,34,166,118,122,121,124,20,0,128,240,0 ; (#R42530) Cannon 45521 DEFB 2,2,112,198,104,107,104,107,40,0,128,0,0 ; (#R50800) 1st drip from left (Red Sausage Room) 45534 DEFB 2,2,112,198,105,110,105,110,41,0,128,0,0 ; (#R50800) 2nd drip from left (Red Sausage Room) 45547 DEFB 2,2,112,198,102,115,102,115,43,0,128,0,0 ; (#R50800) 3rd drip from left (Red Sausage Room) 45560 DEFB 2,2,112,198,103,120,103,120,44,0,128,0,0 ; (#R50800) 4th drip from left (Red Sausage Room) 45573 DEFB 2,2,112,198,104,128,104,128,45,0,128,0,0 ; (#R50800) 5th drip from left (Red Sausage Room) 45586 DEFB 3,2,112,198,104,113,104,113,46,0,128,0,0 ; (#R50800) Drip (Skeleton's Room) 45599 DEFB 0,0,112,198,0,0,0,0,30,0,128,0,0 ; (#R50800) Cannon's Projectile 45612 DEFB 2,1,120,168,121,110,121,111,3,0,128,240,0 ; (#R43128) Red Sausage (Jumping, duration = permanent) 45625 DEFB 4,1,129,168,121,124,121,125,7,0,134,240,0 ; (#R43137) Cyan Sausage (Flying, duration = 6) 45638 DEFB 5,2,129,168,120,111,120,112,8,0,131,240,0 ; (#R43137) Cyan Sausage (Flying, duration = 3) 45651 DEFB 1,1,246,197,113,102,121,109,33,1,0,192,0 ; (#R50678) Door 45664 DEFB 1,1,21,192,100,100,121,101,128,0,0,240,0 ; (#R49173) Yellow brick column 45677 DEFB 1,1,21,192,110,109,121,110,30,0,0,0,0 ; (#R49173) Yellow brick column 45690 DEFB 1,1,163,193,112,102,112,102,30,0,0,0,0 ; (#R49571) Long yellow brick 45703 DEFB 2,1,240,192,115,131,118,132,128,0,0,240,0 ; (#R49392) Blue and Red Mini Wall 45716 DEFB 3,1,240,192,115,99,118,100,128,0,0,240,0 ; (#R49392) Blue and Red Mini Wall 45729 DEFB 3,1,240,192,115,131,118,132,128,0,0,240,0 ; (#R49392) Blue and Red Mini Wall 45742 DEFB 4,1,240,192,115,99,118,101,128,0,0,240,0 ; (#R49392) Blue and Red Mini Wall 45755 DEFB 4,1,112,198,120,111,121,120,129,0,0,240,0 ; (#R50800) Marker (makes Berk and Drutt fall) 45768 DEFB 4,1,21,192,102,109,121,110,30,0,0,0,0 ; (#R49173) Yellow brick column 45781 DEFB 4,1,21,192,101,131,121,132,30,0,0,0,0 ; (#R49173) Yellow brick column 45794 DEFB 4,1,2,167,111,121,114,122,30,0,0,0,0 ; (#R42754) Ghost 45807 DEFB 5,1,112,198,100,100,101,110,130,0,0,240,0 ; (#R50800) Marker (makes Berk and Drutt bounce off or bang ; head) 45820 DEFB 5,1,112,198,100,121,101,131,130,0,0,240,0 ; (#R50800) Marker (makes Berk and Drutt bounce off or bang ; head) 45833 DEFB 5,1,127,193,102,104,121,106,128,0,0,16,0 ; (#R49535) Left wall, short 45846 DEFB 5,1,145,193,102,125,121,127,128,0,0,32,0 ; (#R49553) Right wall, long 45859 DEFB 255 ; End Marker ; Room Dimension Data (Level 4) b45860 DEFB 2,0,31,0,21 ; (01) Door Room 45865 DEFB 2,0,31,0,21 ; (02) Five Drips Room 45870 DEFB 2,0,31,0,21 ; (03) Skeleton's Room 45875 DEFB 2,0,31,0,21 ; (04) Fake Boni's Room 45880 DEFB 2,0,31,0,21 ; (05) Pit 45885 DEFB 255 ; End Marker ; Horizontal Room Connectivity Map (Level 4) b45886 DEFB 1,2 ; Door Room and Five Drips Room 45888 DEFB 2,3 ; Five Drips Room and Skeleton's Room 45890 DEFB 3,4 ; Skeleton's Room and Fake Boni's Room 45892 DEFB 255,255 ; End Marker ; Unused ; ; Data Block (09) (Level 4) b45894 DEFB 255 ; Vertical Room Connectivity Map (Level 4) b45895 DEFB 4,5 ; Fake Boni's Room and Pit 45897 DEFB 255,255 ; End Marker ; Populate Primary Display Buffer with Layout Data for Current Character's Current Room ; ; Used by the routine at #R34438. c45899 LD HL,(34279) ; Modify instruction at #R46045 with address of Primary Display Buffer... 45902 LD (46046),HL ; ... 45905 LD A,(34230) ; Load C with depth of current character's current room... 45908 LD C,A ; ... 45909 LD A,(34218) ; Load B with index of current character's current room... 45912 LD B,A ; ... 45913 LD D,0 ; Load D with zero ; Start drawing simple entities *45915 LD IX,(34236) ; Load IX with start address of current level's simple state data 45919 LD E,6 ; Load DE with 6 (as simple state data entries are 6 bytes wide) *45921 LD A,(IX+0) ; Load first byte of current simple state data entry into A 45924 CP 255 ; If this is 255 (end marker for complex state data)... 45926 JR Z,45961 ; ...then skip ahead to #R45961 45928 CP 254 ; If it is not 254 (end marker for level's simple state data)... 45930 JR NZ,45939 ; ...then skip ahead to #R45939 ; At this point, we have passed the end marker for the simple state data block and are now at the start of the ; complex state data block whose entries are 13 bytes wide. 45932 LD E,13 ; Load DE with 13 45934 INC IX ; Advance IX to start of complex state data block 45936 LD A,(IX+0) ; Load A with entity's room index ; At this point, A holds the index of the room to which the simple or complex entity belongs *45939 CP B ; If entity's room is not the same as the current character's current room... 45940 JR NZ,45957 ; ...then skip ahead to #R45957 45942 LD A,C ; If entity's depth is not the same as current depth in C... 45943 CP (IX+1) ; ... 45946 JR NZ,45957 ; ...then skip ahead to #R45957 45948 EXX ; Switch registers 45949 PUSH IX ; Store IX (pointer to current entry in simple/complex state data) 45951 CALL 45965 ; Load Primary Display Buffer with graphic layout data for current entity 45954 POP IX ; Restore IX (pointer to current entry in simple/complex state data) 45956 EXX ; Switch registers *45957 ADD IX,DE ; Advance IX to next entity's state data 45959 JR 45921 ; Loop back to #R45921 *45961 DEC C ; Decrease current depth (i.e. closer to screen) 45962 JR NZ,45915 ; If depth is not zero (i.e. still depth levels to process) then loop back to #R45915 45964 RET ; Return ; Populate Primary Display Buffer with Graphic Layout Data for Entity Whose Simple / Complex State Data is at ; Address in IX ; ; Used by the routine at #R45899. Input: IX Address of complex state data for an entity IX (Entry at #R45999, ; #R46001 or #R46003 only) Address of graphic layout data to draw B (Entry at #R45999, #R46001 or #R46003 only) 0 ; if current position in Display Buffer needs to be recalculated. 1 otherwise. c45965 LD E,(IX+2) ; Load DE with address of graphic layout data for entity... 45968 LD D,(IX+3) ; ... 45971 LD A,(34233) ; Load A with y-coordinate of top edge of current character's current room... 45974 ADD A,(IX+4) ; ...add y-coordinate of graphic element to draw as offset... 45977 SUB 100 ; ...subtract 100... 45979 LD L,A ; ...and load into L 45980 LD A,(34231) ; Load A with x-coordinate of left edge of current character's current room... 45983 ADD A,(IX+5) ; ...add x-coordinate of graphic element to draw as offset... 45986 SUB 100 ; ...subtract 100... 45988 LD H,A ; ...and load into H 45989 LD (34281),HL ; Store x- and y-coordinates at #R34281 45992 PUSH DE ; Transfer address of graphic layout data in simple/complex state data from DE... 45993 POP IX ; ...into IX 45995 LD B,0 ; Reset Do Not Recalculate Display Buffer Address Flag, as address not yet calculated 45997 JR 46003 ; Jump to #R46003 (read / process data at address in IX) ; This entry point is used by the routines at #R46427, #R46442, #R46460 and #R46599. *45999 INC IX ; Advance IX by one byte ; This entry point is used by the routines at #R46284, #R46295 and #R46306. *46001 INC IX ; Advance IX by one byte ; This entry point is used by the routines at #R46317, #R46347, #R46363, #R46460, #R46481, #R46495, #R46611, ; #R46628, #R46647 and #R46664. *46003 LD A,(IX+0) ; If first byte of graphic layout data entry is at least 236... 46006 CP 236 ; ...i.e. IX points to an instruction... 46008 JP NC,46218 ; ...then jump to appropriate graphic layout routine ; At this point, the graphic layout data pointed to by IX is graphical data, not an instruction. We only draw the ; graphics if they lie within the display area (i.e. have x- and y-coordinates less than 32 and 24 respectively, see ; trivia). 46011 LD A,H ; If x-coordinate of graphic to draw is 32 or more... 46012 CP 32 ; ... 46014 JP NC,46151 ; ...then skip ahead to #R46151 46017 LD A,L ; If y-coordinate of graphic to draw is 24 or more... 46018 CP 24 ; ... 46020 JP NC,46151 ; ...then skip ahead to #R46151 46023 PUSH HL ; Store HL (H = x-coordinate to draw to, L = y-coordinate to draw to) 46024 DEC B ; Decrease value of Don't Recalculate Display Buffer Address Flag 46025 JP Z,46051 ; If B is zero (i.e. we don't need to recalculate current position in display buffer), then ; skip ahead to #R46051 ; If B was 1, then we need to load DE with the address of the current position in the Primary Display Buffer. 46028 LD A,H ; Load C with three times entity's x-coordinate... 46029 ADD A,A ; ... 46030 ADD A,H ; ... 46031 LD C,A ; ... 46032 LD A,L ; Load DE with double entity's y-coordinate... 46033 ADD A,A ; ... 46034 LD E,A ; ... 46035 LD D,0 ; ... 46037 LD B,D ; Set B to zero (BC now holds three times x-coordinate) 46038 LD HL,46170 ; Point HL at start of Table of Multiples of 96 46041 ADD HL,DE ; Add double y-coordinate as offset 46042 LD E,(HL) ; Load DE with corresponding multiple of 96... 46043 INC HL ; ... 46044 LD D,(HL) ; ... ; The operand of the instruction at #R46045 represents the address of the Primary Display Buffer. This is modified ; by the instruction at #R45902. 46045 LD HL,0 ; Load HL with start address of Primary Display Buffer 46048 ADD HL,DE ; Move HL to position in Primary Display Buffer corresponding to x- and y-coordinates of ; entity... 46049 ADD HL,BC ; ... 46050 EX DE,HL ; Switch DE (now points to position in Primary Display Buffer for current entity) and HL *46051 LD A,(DE) ; Load A with Graphic Set Index plus one from this entry in Primary Display Buffer... 46052 INC A ; ...and if value is now zero (i.e. old value was 255 corresponding to a block outside ; dimensions of room)... 46053 JP Z,46150 ; ...then skip ahead to #R46150 46056 LD A,(34268) ; Load current Graphic Set Index into this location in Primary Display Buffer... 46059 LD (DE),A ; ... 46060 INC DE ; Advance to Graphic Index in current character block's entry in Primary Display Buffer 46061 LD A,(IX+0) ; Load Graphic Index into current Display Buffer location... 46064 LD (DE),A ; ... 46065 INC DE ; Advance to next byte in current character block's display buffer entry (Attribute) 46066 LD A,(34270) ; Load Current Attribute into A... 46069 OR A ; ...and if not zero... 46070 JR NZ,46077 ; ...then skip ahead to #R46077 ; Current Attribute is zero (i.e. not set) so DE points to attribute data 46072 INC IX ; Advance IX to next byte in graphic layout data (attribute)... 46074 LD A,(IX+0) ; ...and load into A ; At this point, A holds an attribute value either from the graphic layout data, or the Current Attribute as stored ; at #R34270. This attribute is to be applied to the current display buffer location. IX (current position in ; graphic layout data) is pointing to either the graphic index (if the Current Attribute at #R34270 is set) or the ; attribute data (if the Current Attribute is not set). In either case, IX+1 is the address of the Cursor Shift ; byte. Bit 7 of the Cursor Shift byte is the Override Attribute Flag. *46077 BIT 7,(IX+1) ; If bit 7 (Override Attribute Flag) is set... 46081 JP NZ,46111 ; ...then skip ahead to #R46111 ; Override Attribute Flag reset 46084 LD L,A ; Load L with attribute value 46085 AND 56 ; Check PAPER bits 46087 LD A,L ; Restore attribute value to A 46088 JP NZ,46111 ; If PAPER is not zero (i.e. black) then skip ahead to #R46111 ; The instructions between #R46091 and #R46110 (inclusive) are executed only when the PAPER component of the ; attribute in A (and L) is black. If the Preserve INK Flag is reset in the attribute value loaded (at #R46098) from ; the Display Buffer, then the instruction at #R46107 will leave the reset (i.e. black) PAPER bits in A. If the ; Preserve INK Flag is set, then the instructions between #R46104 and #R46106 (inclusive) will shift the bits used ; for INK into the PAPER positions and this PAPER colour (originally INK colour) will be preserved when the ; instruction at #R46107 is executed. 46091 AND 192 ; Reset all bits except Preserve INK and Mirror flags 46093 LD B,A ; Load B with Preserve INK and Mirror flags 46094 LD A,L ; Restore attribute value to A 46095 AND 63 ; Reset bits Preserve INK and Mirror flags 46097 LD C,A ; Load C with INK and PAPER bits of attribute value 46098 LD A,(DE) ; Load value currently in Display Buffer into A... 46099 BIT 6,A ; ...and if Preserve INK Flag is reset... 46101 JP Z,46107 ; ...then skip ahead to #R46107 ; Preserve INK Flag set in Display Buffer 46104 ADD A,A ; Shift INK bits into PAPER bits... 46105 ADD A,A ; ... 46106 ADD A,A ; ... *46107 AND 56 ; Reset all except PAPER bits 46109 OR B ; (Re)set Preserve INK and Mirror flags as stored in B previously 46110 OR C ; Set INK bits as stored in C previously (PAPER was black) *46111 LD (DE),A ; Load attribute in A into Display Buffer 46112 POP HL ; Restore HL (H = x-coordinate to draw to, L = y-coordinate to draw to) ; Read Cursor Shift byte. Bits 0-6 of this byte control where the cursor to write to Primary Display Buffer is moved ; to after writing the current character block. A value of 33 advances the cursor right by one character. A value, ; n, less than 33 moves the cursor down a character row, and left by 33-(n+1) characters. A value greater than 33 ; moves the cursor right by (n+1)-33 characters. Bit 7 is the Override Attribute Flag. 46113 LD A,(IX+1) ; Load A with Cursor Shift byte... 46116 CP 255 ; ...and if this is 255 (End Marker)... 46118 JP Z,46418 ; ...then jump to #R46418 (load HL with stored coordinates from #R34281 and return from ; drawing) 46121 AND 127 ; Reset bit 7 (Override Attribute Flag) 46123 SUB 33 ; Subtract 33, and if remaining value is 0 (i.e. original value was 33)... 46125 JP Z,46140 ; ...then skip ahead to #R46140... *46128 JP NC,46132 ; ...else, if value was greater than 33 then skip ahead to #R46132 ; Cursor Shift byte was less than 33 (move the cursor down a character row, and left by 33-(n+1) characters) 46131 INC L ; Increase y-coordinate *46132 INC A ; Increase A (x-coordinate offset) and add to x-coordinate... 46133 ADD A,H ; ... 46134 LD H,A ; ... *46135 LD B,0 ; Prepare to recalculate Display Buffer address as change in coordinates is non-trivial 46137 JP 45999 ; Advance graphic layout data pointer by two bytes and read / process next data ; Cursor Shift byte was 33 (move the cursor right by one character) *46140 INC DE ; Advance pointer to start of next entry in Primary Display Buffer 46141 INC H ; Increase x-coordinate by one 46142 JP Z,46135 ; If x-coordinate is zero then jump back to #R46135 (see trivia) 46145 LD B,1 ; Prepare to skip over recalculation of Display Buffer address as we moved right one character 46147 JP 45999 ; Advance graphic layout data pointer by two bytes and read / process next data ; First byte in Primary Display Buffer entry for current position is 255 (i.e. outside dimensions of room) *46150 POP HL ; Restore HL (H = x-coordinate to draw to, L = y-coordinate to draw to) *46151 LD A,(34270) ; Load Current Attribute into A... 46154 OR A ; ...and if not zero... 46155 JP NZ,46160 ; ...then skip ahead to #R46160 46158 INC IX ; Advance IX to next byte in graphic layout data (attribute) *46160 LD A,(IX+1) ; Load A with Cursor Shift byte... 46163 AND 127 ; Reset bit 7 (Override Attribute Flag) 46165 SUB 33 ; Subtract 33... 46167 JP 46128 ; ...and jump back to #R46128 to update current drawing position ; Table of Multiples of 96 ; ; Used in calculating position in Display Buffer data for a given y-coordinate (as Display Buffer data is 3 bytes ; per character block, so 1 character row's worth of data is 3 x 32 = 96 bytes b46170 DEFW 0 46172 DEFW 96 46174 DEFW 192 46176 DEFW 288 46178 DEFW 384 46180 DEFW 480 46182 DEFW 576 46184 DEFW 672 46186 DEFW 768 46188 DEFW 864 46190 DEFW 960 46192 DEFW 1056 46194 DEFW 1152 46196 DEFW 1248 46198 DEFW 1344 46200 DEFW 1440 46202 DEFW 1536 46204 DEFW 1632 46206 DEFW 1728 46208 DEFW 1824 46210 DEFW 1920 46212 DEFW 2016 46214 DEFW 2112 46216 DEFW 2208 ; Jump to Appropriate Graphic Layout Routine ; ; Used by the routine at #R45965. Input: A Index of graphic layout data instruction IX Address of current graphic ; layout data instruction c46218 INC IX ; Advance IX to first parameter byte in graphic layout data 46220 SUB 236 ; Subtract 236 to get zero-based index of required instruction 46222 ADD A,A ; Load double index of graphic layout data instruction into BC... 46223 LD C,A ; ... 46224 LD B,0 ; ... 46226 PUSH HL ; Store HL 46227 LD HL,46244 ; Point HL at start of Table of Addresses of Graphic Layout Data Handling Routines 46230 ADD HL,BC ; Add doubled instruction index as offset to HL to point to address of required routine 46231 LD A,(HL) ; Modify JP instruction at #R46241 with this address... 46232 LD (46242),A ; ... 46235 INC HL ; ... 46236 LD A,(HL) ; ... 46237 LD (46243),A ; ... 46240 POP HL ; Restore HL ; The operand of the instruction at #R46241 represents the addresses of the required graphic layout data handling ; routine. This is modified by the instruction at #R46232. 46241 JP 0 ; Jump to appropriate instruction handling routine ; Table of Addresses of Graphic Layout Data Handling Routines ; ; Graphic layout data is stored in the form of encoded instructions. Generally an instruction is simply to display a ; graphic of given index with a given attribute and then to advance the position of the drawing "cursor". If the ; first byte (normally the graphic index) is 236 or greater, however, then we are dealing with a special ; instruction; the values 236 and above can be considered to be opcodes. These opcodes correspond to calls/jumps to ; routines at addresses stored in this table. The opcodes all take different combinations of parameters. b46244 DEFW 46317 ; (236) 46246 DEFW 46284 ; (237) 46248 DEFW 46611 ; (238) 46250 DEFW 46628 ; (239) 46252 DEFW 46647 ; (240) 46254 DEFW 46664 ; (241) 46256 DEFW 46295 ; (242) 46258 DEFW 46559 ; (243) 46260 DEFW 46306 ; (244) 46262 DEFW 46347 ; (245) 46264 DEFW 46363 ; (246) 46266 DEFW 46577 ; (247) 46268 DEFW 46481 ; (248) 46270 DEFW 46495 ; (249) 46272 DEFW 46427 ; (250) 46274 DEFW 46460 ; (251) 46276 DEFW 46599 ; (252) 46278 DEFW 46594 ; (253) 46280 DEFW 46442 ; (254) 46282 DEFW 46418 ; (255) ; Graphic Layout Routine (237) Set New Pending Sound Input: IX Address of first parameter in current graphic ; layout data instruction Output: B Do Not Recalculate Display Buffer Address Flag (0) c46284 LD A,(IX+0) ; Load current byte of graphic layout data into A 46287 CALL 59613 ; Set pending sound index to A if it is currently zero, or lower priority 46290 LD B,0 ; Prepare to recalculate Display Buffer address 46292 JP 46001 ; Advance graphic layout data pointer by one byte and read / process next data ; Graphic Layout Routine (242) Set Current Attribute Input: IX Address of first parameter in current graphic ; layout data instruction Output: B Do Not Recalculate Display Buffer Address Flag (0) c46295 LD A,(IX+0) ; Load current byte of graphic layout data... 46298 LD (34270),A ; ...and set as current Attribute 46301 LD B,0 ; Prepare to recalculate Display Buffer address 46303 JP 46001 ; Advance graphic layout data pointer by one byte and read / process next data ; Graphic Layout Routine (244) Set Current Graphic Set Index Input: IX Address of first parameter in current ; graphic layout data instruction Output: B Do Not Recalculate Display Buffer Address Flag (0) c46306 LD A,(IX+0) ; Load current byte of graphic layout data... 46309 LD (34268),A ; ...and set as current Graphic Set Index 46312 LD B,0 ; Prepare to recalculate Display Buffer address 46314 JP 46001 ; Advance graphic layout data pointer by one byte and read / process next data ; Graphic Layout Routine (236) Set Graphic Index in Next Instruction to Value Randomly Selected from List ; ; Read Current Byte (n, random number cap), generate random number m (1 to n inclusive) and copy the m-th byte in ; following list into position after end of list bytes (i.e. the graphic index field of the next graphic layout data ; entry), then advance current position to this location. Input: IX Address of first parameter in current graphic ; layout data instruction Output: B Do Not Recalculate Display Buffer Address Flag (0) IX Address of next graphic ; layout data instruction to process c46317 PUSH IX ; Store current position in graphic layout data 46319 LD A,(IX+0) ; Load current byte (Random Number Cap) from graphic layout data into A... 46322 LD E,A ; ...and copy into E 46323 CALL 54222 ; Load BC with a random number, 1-A... 46326 INC A ; ... 46327 LD C,A ; ... 46328 LD B,0 ; ... 46330 ADD IX,BC ; Advance IX by number of bytes stored in BC 46332 LD A,(IX+0) ; Load byte at this location into A 46335 POP IX ; Restore previous position in graphic layout data 46337 LD C,E ; Load Random Number Cap into BC... 46338 INC C ; ...and add one 46339 ADD IX,BC ; Advance IX by this number of bytes 46341 LD (IX+0),A ; Store byte previously read at current position 46344 JP 46003 ; Read / process data at address in IX ; Graphic Layout Routine (245) Decrease Timer Value, and if Zero, Reset and Write Random Graphic Index from List ; into Next Instruction ; ; Decrease timer value (1st parameter). If now zero, then reset timer to value in 2nd parameter, then load one of ; the n (3rd parameter) following values chosen at random into the Graphic Index field of the next instruction. ; Input: IX Address of first parameter in current graphic layout data instruction Output: B Do Not Recalculate ; Display Buffer Address Flag (0) IX Address of next graphic layout data instruction to process c46347 LD B,0 ; Prepare to recalculate Display Buffer address 46349 DEC (IX+0) ; Decrease timer value 46352 JR NZ,46370 ; If timer is not zero, then advance IX to start of next instruction and process 46354 CALL 46385 ; Reset timer to maximum, advance IX to start of next instruction and set value here (graphic ; index) to random value from sequence of data following previous instruction... 46357 LD (IX+0),E ; ... 46360 JP 46003 ; Read / process data at address in IX ; Graphic Layout Routine (246) Decrease Timer Value, and if Zero, Reset and Write Random Attribute from List into ; Next Instruction ; ; Decrease timer value (1st parameter). If now zero, then reset timer to value in 2nd parameter, then load one of ; the n (3rd parameter) following values chosen at random into the Attribute field of the next instruction. Input: ; IX Address of first parameter in current graphic layout data instruction Output: B Do Not Recalculate Display ; Buffer Address Flag (0) IX Address of next graphic layout data instruction to process c46363 LD B,0 ; Prepare to recalculate Display Buffer address 46365 DEC (IX+0) ; Decrease timer value 46368 JR Z,46376 ; If timer is zero, then reset timer, advance to next instruction and set that instruction's ; attribute to random value from sequence ; This entry point is used by the routine at #R46347. *46370 CALL 46409 ; Advance to next instruction and process... 46373 JP 46003 ; ... *46376 CALL 46385 ; Reset timer to maximum, advance IX to start of next instruction and set second value here ; (attribute) to random value from sequence of data following previous instruction... 46379 LD (IX+1),E ; ... 46382 JP 46003 ; Read / process data at address in IX ; Reset Timer to Initial Value then Load E with Random Value from Sequence (in Graphic Layout Data) ; ; Used by the routines at #R46347 and #R46363. Input: B Always zero IX Current address in graphic layout data c46385 LD A,(IX+1) ; Set current timer value to maximum... 46388 LD (IX+0),A ; ... 46391 LD A,(IX+2) ; Load A with number of states 46394 CALL 54222 ; Set C to a random number between 3 and (number of states + 2)... 46397 ADD A,3 ; ... 46399 LD C,A ; ... 46400 PUSH IX ; Store IX (current position in graphic layout data) 46402 ADD IX,BC ; Advance IX by C bytes (BC = C, as B = 0) 46404 LD E,(IX+0) ; Load E with value at this position 46407 POP IX ; Restore IX (old position in graphic layout data) ; This entry point is used by the routine at #R46363. *46409 LD A,(IX+2) ; Advance IX by number of states + 3 bytes to arrive at start of next data... 46412 ADD A,3 ; ... 46414 LD C,A ; ... 46415 ADD IX,BC ; ... 46417 RET ; Return ; Graphic Layout Routine (255) Load HL with Stored Coordinates from 34281 and Return from Drawing ; ; Note that when returning from another block of graphic layout data, the Current Attribute stored at #R34270 (and ; set in the called block) is not preserved. Upon returning, the Current Attribute value is cleared. Output: B Do ; Not Recalculate Display Buffer Address Flag (0) H Current x-coordinate L Current y-coordinate c46418 XOR A ; Set Current Attribute to zero... 46419 LD (34270),A ; ... 46422 LD HL,(34281) ; Load HL with base x- and y-coordinates 46425 LD B,A ; Set B to zero 46426 RET ; Return ; Graphic Layout Routine (250) Adjust x- and y-Coordinates for Drawing Without Storing ; ; Read following two bytes in graphic layout data and adjust y- and x-coordinates by these amounts respectively, ; without storing. These new coordinates will be lost on the next draw operation, being overwritten by the values ; stored at #R34281. Input: IX Address of first parameter in current graphic layout data instruction Output: B Do ; Not Recalculate Display Buffer Address Flag (0) c46427 LD A,(IX+0) ; Read delta-y into A... 46430 ADD A,L ; ...and adjust y-coordinate by this amount... 46431 LD L,A ; ... 46432 LD A,(IX+1) ; Read delta-x into A... 46435 ADD A,H ; ...and adjust x-coordinate by this amount... 46436 LD H,A ; ... 46437 LD B,0 ; Prepare to recalculate Display Buffer address 46439 JP 45999 ; Advance graphic layout data pointer by two bytes and read / process next data ; Graphic Layout Routine (254) Adjust x- and y-Coordinates for Drawing and Set as New Base Coordinates ; ; Read following two bytes in graphic layout data and adjust y- and x-coordinates by these amounts respectively, ; storing at #R34281 as base coordinates. These new coordinates will be used as the starting position on the next ; draw operation. Input: H Current x-coordinate L Current y-coordinate IX Address of first parameter in current ; graphic layout data instruction Output: B Do Not Recalculate Display Buffer Address Flag (0) c46442 LD A,(IX+0) ; Read delta-y into A... 46445 ADD A,L ; ...and adjust y-coordinate by this amount... 46446 LD L,A ; ... 46447 LD A,(IX+1) ; Read delta-x into A... 46450 ADD A,H ; ...and adjust x-coordinate by this amount... 46451 LD H,A ; ... 46452 LD (34281),HL ; Store new coordinates at #R34281 46455 LD B,0 ; Prepare to recalculate Display Buffer address 46457 JP 45999 ; Advance graphic layout data pointer by two bytes and read / process next data ; Graphic Layout Routine (251) Process Graphic Layout Data at Following Address and Return When Complete ; ; Functionally equivalent to "CALL" instruction. Read current WORD (address) from graphic layout data, load graphic ; layout data at that address into Primary Display Buffer and return to previous position. Upon returning (via ; routine at #R46418 when a 255 is encountered), the position of the cursor (i.e. the value in HL) is reset to the ; base coordinates as stored at #R34281 - see instruction at #R46422. Input: IX Address of first parameter in ; current graphic layout data instruction Output: B Do Not Recalculate Display Buffer Address Flag (0) c46460 LD C,(IX+0) ; Load BC with destination graphic layout data address... 46463 LD B,(IX+1) ; ... 46466 PUSH IX ; Store IX (current position in graphic layout data) 46468 PUSH BC ; Transfer address just read into BC into IX... 46469 POP IX ; ... 46471 CALL 46003 ; Load graphic layout data from this new location into Primary Display Buffer (recursive call) 46474 POP IX ; Restore IX (previously stored position in graphic layout data) 46476 LD B,0 ; Prepare to recalculate Display Buffer address 46478 JP 45999 ; Advance graphic layout data pointer by two bytes and read / process next data ; Graphic Layout Routine (248) Jump to Graphic Layout Data Address ; ; Read current WORD (address) from graphic layout data and move graphic layout data Pointer to this address. Input: ; IX Address of first parameter in current graphic layout data instruction Output: B Do Not Recalculate Display ; Buffer Address Flag (0) IX Address of next graphic layout data instruction to process c46481 LD C,(IX+0) ; Load next two bytes as a WORD into IX... 46484 LD B,(IX+1) ; ... 46487 PUSH BC ; ... 46488 POP IX ; ... 46490 LD B,0 ; Prepare to recalculate Display Buffer address 46492 JP 46003 ; Read / process data at address in IX ; Graphic Layout Routine (249) Jump to Time-Weighted, Randomly Selected Graphic Layout Data Address in List Input: ; IX Address of first parameter in current graphic layout data instruction Output: B Do Not Recalculate Display ; Buffer Address Flag (0) IX Address of next graphic layout data instruction to process c46495 PUSH IX ; Store IX (pointer to first parameter in graphic layout data) 46497 LD A,(IX+1) ; Load A with current state number 46500 ADD A,A ; Multiply A by four and add two... 46501 ADD A,A ; ...to give number of bytes of data to skip over... 46502 ADD A,2 ; ... 46504 LD C,A ; Load BC with value in A... 46505 LD B,0 ; ... 46507 ADD IX,BC ; ...and add to IX to advance to start of data for current state 46509 DEC (IX+0) ; Decrease the timer value for this state... 46512 JR NZ,46544 ; ...and if not zero, skip ahead to #R46544 46514 POP IX ; Restore (pointer to first parameter in graphic layout data) 46516 LD A,(IX+0) ; Load A with random number... 46519 CALL 54222 ; ...from zero to one less than number of states... 46522 LD (IX+1),A ; ...and set this as the index of the current state 46525 ADD A,A ; Multiply A by four and add two... 46526 ADD A,A ; ...to give number of bytes of data to skip over... 46527 ADD A,2 ; ... 46529 LD C,A ; Load BC with value in A 46530 ADD IX,BC ; Advance IX to start of data for (new) current state 46532 LD A,(IX+1) ; Load A with random number... 46535 CALL 54222 ; ...from one to maximum timer value for state... 46538 INC A ; ... 46539 LD (IX+0),A ; ...and set as current timer value for this state 46542 JR 46545 ; Skip ahead to #R46545 *46544 POP BC ; Restore BC (graphic layout data position, was previously in IX) *46545 LD C,(IX+2) ; Load IX with graphic layout data address... 46548 LD B,(IX+3) ; ...in current state's data... 46551 PUSH BC ; ... 46552 POP IX ; ... 46554 LD B,0 ; Prepare to recalculate Display Buffer address 46556 JP 46003 ; Read / process data at address in IX ; Graphic Layout Routine (243) Increment Index, n, and Jump to n-th Address in Following List ; ; Read first parameter (n) from graphic layout data, increment (resetting to zero if it is equal to the length of ; the list of addresses as specified by the second parameter) and jump to n-th address. Input: IX Address of first ; parameter in current graphic layout data instruction Output: A Number of bytes in graphic layout data to skip ; over c46559 LD A,(IX+0) ; Load current byte of graphic layout data into A 46562 INC A ; Increase by one 46563 CP (IX+1) ; If following byte (cap value) is greater than current byte... 46566 JR C,46569 ; ...then skip ahead to #R46569 46568 XOR A ; Reset current value to zero as cap value reached *46569 LD (IX+0),A ; Load current value back into current position in graphic layout data 46572 ADD A,A ; Load double current value + 2 (as we're skipping over first two bytes and subsequent data are ; WORD addresses) into A... 46573 ADD A,2 ; ... 46575 JR 46586 ; Jump to #R46586 ; Graphic Layout Routine (247) Jump to Randomly Selected Graphic Layout Data Address from List ; ; Read current byte value (n) from graphic layout data, generate random number m (0 - n-1) then jump to address in ; m-th WORD after current position. Input: A (Entry at #R46585) Number of words in graphic layout data to skip ; over A (Entry at #R46586) Number of bytes in graphic layout data to skip over IX Address of first parameter in ; current graphic layout data instruction Output: IX Address of next graphic layout data instruction to process c46577 LD A,(IX+0) ; Load current byte of graphic layout data into A 46580 INC IX ; Advance pointer to next byte 46582 CALL 54222 ; Load A with a random number between 0 and (A-1) ; This entry point is used by the routine at #R46594. *46585 ADD A,A ; Double the number ; This entry point is used by the routine at #R46559. *46586 LD C,A ; Load BC with offset value in A... 46587 LD B,0 ; ... 46589 ADD IX,BC ; Advance IX by offset value 46591 JP 46481 ; Jump to #R46481 (set current position in graphic layout data to value of WORD at this ; address) ; Graphic Layout Routine (253) Jump to Graphic Layout Data Address Selected from List, Based Upon Width of Berk's ; Carried Entity Output: A Number of words in graphic layout data to skip over c46594 LD A,(34272) ; Load A with width of entity (characters) carried by Berk, minus 1 46597 JR 46585 ; Set current position in graphic layout data to value of A-th word in list ; Unused routine ; ; Graphic layout routine (252): if Berk is holding nothing then jump to address. Input:IX Address of first parameter ; in current graphic layout data instruction Output:B Do Not Recalculate Display Buffer Address Flag (0) c46599 LD A,(34221) ; If Berk is not holding anything... 46602 OR A ; ... 46603 JP Z,46481 ; ...then jump to #R46481 (set current position in graphic layout data to value of WORD at this ; address) 46606 LD B,0 ; Prepare to recalculate Display Buffer address 46608 JP 45999 ; Advance graphic layout data pointer by two bytes and read / process next data ; Graphic Layout Routine (238) Start Loop (1 / 2) ; ; Start a loop in graphic layout data. The parameter is the repeat count. The current value of the repeat counter is ; stored at #R34274 and the address of the next instruction (i.e. the first instruction that is processed in each ; loop) is stored at #R34294. Input: IX Address of first parameter in current graphic layout data instruction ; Output: B Do Not Recalculate Display Buffer Address Flag (0) IX Address of next graphic layout data instruction ; to process c46611 LD A,(IX+0) ; Load current byte of graphic layout data... 46614 LD (34274),A ; ...into #R34274 (repeat counter) 46617 INC IX ; Advance IX to next position in graphic layout data... 46619 LD (34294),IX ; ...and store at #R34294 46623 LD B,0 ; Prepare to recalculate Display Buffer address 46625 JP 46003 ; Read / process data at address in IX ; Graphic Layout Routine (239) End Loop (1 / 2) Output: B Do Not Recalculate Display Buffer Address Flag (0) IX ; Address of next graphic layout data instruction to process c46628 LD A,(34274) ; Decrement repeat counter... 46631 DEC A ; ... 46632 LD (34274),A ; ... 46635 LD B,0 ; Prepare to recalculate Display Buffer address 46637 JP Z,46003 ; If repeat counter is zero, then exit loop and process subsequent bytes... 46640 LD IX,(34294) ; ...else, restore stored position in graphic layout data (start of loop)... 46644 JP 46003 ; ...and continue processing data from this point ; Graphic Layout Routine (240) Start Loop (2 / 2) ; ; Start a loop in graphic layout data. The parameter is the repeat count. The current value of the repeat counter is ; stored at #R34275 and the address of the next instruction (i.e. the first instruction that is processed in each ; loop) is stored at #R34296. Input: IX Address of first parameter in current graphic layout data instruction ; Output: B Do Not Recalculate Display Buffer Address Flag (0) IX Address of next graphic layout data instruction ; to process c46647 LD A,(IX+0) ; Load current byte of graphic layout data... 46650 LD (34275),A ; ...into #R34275 (repeat counter) 46653 INC IX ; Advance IX to next position in graphic layout data... 46655 LD (34296),IX ; ...and store at #R34296 46659 LD B,0 ; Prepare to recalculate Display Buffer address 46661 JP 46003 ; Read / process data at address in IX ; Graphic Layout Routine (241) End Loop (2 / 2) Output: B Do Not Recalculate Display Buffer Address Flag (0) IX ; Address of next graphic layout data instruction to process c46664 LD A,(34275) ; Decrement repeat counter... 46667 DEC A ; ... 46668 LD (34275),A ; ... 46671 LD B,0 ; Prepare to recalculate Display Buffer address 46673 JP Z,46003 ; If repeat counter is zero, then exit loop and process subsequent bytes... 46676 LD IX,(34296) ; ...else, restore stored position in graphic layout data (start of loop)... 46680 JP 46003 ; ...and continue processing data from this point ; Current Keyboard Controls b46683 DEFM "X" ; Right 46684 DEFM "Z" ; Left 46685 DEFM "A" ; Forward 46686 DEFM "Q" ; Back 46687 DEFM "C" ; Berk / Drutt 46688 DEFM "P" ; Pause 46689 DEFM "R" ; Restart ; Table of Attribute File Addresses for Main Menu Strings b46690 DEFW 22666 ; "S   START   " 46692 DEFW 22762 ; "K NEW KEYS  " 46694 DEFW 22851 ; "J +KEMPSTON " 46696 DEFW 22947 ; "   RIGHT    " 46698 DEFW 23043 ; "   LEFT     " 46700 DEFW 23139 ; "   FORWARD  " 46702 DEFW 22865 ; "   BACK     " 46704 DEFW 22961 ; "   BERK/DRUT" 46706 DEFW 23057 ; "   PAUSE    " 46708 DEFW 23153 ; "   RESTART  " ; Table of Main Menu Strings b46710 DEFM "S START " 46722 DEFM "K NEW KEYS " 46734 DEFM "J +KEMPSTON " 46746 DEFM " RIGHT " 46758 DEFM " LEFT " 46770 DEFM " FORWARD " 46782 DEFM " BACK " 46794 DEFM " BERK/DRUT" ; (see bugs) 46806 DEFM " PAUSE " 46818 DEFM " RESTART " ; Display and Handle Main Menu ; ; Used by the routine at #R34438. c46830 LD A,1 ; Load A with 1 (blue) 46832 LD (34217),A ; Store at #R34217 and... 46835 OUT (254),A ; ...set border to this value (blue) 46837 LD A,9 ; Fill top 22 rows of Attribute File with blue PAPER & blue INK... 46839 CALL 53649 ; ... 46842 CALL 47140 ; Print "THROUGH the TRAPDOOR" string 46845 CALL 47628 ; Print SCORE / TOTAL / HI-SC string in current character's colours 46848 LD IX,46690 ; Point IX at Table of Attribute File Addresses for Main Menu Strings 46852 LD IY,46710 ; Point IY at start of Table of Main Menu Strings 46856 LD A,112 ; Load A with 112 (black INK on yellow PAPER) 46858 LD (34269),A ; Store at #R34269 46861 LD B,10 ; Load B with 10 as there are 10 strings to print (loop counter) *46863 PUSH BC ; Store BC (B = remaining number of strings to print) 46864 LD L,(IX+0) ; Load Attribute File address at which to print text into HL... 46867 LD H,(IX+1) ; ... 46870 LD B,12 ; Load B with 12 as there are 12 characters to print (loop counter) *46872 PUSH BC ; Store BC (B = number of remaining characters to print) 46873 LD E,(IY+0) ; Load E with text character to print 46876 CALL 47682 ; Print double-height text character in E 46879 INC IY ; Advance IY to next character in text to print 46881 INC HL ; Advance to next Attribute File location 46882 POP BC ; Restore BC (B = number of remaining characters to print) 46883 DJNZ 46872 ; Loop back for next character 46885 INC IX ; Advance IX to next entry in list of Attribute File addresses to print to... 46887 INC IX ; ... 46889 POP BC ; Restore BC (B = remaining number of strings to print) 46890 DJNZ 46863 ; Loop back for next string 46892 CALL 46946 ; Draw Joystick "J" (Main Menu) in colour depending upon Joystick Mode 46895 LD A,114 ; Load A with the attribute value for red INK, yellow PAPER, BRIGHT 46897 CALL 47084 ; Print keyboard controls on main menu ; This entry point is used by the routine at #R46968. *46900 CALL 47955 ; Wait for key-press, store pressed key code in A and play Main Menu Sound 46903 CP 83 ; If pressed key was not 83 (S)... 46905 JR NZ,46915 ; ...then skip ahead to #R46915 46907 LD A,2 ; Set current border colour to red... 46909 LD (34217),A ; ... 46912 OUT (254),A ; ... 46914 RET ; Return *46915 CP 74 ; If pressed key was not 74 (J)... 46917 JR NZ,46968 ; ...then jump to #R46968 (if "K" pressed then redefine controls) 46919 LD A,(34298) ; If we are in Joystick Mode... 46922 OR A ; ... 46923 JR NZ,46937 ; ...then skip ahead to #R46937 46925 CALL 47043 ; If Kempston Interface not present, or Kempston Joystick moved / fire pressed... 46928 JR C,46900 ; ...then jump to #R46900 46930 LD A,1 ; Set Joystick Mode to On... 46932 LD (34298),A ; ...(see trivia) 46935 JR 46938 ; Skip ahead to #R46938 *46937 DEC A ; Set Joystick Mode to Off... *46938 LD (34298),A ; ... 46941 CALL 46946 ; Draw Joystick "J" (Main Menu) in colour depending upon Joystick Mode 46944 JR 46900 ; Loop back to #R46900 ; Draw Joystick "J" (Main Menu) in Colour Depending Upon Joystick Mode ; ; Used by the routine at #R46830. c46946 LD A,(34298) ; If Joystick Mode Flag is set... 46949 OR A ; ... 46950 JR NZ,46956 ; ...then skip ahead to #R46956 46952 LD A,112 ; Load A with attribute value for black INK, yellow PAPER, BRIGHT 46954 JR 46958 ; Skip ahead to #R46958 *46956 LD A,114 ; Load A with attribute value for red INK, yellow PAPER, BRIGHT *46958 LD E,74 ; Load E with 74 (index for character "J") 46960 LD IX,46694 ; Point IX at entry for "J +KEMPSTON " in table of Attribute File addresses at which to print ; menu strings 46964 CALL 47071 ; Set attribute to A and location to (IX) and print double-height character in E 46967 RET ; Return ; If "K" Pressed then Redefine Controls ; ; Used by the routine at #R46830. Input: A ASCII code of pressed key c46968 CP 75 ; If pressed key was not 75 (K)... 46970 JR NZ,46900 ; ...then jump to Main Menu handling routine at #R46900 46972 LD B,7 ; Load B with 7 (as there are seven controls to define) 46974 LD HL,46683 ; Point HL at start of Table of Current Keyboard Controls *46977 LD (HL),63 ; Set current entry in table to 63 (ASCII code for "?") 46979 INC HL ; Advance HL to next entry 46980 DJNZ 46977 ; Decrease remaining number of controls to change and loop back to #R46977 if not zero 46982 LD A,112 ; Load A with the attribute value for black INK, yellow PAPER, BRIGHT 46984 CALL 47084 ; Print keyboard controls on main menu 46987 LD IY,46683 ; Point IY at Table of Current Keyboard Controls 46991 LD IX,46696 ; Point IX at entry for "   RIGHT    " text in table of Attribute File addresses at which to ; print for main menu 46995 LD B,7 ; Load B with 7 (as there are seven controls to define) *46997 PUSH BC ; Store BC (remaining number of controls to define) 46998 LD A,198 ; Load A with 198 (yellow INK, black PAPER, BRIGHT, FLASH) 47000 LD E,32 ; Load E with 32 (" ") 47002 CALL 47071 ; Set attribute to A and location to (IX) and print double-height character in E *47005 CALL 47955 ; Wait for key-press, store pressed key code in A and play Main Menu Sound 47008 CALL 47060 ; If key pressed matches a direction, or the Berk / Drutt key... 47011 JR Z,47005 ; ...then loop back to #R47005 47013 LD E,A ; Load keycode of pressed control into E... 47014 LD (IY+0),E ; ...and store in Table of Current Keyboard Controls 47017 INC IY ; Advance IY to next control 47019 LD A,113 ; Load A with 113 (blue INK, yellow PAPER, BRIGHT) 47021 CALL 47071 ; Set attribute to A and location to (IX) and print double-height character in E 47024 INC IX ; Advance IX to next entry in table of Attribute File addresses... 47026 INC IX ; ... 47028 POP BC ; Restore BC (remaining number of controls to define) 47029 DJNZ 46997 ; Decrease remaining number of controls to define and loop back to #R46997 if not zero 47031 XOR A ; Switch Joystick Mode to Off... 47032 LD (34298),A ; ... 47035 LD A,114 ; Load A with the attribute value for red INK, yellow PAPER, BRIGHT 47037 CALL 47084 ; Print keyboard controls on main menu 47040 JP 46900 ; Jump to Main Menu handling routine at #R46900 ; Set Carry Flag if Kempston Interface not Present, or Kempston Joystick Moved / Fire Pressed ; ; Used by the routine at #R46830. Output: F Carry Flag set if Kempston Interface not present, Kempston Joystick ; moved or fire pressed, reset otherwise c47043 LD B,0 ; Set B to zero (to repeat check loop 256 times) *47045 IN A,(31) ; Read value from Port 31 into A (Kempston Interface) 47047 OR A ; If retrieved value is not zero (i.e. Kempston Interface not present, or Kempston Joystick not ; centred / fire button pressed)... 47048 JR NZ,47053 ; ...then skip ahead to #R47053 47050 DJNZ 47045 ; Decrease B (loop counter) and loop back to #R47045 to check Kempston status again if counter ; not zero 47052 RET ; Return *47053 LD A,6 ; Set sound 6 as pending if appropriate, then play and clear pending sound... 47055 CALL 59722 ; ... 47058 SCF ; Set Carry Flag 47059 RET ; Return ; Set Zero Flag if Key Whose Index is in A Matches a Direction, or the Berk / Drutt Key ; ; Used by the routine at #R46968. Input: A Index of pressed key Output: F Zero Flag set if input key index ; matches an entry in table at #R46683, reset otherwise HL Address of matching entry in table at #R46683 (if match ; found) c47060 LD HL,46683 ; Point HL at Table of Current Keyboard Controls 47063 LD B,5 ; Load B with 5 (as we are checking the first five defined keys, see bugs) *47065 CP (HL) ; If character code at current HL position matches the key we are checking... 47066 RET Z ; ...then return with Zero Flag set 47067 INC HL ; Advance HL to next character in keyboard controls table 47068 DJNZ 47065 ; Loop back to #R47065 to check next control 47070 RET ; Return ; Set Attribute and Location and Print Double-Height Character in E ; ; Used by the routines at #R46946 and #R46968. Input: A Attribute for character to print E Character to print IX ; Points to memory location holding Attribute File address at which to print character c47071 LD (34269),A ; Set text printing attribute to value in A 47074 LD L,(IX+0) ; Load Attribute File address to print character to into HL... 47077 LD H,(IX+1) ; ... 47080 CALL 47682 ; Print double-height text character in E 47083 RET ; Return ; Print Keyboard Controls on Main Menu ; ; Used by the routines at #R46830 and #R46968. Input: A Attribute for printing text c47084 LD (34269),A ; Set attribute for printing text 47087 LD IX,46696 ; Point IX at entry for " RIGHT " text in table of Attribute File addresses at which to ; print 47091 LD IY,46683 ; Point IY at Table of Current Keyboard Controls 47095 LD B,7 ; Load B with 7, as there are 7 keyboard controls (loop counter) *47097 PUSH BC ; Store BC (B = number of remaining control keys) 47098 LD L,(IX+0) ; Load HL with Attribute File address at which to print character... 47101 LD H,(IX+1) ; ... 47104 LD E,(IY+0) ; Load E with character to print (current keyboard control) 47107 CALL 47682 ; Print double-height text character in E 47110 INC IY ; Advance IY to next keyboard control 47112 INC IX ; Advance IX to next entry in list of Attribute File addresses... 47114 INC IX ; ... 47116 POP BC ; Restore BC (B = number of remaining control keys) 47117 DJNZ 47097 ; Loop back to #R47097 for next keyboard control 47119 RET ; Return ; "THROUGH the TRAPDOOR" String b47120 DEFM "THROUGH the TRAPDOOR" ; Print "THROUGH the TRAPDOOR" String ; ; Used by the routine at #R46830. c47140 LD B,20 ; Load B with 20 (length of string to print) 47142 LD HL,22566 ; Point HL at position to start printing text in Attribute File 47145 LD A,79 ; Load A with 79, for blue PAPER, white INK, BRIGHT 47147 LD IX,47120 ; Point IX to text to print 47151 JR 47224 ; Print the text and return ; "SORRY BERK, BUT YOUR TIME IS UP" String b47153 DEFM "SORRY BERK, BUT YOUR TIME IS UP" ; Print "SORRY BERK, BUT YOUR TIME IS UP" String ; ; Used by the routine at #R34438. c47185 LD B,32 ; Load B with 32 (length of string to print) 47187 LD A,199 ; Load A with 199, for black PAPER, white INK, BRIGHT, FLASH 47189 LD IX,47153 ; Point IX to text to print 47193 LD HL,23232 ; Point HL at position at which to start printing text in Attribute File (start of second-last ; row) 47196 JR 47224 ; Print the text and return ; "HOME SWEET HOME" String b47198 DEFM "HOME SWEET HOME" ; Print "HOME SWEET HOME" String ; ; Used by the routine at #R34438. c47213 LD B,15 ; Set string length to 15 47215 LD A,68 ; Set attribute to green INK on black PAPER, BRIGHT 47217 LD IX,47198 ; Point IX at "HOME SWEET HOME" text 47221 LD HL,22792 ; Point HL at Attribute File address at which to print text ; This entry point is used by the routines at #R47140 and #R47185. *47224 LD (34269),A ; Store attribute at #R34269 *47227 PUSH BC ; Store BC (B=remaining length of text) 47228 LD E,(IX+0) ; Load character of text to print into E 47231 CALL 47682 ; Print double-height text character in E 47234 INC IX ; Advance IX to next text character to print 47236 INC HL ; Advance HL to next Attribute File address at which to print 47237 POP BC ; Restore BC (B = remaining length of text) 47238 DJNZ 47227 ; Decrease remaining length of text by one and repeat loop for next character 47240 RET ; Return ; Reset Show Score Flag and Draw Timer Figures Bar ; ; Used by the routines at #R34438, #R34916 and #R47468. c47241 LD A,(34208) ; Reset Show Score Flag... 47244 RES 7,A ; ... 47246 LD (34208),A ; ... 47249 LD IX,23232 ; Point IX to start of second-last row of Attribute File 47253 LD A,(34210) ; Load remaining time / lives into A... 47256 OR A ; ...and if zero... 47257 JR Z,47267 ; ...then skip ahead 47267 47259 LD B,A ; Load number of lives into B *47260 PUSH BC ; Store BC (B = remaining number of pairs of open eyes to draw) 47261 CALL 47315 ; If Show Score Flag reset then draw pair of Timer Figure eyes (open, random frame) at ; Attribute File address in IX and advance by two bytes 47264 POP BC ; Restore BC (B = remaining number of pairs of open eyes to draw) 47265 DJNZ 47260 ; Decrease B (remaining number of pairs of open eyes to draw) and loop back to #R47260 if not ; zero *47267 LD A,(34210) ; Load remaining time / lives into E... 47270 LD E,A ; ... 47271 LD A,16 ; Load A with number of lives lost by subtracting E from 16... 47273 SUB E ; ... 47274 JR Z,47284 ; If zero, then skip ahead to #R47284 47276 LD B,A ; Load number of lost lives into B as counter for loop *47277 PUSH BC ; Store BC (B = remaining number of pairs of closed eyes to draw) 47278 CALL 47302 ; If Show Score Flag reset then draw pair of Timer Figure eyes (closed) at Attribute File ; address in IX and advance by two bytes 47281 POP BC ; Restore BC (B = remaining number of pairs of closed eyes to draw) 47282 DJNZ 47277 ; Decrease B (remaining number of pairs of open eyes to draw) and loop back to #R47277 if not ; zero *47284 LD C,27 ; Set graphic index to 27 (timer figures' bodies) 47286 LD A,(34226) ; Load attribute of current character into A 47289 LD B,16 ; Load B with 16 (as 16 timer figures' bodies to draw) *47291 PUSH BC ; Store B (remaining number of timer figure bodies to draw) 47292 CALL 47333 ; Draw left half of timer figure's body and invert mirror flag on attribute 47295 CALL 47333 ; Draw right half of timer figure's body 47298 POP BC ; Restore B (remaining number of timer figure bodies to draw) 47299 DJNZ 47291 ; Decrease B and loop back to #R47291 47301 RET ; Return ; If Show Score Flag Reset then Draw Pair of Timer Figure Eyes (Closed) at Attribute File Address IX and Advance IX ; by Two Bytes ; ; Used by the routines at #R47241 and #R47363. Input: IX Pointer to a location in Attribute File c47302 CALL 47355 ; If Show Score Flag is set then return, else proceed ahead to #R47305 47305 LD A,(34226) ; Load A with the attribute of the current character 47308 LD C,28 ; Load C with 28 (graphic index of timer figures' closed eyes) 47310 CALL 47333 ; Draw the left (closed) eye at Attribute File address in IX and advance IX by one byte 47313 JR 47333 ; Draw the right (closed) eye at Attribute File address in IX, advance IX by one byte and ; return ; If Show Score Flag Reset then Draw Pair of Timer Figure Eyes (Open, Random Frame) at Attribute File Address IX and ; Advance IX by Two Bytes ; ; Used by the routines at #R47241, #R47363 and #R47431. Input: IX Attribute File address at which to draw pair of ; eyes Output: IX Attribute File address two bytes on from initial IX c47315 CALL 47355 ; If Show Score Flag is set then return, else proceed ahead to #R47318 47318 CALL 47323 ; Draw Timer Figure's left eye (random frame) at Attribute File address in IX and advance IX by ; one byte 47321 JR 47333 ; Draw Timer Figure's right eye (same frame as above), advance IX by one byte then return ; Draw a Timer Figure's Eye (Random Frame) at Attribute File Address in IX and Advance IX by One Byte ; ; Used by the routine at #R47315. Input: IX (Entry at #R47323 and #R47333) Pointer to a location in Attribute File ; A (Entry at #R47333 only) Attribute C (Entry at #R47333 only) Graphic Index (e.g. 27 for timer figures' bodies) ; Output: A Attribute (including inverted mirror flag) IX Pointer to next location in Attribute File c47323 LD A,5 ; Load A with a random number, 0-4... 47325 CALL 54222 ; ... 47328 ADD A,29 ; Add 29 (as 29 is the index of the first of five eye direction graphics) in C... 47330 LD C,A ; ... 47331 LD A,7 ; Set attribute for timer indicator figures' eyes to white INK on black PAPER ; This entry point is used by the routines at #R47241, #R47302 and #R47315. *47333 LD B,4 ; Set Graphic Set Index to 4 47335 PUSH AF ; Store AF (A = attribute) 47336 PUSH BC ; Store BC (B = graphic set index, C = graphic index) 47337 CALL 54144 ; Draw a graphic character block to display 47340 POP BC ; Restore BC (B = graphic set index, C = graphic index) 47341 LD A,C ; Load Graphic Index into A 47342 CP 32 ; If graphic index is less than 32 (i.e. we're not dealing with #32 - eyes looking right or #33 ; - eyes looking left and don't need to cancel inversion at 47350)... 47344 JR C,47348 ; ...then skip ahead to #R47348 47346 XOR 1 ; Add or subtract 1 if Graphic Index is 32 or 33 respectively (Timer Figures' Eyes looking ; right or left respectively) to cancel out inversion at 47350 *47348 LD C,A ; Load Graphic Index into C 47349 POP AF ; Restore AF (A = attribute) 47350 XOR 128 ; Flip mirror flag to prepare to draw mirror image of just-drawn character block 47352 INC IX ; Advance IX to next byte in Attribute File 47354 RET ; Return ; If Show Score Flag is Reset then Return to Calling Routine, else Return to Routine that Called Calling Routine ; ; Used by the routines at #R47302 and #R47315. c47355 LD A,(34208) ; If Show Score Flag is reset... 47358 BIT 7,A ; ... 47360 RET Z ; ...then return 47361 POP BC ; Remove return address from stack... 47362 RET ; ...and return to routine that called the calling routine ; Update Eyes of a Randomly Selected Timer Figure, Increase Timer Tick Counter and Process Timer Figure Blinking ; ; Used by the routine at #R34438. c47363 CALL 47431 ; Select a remaining Timer Figure at random and update its eyes to a random (open-eyed) frame 47366 CALL 47468 ; Increase Timer Tick Counter and reduce remaining time if Counter > 767 47369 LD A,(34227) ; If Blink Duration Counter is zero... 47372 OR A ; ... 47373 JR Z,47388 ; ...then skip ahead to #R47388 47375 DEC A ; Decrease Blink Duration Counter by one... 47376 LD (34227),A ; ... 47379 OR A ; If decreased Blink Duration Counter is not zero... 47380 RET NZ ; ...then return 47381 LD IX,(34264) ; Restore Attribute File address of eyes of currently blinking timer figure into IX 47385 JP 47315 ; If Show Score Flag reset then draw pair of Timer Figure eyes (open, random frame) at ; Attribute File address IX, advance IX by two bytes then return ; Make a randomly chosen timer figure blink *47388 LD A,10 ; Load A with a random number, 0-9... 47390 CALL 54222 ; ... 47393 OR A ; If A is not zero (9 in 10 chance)... 47394 RET NZ ; ...then return 47395 LD A,(34210) ; Load remaining time / lives into A 47398 CP 2 ; If less than two time / lives remain... 47400 RET C ; ...then return 47401 CALL 54222 ; Load A with a random number, 0-(x-1) (where x is remaining time / lives) 47404 ADD A,A ; Double A... 47405 LD C,A ; ...and load into BC... 47406 LD B,0 ; ... 47408 LD IX,23232 ; Point IX to start of second-last row of Attribute File 47412 ADD IX,BC ; Add BC as offset to IX (i.e. point to a random "awake" timer figure) 47414 LD (34264),IX ; Store Attribute File address of eyes of currently blinking timer figure at 34264 47418 CALL 47302 ; If Show Score Flag reset then draw pair of Timer Figure eyes (closed) at Attribute File ; address IX and advance IX by two bytes 47421 LD A,10 ; Set Blink Duration Counter to a random number, 1-9... 47423 CALL 54222 ; ... 47426 INC A ; ... 47427 LD (34227),A ; ... 47430 RET ; Return ; Select a Remaining Timer Figure at Random and Update its Eyes to a Random (Open-Eyed) Frame ; ; Used by the routine at #R47363. c47431 LD A,(34210) ; Load remaining time / lives into A... 47434 OR A ; ...and if none remain... 47435 RET Z ; ...then return 47436 LD E,A ; Load remaining time / lives into E 47437 LD A,18 ; Load A with 18 minus remaining time / lives (i.e. number in range 2 to 18)... 47439 SUB E ; ... ; As the value of x (Remaining Time / Lives) decreases, the probability that a randomly generated number between 0 ; and (18-x) is 2 or more increases. This probability is used to ensure that the rate at which each timer figure is ; updated remains roughly constant. 47440 CALL 54222 ; Load A with a random number, 0-(17 minus remaining time / lives) 47443 CP 2 ; If generated number is 2 or more... 47445 RET NC ; ...then return 47446 LD IX,23232 ; Point IX to start of second-last row of Attribute File 47450 LD A,E ; Load remaining time / lives into A ; If remaining time / lives is one, then there is only one Timer Figure to update 47451 CP 1 ; If this is 1... 47453 JP Z,47315 ; ...then jump to #R47315 (If Show Score Flag reset then draw pair of Timer Figure eyes and ; return) ; Otherwise, randomly select one of the remaining Timer Figures to update 47456 CALL 54222 ; Load A with random number between 0 and (x-1) where x is remaining time / lives 47459 ADD A,A ; Double A... 47460 LD C,A ; ...and load into BC... 47461 LD B,0 ; ... 47463 ADD IX,BC ; Add BC as offset to IX (i.e. advance IX to point to left eye of randomly chosen Timer Figure) 47465 JP 47315 ; If Show Score Flag reset then draw pair of Timer Figure eyes (open, random frame) at ; Attribute File address IX, advance IX by two bytes then return ; Increase Timer Tick Counter and Reduce Remaining Time if Counter > 767 ; ; Used by the routine at #R47363. c47468 LD HL,(34211) ; Increase Timer Tick Counter by one... 47471 INC HL ; ... 47472 LD (34211),HL ; ... 47475 LD A,H ; If Timer Tick Counter is less than 768 (i.e. 3 x 256)... 47476 CP 3 ; ... 47478 RET C ; ...then return 47479 LD HL,0 ; Reset Timer Tick Counter to zero... 47482 LD (34211),HL ; ... ; This entry point is used by the routine at #R53723. *47485 LD A,(34210) ; If no time / lives remain... 47488 OR A ; ... 47489 JP Z,47241 ; ...then reset Show Score Flag, draw timer figures bar and return 47492 DEC A ; Decrease current time / lives by one... 47493 LD (34210),A ; ... 47496 JP 47241 ; Reset Show Score Flag, and draw timer figures bar and return ; Update Scores and Display ; ; Used by the routine at #R34438. c47499 LD HL,34208 ; Set Show Score Flag... 47502 SET 7,(HL) ; ... 47504 LD HL,0 ; Set HL to zero 47507 LD A,(34210) ; If no time / lives remain... 47510 OR A ; ... 47511 JR Z,47526 ; ...then skip ahead to #R47526 47513 LD B,A ; Load HL with 1000 x current remaining time / lives... 47514 LD DE,1000 ; ... *47517 ADD HL,DE ; ... 47518 DJNZ 47517 ; ... 47520 LD DE,(34211) ; Subtract value of Timer Tick Counter (i.e. Score Penalty) from current level's score... 47524 SBC HL,DE ; ... *47526 LD (34213),HL ; Set score for current level 47529 LD DE,(34215) ; Load DE with current total score 47533 ADD HL,DE ; Add score for current level to total score... 47534 LD (34215),HL ; ...and store 47537 LD DE,(34299) ; Load current high score into DE 47541 SBC HL,DE ; Subtract high score from current total score... 47543 JR C,47551 ; ...and if this is less than zero (i.e. high score is higher than current total score) then ; skip ahead to #R47551 47545 LD HL,(34215) ; Load current total score into HL... 47548 LD (34299),HL ; ...and store as new high score *47551 LD A,16 ; Set time / lives to 16... 47553 LD (34210),A ; ... 47556 LD IY,47596 ; Point IY at "numeric (score)" part of string at 47589 47560 LD HL,(34213) ; Load HL with current score... 47563 CALL 47741 ; ...and convert to string at IY 47566 LD IY,47609 ; Point IY at "numeric (total)" part of string at 47589 47570 LD HL,(34215) ; Load HL with current total score... 47573 CALL 47741 ; ...and convert to string at IY 47576 LD IY,47622 ; Point IY at "numeric (high score)" part of string at 47589 47580 LD HL,(34299) ; Load HL with current high score... 47583 CALL 47741 ; ...and convert to string at IY 47586 JP 47628 ; Print SCORE / TOTAL / HI-SC string in current character's colours and return ; Score / Total / High Score String b47589 DEFM 42,"SCORE",35,"00000",42," TOTAL",35,"00000",42," HI-SC",35,"00999",36 ; Print Score / Total / High Score String in Current Character's Colours ; ; Used by the routines at #R34916, #R46830 and #R47499. c47628 LD IY,47589 ; Point IY at SCORE / TOTAL / HI-SC text 47632 LD HL,23232 ; Set Attribute File address at which to print text to start of second-last character row *47635 LD A,(IY+0) ; Load a character from the string into A 47638 CP 36 ; If the character is 36 (end marker)... 47640 RET Z ; ...then return 47641 CP 42 ; If character is not 42 ("set attribute to current character's colours" marker)... 47643 JR NZ,47660 ; ...then skip ahead to #R47660 47645 LD A,(34226) ; Load current character's attribute into A (blue for Berk, yellow for Drutt) 47648 CP 1 ; If blue (Berk)... 47650 JR Z,47656 ; ...then skip ahead to #R47656 47652 LD A,112 ; Load A with value for black INK, yellow PAPER, BRIGHT (Drutt's colours) 47654 JR 47666 ; Skip ahead to #R47666 *47656 LD A,79 ; Load A with value for white INK, blue PAPER, BRIGHT (Berk's colours) 47658 JR 47666 ; Skip ahead to #R47666 *47660 CP 35 ; If character is not 35 ("set attribute to standard" marker)... 47662 JR NZ,47673 ; ...then skip ahead to #R47673 47664 LD A,71 ; Load A with value for white INK, black PAPER, BRIGHT *47666 LD (34269),A ; Store this value as the attribute to print text 47669 INC IY ; Advance IY to next character in string to print 47671 JR 47635 ; Loop back to #R47635 for next character *47673 LD E,A ; Load character to print into E 47674 CALL 47682 ; Print double-height text character in E 47677 INC HL ; Advance HL to next Attribute File address 47678 INC IY ; Advance IY to next character to process 47680 JR 47635 ; Loop back to #R47635 for next character ; Print a Double-Height Text Character ; ; Used by the routines at #R46830, #R47071, #R47084, #R47213 and #R47628. Input: HL Attribute File address at ; which to print character E Character to print c47682 LD BC,32 ; Load BC with 32 (width of a row in Attribute File) 47685 PUSH HL ; Store HL (Attribute File address at which to print character) 47686 LD D,0 ; Set D to zero 47688 EX DE,HL ; Swap DE (now Attribute File address at which to print character) and HL (now H = 0, L = ; character to print) 47689 ADD HL,HL ; Multiply index of character to print by eight in HL, as each character's graphic data is ; eight bytes long... 47690 ADD HL,HL ; ... 47691 ADD HL,HL ; ... 47692 LD DE,15360 ; Add eight times character index to 15360 in HL, to point to graphic of character in ROM... 47695 ADD HL,DE ; ... 47696 EX DE,HL ; Swap DE (now points to graphic of character in ROM) and HL (now 15360) 47697 POP HL ; Restore HL (Attribute File address at which to print character) 47698 CALL 47709 ; Print top half of a double-height text character 47701 ADD HL,BC ; Add BC to HL to advance down a character row 47702 CALL 47709 ; Print bottom half of a double-height text character 47705 AND A ; Reset Carry Flag 47706 SBC HL,BC ; Subtract 32 from HL to restore to value it had upon starting this routine 47708 RET ; Return ; Print Half of a Double-Height Text Character ; ; The most significant byte of the Attribute File address starts off as 88 for the top third of the screen. In the ; middle third it becomes 89 and in the lower third it reaches 90. The most significant byte of the Display File ; address (for the top pixel row of each character row) is 64 in the top third, 72 in the middle third and 80 in the ; lower third. Generally speaking, therefore, the most significant byte in the Display File address increases by ; eight for every increase of one in the attribute address most significant byte, so multiplying the latter by eight ; (giving 192, 200 or 208, values roll over 255-0 boundary with excess truncated) would put it on the same scale as ; the former (64, 72 or 80). Input: DE 15360 + 8 x character index [+4 for second run-through] (i.e. points to ROM ; graphic data for the character of interest) HL Attribute File address at which to print character c47709 PUSH HL ; Store HL 47710 PUSH BC ; Store BC 47711 LD A,(34269) ; Load stored attribute into A 47714 LD (HL),A ; Write this to Attribute File 47715 LD A,H ; Multiply the most significant byte (MSB) of the Attribute File address by eight... 47716 ADD A,A ; ...to put it on the same scale as the MSB of the Display File address MSB (see notes)... 47717 ADD A,A ; ... 47718 ADD A,A ; ... 47719 AND 91 ; Drop the most significant bit to point to the correct location in Display File 47721 LD H,A ; Load back into HL (L is unaffected, as it should be) 47722 LD B,4 ; Set B to 4 (loop counter) *47724 LD A,(DE) ; Load a byte from the graphic data into C... 47725 LD C,A ; ... 47726 SRL C ; Shift bitmap data left one pixel in C 47728 OR C ; Merge this into bitmap data already in A to give a "bold" typeface appearance 47729 AND 127 ; Drop the leftmost bit to prevent one character touching the next (space between letters) 47731 LD (HL),A ; Load the bitmap data into two consecutive rows to provide double-height (2 chars) text... 47732 INC H ; ... 47733 LD (HL),A ; ... 47734 INC H ; ... 47735 INC DE ; Advance to next byte of graphic data 47736 DJNZ 47724 ; Repeat for next row of graphic data 47738 POP BC ; Restore BC 47739 POP HL ; Restore HL 47740 RET ; Return ; Convert Number in HL to String at IY ; ; Used by the routine at #R47499. Input: HL A number to convert to string IY A location in memory to store a ; number converted to a string c47741 LD DE,10000 ; Convert the ten thousands to a character... 47744 CALL 47772 ; ... 47747 LD DE,1000 ; Convert the thousands to a character... 47750 CALL 47772 ; ... 47753 LD DE,100 ; Convert the hundreds to a character... 47756 CALL 47772 ; ... 47759 LD DE,10 ; Convert the tens to a character... 47762 CALL 47772 ; ... 47765 LD A,L ; Load remainder (units) into L 47766 ADD A,48 ; Add as offset to 48 (ASCII code for "0") 47768 LD (IY+0),A ; Load ASCII character code into units position in string 47771 RET ; Return ; Convert a Digit of Numeric Data to its String Equivalent ; ; Used by the routine at #R47741. Input: DE Current power of ten HL A number to convert to string IY A location ; in memory to store a current digit converted to a string c47772 LD (IY+0),47 ; Set character in string to "/" (character immediately before "0") 47776 AND A ; Reset Carry Flag *47777 INC (IY+0) ; Advance character at current string position to next numeric character up 47780 SBC HL,DE ; Subtract current power of ten from number to convert 47782 JR NC,47777 ; If number to convert has not dropped below 0 (i.e. we have not yet subtracted too many of the ; current power of ten) then loop back to #R47777 47784 ADD HL,DE ; We have subtracted one too many of the current power of ten, so add it back to make the ; remainder positive 47785 INC IY ; Advance to next character in the string as we are finished dealing with the current power of ; ten 47787 RET ; Return ; Read Keyboard and Load Pressed Key Character into A ; ; Used by the routines at #R47893 and #R47942. Output: A Index of the key that was pressed c47788 EXX ; Swap registers 47789 LD BC,65278 ; Load B and C with 254 47792 LD HL,47853 ; Point HL at list of return values 47795 IN A,(C) ; Read from port 254 into A (i.e. read keyboard) [IN 65278 reads the half row CAPS SHIFT to V] 47797 SET 0,A ; Set bit 0 of A (i.e. clear pressing of CAPS SHIFT) 47799 AND 31 ; Strip out all but the five bits representing key presses 47801 XOR 31 ; Invert all of the lowest five bits 47803 JR NZ,47843 ; If this value is non-zero, then a key has been pressed, so skip ahead to #R47843 47805 LD DE,5 ; Advance HL by five characters in list of return values string... 47808 ADD HL,DE ; ... 47809 LD E,6 ; Load E with 6 as there are 6 keyboard half-rows to test (loop counter) *47811 RLC B ; With each loop, change BC from 65278 -> 65022 -> 64510 -> 63486 -> 61438 -> 57342 -> 49150 47813 IN A,(C) ; Read from port 254 into A (i.e. read keyboard) 47815 AND 31 ; Strip out all but the five bits representing key presses 47817 XOR 31 ; Invert all of the lowest five bits 47819 JR NZ,47843 ; If this value is non-zero, then a key has been pressed, so skip ahead to #R47843 47821 INC HL ; Advance HL by five characters in list of return values string... 47822 INC HL ; ... 47823 INC HL ; ... 47824 INC HL ; ... 47825 INC HL ; ... 47826 DEC E ; Decrease number of remaining keyboard half-rows to check 47827 JR NZ,47811 ; If there are any more half rows to check then loop back to #R47811 47829 RLC B ; Set BC to 32766 for final keyboard half-row 47831 IN A,(C) ; Read from port 254 into A (i.e. read keyboard) 47833 SET 1,A ; Set bit 1 of A (i.e. clear pressing of SYMBOL SHIFT) 47835 AND 31 ; Strip out all but the five bits representing key presses 47837 XOR 31 ; Invert all of the lowest five bits 47839 JR NZ,47843 ; If this value is non-zero, then a key has been pressed, so skip ahead to #R47843 47841 EXX ; Swap registers 47842 RET ; Return [no key pressed] *47843 SRL A ; Shift bits right 47845 JR C,47850 ; If carry flag is set, then this is the key that was pressed, so skip ahead to #R47850 47847 INC HL ; Advance HL to check next character 47848 JR 47843 ; Loop back to #R47843 *47850 LD A,(HL) ; Load current character in list of return values string into A as this is the key that was ; pressed 47851 EXX ; Swap registers 47852 RET ; Return [key pressed] ; Return Values from Keyboard Reading Routine b47853 DEFM "cZXCVASDFGQWERT1234509876POIUYeLKJH yMNB" ; Check for Control Key Press and Store at 34219 ; ; Used by the routine at #R34438. c47893 XOR A ; Clear previously stored control input... 47894 LD (34219),A ; ... 47897 CALL 47788 ; Read keyboard and load character of pressed key into A 47900 OR A ; If no key was pressed... 47901 JR Z,47930 ; ...then read joystick input and return 47903 LD E,1 ; Set least significant bit of E as we are testing the first keyboard control first 47905 LD B,7 ; Set B to 7 as there are 7 keyboard controls to check (loop counter) 47907 LD HL,46683 ; Point HL at Table of Current Keyboard Controls *47910 CP (HL) ; If pressed key is the same as the current keyboard control... 47911 JR Z,47921 ; ...then skip ahead to #R47921 47913 INC HL ; Advance HL to next keyboard control 47914 SLA E ; Shift E left 47916 DJNZ 47910 ; Loop back to #R47910 for next keyboard control 47918 XOR A ; Set A to zero 47919 JR 47926 ; Skip ahead to #R47926 *47921 LD A,E ; Load input bitmap into A (bit that is set represents the control that has been pressed) 47922 BIT 5,A ; If bit 5 is set (i.e. Berk / Drutt key has been pressed)... 47924 JR NZ,47942 ; ...then jump to #R47942 (Wait for current key to be released and another to be pressed, ; storing in A) and return ; This entry point is used by the routine at #R47930. *47926 LD (34219),A ; Store control input at #R34219 47929 RET ; Return ; If Joystick Mode is On, then Read Joystick Input ; ; Used by the routine at #R47893. c47930 LD A,(34298) ; If Joystick Mode is Off... 47933 OR A ; ... 47934 RET Z ; ...then return 47935 IN A,(31) ; Read state of Kempston joystick into A 47937 AND 31 ; If joystick input is non-zero... 47939 JR NZ,47926 ; ...then jump to #R47926 47941 RET ; Return ; Wait for Current Key to Be Released and Another to Be Pressed, Storing in A ; ; Used by the routines at #R34438, #R47893 and #R47955. c47942 CALL 47788 ; Read keyboard and load character of pressed key into A 47945 OR A ; If a key is pressed... 47946 JR NZ,47942 ; ...then loop back to #R47942 *47948 CALL 47788 ; Read keyboard and load character of pressed key into A 47951 OR A ; If a key is not pressed... 47952 JR Z,47948 ; ...then loop back to #R47948 47954 RET ; Return ; Wait for Key-Press, Store Pressed Key Code in A and Play Main Menu Sound ; ; Used by the routines at #R46830 and #R46968. Output: A code of pressed key c47955 CALL 47942 ; Wait for current key to be released and another to be pressed, storing in A 47958 PUSH AF ; Store AF (A = last pressed key) 47959 LD A,2 ; Set sound 2 as pending if appropriate, then play and clear pending sound... 47961 CALL 59722 ; ... 47964 POP AF ; Restore AF (A = last pressed key) 47965 RET ; Return ; Table of Script Routine Start Addresses b47966 DEFW 0 ; (00) - Unused 47968 DEFW 48285 ; (01) - Load HL (Script Data Pointer) with New Address 47970 DEFW 48660 ; (02) - Move Entity at IX (and if Berk, Carried Entity) Left One Character 47972 DEFW 48615 ; (03) - Move Entity at IX (and if Berk, Carried Entity) Right One Character 47974 DEFW 48133 ; (04) - If Current Character and Target Entity are in the Same Room then Set Pending Sound 47976 DEFW 0 ; (05) - Unused 47978 DEFW 48238 ; (06) - Set Berk's Facing Into Screen Flag, and Reset his Facing Left and Facing Right flags 47980 DEFW 48234 ; (07) - Reset Berk's Facing Into Screen, Facing Left and Facing Right Flags 47982 DEFW 48267 ; (08) - Set Must Process Current Script Data Flag for Entity at IX 47984 DEFW 48260 ; (09) - Reset Must Process Current Script Data Flag for Entity at IX 47986 DEFW 48212 ; (10) - Reset Entity's Walking Left and Walking Right flags 47988 DEFW 48220 ; (11) - Set Entity Walking Left Flag 47990 DEFW 48216 ; (12) - Set Entity Walking Right Flag 47992 DEFW 48242 ; (13) - Set Berk's Facing Left Flag, and Reset his Facing Into Screen and Facing Right Flags 47994 DEFW 48246 ; (14) - Set Berk's Facing Right Flag, and Reset his Facing Into Screen and Facing Left Flags 47996 DEFW 48274 ; (15) - Jump to New Address if Berk Is Carrying Something 47998 DEFW 48148 ; (16) - Have Berk Hold an Entity, and Position it Appropriately Between his Hands 48000 DEFW 48154 ; (17) - Have Berk Put Down an Entity in Front of Him, if Appropriate 48002 DEFW 48158 ; (18) - Have Berk Put Down an Entity Behind Him, if Appropriate 48004 DEFW 48698 ; (19) - Move Carried Entity to Berk's Left as he Faces Left 48006 DEFW 48704 ; (20) - Move Carried Entity to Berk's Right as he Faces Right 48008 DEFW 48692 ; (21) - Move Carried Entity in Front of Berk as he Faces Out of Screen 48010 DEFW 48686 ; (22) - Move Carried Entity Behind Berk as he Faces Into Screen 48012 DEFW 48295 ; (23) - Start Loop (1 / 3) 48014 DEFW 48307 ; (24) - End Loop (1 / 3) 48016 DEFW 48324 ; (25) - Start Loop (2 / 3) 48018 DEFW 48336 ; (26) - End Loop (2 / 3) 48020 DEFW 48353 ; (27) - Start Loop (3 / 3) 48022 DEFW 48365 ; (28) - End Loop (3 / 3) 48024 DEFW 48920 ; (29) - Make Berk Start Falling, and Drop his Carried Entity if Appropriate 48026 DEFW 48934 ; (30) - Check Berk's Fall Velocity, and React to Landing 48028 DEFW 48976 ; (31) - React to Berk's Landing 48030 DEFW 48487 ; (32) - Update Berk's Position and State (Flying) Depending Upon Control Input 48032 DEFW 49010 ; (33) - Advance Berk's Jump and Select Next Phase if Current Phase Complete 48034 DEFW 48541 ; (34) - Move Entity at IX (and if Berk, Carried Entity) Up One Character 48036 DEFW 48567 ; (35) - Move Entity at IX (and if Berk, Carried Entity) Down One Character 48038 DEFW 36950 ; (36) - Set Boni's Room (Level 1) to Zero 48040 DEFW 36957 ; (37) - Remove Flying Skeleton Creature from Level 1, and Terminate Script Processing 48042 DEFW 36984 ; (38) - Close the Trap Door 48044 DEFW 36990 ; (39) - Open the Trap Door 48046 DEFW 37778 ; (40) - Move Spider Down One Character, and if at Bottom, Advance it to Bounce / Climb Up Mode 48048 DEFW 37718 ; (41) - Move Spider Up One Character and, if Home, Reset its Timer and Make it Wait 48050 DEFW 37753 ; (42) - Decrease Remaining Time Until Spider Next Descends and if Zero, Start Descent 48052 DEFW 51779 ; (43) - Select Next Action for Drutt Depending Upon Control Input 48054 DEFW 52029 ; (44) - Move Entity Up One Character 48056 DEFW 52038 ; (45) - Move Entity Down One Character 48058 DEFW 52047 ; (46) - Move Drutt, or Entity he is Pushing Left One Character and Start Pushed Entity Falling ; if Appropriate 48060 DEFW 52142 ; (47) - Move Drutt, or Entity he is Pushing Right One Character and Start Pushed Entity ; Falling if Appropriate 48062 DEFW 34901 ; (48) - Return 48064 DEFW 34901 ; (49) - Return 48066 DEFW 52243 ; (50) - Advance Drutt's Jump and Select Next Phase if Current Phase Complete 48068 DEFW 52309 ; (51) - Swap Drutt's Current Depth Level if Possible 48070 DEFW 52967 ; (52) - Increase Worm's Age and Decrease Time Until Direction Change, or React to Drutt's ; Presence 48072 DEFW 52870 ; (53) - Move Worm Left if Possible, Otherwise Choose New Direction 48074 DEFW 52889 ; (54) - Move Worm Right if Possible, Otherwise Choose New Direction 48076 DEFW 52914 ; (55) - Choose New Direction and Start Crawling (Worm) 48078 DEFW 36471 ; (56) - Give Berk Power Corresponding to Entity Eaten 48080 DEFW 36610 ; (57) - Cycle Attributes (Full-Screen), Clear Display Buffers and Paint Red Areas Outside ; Current Room 48082 DEFW 36390 ; (58) - Have Berk Interact Appropriately with a Door in Front of Him 48084 DEFW 36385 ; (59) - Have Berk Interact Appropriately with a Door Behind Him 48086 DEFW 38554 ; (60) - Check Position of Apebeast and Turn If Appropriate 48088 DEFW 38165 ; (61) - Fire Bubo's Projectile 48090 DEFW 48142 ; (62) - Move Entity at IX into Room to the Left, if Appropriate 48092 DEFW 41550 ; (63) - Have Skeleton Advance or Retreat Based Upon Positions of Berk and Fake Boni 48094 DEFW 41617 ; (64) - Set Random (1 to 10) Number of Iterations in Following Loop Script Instruction ; Advance HL to Next Script Instruction and Execute ; ; Used by the routines at #R35735, #R36116, #R36390, #R36471, #R36542, #R36610, #R36947, #R36950, #R36984, #R36990, ; #R37085, #R37639, #R37753, #R38074, #R38165, #R38540, #R38554, #R41498, #R41617, #R48133, #R48142, #R48148, ; #R48158, #R48220, #R48246, #R48260, #R48267, #R48274, #R48307, #R48336, #R48365, #R48487, #R48567, #R48593, ; #R48641, #R48686, #R48692, #R48698, #R48704, #R48920, #R49010, #R51765, #R52029, #R52038, #R52047, #R52142, ; #R52243, #R52309, #R52860, #R52870, #R52889 and #R52967. Input: IX (Entry at #R48096 and #R48098) Address of ; complex state data for an entity Output: HL Current position in script data c48096 INC HL ; Advance Script Data Pointer by two bytes... 48097 INC HL ; ... ; This entry point is used by the routines at #R35577, #R35735, #R36008, #R36036, #R36116, #R36367, #R36390, ; #R36471, #R36638, #R37085, #R37639, #R37718, #R37753, #R37778, #R38074, #R38554, #R41550, #R48285, #R48295, ; #R48307, #R48324, #R48336, #R48353, #R48365, #R48388, #R48934, #R48976, #R49010, #R51765, #R51779, #R51904, ; #R51924, #R51944, #R51954, #R51960, #R52053, #R52148, #R52243, #R52908, #R52914, #R52967 and #R53083. *48098 INC HL ; Advance Script Data Pointer by one byte 48099 LD A,(HL) ; Load byte at this location into A 48100 DEC HL ; Move HL back one byte 48101 OR A ; If byte loaded into A was zero (i.e. a script instruction)... 48102 JR Z,48117 ; ...then skip ahead to #R48117 ; HL pointing to a graphic layout data address, rather than a script instruction 48104 LD (34277),HL ; Store address in HL at #R34277 as position in script currently running 48107 LD A,(HL) ; Load word at location HL into Graphic Layout Address in current entity's complex state data ; entry (IX)... 48108 LD (IX+2),A ; ... 48111 INC HL ; ... 48112 LD A,(HL) ; ... 48113 LD (IX+3),A ; ... 48116 RET ; Return ; HL pointing to a script instruction *48117 LD A,(HL) ; Load script "instruction" into A 48118 PUSH HL ; Store HL (pointer to current position in script data) 48119 LD HL,47966 ; Point HL at Table of Script Routine Start Addresses 48122 ADD A,A ; Load double index of script instruction into BC... 48123 LD C,A ; ... 48124 LD B,0 ; ... 48126 ADD HL,BC ; ...and add as offset in HL to point to start address of required script routine 48127 LD C,(HL) ; Load address at this location into BC... 48128 INC HL ; ... 48129 LD B,(HL) ; ... 48130 POP HL ; Restore HL (pointer to current position in script data) 48131 PUSH BC ; Push address in BC onto stack... 48132 RET ; ...and RET to this address ; Script Routine (04) If Current Character and Target Entity are in the Same Room then Set Pending Sound Input: HL ; Current position in script data IX Address of complex state data for an entity c48133 INC HL ; Advance HL to parameter (sound index)... 48134 INC HL ; ... 48135 LD A,(HL) ; Load A with sound index 48136 CALL 59601 ; If current character is in same room as target entity at IX then set pending sound to A 48139 JP 48096 ; Advance HL to next script instruction and execute ; Script Routine (62) Move Entity at IX into Room to the Left, if Appropriate c48142 CALL 54348 ; Move entity at IX into room to the left, if appropriate 48145 JP 48096 ; Advance HL to next script instruction and execute ; Script Routine (16) Have Berk Hold an Entity, and Position it Appropriately Between his Hands c48148 CALL 48850 ; Have Berk hold an entity, and position it appropriately between his hands 48151 JP 48096 ; Advance HL to next script instruction and execute ; Script Routine (17) Have Berk Put Down an Entity in Front of Him, if Appropriate Output: D Depth offset for ; entity being put down c48154 LD D,0 ; Load D with depth offset of 0 (as Berk is putting down an entity in front of him) 48156 JR 48160 ; Have Berk put down an entity, if appropriate ; Script Routine (18) Have Berk Put Down an Entity Behind Him, if Appropriate Input: D (Entry at #R48160 only) ; Depth offset for entity being put down IX Address of complex state data (current level) for Berk c48158 LD D,255 ; Load D with depth offset of -1 (as Berk is putting down an entity behind him) ; This entry point is used by the routine at #R48154. *48160 BIT 4,(IX+9) ; If Berk's Carrying Something Flag is reset... 48164 RET Z ; ...then return ; Berk is carrying something 48165 RES 4,(IX+9) ; Reset Berk's Carrying Something Flag 48169 XOR A ; Set class of entity held by Berk to zero (i.e. nothing)... 48170 LD (34221),A ; ... 48173 LD IY,(34260) ; Load IY with address of complex state data for entity last held by Berk... 48177 RES 5,(IY+10) ; ...and reset its Is Being Carried Flag 48181 LD A,(IY+6) ; Load E with height of entity minus one... 48184 SUB (IY+4) ; ... 48187 LD E,A ; ... 48188 LD A,(34222) ; Load A with y-coordinate minus one of top edge of coloured creature slot Berk is interacting ; with... 48191 OR A ; ...and if this is not zero... 48192 JR NZ,48198 ; ...then skip ahead to #R48198 ; Value at #R34222 is zero (i.e. Berk not interacting with a coloured creature slot on Level 3) 48194 LD A,(IX+6) ; Load A with y-coordinate of Berk's bottom edge... 48197 ADD A,D ; ...plus depth offset... ; At this point, A holds either the y-coordinate of Berk's bottom edge plus depth offset, or the y-coordinate minus ; one of the top edge of (actually the y-coordinate of the bottom of the space within) a coloured creature slot on ; Level 3. This value in A is the y-coordinate that the carried entity's bottom edge will take on when that entity ; is put down. *48198 LD (IY+6),A ; Set the y-coordinate of the bottom edge of the put-down entity to value in A 48201 SUB E ; Set the y-coordinate of the top edge of the put-down entity... 48202 LD (IY+4),A ; ...to that of the bottom edge, minus the height as appropriate 48205 XOR A ; Set value at #R34222 to zero... 48206 LD (34222),A ; ...as Berk is not (any longer) interacting with a coloured creature slot on Level 3 48209 JP 48096 ; Advance HL to next script instruction and execute ; Script Routine (10) Reset Walking Left and Walking Right Flags ; ; Used by the routine at #R36542. Output: E Combination of flags to (re)set c48212 LD E,0 ; Reset Entity Walking Left and Entity Walking Right flags... 48214 JR 48222 ; ...and advance HL to next script instruction and execute ; Script Routine (12) Reset Walking Left Flag and Set Walking Right Flag Output: E Combination of flags to (re)set c48216 LD E,1 ; Set Entity Walking Right Flag, reset Entity Walking Left Flag... 48218 JR 48222 ; ...and advance HL to next script instruction and execute ; Script Routine (11) Set Walking Left Flag and Reset Walking Right Flag Input: E (Entry at #R48222 only) ; Combination of flags to (re)set IX Address of complex state data for an entity c48220 LD E,2 ; Prepare to set Entity Walking Left Flag and reset Entity Walking Right Flag ; This entry point is used by the routines at #R48212 and #R48216. *48222 LD A,(IX+11) ; (Re)set Walking Left and Walking Right flags as prepared in E... 48225 AND 240 ; ...and reset Unused (11,2) and Unused (11,3) flags... 48227 ADD A,E ; ... 48228 LD (IX+11),A ; ... 48231 JP 48096 ; Advance HL to next script instruction and execute ; Script Routine (07) Reset Berk's Facing Into Screen, Facing Left and Facing Right Flags Output: B Combination of ; flags to (re)set c48234 LD B,0 ; Reset Berk's Facing Into Screen, Facing Left and Facing Right flags... 48236 JR 48248 ; ...and advance HL to next script instruction and execute ; Script Routine (06) Set Berk's Facing Into Screen Flag, and Reset his Facing Left and Facing Right Flags Output: B ; Combination of flags to (re)set c48238 LD B,2 ; Set Berk's Facing Into Screen Flag, and reset his Facing Left and Facing Right flags... 48240 JR 48248 ; ...and advance HL to next script instruction and execute ; Script Routine (13) Set Berk's Facing Left Flag, and Reset his Facing Into Screen and Facing Right Flags Output: B ; Combination of flags to (re)set c48242 LD B,4 ; Set Berk's Facing Left Flag, and reset his Facing Into Screen and Facing Right flags... 48244 JR 48248 ; ...and advance HL to next script instruction and execute ; Script Routine (14) Set Berk's Facing Right Flag, and Reset his Facing Into Screen and Facing Left Flags Input: B ; (Entry at #R48248 only) Combination of flags to (re)set IX Address of complex state data (current level) for Berk c48246 LD B,8 ; Prepare to set Berk's Facing Right Flag, and reset his Facing Into Screen and Facing Left ; flags ; This entry point is used by the routines at #R48234, #R48238 and #R48242. *48248 LD A,(IX+9) ; Load A with Berk's flags... 48251 AND 241 ; ...clearing Facing Into Screen, Facing Left and Facing Right flags 48253 ADD A,B ; Combine with flags in B... 48254 LD (IX+9),A ; ...and store 48257 JP 48096 ; Advance HL to next script instruction and execute ; Script Routine (09) Reset Must Process Current Script Data Flag for Entity at IX Input: IX Address of complex ; state data for an entity c48260 RES 0,(IX+9) ; Reset Must Process Current Script Data Flag 48264 JP 48096 ; Advance HL to next script instruction and execute ; Script Routine (08) Set Must Process Current Script Data Flag for Entity at IX Input: IX Address of complex ; state data for an entity c48267 SET 0,(IX+9) ; Set Must Process Current Script Data Flag 48271 JP 48096 ; Advance HL to next script instruction and execute ; Script Routine (15) Jump to New Address if Berk Is Carrying Something Input: HL Current position in script data ; IX Address of complex state data for an entity c48274 INC HL ; Advance HL to parameter for current instruction... 48275 INC HL ; ... 48276 BIT 4,(IX+9) ; If Berk is carrying an entity... 48280 JR NZ,48287 ; ...then read parameter address into HL and execute next script instruction at that address 48282 JP 48096 ; Advance HL to next script instruction and execute ; Script Routine (01) Load HL (Script Data Pointer) with New Address ; ; Functionality analogous to JP instruction. Input: HL Address in script data Output: HL New address in script ; data c48285 INC HL ; Advance Script Data Pointer by two bytes... 48286 INC HL ; ... ; This entry point is used by the routine at #R48274. *48287 LD C,(HL) ; Read WORD at this location into HL... 48288 INC HL ; ...(i.e. update Script Data Pointer to this address)... 48289 LD B,(HL) ; ... 48290 PUSH BC ; ... 48291 POP HL ; ... 48292 JP 48098 ; ...and execute script instruction at this location ; Script Routine (23) Start Loop (1 / 3) ; ; Start a loop in script data. The first of the following two bytes is the repeat count and the second is ; disregarded. The current value of the repeat counter is stored at #R34285 and the address of the next instruction ; (i.e. the first instruction that is processed in each loop) is stored at #R34285. Output: HL Address of next ; script instruction to execute c48295 CALL 48382 ; Load A with script instruction parameter, and advance HL to next instruction 48298 LD (34285),A ; Store repeat count at #R34285 48301 LD (34286),HL ; Store address to return to (i.e. first instruction in loop) at #R34285... 48304 JP 48098 ; ...and execute script instruction at this location ; Script Routine (24) End Loop (1 / 3) Output: HL Address of next script instruction to execute c48307 LD A,(34285) ; Load A with current repeat count 48310 OR A ; If repeat count is zero... 48311 JP Z,48096 ; ...then jump to #R48096 (advance HL to next script instruction and execute) 48314 DEC A ; Decrease repeat count... 48315 LD (34285),A ; ...and store 48318 LD HL,(34286) ; Load HL with address of first instruction in loop... 48321 JP 48098 ; ...and execute script instruction at this location ; Script Routine (25) Start Loop (2 / 3) ; ; Start a loop in script data. The first of the following two bytes is the repeat count and the second is ; disregarded. The current value of the repeat counter is stored at #R34288 and the address of the next instruction ; (i.e. the first instruction that is processed in each loop) is stored at #R34288. Output: HL Address of next ; script instruction to execute c48324 CALL 48382 ; Load A with script instruction parameter, and advance HL to next instruction 48327 LD (34288),A ; Store repeat count at #R34288 48330 LD (34289),HL ; Store address to return to (i.e. first instruction in loop) at #R34288... 48333 JP 48098 ; ...and execute script instruction at this location ; Script Routine (26) End Loop (2 / 3) Output: HL Address of next script instruction to execute c48336 LD A,(34288) ; Load A with current repeat count 48339 OR A ; If repeat count is zero... 48340 JP Z,48096 ; ...then jump to #R48096 (advance HL to next script instruction and execute) 48343 DEC A ; Decrease repeat count... 48344 LD (34288),A ; ...and store 48347 LD HL,(34289) ; Load HL with address of first instruction in loop... 48350 JP 48098 ; ...and execute script instruction at this location ; Script Routine (27) Start Loop (3 / 3) ; ; Start a loop in script data. The first of the following two bytes is the repeat count and the second is ; disregarded. The current value of the repeat counter is stored at #R34291 and the address of the next instruction ; (i.e. the first instruction that is processed in each loop) is stored at #R34291. Output: HL Address of next ; script instruction to execute c48353 CALL 48382 ; Load A with script instruction parameter, and advance HL to next instruction 48356 LD (34291),A ; Store repeat count at #R34291 48359 LD (34292),HL ; Store address to return to (i.e. first instruction in loop) at #R34291... 48362 JP 48098 ; ...and execute script instruction at this location ; Script Routine (28) End Loop (3 / 3) Output: HL Address of next script instruction to execute c48365 LD A,(34291) ; Load A with current repeat count 48368 OR A ; If repeat count is zero... 48369 JP Z,48096 ; ...then jump to #R48096 (advance HL to next script instruction and execute) 48372 DEC A ; Decrease repeat count... 48373 LD (34291),A ; ...and store 48376 LD HL,(34292) ; Load HL with address of first instruction in loop... 48379 JP 48098 ; ...and execute script instruction at this location ; Load A with Script Instruction Parameter then Advance HL to Next Instruction ; ; Used by the routines at #R48295, #R48324 and #R48353. c48382 INC HL ; Advance HL by two bytes, beyond end of current instruction... 48383 INC HL ; ... 48384 LD A,(HL) ; Load value here into A 48385 INC HL ; Advance HL by two more bytes to start of next instruction... 48386 INC HL ; ... 48387 RET ; Return ; Decrease Remaining Time for Current Power and if Zero, Exit Calling Routine and Run Script Data for Removal of ; Power ; ; Used by the routines at #R35689, #R36542 and #R48487. c48388 LD DE,(34224) ; Load remaining power time into DE 48392 LD A,E ; Increase E (number of game-cycles power has been in use in current block)... 48393 INC A ; ... 48394 LD E,A ; ... 48395 CP 15 ; If 16 game-cycles of power use have not yet elapsed... 48397 JR NZ,48402 ; ...then skip ahead to #R48402 48399 LD E,0 ; Reset number of game-cycles power has been in use to zero... 48401 DEC D ; ...and decrease remaining number of 16-game-cycles *48402 LD (34224),DE ; Store updated remaining power time... 48406 RET NZ ; ...and return if this is not zero 48407 POP BC ; Remove top value from stack (i.e. return address to routine that called this routine) 48408 CALL 48417 ; Remove Berk's current power and reset sweet / mushroom / edible eyes / sausage to its ; original position 48411 LD HL,35275 ; Point HL at script data for Berk's power expiring... 48414 JP 48098 ; ...and execute ; Remove Berk's Current Power and Reset Sweet / Mushroom / Edible Eyes / Sausage to its Original Position ; ; Used by the routines at #R36390, #R36471, #R39151 and #R48388. c48417 LD A,(34220) ; If Berk has no current power... 48420 OR A ; ... 48421 RET Z ; ...then return 48422 PUSH IX ; Store IX 48424 CP 6 ; If Berk's current power is not 6 (flying, level 3, 2)... 48426 JR NZ,48445 ; ...then skip ahead to #R48445 48428 LD A,13 ; Reset complex state data for Red Coloured Creature to that stored in Initial-State Table... 48430 CALL 53987 ; ... 48433 LD A,14 ; Reset complex state data for Yellow Coloured Creature to that stored in Initial-State ; Table... 48435 CALL 53987 ; ... 48438 LD A,15 ; Reset complex state data for White Coloured Creature to that stored in Initial-State ; Table... 48440 CALL 53987 ; ... 48443 JR 48474 ; Skip ahead to #R48474 *48445 CP 10 ; If Berk's current power is not 10 (floating)... 48447 JR NZ,48474 ; ...then skip ahead to #R48474 48449 LD IX,(34240) ; Load IX with address of current level's complex state data for Berk 48453 RES 7,(IX+9) ; Reset Berk's Moving Upwards Flag 48457 LD (IX+11),192 ; Reset Berk's Walking Right, Walking Left, Unused (11,2), Unused (11,3), Impassable Leftwards ; and Impassable Rightwards flags and set his Interaction (11,6) and Interaction (11,7) flags 48461 RES 7,(IX+8) ; Reset bit 7 of Berk's class value (change from 159 to 31) 48465 DEC (IX+6) ; Decrease Berk's bottom y-coordinate by two... 48468 DEC (IX+6) ; ... 48471 CALL 55516 ; Set Berk's Can Fall Flag and set his initial velocity factor to 2 *48474 LD A,(34220) ; Reset complex state data for entity responsible for Berk's current power to that stored in ; Initial-State Table... 48477 CALL 53987 ; ... 48480 XOR A ; Clear Berk's current power... 48481 LD (34220),A ; ... 48484 POP IX ; Restore IX 48486 RET ; Return ; Script Routine (32) Update Berk's Position and State (Flying) Depending Upon Control Input ; ; See pokes Input: IX (Entry at #R48487 only) Address of complex state data (current level) for Berk IX (Entry at ; #R48541 only) Address of complex state data for an entity Output: HL Address of next script instruction to ; execute c48487 CALL 48388 ; Decrease remaining time for current power and if zero, exit this routine and run script data ; for removal of power 48490 CALL 54768 ; Check entity at IX for collision with another entity at same depth whose Interaction (11,6) ; Flag is set... 48493 CP 130 ; ...and if collision was not with entity of class 130 (causes Berk and Drutt to bounce off or ; bang head)... 48495 JR NZ,48507 ; ...then skip ahead to #R48507 48497 RES 6,(IX+9) ; Reset entity's Is Flying Flag 48501 LD HL,35359 ; Load HL with script data address for Berk starting to fall downwards 48504 JP 48096 ; Advance HL to next script instruction and execute *48507 LD A,(IX+6) ; If y-coordinate of Berk's bottom edge is 121 or greater... 48510 CP 121 ; ... 48512 JR NC,48527 ; ...then skip ahead to #R48527 48514 LD A,(34219) ; Load A with control input 48517 BIT 0,A ; If right pressed... 48519 JP NZ,48593 ; ...then move Berk right one character, and into new room if appropriate 48522 BIT 1,A ; If left pressed... 48524 JP NZ,48641 ; ...then move Berk left one character, and into new room if appropriate *48527 LD A,(IX+6) ; If y-coordinate of Berk's bottom edge is less than 98... 48530 CP 98 ; ... 48532 JP C,48096 ; ...then jump to #R48096 (advance HL to next script instruction and execute) 48535 CALL 55433 ; Change Berk's room up one if appropriate 48538 CALL 48710 ; Move carried entity in front of Berk as he faces out of screen ; This entry point is used by the routine at #R37718. It is also the start of the routine triggered by instruction ; 34 in script data. *48541 DEC (IX+4) ; Decrease y-coordinates of entity's top and bottom edges by one character... 48544 DEC (IX+6) ; ... 48547 BIT 4,(IX+9) ; If entity is Berk and his Carrying Something Flag is reset... 48551 JP Z,48096 ; ...then jump to #R48096 (advance HL to next script instruction and execute) 48554 LD IY,(34260) ; Load IY with address of complex state data for entity held by Berk... 48558 DEC (IY+4) ; ...and decrease its top and bottom y-coordinates by one character... 48561 DEC (IY+6) ; ... 48564 JP 48096 ; Advance HL to next script instruction and execute ; Script Routine (35) Move Entity at IX (and if Berk, Carried Entity) Down One Character ; ; Used by the routine at #R37778. Input: IX Address of complex state data for an entity c48567 INC (IX+4) ; Increase y-coordinates of entity's top and bottom edges by one character... 48570 INC (IX+6) ; ... 48573 BIT 4,(IX+9) ; If entity is Berk and his Carrying Something Flag is reset... 48577 JP Z,48096 ; ...then jump to #R48096 (advance HL to next script instruction and execute) 48580 LD IY,(34260) ; Load IY with address of complex state data for entity held by Berk... 48584 INC (IY+4) ; ...and increase its top and bottom y-coordinates by one character... 48587 INC (IY+6) ; ... 48590 JP 48096 ; Advance HL to next script instruction and execute ; Move Entity Right One Character, and Into New Room if Appropriate ; ; Used by the routine at #R48487. Input: IX (Entry at #R48593 only) Address of complex state data (current level) ; for Berk IX (Entry at #R48615 only) Address of complex state data for an entity c48593 LD A,(34235) ; Load E with width of current room (chars) + 99... 48596 LD E,A ; ... 48597 LD A,(IX+7) ; If x-coordinate of Berk's right side is less than x-coordinate of right of current room... 48600 CP E ; ... 48601 JR C,48615 ; ...then skip ahead to #R48615 (move Berk right by one character 48603 CALL 54505 ; Load B with index of room to right of current character's current room... 48606 JP Z,48096 ; ...and if there is no room to the right, then jump to #R48096 (advance HL to next script ; instruction and execute) 48609 CALL 54383 ; Move Berk into room to right of its current room and update position of carried entity if ; moving entity is Berk 48612 CALL 48710 ; Move carried entity in front of Berk as he faces out of screen ; This entry point is used by the routine at #R37085. It is also the start of the routine triggered by instruction ; 03 in script data. *48615 INC (IX+5) ; Increase x-coordinates of entity's left and right edges by one character... 48618 INC (IX+7) ; ... 48621 BIT 4,(IX+9) ; If entity is Berk and his Carrying Something Flag is reset... 48625 JP Z,48096 ; ...then jump to #R48096 (advance HL to next script instruction and execute) 48628 LD IY,(34260) ; Load IY with address of complex state data for entity held by Berk... 48632 INC (IY+5) ; ...and increase its left and right x-coordinates by one character... 48635 INC (IY+7) ; ... 48638 JP 48096 ; Advance HL to next script instruction and execute ; Move Entity Left One Character, and Into New Room if Appropriate ; ; Used by the routine at #R48487. Input: IX (Entry at #R48641 only) Address of complex state data (current level) ; for Berk IX (Entry at #R48660 only) Address of complex state data for an entity c48641 LD A,100 ; If Berk's left-side x-coordinate is greater than 100 (x-coordinate of left side of room)... 48643 CP (IX+5) ; ... 48646 JR C,48660 ; ...then skip ahead to #R48660 (move Berk left by one character) 48648 CALL 54539 ; Load B with index of room to left of entity's current room... 48651 JP Z,48096 ; ...and if there is no room to the left, then jump to #R48096 (advance HL to next script ; instruction and execute) 48654 CALL 54419 ; Move Berk into room to left of its current room and update position of carried entity if ; moving entity is Berk 48657 CALL 48710 ; Move carried entity in front of Berk as he faces out of screen ; This entry point is used by the routine at #R37085. It is also the start of the routine triggered by instruction ; 02 in script data. *48660 DEC (IX+5) ; Decrease x-coordinates of entity's left and right edges by one character... 48663 DEC (IX+7) ; ... 48666 BIT 4,(IX+9) ; If entity is Berk and his Carrying Something Flag is reset... 48670 JP Z,48096 ; ...then jump to #R48096 (advance HL to next script instruction and execute) 48673 LD IY,(34260) ; Load IY with address of complex state data for entity held by Berk... 48677 DEC (IY+5) ; ...and decrease its left and right x-coordinates by one character... 48680 DEC (IY+7) ; ... 48683 JP 48096 ; Advance HL to next script instruction and execute ; Script Routine (22) Move Carried Entity Behind Berk as he Faces Into Screen c48686 CALL 48715 ; Move carried entity behind Berk as he faces into screen 48689 JP 48096 ; Advance HL to next script instruction and execute ; Script Routine (21) Move Carried Entity in Front of Berk as he Faces Out of Screen c48692 CALL 48710 ; Move carried entity in front of Berk as he faces out of screen 48695 JP 48096 ; Advance HL to next script instruction and execute ; Script Routine (19) Move Carried Entity to Berk's Left as he Faces Left c48698 CALL 48738 ; Move carried entity to Berk's left as he faces left 48701 JP 48096 ; Advance HL to next script instruction and execute ; Script Routine (20) Move Carried Entity to Berk's Right as he Faces Right c48704 CALL 48727 ; Move carried entity to Berk's right as he faces right 48707 JP 48096 ; Advance HL to next script instruction and execute ; Move Carried Entity in Front of Berk as he Faces Out of Screen ; ; Used by the routines at #R36008, #R48487, #R48593, #R48641 and #R48692. c48710 CALL 48760 ; If Berk is carrying an entity then load A with its width minus one divided by two and D with ; Berk's depth, else return 48713 JR 48719 ; Move carried entity into horizontal position appropriate to its width (see notes in routine ; at #R48850) and return ; Move Carried Entity Behind Berk as he Faces into Screen ; ; Used by the routine at #R48686. c48715 CALL 48760 ; If Berk is carrying an entity then load A with its width minus one divided by two and D with ; Berk's depth, else return 48718 INC D ; Increase the depth (as carried entity has moved deeper into the screen) ; This entry point is used by the routine at #R48710. *48719 XOR 1 ; Move carried entity into horizontal position appropriate to its width (see notes in routine ; at #R48850)... 48721 INC A ; ... 48722 ADD A,(IX+5) ; ... 48725 JR 48749 ; Set carried entity's horizontal position and depth and return ; Move Carried Entity to Berk's Right as he Faces Right ; ; Used by the routines at #R48704 and #R54383. c48727 CALL 48760 ; If Berk is carrying an entity then load A with its width minus one divided by two and D with ; Berk's depth, else return 48730 INC D ; Increase the depth (as carried entity has moved deeper into the screen) 48731 NEG ; Subtract width of carried entity minus one divided by two... 48733 ADD A,(IX+7) ; ...from Berk's right-side x-coordinate and load into A 48736 JR 48749 ; Set carried entity's calculated horizontal position and depth and return ; Move Carried Entity to Berk's Left as he Faces Left ; ; Used by the routines at #R48698 and #R54419. Input: IY Address of complex state data for an entity carried by ; Berk c48738 CALL 48760 ; If Berk is carrying an entity then load A with its width minus one divided by two and D with ; Berk's depth, else return 48741 ADD A,A ; Double A to give width minus one... (see bugs) 48742 INC A ; ...and add one to get width of entity 48743 NEG ; Subtract width of carried entity... 48745 ADD A,(IX+5) ; ...from Berk's left-side x-coordinate and load into A 48748 INC D ; Increase the depth (as carried entity has moved deeper into the screen) ; This entry point is used by the routines at #R48715 and #R48727. *48749 LD (IY+5),A ; Set carried entity's horizontal position and depth... 48752 ADD A,E ; ... 48753 LD (IY+7),A ; ... 48756 LD (IY+1),D ; ... 48759 RET ; Return ; Load A, D and E with Positional Data for a Carried Entity or Return ; ; Used by the routines at #R48710, #R48715, #R48727 and #R48738. Input: IX Address of complex state data for an ; entity Output: A Width of carried entity (characters) minus 1, divided by two D Depth of entity at IX (Berk) E ; Width of carried entity (characters) minus 1 IY Address of complex state data for entity held by Berk c48760 BIT 4,(IX+9) ; If entity IX is Berk and his Carrying Something Flag is set... 48764 JR NZ,48768 ; ...then skip ahead to #R48768 48766 POP BC ; Pop top value (return address) off stack... 48767 RET ; ...and return to routine that called the calling routine *48768 LD IY,(34260) ; Load IY with address of complex state data for entity held by Berk 48772 LD A,(IX+0) ; Set this entity's room to be same as Berk's... 48775 LD (IY+0),A ; ... 48778 CALL 48897 ; Move carried entity into vertical position appropriate to its height 48781 LD A,(34272) ; Load A and E with width of entity (characters) carried by Berk, minus 1... 48784 LD E,A ; ... 48785 SRL A ; Divide A by two, removing remainder 48787 LD D,(IX+1) ; Load carried entity's depth into D 48790 RET ; Return ; Unused routine ; ; Assuming that IX and IY contain the addresses of two entities' complex state data, this routine will position the ; entity at IX such that it is horizontally centred with respect to, and B characters below the entity at IY. Input: ; IX Address of complex state data for Entity 1 (assumed) IY Address of complex state data for Entity 2 (assumed) ; B Vertical offset (assumed) c48791 LD A,(IX+6) ; Load C with height of Entity 1 minus one... 48794 SUB (IX+4) ; ... 48797 LD C,A ; ... 48798 LD A,(IY+6) ; Load A with y-coordinate of bottom edge of Entity 2 plus B... 48801 ADD A,B ; ... 48802 LD (IX+6),A ; Set y-coordinate of bottom edge of Entity 1 to A 48805 SUB C ; Update y-coordinate of top edge of Entity 1 accordingly... 48806 LD (IX+4),A ; ... 48809 LD A,(IX+7) ; Load B with width of Entity 1 minus one... 48812 SUB (IX+5) ; ... 48815 LD B,A ; ... 48816 SRL A ; Load C with half of width of Entity 1 minus one... 48818 LD C,A ; ... 48819 LD A,(IY+7) ; Load A with half of width of Entity 2 minus one... 48822 SUB (IY+5) ; ... 48825 SRL A ; ... 48827 ADD A,(IY+5) ; ...and add x-coordinate of left edge of Entity 2 ; At this point, A holds the x-coordinate of the mid-point of Entity 2 48830 SUB C ; Subtract half of width of Entity 1 minus one... 48831 LD (IX+5),A ; ...and set as x-coordinate of left edge of Entity 1 48834 ADD A,B ; Update x-coordinate of right edge of entity 2 accordingly... 48835 LD (IX+7),A ; ... 48838 LD A,(IX+8) ; If Entity 1 is not Berk... 48841 CP 31 ; ... 48843 RET NZ ; ...then return 48844 PUSH HL ; Store HL 48845 CALL 53887 ; Paint red areas outside accessible areas of current character's current room 48848 POP HL ; Restore HL 48849 RET ; Return ; Have Berk Hold an Entity, and Position it Appropriately Between his Hands ; ; The instruction blocks #R48872-#R48894 and #R48897-#R48916 move the entity that Berk is carrying into position ; (i.e. between Berk's hands), at a horizontal or vertical position appropriate to the height / width of that ; entity. These instructions result in the following x- or y-coordinates (left or top of carried entity relative to ; left or top of carrier, i.e. Berk): Input: IX Address of complex state data (current level) for Berk IY (entry ; at #R48897) Address of complex state data for an entity carried by Berk Output: IY Address of complex state data ; for entity held by Berk c48850 LD IY,(34256) ; Load IY with address of complex state data for entity to be held by Berk... 48854 LD (34260),IY ; ...and store at #R34260 as address of state data for entity held by Berk 48858 SET 5,(IY+10) ; Set the entity's Is Being Carried Flag 48862 SET 4,(IX+9) ; Set Berk's Carrying Something Flag 48866 LD A,(IY+8) ; Set class of entity held by Berk to be this entity's class... 48869 LD (34221),A ; ... 48872 LD A,(IY+7) ; Load A with the width of the entity, minus 1... 48875 SUB (IY+5) ; ... 48878 LD (34272),A ; ...and store at #R34272 48881 LD E,A ; Load E with width of entity, minus 1 48882 SRL A ; Move entity defined at IY into horizontal position appropriate to its height (see notes ; above)... 48884 XOR 1 ; ... 48886 INC A ; ... 48887 ADD A,(IX+5) ; ... 48890 LD (IY+5),A ; ... 48893 ADD A,E ; ... 48894 LD (IY+7),A ; ... ; This entry point is used by the routine at #R48760. *48897 LD A,(IY+6) ; Move entity defined at IY into vertical position appropriate to its height (see notes ; above)... 48900 SUB (IY+4) ; ... 48903 LD E,A ; ... 48904 SRL A ; ... 48906 XOR 1 ; ... 48908 INC A ; ... 48909 ADD A,(IX+4) ; ... 48912 LD (IY+4),A ; ... 48915 ADD A,E ; ... 48916 LD (IY+6),A ; ... 48919 RET ; Return ; Script Routine (29) Make Berk Start Falling, and Drop his Carried Entity if Appropriate Input: IX Address of ; complex state data for an entity c48920 LD (IX+12),2 ; Set Berk's initial velocity factor to 2 48924 SET 6,(IX+10) ; Set Berk's "Can Fall" flag 48928 CALL 36296 ; Make Berk drop the entity he is holding and load IY with its complex state data address 48931 JP 48096 ; Advance HL to next script instruction and execute ; Script Routine (30) Check Berk's Fall Velocity, and React to Landing ; ; See trivia and pokes Input: IX Address of complex state data (current level) for Berk Output: HL Address of ; next script instruction to execute c48934 BIT 6,(IX+10) ; If Berk's "Can Fall" Flag is reset (i.e. Berk has landed)... 48938 JR Z,48958 ; ...then skip ahead to #R48958 48940 BIT 3,(IX+12) ; If bit 3 of Berk's velocity factor is set (i.e. Berk has a velocity factor of 8)... 48944 JR NZ,48952 ; ...then skip ahead to #R48952 48946 LD HL,35363 ; Load HL with address of script data for Berk starting to fall... 48949 JP 48098 ; ...and execute *48952 LD HL,35367 ; Point HL at script data for Berk falling rapidly (horizontal, arms outstretched)... 48955 JP 48098 ; ...and execute *48958 BIT 3,(IX+12) ; If bit 3 of Berk's velocity factor is set (i.e. Berk has a velocity factor of 8)... 48962 JR NZ,48970 ; ...then skip ahead to #R48970 48964 LD HL,35457 ; Point HL at script data for Berk landing (after jump) 48967 JP 48098 ; ...and execute *48970 LD HL,35371 ; Point HL at script data for Berk lying on floor stunned and getting up 48973 JP 48098 ; ...and execute ; Script Routine (31) React to Berk's Landing ; ; See trivia Input: IX Address of complex state data for an entity Output: HL Address of next script instruction ; to execute c48976 BIT 3,(IX+12) ; If bit 3 of Berk's velocity factor is set (i.e. Berk has a velocity factor of 8)... 48980 JR NZ,48988 ; ...then skip ahead to #R48988 48982 LD HL,35457 ; Point HL at script data for Berk landing (after jump) 48985 JP 48098 ; ...and execute *48988 LD HL,35371 ; Point HL at script data for Berk lying on floor stunned and getting up 48991 JP 48098 ; ...and execute ; Table of Addresses of Berk's Jump Script Data b48994 DEFW 35441 ; (1) - Berk starting to jump straight up 48996 DEFW 35447 ; (2) - Unused 48998 DEFW 35457 ; (3) - Berk landing (after jump) 49000 DEFW 35469 ; (4) - Berk jumping left 49002 DEFW 35481 ; (5) - Berk jumping right 49004 DEFW 35283 ; (6) - Berk banging head 49006 DEFW 35339 ; (7) - Berk falling to the right 49008 DEFW 35303 ; (8) - Berk falling to the left ; Script Routine (33) Advance Berk's Jump and Select Next Phase if Current Phase Complete Output: HL Address of ; next script instruction to execute c49010 CALL 55041 ; Handle Berk's jump, and load A with Jump State Index as appropriate... 49013 LD A,E ; ... 49014 OR A ; If Jump State Index is zero... 49015 JP Z,48096 ; ...then jump to #R48096 (advance HL to next script instruction and execute) 49018 DEC A ; Decrease Jump State Index 49019 LD DE,48994 ; Load DE with start address of Table of Addresses of Berk's Jump Script Data 49022 CALL 53814 ; Advance DE by 2xA Bytes, load WORD at this location into HL... 49025 EX DE,HL ; ... 49026 JP 48098 ; ...and execute script instruction at this location ; Graphic Layout Data Architecture (Level 4) Double Row of Green Bricks, 32 Characters Wide b49029 DEFB 250,0,16 ; Change cursor's x- and y-coordinates by +16 and 0 characters ; respectively 49032 DEFB 251,208,191 ; Process graphic layout data at #R49104 and upon returning, move ; cursor to base coordinates ; Double Row of Green Bricks (1 / 2), 16 Characters Wide 49035 DEFB 244,12 ; Set current graphic set to 12 49037 DEFB 242,4 ; Set current attribute to 4 49039 DEFB 9,161,10,161,11,161 49045 DEFB 9,161,10,161,10,161,11,161 49053 DEFB 9,161,11,161 49057 DEFB 9,161,10,161,11,161 49063 DEFB 9,161,10,161,10,161,11,145 49071 DEFB 9,161,11,161 49075 DEFB 9,161,10,161,10,161,11,161 49083 DEFB 9,161,11,161 49087 DEFB 9,161,10,161,11,161 49093 DEFB 9,161,10,161,11,161 49099 DEFB 9,161,11,161 49103 DEFB 255 ; End Marker ; Double Row of Green Bricks (2 / 2), 16 Characters Wide 49104 DEFB 244,12 ; Set current graphic set to 12 49106 DEFB 242,4 ; Set current attribute to 4 49108 DEFB 9,161,10,161,11,161 49114 DEFB 9,161,11,161 49118 DEFB 9,161,10,161,10,161,11,161 49126 DEFB 9,161,10,161,11,161 49132 DEFB 9,161,11,161 49136 DEFB 9,161,11,145 49140 DEFB 9,161,10,161,10,161,11,161 49148 DEFB 9,161,10,161,11,161 49154 DEFB 9,161,10,161,11,161 49160 DEFB 9,161,10,161,11,161 49166 DEFB 9,161,10,161,11,161 49172 DEFB 255 ; End Marker ; Yellow Brick Column 49173 DEFB 242,6 ; Set current attribute to 6 49175 DEFB 248,28,192 ; Jump to #R49180 (brick column) ; Green Brick Column 49178 DEFB 242,4 ; Set current attribute to 4 49180 DEFB 244,12 ; Set current graphic set to 12 49182 DEFB 250,0,249 ; Change cursor's x- and y-coordinates by -7 and 0 characters ; respectively 49185 DEFB 9,161,10,161,10,161,11,161 49193 DEFB 9,161,11,161 49197 DEFB 9,161,10,161,11,161 49203 DEFB 9,161,11,161 49207 DEFB 9,161,10,161,11,161 49213 DEFB 9,161,10,161,10,161,10,161,11,143 49223 DEFB 9,161,10,161,10,161,11,161 49231 DEFB 9,161,10,161,11,161 49237 DEFB 9,161,10,161,10,161,10,161,11,161 49247 DEFB 9,161,10,161,11,148 49253 DEFB 9,161,11,161 49257 DEFB 9,161,10,161,10,161,11,161 49265 DEFB 9,161,10,161,11,161 49271 DEFB 9,161,11,153 49275 DEFB 9,161,10,161,10,161,11,161 49283 DEFB 9,161,11,155 49287 DEFB 9,161,10,161,10,161,11,158 49295 DEFB 9,161,10,161,11,157 49301 DEFB 9,161,10,161,11,158 49307 DEFB 9,161,10,161,11,159 49313 DEFB 9,161,11,159 49317 DEFB 9,161,10,161,11,158 49323 DEFB 9,161,11,158 49327 DEFB 9,161,10,161,10,161,11,158 49335 DEFB 9,161,11,159 49339 DEFB 9,161,10,161,11,158 49345 DEFB 9,161,11,158 49349 DEFB 9,161,10,161,11,158 49355 DEFB 9,161,10,161,10,161,11,158 49363 DEFB 9,161,10,161,11,158 49369 DEFB 9,161,11,158 49373 DEFB 9,161,10,161,11,159 49379 DEFB 9,161,11,158 49383 DEFB 9,161,10,161,10,161,11,161 49391 DEFB 255 ; End Marker ; Small Red and Blue Wall 49392 DEFB 244,12 ; Set current graphic set to 12 49394 DEFB 242,2 ; Set current attribute to 2 49396 DEFB 238,4 ; Set Repeat Counter A to 4 49398 DEFB 9,161,11,159 49402 DEFB 239 ; Decrement Repeat Counter A and loop back to #R49398 if not zero 49403 DEFB 242,1 ; Set current attribute to 1 49405 DEFB 238,3 ; Set Repeat Counter A to 3 49407 DEFB 9,161,11,159 49411 DEFB 239 ; Decrement Repeat Counter A and loop back to #R49407 if not zero 49412 DEFB 255 ; End Marker ; Fake Boni's Alcove 49413 DEFB 244,12 ; Set current graphic set to 12 49415 DEFB 242,4 ; Set current attribute to 4 49417 DEFB 250,251,0 ; Change cursor's x- and y-coordinates by 0 and -4 characters ; respectively 49420 DEFB 9,161,10,161 49424 DEFB 10,161,10,161 49428 DEFB 10,161,11,153 49432 DEFB 9,161,10,161 49436 DEFB 10,161,11,163 49440 DEFB 9,161,11,154 49444 DEFB 9,161,10,161 49448 DEFB 11,163,9,161 49452 DEFB 10,161,11,154 49456 DEFB 9,161,11,163 49460 DEFB 9,161,11,154 49464 DEFB 9,161,10,161 49468 DEFB 11,163,9,161 49472 DEFB 10,161,11,154 49476 DEFB 9,161,10,161 49480 DEFB 10,161,10,161 49484 DEFB 10,161,11,161 49488 DEFB 255 ; End Marker ; Snake's Brickwork 49489 DEFB 244,12 ; Set current graphic set to 12 49491 DEFB 242,4 ; Set current attribute to 4 49493 DEFB 9,161,10,161 49497 DEFB 10,161,10,161 49501 DEFB 11,161 49503 DEFB 250,3,251 ; Change cursor's x- and y-coordinates by -4 and +3 characters ; respectively 49506 DEFB 9,161,10,161 49510 DEFB 11,161,9,161 49514 DEFB 11,161,9,161 49518 DEFB 11,154,9,161 49522 DEFB 10,161,10,161 49526 DEFB 11,161,9,161 49530 DEFB 10,161,11,161 49534 DEFB 255 ; End Marker ; Left Wall, Short 49535 DEFB 244,12 ; Set current graphic set to 12 49537 DEFB 242,4 ; Set current attribute to 4 49539 DEFB 238,8 ; Set Repeat Counter A to 8 49541 DEFB 9,161,10,161 49545 DEFB 11,159,9,161 49549 DEFB 11,158 49551 DEFB 239 ; Decrement Repeat Counter A and loop back to #R49541 if not zero 49552 DEFB 255 ; End Marker ; Right Wall, Long 49553 DEFB 244,12 ; Set current graphic set to 12 49555 DEFB 242,4 ; Set current attribute to 4 49557 DEFB 238,11 ; Set Repeat Counter A to 11 49559 DEFB 9,161,10,161 49563 DEFB 11,158,9,161 49567 DEFB 11,159 49569 DEFB 239 ; Decrement Repeat Counter A and loop back to #R49559 if not zero 49570 DEFB 255 ; End Marker ; Long Yellow Brick 49571 DEFB 244,12 ; Set current graphic set to 12 49573 DEFB 242,6 ; Set current attribute to 6 49575 DEFB 9,161,10,161 49579 DEFB 10,161,11,161 49583 DEFB 255 ; End Marker ; Vertical Red Bar (Outside Normal Game Area) 49584 DEFB 242,18 ; Set current attribute to 18 49586 DEFB 238,20 ; Set Repeat Counter A to 20 49588 DEFB 0,33,0,33 49592 DEFB 0,33,0,33 49596 DEFB 0,28 49598 DEFB 239 ; Decrement Repeat Counter A and loop back to #R49588 if not zero 49599 DEFB 255 ; End Marker ; Drip Stage 1 - Green Drip, Forming 49600 DEFB 244,12 ; Set current graphic set to 12 49602 DEFB 250,255,255 ; Change cursor's x- and y-coordinates by -1 and -1 characters ; respectively 49605 DEFB 12,4,33,14,4,33 49611 DEFB 13,4,33 49614 DEFB 255 ; End Marker ; Drip Stage 2 - Red Drip, Enlarging 49615 DEFB 244,12 ; Set current graphic set to 12 49617 DEFB 250,255,255 ; Change cursor's x- and y-coordinates by -1 and -1 characters ; respectively 49620 DEFB 12,2,33,15,2,33 49626 DEFB 13,2,33 49629 DEFB 255 ; End Marker ; Drip Stage 3 - Magenta Drip, Enlarging 49630 DEFB 244,12 ; Set current graphic set to 12 49632 DEFB 250,255,255 ; Change cursor's x- and y-coordinates by -1 and -1 characters ; respectively 49635 DEFB 12,3,33,16,3,33 49641 DEFB 13,3,33 49644 DEFB 255 ; End Marker ; Drip Stage 4 - Cyan Drip, Enlarging 49645 DEFB 244,12 ; Set current graphic set to 12 49647 DEFB 250,255,255 ; Change cursor's x- and y-coordinates by -1 and -1 characters ; respectively 49650 DEFB 12,5,33,17,5,33 49656 DEFB 13,5,31,18,5,33 49662 DEFB 255 ; End Marker ; Drip Stage 5 - Yellow Drip, Full Size 49663 DEFB 244,12 ; Set current graphic set to 12 49665 DEFB 250,255,255 ; Change cursor's x- and y-coordinates by -1 and -1 characters ; respectively 49668 DEFB 12,6,33,19,6,33 49674 DEFB 13,6,31,20,6,33 49680 DEFB 255 ; End Marker ; Drip Stage 6 - Yellow Drip, Extended 49681 DEFB 244,12 ; Set current graphic set to 12 49683 DEFB 250,255,255 ; Change cursor's x- and y-coordinates by -1 and -1 characters ; respectively 49686 DEFB 12,6,33,21,6,33 49692 DEFB 13,6,31,22,70,33 49698 DEFB 255 ; End Marker ; Drip Stage 7 - Drip Disconnected and Falling / Cannon Projectile 49699 DEFB 244,12 ; Set current graphic set to 12 49701 DEFB 22,71,33 49704 DEFB 255 ; End Marker ; Graphic Layout Data Architecture (Level 3) Ceiling (Full Width) b49705 DEFB 251,52,194 ; Process graphic layout data at #R49716 and upon returning, move cursor to base coordinates 49708 DEFB 250,0,16 ; Change cursor's x- and y-coordinates by +16 and 0 characters respectively ; Ceiling (Half Width) 49711 DEFB 242,196 ; Set current attribute to 196 49713 DEFB 248,54,194 ; Jump to #R49718 49716 DEFB 242,68 ; Set current attribute to 68 49718 DEFB 244,8 ; Set current graphic set to 8 49720 DEFB 32,33,27,33 49724 DEFB 28,33,9,33 49728 DEFB 10,33,30,33 49732 DEFB 31,33,28,33 49736 DEFB 13,33,14,33 49740 DEFB 9,33,32,33 49744 DEFB 31,33,30,33 49748 DEFB 14,33,10,33 49752 DEFB 255 ; End Marker ; Platform 49753 DEFB 244,10 ; Set current graphic set to 10 49755 DEFB 242,4 ; Set current attribute to 4 49757 DEFB 250,1,0 ; Change cursor's x- and y-coordinates by 0 and +1 characters respectively 49760 DEFB 31,33,29,33 49764 DEFB 28,33,27,33 49768 DEFB 30,28,31,33 49772 DEFB 29,33,28,33 49776 DEFB 27,33,30,33 49780 DEFB 255 ; End Marker ; Fifteen Glowing Tangleweeds, Animated 49781 DEFB 244,10 ; Set current graphic set to 10 49783 DEFB 254,0,246 ; Change cursor's x- and y-coordinates by -10 and 0 characters respectively and store as new ; base coordinates 49786 DEFB 248,177,194 ; Jump to #R49841 ; Six Glowing Tangleweeds, Animated 49789 DEFB 244,10 ; Set current graphic set to 10 49791 DEFB 254,0,233 ; Change cursor's x- and y-coordinates by -23 and 0 characters respectively and store as new ; base coordinates 49794 DEFB 248,237,194 ; Jump to #R49901 ; Twenty Two Glowing Tangleweeds, Animated 49797 DEFB 244,10 ; Set current graphic set to 10 49799 DEFB 250,254,0 ; Change cursor's x- and y-coordinates by 0 and -2 characters respectively 49802 DEFB 251,14,195 ; Process graphic layout data at #R49934 and upon returning, move cursor to base coordinates 49805 DEFB 250,251,1 ; Change cursor's x- and y-coordinates by +1 and -5 characters respectively 49808 DEFB 251,51,195 ; Process graphic layout data at #R49971 and upon returning, move cursor to base coordinates 49811 DEFB 250,251,3 ; Change cursor's x- and y-coordinates by +3 and -5 characters respectively 49814 DEFB 251,51,195 ; Process graphic layout data at #R49971 and upon returning, move cursor to base coordinates 49817 DEFB 250,251,6 ; Change cursor's x- and y-coordinates by +6 and -5 characters respectively 49820 DEFB 251,14,195 ; Process graphic layout data at #R49934 and upon returning, move cursor to base coordinates 49823 DEFB 250,252,7 ; Change cursor's x- and y-coordinates by +7 and -4 characters respectively 49826 DEFB 251,51,195 ; Process graphic layout data at #R49971 and upon returning, move cursor to base coordinates 49829 DEFB 250,251,8 ; Change cursor's x- and y-coordinates by +8 and -5 characters respectively 49832 DEFB 251,14,195 ; Process graphic layout data at #R49934 and upon returning, move cursor to base coordinates 49835 DEFB 250,254,9 ; Change cursor's x- and y-coordinates by +9 and -2 characters respectively 49838 DEFB 251,51,195 ; Process graphic layout data at #R49971 and upon returning, move cursor to base coordinates 49841 DEFB 250,0,10 ; Change cursor's x- and y-coordinates by +10 and 0 characters respectively 49844 DEFB 251,14,195 ; Process graphic layout data at #R49934 and upon returning, move cursor to base coordinates 49847 DEFB 250,251,11 ; Change cursor's x- and y-coordinates by +11 and -5 characters respectively 49850 DEFB 251,51,195 ; Process graphic layout data at #R49971 and upon returning, move cursor to base coordinates 49853 DEFB 250,250,14 ; Change cursor's x- and y-coordinates by +14 and -6 characters respectively 49856 DEFB 251,14,195 ; Process graphic layout data at #R49934 and upon returning, move cursor to base coordinates 49859 DEFB 250,253,14 ; Change cursor's x- and y-coordinates by +14 and -3 characters respectively 49862 DEFB 251,51,195 ; Process graphic layout data at #R49971 and upon returning, move cursor to base coordinates 49865 DEFB 250,255,17 ; Change cursor's x- and y-coordinates by +17 and -1 characters respectively 49868 DEFB 251,14,195 ; Process graphic layout data at #R49934 and upon returning, move cursor to base coordinates 49871 DEFB 250,251,18 ; Change cursor's x- and y-coordinates by +18 and -5 characters respectively 49874 DEFB 251,51,195 ; Process graphic layout data at #R49971 and upon returning, move cursor to base coordinates 49877 DEFB 250,253,19 ; Change cursor's x- and y-coordinates by +19 and -3 characters respectively 49880 DEFB 251,14,195 ; Process graphic layout data at #R49934 and upon returning, move cursor to base coordinates 49883 DEFB 250,255,20 ; Change cursor's x- and y-coordinates by +20 and -1 characters respectively 49886 DEFB 251,51,195 ; Process graphic layout data at #R49971 and upon returning, move cursor to base coordinates 49889 DEFB 250,253,21 ; Change cursor's x- and y-coordinates by +21 and -3 characters respectively 49892 DEFB 251,14,195 ; Process graphic layout data at #R49934 and upon returning, move cursor to base coordinates 49895 DEFB 250,252,22 ; Change cursor's x- and y-coordinates by +22 and -4 characters respectively 49898 DEFB 251,51,195 ; Process graphic layout data at #R49971 and upon returning, move cursor to base coordinates 49901 DEFB 250,254,23 ; Change cursor's x- and y-coordinates by +23 and -2 characters respectively 49904 DEFB 251,14,195 ; Process graphic layout data at #R49934 and upon returning, move cursor to base coordinates 49907 DEFB 250,255,25 ; Change cursor's x- and y-coordinates by +25 and -1 characters respectively 49910 DEFB 251,51,195 ; Process graphic layout data at #R49971 and upon returning, move cursor to base coordinates 49913 DEFB 250,252,26 ; Change cursor's x- and y-coordinates by +26 and -4 characters respectively 49916 DEFB 251,14,195 ; Process graphic layout data at #R49934 and upon returning, move cursor to base coordinates 49919 DEFB 250,253,28 ; Change cursor's x- and y-coordinates by +28 and -3 characters respectively 49922 DEFB 251,51,195 ; Process graphic layout data at #R49971 and upon returning, move cursor to base coordinates 49925 DEFB 250,0,30 ; Change cursor's x- and y-coordinates by +30 and 0 characters respectively 49928 DEFB 251,14,195 ; Process graphic layout data at #R49934 and upon returning, move cursor to base coordinates 49931 DEFB 250,252,31 ; Change cursor's x- and y-coordinates by +31 and -4 characters respectively 49934 DEFB 247,3 ; Jump to one of the 3 addresses in the following list, chosen at random: 49936 DEFB 22,195 ; #R49942 (Green Tangleweed 1) 49938 DEFB 27,195 ; #R49947 (Yellow Tangleweed 1) 49940 DEFB 32,195 ; #R49952 (Green Tangleweed 1) (see trivia) ; Green Tangleweed (1) 49942 DEFB 242,4 ; Set current attribute to 4 49944 DEFB 248,34,195 ; Jump to #R49954 ; Yellow Tangleweed (1) 49947 DEFB 242,6 ; Set current attribute to 6 49949 DEFB 248,34,195 ; Jump to #R49954 ; Green Tangleweed (1) 49952 DEFB 242,4 ; Set current attribute to 4 49954 DEFB 9,32,10,32 49958 DEFB 11,32,12,32 49962 DEFB 13,32,14,32 49966 DEFB 15,32,16,33 49970 DEFB 255 ; End Marker ; Glowing Tangleweed (2) 49971 DEFB 247,3 ; Jump to one of the 3 addresses in the following list, chosen at random: 49973 DEFB 59,195 ; #R49979 (Green Tangleweed 2) 49975 DEFB 64,195 ; #R49984 (Yellow Tangleweed 2) 49977 DEFB 69,195 ; #R49989 (Green Tangleweed 2) (see trivia) ; Green Tangleweed (2) 49979 DEFB 242,4 ; Set current attribute to 4 49981 DEFB 248,71,195 ; Jump to #R49991 ; Yellow Tangleweed (2) 49984 DEFB 242,6 ; Set current attribute to 6 49986 DEFB 248,71,195 ; Jump to #R49991 ; Green Tangleweed (2) 49989 DEFB 242,4 ; Set current attribute to 4 49991 DEFB 17,32,18,32 49995 DEFB 19,32,20,32 49999 DEFB 21,32,22,32 50003 DEFB 23,32,24,33 50007 DEFB 255 ; End Marker ; Graphic Layout Data Architecture (Level 1) Part 1 Three Spider's Webs b50008 DEFB 240,3 ; Set Repeat Counter B to 3 50010 DEFB 251,98,195 ; Process graphic layout data at #R50018 and upon returning, move cursor to base ; coordinates 50013 DEFB 254,0,8 ; Change cursor's x- and y-coordinates by +8 and 0 characters respectively and store as ; new base coordinates 50016 DEFB 241 ; Decrement Repeat Counter B and loop back to #R50010 if not zero 50017 DEFB 255 ; End Marker ; Spider's Web 50018 DEFB 244,5 ; Set current graphic set to 5 50020 DEFB 242,7 ; Set current attribute to 7 50022 DEFB 250,2,2 ; Change cursor's x- and y-coordinates by +2 and +2 characters respectively 50025 DEFB 1,161,2,161 50029 DEFB 3,157,4,161 50033 DEFB 5,161,6,161 50037 DEFB 7,161,8,156 50041 DEFB 9,161,10,161 50045 DEFB 11,161,12,161 50049 DEFB 13,161,14,155 50053 DEFB 15,161,16,161 50057 DEFB 17,161,18,161 50061 DEFB 19,156,20,165 50065 DEFB 21,161 50067 DEFB 255 ; End Marker ; Upper Section of Arch 50068 DEFB 242,4 ; Set current attribute to 4 50070 DEFB 244,3 ; Set current graphic set to 3 50072 DEFB 250,0,2 ; Change cursor's x- and y-coordinates by +2 and 0 characters respectively 50075 DEFB 56,33,57,33 50079 DEFB 58,33,59,28 50083 DEFB 60,33,61,33 50087 DEFB 62,33,63,33 50091 DEFB 9,33,10,26 50095 DEFB 11,33,12,33 50099 DEFB 13,35,14,33 50103 DEFB 15,33,16,25 50107 DEFB 17,33,18,37 50111 DEFB 19,33,20,33 50115 DEFB 255 ; End Marker ; Four Arches 50116 DEFB 240,4 ; Set Repeat Counter B to 4 50118 DEFB 251,206,195 ; Process graphic layout data at #R50126 and upon returning, move cursor to base ; coordinates 50121 DEFB 254,0,8 ; Change cursor's x- and y-coordinates by +8 and 0 characters respectively and store as ; new base coordinates 50124 DEFB 241 ; Decrement Repeat Counter B and loop back to #R50118 if not zero 50125 DEFB 255 ; End Marker ; Single Arch 50126 DEFB 251,148,195 ; Process graphic layout data at #R50068 and upon returning, move cursor to base ; coordinates 50129 DEFB 250,4,0 ; Change cursor's x- and y-coordinates by 0 and +4 characters respectively 50132 DEFB 242,6 ; Set current attribute to 6 50134 DEFB 23,39,22,25 50138 DEFB 30,39,29,25 50142 DEFB 32,39,31,33 50146 DEFB 255 ; End Marker ; Boni's Platform 50147 DEFB 242,6 ; Set current attribute to 6 50149 DEFB 244,3 ; Set current graphic set to 3 50151 DEFB 29,33,30,31 50155 DEFB 31,33,32,33 50159 DEFB 255 ; End Marker ; Floor (Full Width, 32 chars) 50160 DEFB 251,62,196 ; Process graphic layout data at #R50238 and upon returning, move cursor to base ; coordinates 50163 DEFB 250,0,12 ; Change cursor's x- and y-coordinates by +12 and 0 characters respectively 50166 DEFB 242,4 ; Set current attribute to 4 50168 DEFB 52,161,53,161 50172 DEFB 54,161,55,161 50176 DEFB 242,132 ; Set current attribute to 132 50178 DEFB 55,161,54,161 50182 DEFB 53,161,52,161 50186 DEFB 44,161,43,161 50190 DEFB 42,161,41,161 50194 DEFB 40,161,39,161 50198 DEFB 38,161,37,161 50202 DEFB 36,161,35,161 50206 DEFB 34,161,33,161 50210 DEFB 255 ; End Marker ; Right Half of Floor 50211 DEFB 242,132 ; Set current attribute to 132 50213 DEFB 44,161,43,161 50217 DEFB 42,161,41,161 50221 DEFB 40,161,39,161 50225 DEFB 38,161,37,161 50229 DEFB 36,161,35,161 50233 DEFB 34,161,33,161 50237 DEFB 255 ; End Marker ; Left Part of Floor (Also Used in Level 4) 50238 DEFB 244,3 ; Set current graphic set to 3 50240 DEFB 242,4 ; Set current attribute to 4 50242 DEFB 33,161,34,161 50246 DEFB 35,161,36,161 50250 DEFB 37,161,38,161 50254 DEFB 39,161,40,161 50258 DEFB 41,161,42,161 50262 DEFB 43,161,44,161 50266 DEFB 255 ; End Marker ; Trap Door, Closed 50267 DEFB 244,3 ; Set current graphic set to 3 50269 DEFB 242,70 ; Set current attribute to 70 50271 DEFB 45,161,46,161 50275 DEFB 238,5 ; Set Repeat Counter A to 5 50277 DEFB 47,161 50279 DEFB 239 ; Decrement Repeat Counter A and loop back to #R50277 if not zero 50280 DEFB 48,161 50282 DEFB 255 ; End Marker ; Trap Door, Open 50283 DEFB 244,3 ; Set current graphic set to 3 50285 DEFB 250,0,8 ; Change cursor's x- and y-coordinates by +8 and 0 characters respectively 50288 DEFB 238,7 ; Set Repeat Counter A to 7 50290 DEFB 49,78,32 50293 DEFB 239 ; Decrement Repeat Counter A and loop back to #R50290 if not zero 50294 DEFB 51,78,33 50297 DEFB 250,250,0 ; Change cursor's x- and y-coordinates by 0 and -6 characters respectively 50300 DEFB 50,6,33 50303 DEFB 255 ; End Marker ; Graphic Layout Data Boni Fake Boni (Level 4) b50304 DEFB 244,4 ; Set current graphic set to 4 50306 DEFB 242,6 ; Set current attribute to 6 50308 DEFB 248,145,196 ; Jump to #R50321 ; Boni Talking (Animated) 50311 DEFB 247,2 ; Jump to one of the 2 addresses in the following list, chosen at random: 50313 DEFB 141,196 ; #R50317 (Boni, mouth closed) 50315 DEFB 162,196 ; #R50338 (Boni, mouth open) ; Boni (Mouth closed) 50317 DEFB 244,4 ; Set current graphic set to 4 50319 DEFB 242,7 ; Set current attribute to 7 50321 DEFB 9,33,10,31 50325 DEFB 11,33,12,31 50329 DEFB 13,33,14,31 50333 DEFB 15,33,16,33 50337 DEFB 255 ; End Marker ; Boni (Mouth open) 50338 DEFB 244,4 ; Set current graphic set to 4 50340 DEFB 242,7 ; Set current attribute to 7 50342 DEFB 1,33,2,31 50346 DEFB 3,33,4,31 50350 DEFB 5,33,6,31 50354 DEFB 7,33,8,33 50358 DEFB 255 ; End Marker ; Graphic Layout Data Architecture (Level 1) Part 2 Wall, vertical bricks, single row b50359 DEFB 244,3 ; Set current graphic set to 3 50361 DEFB 238,3 ; Set Repeat Counter A to 3 50363 DEFB 25,4,160,27,4,160 50369 DEFB 26,4,160,28,4,160 50375 DEFB 25,132,160,27,132,160 50381 DEFB 26,132,160,28,132,160 50387 DEFB 239 ; Decrement Repeat Counter A and loop back to #R50363 if not zero 50388 DEFB 255 ; End Marker ; Background brickwork 50389 DEFB 244,3 ; Set current graphic set to 3 50391 DEFB 250,0,12 ; Change cursor's x- and y-coordinates by +12 and 0 characters respectively 50394 DEFB 21,4,33,23,4,21 50400 DEFB 22,4,33,24,4,32 50406 DEFB 250,0,7 ; Change cursor's x- and y-coordinates by +7 and 0 characters respectively 50409 DEFB 25,4,32,27,4,27 50415 DEFB 23,132,33,21,132,27 50421 DEFB 24,132,33,22,132,33 50427 DEFB 250,1,8 ; Change cursor's x- and y-coordinates by +8 and +1 characters respectively 50430 DEFB 23,132,33,22,132,24 50436 DEFB 22,4,33,22,132,33 50442 DEFB 250,1,3 ; Change cursor's x- and y-coordinates by +3 and +1 characters respectively 50445 DEFB 26,4,32,28,4,25 50451 DEFB 23,132,33,22,132,43 50457 DEFB 25,132,32,28,4,21 50463 DEFB 21,4,33,23,4,33 50469 DEFB 250,1,5 ; Change cursor's x- and y-coordinates by +5 and +1 characters respectively 50472 DEFB 22,4,33,24,4,33 50478 DEFB 255 ; End Marker ; "Home Sweet Home" Message Brick Border (End of Game) 50479 DEFB 244,3 ; Set current graphic set to 3 50481 DEFB 242,4 ; Set current attribute to 4 50483 DEFB 21,161,23,161 50487 DEFB 22,161,24,161 50491 DEFB 21,161,24,161 50495 DEFB 22,161,23,161 50499 DEFB 21,161,23,161 50503 DEFB 22,161,24,161 50507 DEFB 22,161,23,161 50511 DEFB 21,161,24,161 50515 DEFB 25,144,26,176 50519 DEFB 27,144,27,176 50523 DEFB 26,144,21,161 50527 DEFB 23,161,22,161 50531 DEFB 24,161,21,161 50535 DEFB 24,161,22,161 50539 DEFB 23,161,21,161 50543 DEFB 23,161,22,161 50547 DEFB 24,161,22,161 50551 DEFB 23,161,21,161 50555 DEFB 24,161,28,161 50559 DEFB 255 ; End Marker ; Graphic Layout Data Sweets (Level 1) Red Sweet b50560 DEFB 242,66 ; Set current attribute to 66 50562 DEFB 248,140,197 ; Jump to #R50572 ; Green Sweet 50565 DEFB 242,68 ; Set current attribute to 68 50567 DEFB 248,140,197 ; Jump to #R50572 ; Cyan Sweet (Unused) 50570 DEFB 242,69 ; Set current attribute to 69 50572 DEFB 244,4 ; Set current graphic set to 4 50574 DEFB 17,33,18,33 50578 DEFB 255 ; End Marker ; Graphic Layout Data Architecture (Level 1) Part 3 Vertical Wall (Horizontal Bricks) b50579 DEFB 244,3 ; Set current graphic set to 3 50581 DEFB 238,5 ; Set Repeat Counter A to 5 50583 DEFB 21,4,33,24,4,31 50589 DEFB 22,4,33,23,4,31 50595 DEFB 23,132,33,21,132,31 50601 DEFB 24,132,33,22,132,31 50607 DEFB 239 ; Decrement Repeat Counter A and loop back to #R50583 if not zero 50608 DEFB 255 ; End Marker ; Row of five horizontal bricks 50609 DEFB 244,3 ; Set current graphic set to 3 50611 DEFB 21,4,33,24,4,33 50617 DEFB 22,4,33,23,4,33 50623 DEFB 23,132,33,21,132,33 50629 DEFB 24,132,33,22,132,33 50635 DEFB 21,4,33,24,4,33 50641 DEFB 255 ; End Marker ; Platform (Pit) 50642 DEFB 244,3 ; Set current graphic set to 3 50644 DEFB 250,1,0 ; Change cursor's x- and y-coordinates by 0 and +1 characters respectively 50647 DEFB 238,2 ; Set Repeat Counter A to 2 50649 DEFB 21,4,33,24,4,33 50655 DEFB 22,4,33,23,4,29 50661 DEFB 239 ; Decrement Repeat Counter A and loop back to #R50649 if not zero 50662 DEFB 255 ; End Marker ; Graphic Layout Data Doors Level 1 b50663 DEFB 244,3 ; Set current graphic set to 3 50665 DEFB 248,248,197 ; Jump to #R50680 ; Level 2 50668 DEFB 244,8 ; Set current graphic set to 8 50670 DEFB 248,248,197 ; Jump to #R50680 ; Level 3 50673 DEFB 244,10 ; Set current graphic set to 10 50675 DEFB 248,248,197 ; Jump to #R50680 ; Level 4 50678 DEFB 244,12 ; Set current graphic set to 12 50680 DEFB 251,13,198 ; Process graphic layout data at #R50701 and upon returning, ; move cursor to base coordinates 50683 DEFB 244,4 ; Set current graphic set to 4 50685 DEFB 250,251,3 ; Change cursor's x- and y-coordinates by +3 and -5 ; characters respectively 50688 DEFB 21,6,33,21,134,31 50694 DEFB 22,6,33,22,134,33 50700 DEFB 255 ; End Marker ; Door (Common) 50701 DEFB 238,9 ; Set Repeat Counter A to 9 50703 DEFB 251,23,198 ; Process graphic layout data at #R50711 and upon returning, ; move cursor to base coordinates 50706 DEFB 254,1,0 ; Change cursor's x- and y-coordinates by 0 and +1 ; characters respectively and store as new base coordinates 50709 DEFB 239 ; Decrement Repeat Counter A and loop back to #R50703 if not ; zero 50710 DEFB 255 ; End Marker ; Door Patterns 50711 DEFB 242,5 ; Set current attribute to 5 50713 DEFB 243,0,4 ; Increase current state value n (initially 0), up to ; maximum of 4, resetting to zero if maximum reached and ; jump to n-th address in following list: 50716 DEFB 36,198 ; #R50724 50718 DEFB 53,198 ; #R50741 50720 DEFB 70,198 ; #R50758 50722 DEFB 87,198 ; #R50775 ; Door Pattern Sequences (these are cycled through) 50724 DEFB 1,33,2,33,3,33,4,33,5,33,6,33,7,33,8,33,255 ; Door row state 1 50741 DEFB 2,33,3,33,4,33,1,33,6,33,7,33,8,33,5,33,255 ; Door row state 2 50758 DEFB 3,33,4,33,1,33,2,33,7,33,8,33,5,33,6,33,255 ; Door row state 3 50775 DEFB 4,33,1,33,2,33,3,33,8,33,5,33,6,33,7,33,255 ; Door row state 4 ; Graphic Layout Data Miscellaneous Part 2 Key b50792 DEFB 244,4 ; Set current graphic set to 4 50794 DEFB 19,7,33 50797 DEFB 20,7,33 50800 DEFB 255 ; End Marker ; Graphic Layout Data Architecture (Level 2) ; ; Note that the graphic layout data that describes the floor of the rooms on Level 2 is also used (with a different ; attribute value) for the floors on Level 3. Green Floor (Level 3) b50801 DEFB 242,4 ; Set current attribute to 4 50803 DEFB 248,120,198 ; Jump to #R50808 ; Red Floor 50806 DEFB 242,2 ; Set current attribute to 2 50808 DEFB 244,1 ; Set current graphic set to 1 50810 DEFB 1,161,2,161 50814 DEFB 3,161,4,161 50818 DEFB 5,161,6,161 50822 DEFB 7,161,8,161 50826 DEFB 9,161,10,161 50830 DEFB 11,161,12,161 50834 DEFB 13,161,14,161 50838 DEFB 15,161,16,161 50842 DEFB 1,161,2,161 50846 DEFB 3,161,4,161 50850 DEFB 5,161,6,161 50854 DEFB 7,161,8,161 50858 DEFB 9,161,10,161 50862 DEFB 11,161,12,161 50866 DEFB 13,161,14,161 50870 DEFB 15,161,16,161 50874 DEFB 255 ; End Marker ; Ceiling 1 50875 DEFB 251,235,198 ; Process graphic layout data at #R50923 and upon returning, move cursor to base ; coordinates 50878 DEFB 250,0,16 ; Change cursor's x- and y-coordinates by +16 and 0 characters respectively 50881 DEFB 248,56,199 ; Jump to #R51000 (Ceiling Section 2) ; Ceiling 2 50884 DEFB 251,56,199 ; Process graphic layout data at #R51000 and upon returning, move cursor to base ; coordinates 50887 DEFB 250,0,16 ; Change cursor's x- and y-coordinates by +16 and 0 characters respectively 50890 DEFB 248,235,198 ; Jump to #R50923 (Ceiling Section 1) ; Right Wall 50893 DEFB 251,125,199 ; Process graphic layout data at #R51069 and upon returning, move cursor to base ; coordinates 50896 DEFB 250,7,0 ; Change cursor's x- and y-coordinates by 0 and +7 characters respectively 50899 DEFB 251,156,199 ; Process graphic layout data at #R51100 and upon returning, move cursor to base ; coordinates 50902 DEFB 250,14,0 ; Change cursor's x- and y-coordinates by 0 and +14 characters respectively 50905 DEFB 248,125,199 ; Jump to #R51069 (Right Wall Section 1) ; Left Wall 50908 DEFB 251,215,199 ; Process graphic layout data at #R51159 and upon returning, move cursor to base ; coordinates 50911 DEFB 250,7,0 ; Change cursor's x- and y-coordinates by 0 and +7 characters respectively 50914 DEFB 251,187,199 ; Process graphic layout data at #R51131 and upon returning, move cursor to base ; coordinates 50917 DEFB 250,14,0 ; Change cursor's x- and y-coordinates by 0 and +14 characters respectively 50920 DEFB 248,215,199 ; Jump to #R51159 (Left Wall Section 1) ; Ceiling Section 1 50923 DEFB 244,8 ; Set current graphic set to 8 50925 DEFB 0,18,33,0,18,33 50931 DEFB 27,66,33,28,66,33 50937 DEFB 29,66,33,0,18,33 50943 DEFB 0,18,33,0,18,33 50949 DEFB 0,18,33,0,18,33 50955 DEFB 30,66,33,31,66,33 50961 DEFB 0,18,33,0,18,33 50967 DEFB 0,18,33,0,18,17 50973 DEFB 242,66 ; Set current attribute to 66 50975 DEFB 32,33,33,35 50979 DEFB 34,33,9,33 50983 DEFB 10,33,32,33 50987 DEFB 33,33,11,35 50991 DEFB 12,33,13,33 50995 DEFB 14,33,32,33 50999 DEFB 255 ; End Marker ; Ceiling Section 2 51000 DEFB 244,8 ; Set current graphic set to 8 51002 DEFB 0,18,33,32,66,33 51008 DEFB 0,18,33,0,18,33 51014 DEFB 0,18,33,30,66,33 51020 DEFB 9,66,33,33,66,33 51026 DEFB 11,66,33,12,66,33 51032 DEFB 29,66,33,0,18,33 51038 DEFB 0,18,33,0,18,33 51044 DEFB 242,66 ; Set current attribute to 66 51046 DEFB 28,33,29,17 51050 DEFB 33,34,12,33 51054 DEFB 14,33,33,38 51058 DEFB 34,33,32,33 51062 DEFB 9,33,33,34 51066 DEFB 34,33 51068 DEFB 255 ; End Marker ; Right Wall Section 1 51069 DEFB 244,8 ; Set current graphic set to 8 51071 DEFB 250,0,1 ; Change cursor's x- and y-coordinates by +1 and 0 characters respectively 51074 DEFB 238,8 ; Set Repeat Counter A to 8 51076 DEFB 0,18,32 51079 DEFB 239 ; Decrement Repeat Counter A and loop back to #R51076 if not zero 51080 DEFB 250,249,255 ; Change cursor's x- and y-coordinates by -1 and -7 characters respectively 51083 DEFB 242,66 ; Set current attribute to 66 51085 DEFB 15,32,16,32 51089 DEFB 17,32,18,32 51093 DEFB 19,32,16,32 51097 DEFB 20,33 51099 DEFB 255 ; End Marker ; Right Wall Section 2 51100 DEFB 244,8 ; Set current graphic set to 8 51102 DEFB 250,0,1 ; Change cursor's x- and y-coordinates by +1 and 0 characters respectively 51105 DEFB 238,8 ; Set Repeat Counter A to 8 51107 DEFB 0,18,32 51110 DEFB 239 ; Decrement Repeat Counter A and loop back to #R51107 if not zero 51111 DEFB 250,249,255 ; Change cursor's x- and y-coordinates by -1 and -7 characters respectively 51114 DEFB 242,66 ; Set current attribute to 66 51116 DEFB 18,32,16,32 51120 DEFB 19,32,16,32 51124 DEFB 20,32,18,32 51128 DEFB 17,33 51130 DEFB 255 ; End Marker ; Left Wall Section 1 51131 DEFB 244,8 ; Set current graphic set to 8 51133 DEFB 238,8 ; Set Repeat Counter A to 8 51135 DEFB 0,18,32 51138 DEFB 239 ; Decrement Repeat Counter A and loop back to #R51135 if not zero 51139 DEFB 250,249,1 ; Change cursor's x- and y-coordinates by +1 and -7 characters respectively 51142 DEFB 242,194 ; Set current attribute to 194 51144 DEFB 15,32,16,32 51148 DEFB 17,32,18,32 51152 DEFB 19,32,16,32 51156 DEFB 20,33 51158 DEFB 255 ; End Marker ; Left Wall Section 1 51159 DEFB 244,8 ; Set current graphic set to 8 51161 DEFB 238,8 ; Set Repeat Counter A to 8 51163 DEFB 0,18,32 51166 DEFB 239 ; Decrement Repeat Counter A and loop back to #R51163 if not zero 51167 DEFB 250,249,1 ; Change cursor's x- and y-coordinates by +1 and -7 characters respectively 51170 DEFB 242,194 ; Set current attribute to 194 51172 DEFB 18,32,16,32 51176 DEFB 19,32,16,32 51180 DEFB 20,32,18,32 51184 DEFB 17,33 51186 DEFB 255 ; End Marker ; Sides of Ceiling Gap 51187 DEFB 244,8 ; Set current graphic set to 8 51189 DEFB 15,194,39,18,66,25 51195 DEFB 7,66,39,20,66,33 ; See bugs 51201 DEFB 255 ; End Marker ; Nine stalactites at various heights 51202 DEFB 250,0,2 ; Change cursor's x- and y-coordinates by +2 and 0 characters respectively 51205 DEFB 251,53,200 ; Process graphic layout data at #R51253 and upon returning, move cursor to base ; coordinates 51208 DEFB 250,255,7 ; Change cursor's x- and y-coordinates by +7 and -1 characters respectively 51211 DEFB 251,53,200 ; Process graphic layout data at #R51253 and upon returning, move cursor to base ; coordinates 51214 DEFB 250,254,11 ; Change cursor's x- and y-coordinates by +11 and -2 characters respectively 51217 DEFB 251,53,200 ; Process graphic layout data at #R51253 and upon returning, move cursor to base ; coordinates 51220 DEFB 250,0,17 ; Change cursor's x- and y-coordinates by +17 and 0 characters respectively 51223 DEFB 251,53,200 ; Process graphic layout data at #R51253 and upon returning, move cursor to base ; coordinates 51226 DEFB 250,255,20 ; Change cursor's x- and y-coordinates by +20 and -1 characters respectively 51229 DEFB 251,53,200 ; Process graphic layout data at #R51253 and upon returning, move cursor to base ; coordinates 51232 DEFB 250,0,26 ; Change cursor's x- and y-coordinates by +26 and 0 characters respectively 51235 DEFB 251,53,200 ; Process graphic layout data at #R51253 and upon returning, move cursor to base ; coordinates 51238 DEFB 250,254,29 ; Change cursor's x- and y-coordinates by +29 and -2 characters respectively 51241 DEFB 251,53,200 ; Process graphic layout data at #R51253 and upon returning, move cursor to base ; coordinates 51244 DEFB 250,255,33 ; Change cursor's x- and y-coordinates by +33 and -1 characters respectively (see ; trivia) 51247 DEFB 251,53,200 ; Process graphic layout data at #R51253 and upon returning, move cursor to base ; coordinates 51250 DEFB 250,0,35 ; Change cursor's x- and y-coordinates by +35 and 0 characters respectively (see ; trivia) 51253 DEFB 244,8 ; Set current graphic set to 8 51255 DEFB 22,66,32,23,66,32 51261 DEFB 24,66,32,25,2,32 51267 DEFB 26,2,33 51270 DEFB 255 ; End Marker ; Graphic Layout Data Mushroom b51271 DEFB 244,4 ; Set current graphic set to 4 51273 DEFB 34,71,33,35,71,31 51279 DEFB 36,7,33,37,7,33 51285 DEFB 255 ; End Marker ; Graphic Layout Data Flying Skeleton Creature Boni being kidnapped, shouting for help, animated b51286 DEFB 251,114,200 ; Process graphic layout data at #R51314 and upon returning, move cursor to base ; coordinates 51289 DEFB 251,135,196 ; Process graphic layout data at #R50311 and upon returning, move cursor to base ; coordinates 51292 DEFB 244,6 ; Set current graphic set to 6 51294 DEFB 250,2,2 ; Change cursor's x- and y-coordinates by +2 and +2 characters respectively 51297 DEFB 242,7 ; Set current attribute to 7 51299 DEFB 21,33,22,161 51303 DEFB 23,161,24,33 51307 DEFB 255 ; End Marker ; Boni being kidnapped, mouth closed 51308 DEFB 251,114,200 ; Process graphic layout data at #R51314 and upon returning, move cursor to base ; coordinates 51311 DEFB 248,141,196 ; Jump to #R50317 (Boni, Mouth Closed) ; Flying Skeleton Creature, animated 51314 DEFB 244,6 ; Set current graphic set to 6 51316 DEFB 251,145,200 ; Process graphic layout data at #R51345 and upon returning, move cursor to base ; coordinates 51319 DEFB 250,5,0 ; Change cursor's x- and y-coordinates by 0 and +5 characters respectively 51322 DEFB 2,7,33,2,135,31 51328 DEFB 247,2 ; Jump to one of the 2 addresses in the following list, chosen at random: 51330 DEFB 134,200 ; #R51334 (tail pointing left) 51332 DEFB 138,200 ; #R51338 (tail pointing right) ; Tail pointing left 51334 DEFB 3,7,33 51337 DEFB 255 ; End Marker ; Tail pointing right 51338 DEFB 250,0,1 ; Change cursor's x- and y-coordinates by +1 and 0 characters respectively 51341 DEFB 3,135,33 51344 DEFB 255 ; End Marker ; Upper Body & Wings, animated 51345 DEFB 243,0,4 ; Increase current state value n (initially 0), up to maximum of 4, resetting to zero if ; maximum reached and jump to n-th address in following list: 51348 DEFB 156,200 ; #R51356 (upper body and wings, frame 1) 51350 DEFB 198,200 ; #R51398 (upper body and wings, frame 2) 51352 DEFB 241,200 ; #R51441 (upper body and wings, frame 3) 51354 DEFB 198,200 ; #R51398 (upper body and wings, frame 2) ; Upper Body and Wings, Frame 1 51356 DEFB 254,1,0 ; Change cursor's x- and y-coordinates by 0 and +1 characters respectively and store as ; new base coordinates 51359 DEFB 251,180,200 ; Process graphic layout data at #R51380 and upon returning, move cursor to base ; coordinates 51362 DEFB 242,7 ; Set current attribute to 7 51364 DEFB 250,2,254 ; Change cursor's x- and y-coordinates by -2 and +2 characters respectively 51367 DEFB 4,33,5,31 51371 DEFB 6,33,7,32 51375 DEFB 8,33,1,33 51379 DEFB 255 ; End Marker ; Right Wing and Upper-Right Body Section, Frame 1 51380 DEFB 242,135 ; Set current attribute to 135 51382 DEFB 250,2,2 ; Change cursor's x- and y-coordinates by +2 and +2 characters respectively 51385 DEFB 5,33,4,31 51389 DEFB 7,33,6,30 51393 DEFB 1,33,8,33 51397 DEFB 255 ; End Marker ; Upper Body and Wings, Frame 2 51398 DEFB 251,221,200 ; Process graphic layout data at #R51421 and upon returning, move cursor to base ; coordinates 51401 DEFB 242,7 ; Set current attribute to 7 51403 DEFB 250,3,254 ; Change cursor's x- and y-coordinates by -2 and +3 characters respectively 51406 DEFB 9,33,10,30 51410 DEFB 11,33,12,33 51414 DEFB 13,33,14,29 51418 DEFB 20,33 51420 DEFB 255 ; End Marker ; Right Wing and Upper-Right Body Section, Frame 2 51421 DEFB 242,135 ; Set current attribute to 135 51423 DEFB 250,3,2 ; Change cursor's x- and y-coordinates by +2 and +3 characters respectively 51426 DEFB 10,33,9,30 51430 DEFB 14,33,13,33 51434 DEFB 12,33,11,32 51438 DEFB 20,33 51440 DEFB 255 ; End Marker ; Upper Body and Wings, Frame 3 51441 DEFB 254,255,0 ; Change cursor's x- and y-coordinates by 0 and -1 characters respectively and store as ; new base coordinates 51444 DEFB 251,9,201 ; Process graphic layout data at #R51465 and upon returning, move cursor to base ; coordinates 51447 DEFB 242,7 ; Set current attribute to 7 51449 DEFB 250,4,254 ; Change cursor's x- and y-coordinates by -2 and +4 characters respectively 51452 DEFB 15,33,16,33 51456 DEFB 14,30,17,33 51460 DEFB 18,31,19,33 51464 DEFB 255 ; End Marker ; Right Wing and Upper-Right Body Section, Frame 3 51465 DEFB 242,135 ; Set current attribute to 135 51467 DEFB 250,4,1 ; Change cursor's x- and y-coordinates by +1 and +4 characters respectively 51470 DEFB 14,33,16,33 51474 DEFB 15,31,18,33 51478 DEFB 17,32,19,33 51482 DEFB 255 ; End Marker ; Graphic Layout Data Explosion (Bubo's Projectile, Fallen Drips and Firing Cannon, Level 4) b51483 DEFB 237,4 ; Set sound 4 (explosion) as pending 51485 DEFB 244,9 ; Set current graphic set to 9 51487 DEFB 250,255,255 ; Change cursor's x- and y-coordinates by -1 and -1 characters respectively 51490 DEFB 40,7,33,41,7,33 51496 DEFB 40,135,30,42,7,33 51502 DEFB 43,120,33,42,135,30 51508 DEFB 45,7,33,46,7,33 51514 DEFB 45,135,33 51517 DEFB 255 ; End Marker ; Current Position in Drutt's Script Data b51518 DEFW 51524 ; Script Data Drutt Facing Out of Screen (Falling) b51520 DEFB 147,204 ; #R52371 (Drutt, facing out of screen, fully animated) 51522 DEFB 43,0 ; Select next action for Drutt depending upon control input ; Script Data Drutt Facing Out of Screen b51524 DEFB 155,204 ; #R52379 (Drutt, facing out of screen, legs bent, eyes and mouth animated) 51526 DEFB 168,204 ; #R52392 (Drutt, facing out of screen, legs partially extended, eyes and mouth animated) 51528 DEFB 168,204 ; #R52392 (Drutt, facing out of screen, legs partially extended, eyes and mouth animated) 51530 DEFB 155,204 ; #R52379 (Drutt, facing out of screen, legs bent, eyes and mouth animated) 51532 DEFB 168,204 ; #R52392 (Drutt, facing out of screen, legs partially extended, eyes and mouth animated) 51534 DEFB 168,204 ; #R52392 (Drutt, facing out of screen, legs partially extended, eyes and mouth animated) 51536 DEFB 43,0 ; Select next action for Drutt depending upon control input ; Script Data Move Drutt and Any Pushed Entity Right By a Hop of Size Four ; ; If Drutt is not pushing anything, then he will hop right by four characters. If he is pushing something, then ; Drutt and the pushed entity will move right in alternate steps, traversing half the distance (two characters) on ; average. b51538 DEFB 12,0 ; Set Drutt's Walking Right Flag 51540 DEFB 218,204 ; #R52442 (Drutt, facing right, legs bent) 51542 DEFB 47,0 ; Move Drutt, or entity he is pushing right one character and start pushed entity falling if ; appropriate 51544 DEFB 236,204 ; #R52460 (Drutt, facing right, legs extended back, jumping) 51546 DEFB 47,0 ; Move Drutt, or entity he is pushing right one character and start pushed entity falling if ; appropriate 51548 DEFB 252,204 ; #R52476 (Drutt, facing right, legs bent, airborne) 51550 DEFB 47,0 ; Move Drutt, or entity he is pushing right one character and start pushed entity falling if ; appropriate 51552 DEFB 9,205 ; #R52489 (Drutt, facing right, legs bent, landing) 51554 DEFB 47,0 ; Move Drutt, or entity he is pushing right one character and start pushed entity falling if ; appropriate 51556 DEFB 4,0,9,0 ; If current character and target entity are in the same room then set pending sound to 9 ; (Drutt hopping) 51560 DEFB 43,0 ; Select next action for Drutt depending upon control input ; Script Data Move Drutt and Any Pushed Entity Right By a Hop of Size Three ; ; If Drutt is not pushing anything, then he will hop right by three characters. If he is pushing something, then ; Drutt and the pushed entity will move right in alternate steps, traversing half the distance (one and a half ; characters) on average. b51562 DEFB 12,0 ; Set Drutt's Walking Right Flag 51564 DEFB 218,204 ; #R52442 (Drutt, facing right, legs bent) 51566 DEFB 47,0 ; Move Drutt, or entity he is pushing right one character and start pushed entity falling if ; appropriate 51568 DEFB 236,204 ; #R52460 (Drutt, facing right, legs extended back, jumping) 51570 DEFB 47,0 ; Move Drutt, or entity he is pushing right one character and start pushed entity falling if ; appropriate 51572 DEFB 252,204 ; #R52476 (Drutt, facing right, legs bent, airborne) 51574 DEFB 47,0 ; Move Drutt, or entity he is pushing right one character and start pushed entity falling if ; appropriate 51576 DEFB 9,205 ; #R52489 (Drutt, facing right, legs bent, landing) 51578 DEFB 4,0,9,0 ; If current character and target entity are in the same room then set pending sound to 9 ; (Drutt hopping) 51582 DEFB 43,0 ; Select next action for Drutt depending upon control input ; Script Data Move Drutt and Any Pushed Entity Left By a Hop of Size Four ; ; If Drutt is not pushing anything, then he will hop left by four characters. If he is pushing something, then Drutt ; and the pushed entity will move left in alternate steps, traversing half the distance (two characters) on average. b51584 DEFB 11,0 ; Set Drutt's Walking Left Flag 51586 DEFB 43,205 ; #R52523 (Drutt, facing left, legs bent) 51588 DEFB 46,0 ; Move Drutt, or entity he is pushing left one character and start pushed entity falling if ; appropriate 51590 DEFB 61,205 ; #R52541 (Drutt, facing left, legs extended back, jumping) 51592 DEFB 46,0 ; Move Drutt, or entity he is pushing left one character and start pushed entity falling if ; appropriate 51594 DEFB 77,205 ; #R52557 (Drutt, facing left, legs bent, airborne) 51596 DEFB 46,0 ; Move Drutt, or entity he is pushing left one character and start pushed entity falling if ; appropriate 51598 DEFB 90,205 ; #R52570 (Drutt, facing left, legs bent, landing) 51600 DEFB 46,0 ; Move Drutt, or entity he is pushing left one character and start pushed entity falling if ; appropriate 51602 DEFB 4,0,9,0 ; If current character and target entity are in the same room then set pending sound to 9 ; (Drutt hopping) 51606 DEFB 43,0 ; Select next action for Drutt depending upon control input ; Script Data Move Drutt and Any Pushed Entity Left By a Hop of Size Three ; ; If Drutt is not pushing anything, then he will hop left by three characters. If he is pushing something, then ; Drutt and the pushed entity will move left in alternate steps, traversing half the distance (one and a half ; characters) on average. b51608 DEFB 11,0 ; Set Drutt's Walking Left Flag 51610 DEFB 43,205 ; #R52523 (Drutt, facing left, legs bent) 51612 DEFB 46,0 ; Move Drutt, or entity he is pushing left one character and start pushed entity falling if ; appropriate 51614 DEFB 61,205 ; #R52541 (Drutt, facing left, legs extended back, jumping) 51616 DEFB 46,0 ; Move Drutt, or entity he is pushing left one character and start pushed entity falling if ; appropriate 51618 DEFB 77,205 ; #R52557 (Drutt, facing left, legs bent, airborne) 51620 DEFB 46,0 ; Move Drutt, or entity he is pushing left one character and start pushed entity falling if ; appropriate 51622 DEFB 90,205 ; #R52570 (Drutt, facing left, legs bent, landing) 51624 DEFB 4,0,9,0 ; If current character and target entity are in the same room then set pending sound to 9 ; (Drutt hopping) 51628 DEFB 43,0 ; Select next action for Drutt depending upon control input ; Script Data Drutt Swapping Depth Levels b51630 DEFB 10,0 ; Reset Drutt's Walking Left and Walking Right flags 51632 DEFB 155,204 ; #R52379 (Drutt, facing out of screen, legs bent, eyes and mouth animated) 51634 DEFB 44,0 ; Move Drutt up two characters... 51636 DEFB 44,0 ; ... 51638 DEFB 193,204 ; #R52417 (Drutt, facing out of screen, legs fully extended, eyes and mouth animated) 51640 DEFB 44,0 ; Move Drutt up two characters... 51642 DEFB 44,0 ; ... 51644 DEFB 193,204 ; #R52417 (Drutt, facing out of screen, legs fully extended, eyes and mouth animated) 51646 DEFB 44,0 ; Move Drutt up one character 51648 DEFB 51,0 ; Swap Drutt's current depth level if possible 51650 DEFB 193,204 ; #R52417 (Drutt, facing out of screen, legs fully extended, eyes and mouth animated) 51652 DEFB 45,0 ; Move Drutt down one character 51654 DEFB 193,204 ; #R52417 (Drutt, facing out of screen, legs fully extended, eyes and mouth animated) 51656 DEFB 45,0 ; Move Drutt down two characters... 51658 DEFB 45,0 ; ... 51660 DEFB 193,204 ; #R52417 (Drutt, facing out of screen, legs fully extended, eyes and mouth animated) 51662 DEFB 45,0 ; Move Drutt down two characters... 51664 DEFB 45,0 ; ... 51666 DEFB 155,204 ; #R52379 (Drutt, facing out of screen, legs bent, eyes and mouth animated) 51668 DEFB 4,0,9,0 ; If current character and target entity are in the same room then set pending sound to 9 ; (Drutt hopping) 51672 DEFB 43,0 ; Select next action for Drutt depending upon control input ; Script Data Drutt Jumping ; ; Drutt Starting to Jump Straight Up b51674 DEFB 10,0 ; Reset Drutt's Walking Left and Walking Right flags 51676 DEFB 155,204 ; #R52379 (Drutt, facing out of screen, legs bent, eyes and mouth animated) 51678 DEFB 147,204 ; #R52371 (Drutt, facing out of screen, fully animated) 51680 DEFB 50,0 ; Advance Drutt's jump and select next phase if current phase complete 51682 DEFB 1,0,222,201 ; Jump to #R51678 ; Drutt Jumping Left 51686 DEFB 11,0 ; Set Drutt's Walking Left Flag 51688 DEFB 61,205 ; #R52541 (Drutt, facing left, legs extended back, jumping) 51690 DEFB 50,0 ; Advance Drutt's jump and select next phase if current phase complete 51692 DEFB 1,0,230,201 ; Jump to #R51686 ; Drutt Jumping Right 51696 DEFB 12,0 ; Set Drutt's Walking Right Flag 51698 DEFB 236,204 ; #R52460 (Drutt, facing right, legs extended back, jumping) 51700 DEFB 50,0 ; Advance Drutt's jump and select next phase if current phase complete 51702 DEFB 1,0,240,201 ; Jump to #R51696 ; Script Data Drutt Eating a Worm b51706 DEFB 197,205 ; #R52677 (Drutt, facing out of screen, legs partially extended, eating a worm, animated) 51708 DEFB 197,205 ; #R52677 (Drutt, facing out of screen, legs partially extended, eating a worm, animated) 51710 DEFB 197,205 ; #R52677 (Drutt, facing out of screen, legs partially extended, eating a worm, animated) 51712 DEFB 197,205 ; #R52677 (Drutt, facing out of screen, legs partially extended, eating a worm, animated) 51714 DEFB 197,205 ; #R52677 (Drutt, facing out of screen, legs partially extended, eating a worm, animated) 51716 DEFB 197,205 ; #R52677 (Drutt, facing out of screen, legs partially extended, eating a worm, animated) 51718 DEFB 4,0,8,0 ; If current character and target entity are in the same room then set pending sound to 8 ; (Drutt eating a worm) 51722 DEFB 168,205 ; #R52648 (Drutt, facing out of screen, smiling, legs partially extended, eyes blinking) 51724 DEFB 168,205 ; #R52648 (Drutt, facing out of screen, smiling, legs partially extended, eyes blinking) 51726 DEFB 168,205 ; #R52648 (Drutt, facing out of screen, smiling, legs partially extended, eyes blinking) 51728 DEFB 168,205 ; #R52648 (Drutt, facing out of screen, smiling, legs partially extended, eyes blinking) 51730 DEFB 43,0 ; Select next action for Drutt depending upon control input ; Reset Drutt to Initial State ; ; Used by the routine at #R34751. c51732 LD HL,51524 ; Set current position in Drutt's script data... 51735 LD (51518),HL ; ...to #R51524 (Drutt facing out of screen) 51738 RET ; Return ; Update States of Drutt and Worm and Store Current Positions in Script Data ; ; Used by the routine at #R34438. c51739 CALL 52837 ; Update state of Worm and store current position in script data 51742 LD IX,(34242) ; Load IX with address of current level's complex state data for Drutt 51746 CALL 53848 ; Store room size data for Drutt's current room 51749 LD HL,(51518) ; Load current position in Drutt's script data from #R51518 into HL... 51752 LD (34277),HL ; ...and store at #R34277 as position in script currently running 51755 CALL 51765 ; Update state of Drutt 51758 LD HL,(34277) ; Store address (current position in script data) stored at #R34277... 51761 LD (51518),HL ; ...at #R51518 as current position in Drutt's script data 51764 RET ; Return ; Update State of Drutt ; ; If Drutt is being carried or falling, then he should be prevented from doing anything. This is accomplished by ; constantly resetting his current script data position to be #R51520. This does nothing except redraw Drutt. Input: ; IX Address of complex state data (current level) for Drutt Output: HL Address of next script instruction to ; execute c51765 LD A,(IX+10) ; If both Drutt's Being Carried and Can Fall flags are reset... 51768 AND 96 ; ... 51770 JP Z,48096 ; ...then jump to #R48096 (advance HL to next script instruction and execute) 51773 LD HL,51520 ; Point HL at script data for Drutt facing out of screen (falling)... 51776 JP 48098 ; ...and execute ; Script Routine (43) Select Next Action for Drutt Depending Upon Control Input Input: IX Address of complex state ; data (current level) for Drutt Output: HL Address of next script instruction to execute c51779 CALL 54768 ; Check Drutt for collision with another entity at same depth whose Interaction (11,6) Flag is ; set... 51782 CP 129 ; ...and if collision was not with entity of class 129 (causes other entities to start ; falling)... 51784 JR NZ,51792 ; ...then skip ahead to #R51792 51786 CALL 55516 ; Set Drutt's Can Fall Flag and initial velocity factor to 2 51789 JP 52038 ; Move Drutt down one character, advance HL to next script instruction and execute *51792 LD IY,(34244) ; Load IY with address of current level's complex state data for worm 51796 LD A,(34208) ; If Drutt Mode Flag is reset... 51799 BIT 0,A ; ... 51801 JR Z,51841 ; ...then skip ahead to #R51841 ; Drutt Mode Flag is set (i.e. Drutt Mode) 51803 SET 1,(IX+9) ; Set Drutt's Under Player Control Flag 51807 LD A,(34219) ; Load A with control input 51810 BIT 0,A ; If right has been pressed... 51812 JR NZ,51904 ; ...then randomly select script data for rightward hop of size three or four, and execute 51814 BIT 1,A ; If left has been pressed... 51816 JR NZ,51924 ; ...then randomly select script data for leftward hop of size three or four, and execute 51818 BIT 2,A ; If forward has been pressed... 51820 JP NZ,51954 ; ...then point HL at script data for Drutt swapping depth levels and execute 51823 BIT 3,A ; If back has been pressed... 51825 JP NZ,51944 ; ...then jump to #R51944 (start Drutt jumping) ; At this point, no control has been pressed, so Drutt is effectively not under player control 51828 RES 1,(IX+9) ; Reset Drutt's Under Player Control Flag 51832 LD A,(IY+1) ; If worm's depth is zero (i.e. not in play area)... 51835 OR A ; ... 51836 JR Z,51875 ; ...then randomly select an action for Drutt and execute 51838 JP 51960 ; Move Drutt closer to the worm and eat it if close enough ; Drutt Mode Flag is reset (i.e. Berk Mode) *51841 RES 1,(IX+9) ; Reset Drutt's Under Player Control Flag 51845 LD A,(IY+1) ; If worm's depth is not zero (i.e. is in play area)... 51848 OR A ; ... 51849 JP NZ,51960 ; ...then move Drutt closer to the worm and eat it if close enough 51852 LD IY,(34240) ; Load IY with address of current level's complex state data for Berk 51856 LD A,(IY+0) ; If Drutt is in the same room as Berk... 51859 CP (IX+0) ; ... 51862 JR Z,51875 ; ...then randomly select an action for Drutt and execute ; The following code will make Drutt move closer to the target (a worm, or Berk if in Berk Mode) if the target's ; room is directly to the left or right of Drutt's room (i.e. no vertical separation). Otherwise, Drutt will perform ; a random action. This entry point is used by the routine at #R51960. *51864 CALL 53194 ; Load A with value indicating which direction room A lies relative to Drutt's current room 51867 CP 1 ; If target room is to the right... 51869 JR Z,51904 ; ...then randomly select script data for rightward hop of size three or four, and execute 51871 CP 2 ; If target room is to the left... 51873 JR Z,51924 ; ...then randomly select script data for leftward hop of size three or four, and execute ; This entry point is used by the routine at #R51960. *51875 LD A,7 ; Load A with a random number, 0-6... 51877 CALL 54222 ; ... 51880 LD DE,51890 ; Point DE at Table of Addresses of Script Data for Drutt's Actions... 51883 CALL 53814 ; ...and load DE with entry of index A in this table 51886 EX DE,HL ; Switch DE and HL (now contains address of randomly selected script data) 51887 JP 48098 ; Execute script data at address in HL ; Table of Addresses of Script Data for Drutt's Actions ; ; When Drutt is neither under player control nor seeking a target (a worm or Berk) then his actions are determined ; by randomly selecting a script data address from this table and executing. There is: b51890 DEFW 51538 ; Move Drutt and any pushed entity right by a hop of size four 51892 DEFW 51608 ; Move Drutt and any pushed entity left by a hop of size three 51894 DEFW 51630 ; Drutt swapping depth levels 51896 DEFW 51524 ; Drutt facing out of screen 51898 DEFW 51524 ; Drutt facing out of screen 51900 DEFW 51524 ; Drutt facing out of screen 51902 DEFW 51524 ; Drutt facing out of screen ; Randomly Select Script Data for Rightward Hop of Size Three or Four, and Execute ; ; Used by the routine at #R51779. c51904 LD A,2 ; Load A with a random number, 0-1... 51906 CALL 54222 ; ... 51909 OR A ; ...and if this is zero (1 in 2 chance)... 51910 JR Z,51918 ; ...then skip ahead to #R51918 51912 LD HL,51538 ; Point HL at script data for moving Drutt and any pushed entity right by a hop of size four... 51915 JP 48098 ; ...and execute *51918 LD HL,51562 ; Point HL at script data for moving Drutt and any pushed entity right by a hop of size ; three... 51921 JP 48098 ; ...and execute ; Randomly Select Script Data for Leftward Hop of Size Three or Four, and Execute ; ; Used by the routine at #R51779. c51924 LD A,2 ; Load A with a random number, 0-1... 51926 CALL 54222 ; ... 51929 OR A ; ...and if this is zero (1 in 2 chance)... 51930 JR Z,51938 ; ...then skip ahead to #R51938 51932 LD HL,51584 ; Point HL at script data for moving Drutt and any pushed entity left by a hop of size four... 51935 JP 48098 ; ...and execute *51938 LD HL,51608 ; Point HL at script data for moving Drutt and any pushed entity left by a hop of size three... 51941 JP 48098 ; ...and execute ; Start Drutt Jumping ; ; Used by the routine at #R51779. c51944 LD (IX+12),130 ; Set Drutt's Is Jumping Flag and set initial Jump Velocity to 2 51948 LD HL,51674 ; Point HL at script data for Drutt starting to jump straight up... 51951 JP 48098 ; ...and execute ; Point HL at Script Data for Drutt Swapping Depth Levels and Execute ; ; Used by the routine at #R51779. c51954 LD HL,51630 ; Point HL at script data for Drutt swapping depth levels... 51957 JP 48098 ; ...and execute ; Move Drutt Closer to the Worm and Eat it if Close Enough ; ; Used by the routine at #R51779. Input: IX Address of complex state data (current level) for Drutt IY Address of ; complex state data (current level) for Worm c51960 LD A,(IY+0) ; If Drutt and worm are not in the same room... 51963 CP (IX+0) ; ... 51966 JP NZ,51864 ; ...then move Drutt closer to worm if appropriate, otherwise make Drutt perform random action 51969 LD A,(IX+5) ; If Drutt's left edge... 51972 CP (IY+5) ; ...is to the left of the worm's... 51975 JR C,52017 ; ...then skip ahead to #R52017 51977 LD A,(IY+7) ; If worm's right edge... 51980 CP (IX+5) ; ...is to the left of Drutt's left edge... 51983 JR C,52023 ; ...then skip ahead to #R52023 51985 LD A,(IX+4) ; If y-coordinate of Drutt's top edge... 51988 CP 120 ; ...is less than 120... 51990 JP C,51875 ; ...then randomly select an action for Drutt and execute 51993 LD A,(IY+1) ; If worm's depth is the same as Drutt's... 51996 CP (IX+1) ; ... 51999 JR Z,52007 ; ...then skip ahead to #R52007 ; Drutt and worm in same room, at different depth and same x-coordinate 52001 LD HL,51630 ; Point HL at script data for Drutt swapping depth levels... 52004 JP 48098 ; ...and execute ; Drutt and worm in same room, at same depth and same x-coordinate *52007 LD (IY+1),0 ; Set worm's depth to zero (i.e. remove from play) 52011 LD HL,51706 ; Point HL at script data for Drutt eating a worm... 52014 JP 48098 ; ...and execute ; Drutt's left edge to left of worm's *52017 LD HL,51538 ; Point HL at script data for moving Drutt and any pushed entity right by a hop of size four... 52020 JP 48098 ; ...and execute ; Worm's right edge to left of Drutt's left edge *52023 LD HL,51584 ; Point HL at script data for moving Drutt and any pushed entity left by a hop of size four... 52026 JP 48098 ; ...and execute ; Script Routine (44) Move Entity Up One Character ; ; Used by the routine at #R48026. Input: IX Address of complex state data for an entity c52029 DEC (IX+4) ; Move entity up one character... 52032 DEC (IX+6) ; ... 52035 JP 48096 ; Advance HL to next script instruction and execute ; Script Routine (45) Move Entity Down One Character ; ; Used by the routine at #R51779. Input: IX Address of complex state data for an entity c52038 INC (IX+4) ; Move entity down one character... 52041 INC (IX+6) ; ... 52044 JP 48096 ; Advance HL to next script instruction and execute ; Script Routine (46) Move Drutt, or Entity he is Pushing Left One Character and Start Pushed Entity Falling if ; Appropriate c52047 CALL 52053 ; Move Drutt, or entity he is pushing left one character and start pushed entity falling if ; appropriate 52050 JP 48096 ; Advance HL to next script instruction and execute ; Move Drutt, or Entity he is Pushing Left One Character and Start Pushed Entity Falling if Appropriate ; ; Drutt will only push other entities when he is under player control. If he is not, then he will just pass through ; pushable entities. Input: IX Address of complex state data (current level) for Drutt c52053 CALL 54666 ; Check entity at IX for collision with another impassable / pushable entity immediately to the ; left... 52056 JR C,52087 ; ...and if a collision has not occurred, then skip ahead to #R52087 ; At this point, a collision has occurred, so IY points to the complex state data entry of the entity with which ; Drutt has collided 52058 CP 22 ; If collision was with an entity of class of 22 or greater (can't be picked up)... 52060 JR NC,52076 ; ...then skip ahead to #R52076 52062 BIT 1,(IX+9) ; If Drutt's Under Player Control Flag is reset... 52066 JR Z,52087 ; ...then skip ahead to #R52087 (move Drutt left without pushing anything) 52068 PUSH IX ; Store IX (address of current level's complex state data for Drutt) 52070 CALL 52098 ; Advance position of entity pushed left by Drutt 52073 POP IX ; Restore IX (address of current level's complex state data for Drutt) 52075 RET ; Return ; Collision with entity of class 22 or greater *52076 CP 129 ; If collision was with entity of class 129 (causes other entities to start falling)... 52078 JR Z,52087 ; ...then skip ahead to #R52087 ; At this point, the entity to Drutt's left is neither passable nor pushable. 52080 POP BC ; Remove top value from stack (i.e. return address to routine that called this routine) 52081 LD HL,51630 ; Point HL at script data for Drutt swapping depth levels... 52084 JP 48098 ; ...and execute ; No collision, not under player control or collision with entity of class 129 *52087 CALL 54348 ; Move Drutt into room to the left, if appropriate... 52090 RET NC ; ...and if Drutt can't enter new room then return 52091 DEC (IX+5) ; Move Drutt left one character... 52094 DEC (IX+7) ; ... 52097 RET ; Return ; Advance Position of Entity Pushed Left by Drutt ; ; Used by the routine at #R52053. Input: IY Address of complex state data for entity pushed by Drutt c52098 PUSH IY ; Transfer address of complex state data for pushed entity from IY... 52100 POP IX ; ...to IX 52102 CALL 54666 ; Check pushed entity for collision with another impassable / pushable entity immediately to ; the left... 52105 JR C,52112 ; ...and if a collision has not occurred, then skip ahead to #R52112 52107 CP 129 ; If collision was with entity of class 129 (causes other entities to start falling)... 52109 JR Z,52134 ; ...then skip ahead to #R52134 52111 RET ; Return (as Drutt can't push two entities) ; No knock-on collision *52112 LD A,(IX+5) ; If x-coordinate of left edge of pushed entity is at least 103... 52115 CP 103 ; ...i.e. not yet at left edge of room... 52117 JR NC,52127 ; ...then skip ahead to #R52127 52119 CALL 54539 ; Load B with index of room to left of current character's current room... 52122 RET Z ; ...and if there is no room to the left then return 52123 CALL 54348 ; Move pushed entity into room to the left, if appropriate... 52126 RET NC ; ...and if pushed entity can't enter new room then return *52127 DEC (IX+5) ; Move pushed entity left one character... 52130 DEC (IX+7) ; ... 52133 RET ; Return *52134 CALL 55516 ; Set Can Fall Flag and set initial velocity factor of 2 for pushed entity 52137 CALL 52127 ; Move pushed entity left two characters... 52140 JR 52127 ; ...and return ; Script Routine (47) Move Drutt, or Entity he is Pushing Right One Character and Start Pushed Entity Falling if ; Appropriate c52142 CALL 52148 ; Move Drutt, or entity he is pushing right one character and start pushed entity falling if ; appropriate 52145 JP 48096 ; Advance HL to next script instruction and execute ; Move Drutt, or Entity he is Pushing Right One Character and Start Pushed Entity Falling if Appropriate ; ; Drutt will only push other entities when he is under player control. If he is not, then he will just pass through ; pushable entities. Input: IX Address of complex state data (current level) for Drutt c52148 CALL 54569 ; Check Drutt for collision with another impassable / pushable entity immediately to the ; right... 52151 JR C,52182 ; ...and if a collision has not occurred, then skip ahead to #R52182 ; At this point, a collision has occurred, so IY points to the complex state data entry of the entity with which ; Drutt has collided 52153 CP 22 ; If collision was with an entity of class 22 or greater (can't be picked up)... 52155 JR NC,52171 ; ...then skip ahead to #R52171 52157 BIT 1,(IX+9) ; If Drutt's Under Player Control Flag is reset... 52161 JR Z,52182 ; ...then skip ahead to #R52182 (move Drutt right without pushing anything) 52163 PUSH IX ; Store IX (address of current level's complex state data for Drutt) 52165 CALL 52193 ; Advance position of entity pushed right by Drutt 52168 POP IX ; Restore IX (address of current level's complex state data for Drutt) 52170 RET ; Return ; Collision with entity of class 22 or greater *52171 CP 129 ; If collision was with entity of class 129 (causes other entities to start falling)... 52173 JR Z,52182 ; ...then skip ahead to #R52182 ; At this point, the entity to Drutt's right is neither passable nor pushable. 52175 POP BC ; Remove top value from stack (i.e. return address to routine that called this routine) 52176 LD HL,51630 ; Point HL at script data for Drutt swapping depth levels... 52179 JP 48098 ; ...and execute ; No collision, not under player control or collision with entity of class 129 *52182 CALL 54313 ; Move Drutt into room to the right, if appropriate... 52185 RET NC ; ...and if Drutt can't enter new room then return 52186 INC (IX+5) ; Move Drutt right one character... 52189 INC (IX+7) ; ... 52192 RET ; Return ; Advance Position of Entity Pushed Right by Drutt ; ; Used by the routine at #R52148. Input: IY Address of complex state data for entity pushed by Drutt c52193 PUSH IY ; Transfer address of complex state data for pushed entity from IY... 52195 POP IX ; ...to IX 52197 CALL 54569 ; Check pushed entity for collision with another impassable / pushable entity immediately to ; the right... 52200 JR C,52207 ; ...and if a collision has not occurred, then skip ahead to #R52207 52202 CP 129 ; If collision was with entity of class 129 (causes other entities to start falling)... 52204 JR Z,52235 ; ...then skip ahead to #R52235 52206 RET ; Return (as Drutt can't push two entities) ; No knock-on collision *52207 LD A,(34235) ; Load E with width of current room (chars) + 99... 52210 SUB 2 ; ...minus 2... 52212 LD E,A ; ... 52213 LD A,(IX+7) ; ...and if x-coordinate of right edge of pushed entity is less than this... 52216 CP E ; ...i.e. not yet at right edge of room... 52217 JR C,52227 ; ...then skip ahead to #R52227 52219 CALL 54505 ; Load B with index of room to right of current character's current room... 52222 RET Z ; ...and if there is no room to the right then return 52223 CALL 54313 ; Move pushed entity into room to the right, if appropriate... 52226 RET NC ; ...and if pushed entity can't enter new room then return *52227 INC (IX+5) ; Move pushed entity right one character... 52230 INC (IX+7) ; ... 52233 XOR A ; Load A with zero (see trivia) 52234 RET ; Return *52235 CALL 55516 ; Set Can Fall Flag and set initial velocity factor of 2 for pushed entity 52238 CALL 52227 ; Move pushed entity right two characters... 52241 JR 52227 ; ...and return ; Script Routine (50) Advance Drutt's Jump and Select Next Phase if Current Phase Complete ; ; The CALL at #R52243 will be RETurned from if Drutt's Is Jumping Flag is reset. Otherwise, E will be loaded with ; Drutt's jump state index (see #R55041). Output: HL Address of next script instruction to execute c52243 CALL 55023 ; Handle Drutt's jump, and load A with Jump State Index as appropriate 52246 LD A,E ; If jump state index is zero... 52247 OR A ; ... 52248 JP Z,48096 ; ...then jump to #R48096 (advance HL to next script instruction and execute) 52251 CP 1 ; If jump state index is 1... 52253 JR Z,52259 ; ...then skip ahead to #R52259 52255 CP 2 ; If jump state index is not 2... 52257 JR NZ,52265 ; ...then skip ahead to #R52265 ; Jump state index is 1 (landed on floor / platform and Back (control input) bit set) or 2 (unused) *52259 LD HL,51674 ; Point HL at script data for Drutt starting to jump straight up... 52262 JP 48098 ; ...and execute ; Jump state index is not 2 *52265 CP 3 ; If jump state index is not 3... 52267 JR NZ,52275 ; ...then skip ahead to #R52275 ; Jump state index is 3 (Drutt's jump velocity less than 4, and back not pressed, i.e. terminate jumping) 52269 LD HL,51524 ; Point HL at script data for Drutt facing out of screen... 52272 JP 48098 ; ...and execute ; Jump state index is not 3 *52275 CP 4 ; If jump state index is not 4... 52277 JR NZ,52285 ; ...then skip ahead to #R52285 ; Jump state index is 4 (bounced off an obstruction to the right or Left (control input) Bit set) 52279 LD HL,51686 ; Point HL at script data for Drutt Jumping Left... 52282 JP 48098 ; ...and execute ; Jump state index is not 4 *52285 CP 5 ; If jump state index is not 5... 52287 JR NZ,52295 ; ...then skip ahead to #R52295 ; Jump state index is 5 (bounced off an obstruction to the left or Right (control input) Bit set) 52289 LD HL,51696 ; Point HL at script data for Drutt Jumping Right... 52292 JP 48098 ; ...and execute ; Jump state index is not 5 *52295 CP 6 ; If jump state index is not 6... 52297 JP NZ,48096 ; ...then jump to #R48096 (advance HL to next script instruction and execute) ; Jump state index is 6 (Drutt has banged his head on something above him) 52300 CALL 55516 ; Set Drutt's Can Fall Flag and set initial velocity factor of 2 52303 LD HL,51520 ; Point HL at script data for Drutt facing out of screen (falling)... 52306 JP 48098 ; ...and execute ; Script Routine (51) Swap Drutt's Current Depth Level if Possible c52309 CALL 52315 ; Swap Drutt's current depth level if possible 52312 JP 48096 ; Advance HL to next script instruction and execute ; Swap Drutt's Current Depth Level if Possible ; ; Used by the routine at #R52309. Input: IX Address of complex state data (current level) for Drutt c52315 LD A,(IX+1) ; If Drutt's depth is not 1... 52318 CP 1 ; ... 52320 JR NZ,52351 ; ...then skip ahead to #R52351 ; Drutt's depth is 1 52322 LD A,(34230) ; If Drutt's current depth is the same as number of available depth levels in current room... 52325 CP (IX+1) ; ...i.e. room has depth of 1... 52328 RET Z ; ...then return (as there is no other depth level for Drutt to move to) ; The following collision check is usually only satisfied by Berk. This prevents Drutt from jumping back a depth ; level while in front of (at same depth level as) Berk. 52329 CALL 54878 ; Check Drutt for collision with another entity (only those defined before, and in reverse ; order) at same depth level whose Interaction (11,7) Flag is set... 52332 RET NC ; ...and if a collision occurred, then return ; The following collision check prevents Drutt from jumping back when there is an obstruction (e.g. the brick ; columns in the pit room, level 1) behind him. 52333 CALL 54890 ; Check Drutt for collision with another entity (in reverse order) at next depth level into ; screen whose Interaction (11,7) Flag is set... 52336 JR C,52341 ; ...and if no collision occurred, then skip ahead to #R52341 52338 CP 22 ; If collision was with an entity of class of 22 or greater (can't be picked up)... 52340 RET NC ; ...then return *52341 INC (IX+1) ; Increase Drutt's depth (i.e. move backward away from screen) 52344 DEC (IX+4) ; Decrease Drutt's top and bottom y-coordinates... 52347 DEC (IX+6) ; ... 52350 RET ; Return ; Drutt's depth is not 1 *52351 LD A,(IX+1) ; If Drutt's current depth is 1... (see trivia) 52354 CP 1 ; ... 52356 RET Z ; ...then return ; The following collision check prevents Drutt from jumping forward a depth level while in behind an obstruction ; (e.g. Berk). 52357 CALL 54764 ; Check Drutt for collision with another entity at next depth level out of screen whose ; Interaction (11,6) Flag is set... 52360 RET NC ; ...and if a collision occurred, then return 52361 DEC (IX+1) ; Decrease Drutt's depth (i.e. move forward towards screen) 52364 INC (IX+4) ; Increase Drutt's top and bottom y-coordinates... 52367 INC (IX+6) ; ... 52370 RET ; Return ; Graphic Layout Data Drutt Facing out of screen, fully animated, jumping / falling / held by Berk b52371 DEFB 247,3 ; Jump to one of the 3 addresses in the following list, chosen at random: 52373 DEFB 155,204 ; #R52379 (facing out of screen, legs bent, eyes and mouth animated) 52375 DEFB 171,204 ; #R52395 (facing out of screen, legs partially extended, eyes and mouth animated) 52377 DEFB 193,204 ; #R52417 (facing out of screen, legs fully extended, eyes and mouth animated) ; Facing out of screen, legs bent, eyes and mouth animated 52379 DEFB 251,124,205 ; Process graphic layout data at #R52604 and upon returning, move cursor to base ; coordinates 52382 DEFB 250,0,255 ; Change cursor's x- and y-coordinates by -1 and 0 characters respectively 52385 DEFB 45,6,34,45,134,33 52391 DEFB 255 ; End Marker ; Facing out of screen, legs partially extended, eyes and mouth animated 52392 DEFB 254,255,0 ; Change cursor's x- and y-coordinates by 0 and -1 characters respectively and ; store as new base coordinates 52395 DEFB 251,124,205 ; Process graphic layout data at #R52604 and upon returning, move cursor to base ; coordinates 52398 DEFB 250,0,255 ; Change cursor's x- and y-coordinates by -1 and 0 characters respectively 52401 DEFB 38,6,34,38,134,30 52407 DEFB 46,6,33,47,6,33 52413 DEFB 46,134,33 52416 DEFB 255 ; End Marker ; Facing out of screen, legs fully extended, eyes and mouth animated 52417 DEFB 251,124,205 ; Process graphic layout data at #R52604 and upon returning, move cursor to base ; coordinates 52420 DEFB 250,0,255 ; Change cursor's x- and y-coordinates by -1 and 0 characters respectively 52423 DEFB 38,6,34,38,134,30 52429 DEFB 58,6,33,56,6,33 52435 DEFB 58,134,31,57,6,33 52441 DEFB 255 ; End Marker ; Facing right, legs bent 52442 DEFB 244,7 ; Set current graphic set to 7 52444 DEFB 250,255,0 ; Change cursor's x- and y-coordinates by 0 and -1 characters respectively 52447 DEFB 48,7,31,38,6,33 52453 DEFB 49,6,161,50,6,33 52459 DEFB 255 ; End Marker ; Facing right, legs extended back (jumping) 52460 DEFB 254,255,0 ; Change cursor's x- and y-coordinates by 0 and -1 characters respectively and ; store as new base coordinates 52463 DEFB 251,25,205 ; Process graphic layout data at #R52505 and upon returning, move cursor to base ; coordinates 52466 DEFB 250,1,255 ; Change cursor's x- and y-coordinates by -1 and +1 characters respectively 52469 DEFB 51,6,33,52,6,33 52475 DEFB 255 ; End Marker ; Facing right, legs bent, airborne 52476 DEFB 254,254,0 ; Change cursor's x- and y-coordinates by 0 and -2 characters respectively and ; store as new base coordinates 52479 DEFB 251,25,205 ; Process graphic layout data at #R52505 and upon returning, move cursor to base ; coordinates 52482 DEFB 250,1,0 ; Change cursor's x- and y-coordinates by 0 and +1 characters respectively 52485 DEFB 53,6,33 52488 DEFB 255 ; End Marker ; Facing right, legs bent, landing 52489 DEFB 254,255,0 ; Change cursor's x- and y-coordinates by 0 and -1 characters respectively and ; store as new base coordinates 52492 DEFB 251,25,205 ; Process graphic layout data at #R52505 and upon returning, move cursor to base ; coordinates 52495 DEFB 250,1,0 ; Change cursor's x- and y-coordinates by 0 and +1 characters respectively 52498 DEFB 54,6,33,55,6,33 52504 DEFB 255 ; End Marker ; Body, facing right 52505 DEFB 244,7 ; Set current graphic set to 7 52507 DEFB 250,255,0 ; Change cursor's x- and y-coordinates by 0 and -1 characters respectively 52510 DEFB 48,7,31,38,6,33 52516 DEFB 0,54,33,38,134,33 52522 DEFB 255 ; End Marker ; Facing left, legs bent 52523 DEFB 244,7 ; Set current graphic set to 7 52525 DEFB 250,255,0 ; Change cursor's x- and y-coordinates by 0 and -1 characters respectively 52528 DEFB 48,135,31,50,134,33 52534 DEFB 49,134,161,38,134,33 52540 DEFB 255 ; End Marker ; Facing left, legs extended back (jumping) 52541 DEFB 254,255,0 ; Change cursor's x- and y-coordinates by 0 and -1 characters respectively and ; store as new base coordinates 52544 DEFB 251,106,205 ; Process graphic layout data at #R52586 and upon returning, move cursor to base ; coordinates 52547 DEFB 250,1,0 ; Change cursor's x- and y-coordinates by 0 and +1 characters respectively 52550 DEFB 52,134,33,51,134,33 52556 DEFB 255 ; End Marker ; Facing left, legs bent, airborne 52557 DEFB 254,254,0 ; Change cursor's x- and y-coordinates by 0 and -2 characters respectively and ; store as new base coordinates 52560 DEFB 251,106,205 ; Process graphic layout data at #R52586 and upon returning, move cursor to base ; coordinates 52563 DEFB 250,1,0 ; Change cursor's x- and y-coordinates by 0 and +1 characters respectively 52566 DEFB 53,134,33 52569 DEFB 255 ; End Marker ; Facing left, legs bent, landing 52570 DEFB 254,255,0 ; Change cursor's x- and y-coordinates by 0 and -1 characters respectively and ; store as new base coordinates 52573 DEFB 251,106,205 ; Process graphic layout data at #R52586 and upon returning, move cursor to base ; coordinates 52576 DEFB 250,1,255 ; Change cursor's x- and y-coordinates by -1 and +1 characters respectively 52579 DEFB 55,134,33,54,134,33 52585 DEFB 255 ; End Marker ; Body, facing left 52586 DEFB 244,7 ; Set current graphic set to 7 52588 DEFB 250,255,0 ; Change cursor's x- and y-coordinates by 0 and -1 characters respectively 52591 DEFB 48,135,31,38,6,33 52597 DEFB 0,54,33,38,134,33 52603 DEFB 255 ; End Marker ; Mouth and eyes (animated) 52604 DEFB 244,7 ; Set current graphic set to 7 52606 DEFB 236,3,39,40,41 ; Modify following instruction to display graphic of random index, chosen from 39, ; 40 and 41 52611 DEFB 0,48,161 52614 DEFB 250,255,254 ; Change cursor's x- and y-coordinates by -2 and -1 characters respectively 52617 DEFB 249,2,0 ; If state n (initially 1) has remaining time of zero then reset its time to ; maximum and randomly select a new state, n, from the 2 in the following list. ; Jump to the address specified in the current state and decrease its remaining ; time: 52620 DEFB 2,4,148,205 ; #R52628 (eyes, open, facing out of screen, for 4 ticks) 52624 DEFB 1,2,158,205 ; #R52638 (eyes, closed, facing out of screen, for 2 ticks) ; Eyes (Open, Facing Out of Screen) 52628 DEFB 37,7,33,35,7,33 52634 DEFB 37,135,33 52637 DEFB 255 ; End Marker ; Eyes (Closed, Facing Out of Screen) 52638 DEFB 37,6,33,36,6,33 52644 DEFB 37,134,33 52647 DEFB 255 ; End Marker ; Facing out of screen, smiling, legs partially extended, eyes blinking 52648 DEFB 244,7 ; Set current graphic set to 7 52650 DEFB 250,255,255 ; Change cursor's x- and y-coordinates by -1 and -1 characters respectively 52653 DEFB 38,6,33,42,48,161 52659 DEFB 38,134,30,46,6,34 52665 DEFB 46,134,33 52668 DEFB 250,254,253 ; Change cursor's x- and y-coordinates by -3 and -2 characters respectively 52671 DEFB 247,2 ; Jump to one of the 2 addresses in the following list, chosen at random: 52673 DEFB 148,205 ; #R52628 (eyes, open, facing out of screen) 52675 DEFB 158,205 ; #R52638 (eyes, closed, facing out of screen) ; Facing out of screen, legs partially extended, eating a worm (animated) 52677 DEFB 251,168,205 ; Process graphic layout data at #R52648 and upon returning, move cursor to base ; coordinates 52680 DEFB 250,255,0 ; Change cursor's x- and y-coordinates by 0 and -1 characters respectively 52683 DEFB 236,2,43,44 ; Modify following instruction to display graphic of random index, chosen from 43 ; and 44 52687 DEFB 0,48,160 52690 DEFB 243,1,6 ; Increase current state value n (initially 1), up to maximum of 6, resetting to ; zero if maximum reached and jump to n-th address in following list: 52693 DEFB 225,205 ; #R52705 (worm facing left, curved up into Drutt's mouth) 52695 DEFB 235,205 ; #R52715 (worm facing right, curved up into Drutt's mouth) 52697 DEFB 225,205 ; #R52705 (worm facing left, curved up into Drutt's mouth) 52699 DEFB 235,205 ; #R52715 (worm facing right, curved up into Drutt's mouth) 52701 DEFB 242,205 ; #R52722 (worm's eyes facing out of screen) 52703 DEFB 242,205 ; #R52722 (worm's eyes facing out of screen) ; Worm facing left, curved up into Drutt's mouth 52705 DEFB 250,0,255 ; Change cursor's x- and y-coordinates by -1 and 0 characters respectively 52708 DEFB 7,7,33,59,3,33 52714 DEFB 255 ; End Marker ; Worm facing right, curved up into Drutt's mouth 52715 DEFB 59,131,33,7,135,33 52721 DEFB 255 ; End Marker ; Worm's eyes facing out of screen 52722 DEFB 34,7,33 52725 DEFB 255 ; End Marker ; Current Position in Worm's Script Data b52726 DEFW 52729 ; Worm's Age b52728 DEFB 0 ; Script Data Worm ; ; Unused b52729 DEFB 92,208 ; #R53340 (Worm looking ahead, blinking) 52731 DEFB 1,0,249,205 ; Jump to #R52729 ; Worm Rising from Floor then Choosing Next Direction 52735 DEFB 92,208 ; #R53340 (Worm looking ahead, blinking) 52737 DEFB 92,208 ; #R53340 (Worm looking ahead, blinking) 52739 DEFB 34,0 ; Move worm up one character 52741 DEFB 92,208 ; #R53340 (Worm looking ahead, blinking) 52743 DEFB 92,208 ; #R53340 (Worm looking ahead, blinking) 52745 DEFB 34,0 ; Move worm up one character ; Choosing Next Direction 52747 DEFB 110,208 ; #R53358 (Worm looking left, normal) 52749 DEFB 110,208 ; #R53358 (Worm looking left, normal) 52751 DEFB 110,208 ; #R53358 (Worm looking left, normal) 52753 DEFB 92,208 ; #R53340 (Worm looking ahead, blinking) 52755 DEFB 125,208 ; #R53373 (Worm looking right, normal) 52757 DEFB 125,208 ; #R53373 (Worm looking right, normal) 52759 DEFB 125,208 ; #R53373 (Worm looking right, normal) 52761 DEFB 92,208 ; #R53340 (Worm looking ahead, blinking) 52763 DEFB 55,0 ; Choose new worm direction and start crawling ; Crawling Left 52765 DEFB 53,0 ; Move worm left if possible, otherwise jump to #R52747 (choose new direction) 52767 DEFB 214,208 ; #R53462 (Worm crawling left, frame 1 / 2) 52769 DEFB 214,208 ; #R53462 (Worm crawling left, frame 1 / 2) 52771 DEFB 229,208 ; #R53477 (Worm crawling left, frame 2 / 2) 52773 DEFB 229,208 ; #R53477 (Worm crawling left, frame 2 / 2) 52775 DEFB 52,0 ; Increase worm's age and decrease Time Until Direction Change or start fleeing if Drutt is ; nearby 52777 DEFB 1,0,29,206 ; Jump to #R52765 ; Crawling Right 52781 DEFB 54,0 ; Move worm right if possible, otherwise jump to #R52747 (choose new direction) 52783 DEFB 21,209 ; #R53525 (Worm crawling right, frame 1 / 2) 52785 DEFB 21,209 ; #R53525 (Worm crawling right, frame 1 / 2) 52787 DEFB 253,208 ; #R53501 (Worm crawling right, frame 2 / 2) 52789 DEFB 253,208 ; #R53501 (Worm crawling right, frame 2 / 2) 52791 DEFB 52,0 ; Increase worm's age and decrease Time Until Direction Change or start fleeing if Drutt is ; nearby 52793 DEFB 1,0,45,206 ; Jump to #R52781 ; Fleeing Left 52797 DEFB 155,208 ; #R53403 (Worm looking right, alarmed) 52799 DEFB 155,208 ; #R53403 (Worm looking right, alarmed) 52801 DEFB 155,208 ; #R53403 (Worm looking right, alarmed) 52803 DEFB 155,208 ; #R53403 (Worm looking right, alarmed) 52805 DEFB 53,0 ; Move worm left if possible, otherwise jump to #R52747 (choose new direction) 52807 DEFB 206,208 ; #R53454 (Worm crawling left, alarmed, frame 1 / 2) 52809 DEFB 241,208 ; #R53489 (Worm crawling left, alarmed, frame 2 / 2) 52811 DEFB 52,0 ; Increase worm's age and decrease Time Until Direction Change or continue fleeing if Drutt ; is nearby 52813 DEFB 1,0,69,206 ; Jump to #R52805 ; Fleeing Right 52817 DEFB 140,208 ; #R53388 (Worm looking left, alarmed) 52819 DEFB 140,208 ; #R53388 (Worm looking left, alarmed) 52821 DEFB 140,208 ; #R53388 (Worm looking left, alarmed) 52823 DEFB 140,208 ; #R53388 (Worm looking left, alarmed) 52825 DEFB 54,0 ; Move worm right if possible, otherwise jump to #R52747 (choose new direction) 52827 DEFB 39,209 ; #R53543 (Worm crawling right, alarmed, frame 1 / 2) 52829 DEFB 9,209 ; #R53513 (Worm crawling right, alarmed, frame 2 / 2) 52831 DEFB 52,0 ; Increase worm's age and decrease Time Until Direction Change or continue fleeing if Drutt ; is nearby 52833 DEFB 1,0,89,206 ; Jump to #R52825 ; Update State of Worm and Store Current Position in Script Data ; ; Used by the routine at #R51739. c52837 LD IX,(34244) ; Load IX with address of current level's complex state data for worm 52841 CALL 53848 ; Store room size data for worm's current room 52844 LD HL,(52726) ; Load current position in worm's script data from #R52726 into HL... 52847 LD (34277),HL ; ...and store at #R34277 as position in script currently running 52850 CALL 52860 ; Update state of worm 52853 LD HL,(34277) ; Store address (current position in script data) stored at #R34277... 52856 LD (52726),HL ; ...at #R52726 as current position in worm's script data 52859 RET ; Return ; Update State of Worm ; ; Used by the routine at #R52837. Input: IX Address of complex state data (current level) for Worm c52860 LD A,(IX+1) ; If worm's depth is zero (i.e. not currently active)... 52863 OR A ; ... 52864 JP Z,53083 ; ...then attempt to spawn a new worm... 52867 JP 48096 ; ...otherwise advance HL to next script instruction and execute ; Script Routine (53) Move Worm Left if Possible, Otherwise Choose New Direction Input: IX Address of complex ; state data for an entity c52870 CALL 54666 ; Check worm for collision with another impassable / pushable entity immediately to the left... 52873 JR NC,52908 ; ...and if a collision occurred, then have worm choose new direction 52875 CALL 54348 ; Move worm into room to the left, if appropriate... 52878 JR NC,52908 ; ...and if worm can't enter new room then have worm choose new direction 52880 DEC (IX+5) ; Move worm left one character... 52883 DEC (IX+7) ; ... 52886 JP 48096 ; Advance HL to next script instruction and execute ; Script Routine (54) Move Worm Right if Possible, Otherwise Choose New Direction Input: IX Address of complex ; state data for an entity c52889 CALL 54569 ; Check worm for collision with another impassable / pushable entity immediately to the ; right... 52892 JR NC,52908 ; ...and if a collision occurred, then have worm choose new direction 52894 CALL 54313 ; Move worm into room to the right, if appropriate... 52897 JR NC,52908 ; ...and if worm can't enter new room then have worm choose new direction 52899 INC (IX+5) ; Move worm right one character... 52902 INC (IX+7) ; ... 52905 JP 48096 ; Advance HL to next script instruction and execute ; Execute Script Data for Worm Choosing Next Direction ; ; Used by the routines at #R52870 and #R52889. c52908 LD HL,52747 ; Point HL at script data for worm, choosing next direction... 52911 JP 48098 ; ...and execute ; Script Routine (55) Choose New Direction and Start Crawling (Worm) Input: IX Address of complex state data for ; an entity c52914 CALL 53057 ; Increase Worm's Age and, if it has expired, set its depth to zero and return 52917 LD A,20 ; Load A with a random number, 5-24... 52919 CALL 54222 ; ... 52922 ADD A,5 ; ... 52924 LD (IX+12),A ; ...and set worm's Time Until Direction Change to this value 52927 LD A,2 ; Load A with a random number, 0-1... 52929 CALL 54222 ; ... 52932 OR A ; ...and if zero (1 in 2 chance)... 52933 JR NZ,52951 ; ...then skip ahead to #R52951 ; Have worm move left 52935 CALL 54666 ; Check worm for collision with another impassable / pushable entity immediately to the left... 52938 JR NC,52961 ; ...and if a collision occurred, then start worm crawling right 52940 CALL 54348 ; Move worm into room to the left, if appropriate... 52943 JR NC,52961 ; ...and if worm can't enter new room then start worm crawling right *52945 LD HL,52765 ; Point HL at script data for worm, crawling left... 52948 JP 48098 ; ...and execute ; Have worm move right *52951 CALL 54569 ; Check worm for collision with another impassable / pushable entity immediately to the ; right... 52954 JR NC,52945 ; ...and if a collision occurred, then start worm crawling left 52956 CALL 54313 ; Move worm into room to the right, if appropriate... 52959 JR NC,52945 ; ...and if worm can't enter new room then start worm crawling left *52961 LD HL,52781 ; Point HL at script data for worm, crawling right... 52964 JP 48098 ; ...and execute ; Script Routine (52) Increase Worm's Age and Decrease Time Until Direction Change, or React to Drutt's Presence ; ; When both Drutt and the worm are in the same room, and the worm is alerted to Drutt's presence, then the worm will ; take on its alarmed appearance and start fleeing in the direction away from Drutt. As long as Drutt remains in the ; same room as the worm, and within the "alerting" distance, the worm will continue fleeing in the same direction, ; and its Time Until Direction Change will be frozen. Input: IX Address of complex state data for an entity ; Output: HL Address of next script instruction to execute c52967 CALL 53057 ; Increase Worm's Age and, if it has expired, set its depth to zero and return 52970 LD IY,(34242) ; Load IY with address of current level's complex state data for Drutt 52974 LD A,(IX+0) ; If Drutt and the worm are in the same room... 52977 CP (IY+0) ; ... 52980 JR Z,53004 ; ...then skip ahead to #R53004 ; Drutt and worm in different rooms, so countdown to next direction change resumes as worm out of danger *52982 RES 1,(IX+9) ; Reset In Danger Flag 52986 LD A,(IX+12) ; If worm's Time Until Direction Change is zero... 52989 OR A ; ... 52990 JR Z,52998 ; ...then skip ahead to #R52998 (have worm choose new direction) 52992 DEC (IX+12) ; Decrease worm's Time Until Direction Change 52995 JP 48096 ; Advance HL to next script instruction and execute *52998 LD HL,52747 ; Point HL at script data for worm, choosing next direction... 53001 JP 48098 ; ...and execute ; Drutt and worm in same room, so worm potentially in danger *53004 LD A,(IX+5) ; Load A with x-coordinate of worm's left edge... 53007 INC A ; ...plus one... 53008 SUB (IY+5) ; ...minus x-coordinate of Drutt's left edge 53011 JR C,53034 ; If negative then skip ahead to #R53034 53013 CP 10 ; If worm's left edge is 9 characters or more to the right of Drutt's... 53015 JR NC,52982 ; ...then jump back to #R52982 53017 BIT 1,(IX+9) ; If In Danger Flag is set... 53021 JP NZ,48096 ; ...then jump to #R48096 (advance HL to next script instruction and execute) 53024 SET 1,(IX+9) ; Set In Danger Flag 53028 LD HL,52817 ; Point HL at script data for worm, fleeing right... 53031 JP 48098 ; ...and execute ; Drutt's left edge more than one character to the right of worm's left edge *53034 NEG ; If worm's left edge is 11 characters or more to the left of Drutt's... 53036 CP 10 ; ... 53038 JR NC,52982 ; ...then jump back to #R52982 53040 BIT 1,(IX+9) ; If In Danger Flag is set... 53044 JP NZ,48096 ; ...then jump to #R48096 (advance HL to next script instruction and execute) 53047 SET 1,(IX+9) ; Set In Danger Flag 53051 LD HL,52797 ; Point HL at script data for worm, fleeing left... 53054 JP 48098 ; ...and execute ; Increase Worm's Age and Set its Depth to Zero if it has Expired ; ; Used by the routines at #R52914 and #R52967. Input: IX Address of complex state data (current level) for Worm c53057 LD A,(52728) ; Increase current Worm Age value... 53060 INC A ; ... 53061 LD (52728),A ; ... 53064 BIT 7,A ; If Worm Age is less than 128... 53066 RET Z ; ...then return 53067 LD A,(34218) ; If current character's room... 53070 CP (IX+0) ; ...is the same as the worm's... 53073 RET Z ; ...then return 53074 XOR A ; Set the worm's depth to zero... 53075 LD (IX+1),A ; ... 53078 LD (52728),A ; Reset Worm Age to zero 53081 POP BC ; Remove top value from stack (return address in calling routine) 53082 RET ; Return (to routine that called the calling routine) ; Attempt to Spawn a New Worm ; ; Used by the routine at #R52860. Input: IX Address of complex state data (current level) for Worm c53083 LD A,60 ; Load A with a random number, 0-59... 53085 CALL 54222 ; ... 53088 OR A ; If random number is not zero (59 in 60 chance)... 53089 RET NZ ; ...then return 53090 LD A,(34218) ; Set worm's current room to same as current character's... 53093 LD (IX+0),A ; ... 53096 CALL 53848 ; Store room size data for worm's current room 53099 LD A,(34235) ; Load A with width of current room (chars) + 99... 53102 SUB 100 ; ...and subtract 100 to get x-coordinate (zero-based) of right side of the room 53104 CALL 54222 ; Load A with a random x-coordinate within current room 53107 ADD A,100 ; Add 100 to restore coordinate system 53109 LD (IX+5),A ; Set this as the worm's left x-coordinate 53112 ADD A,2 ; Add two to this... 53114 LD (IX+7),A ; ...and set as the worm's right x-coordinate 53117 LD A,2 ; Load A with a random number, 1-2... 53119 CALL 54222 ; ... 53122 INC A ; ... 53123 LD (IX+1),A ; ...and assign the worm this depth 53126 LD A,124 ; Load A with 124 (y-coordinate of character row below bottom of room) 53128 SUB (IX+1) ; Subtract worm's depth value to get its bottom y-coordinate... 53131 LD (IX+6),A ; ...and assign 53134 PUSH AF ; Store AF (A = bottom y-coordinate of worm) 53135 LD (IX+4),121 ; Set worm's top y-coordinate to 121 53139 CALL 54768 ; Check entity at IX for collision with another entity at same depth whose Interaction (11,6) ; Flag is set 53142 POP BC ; Store AF (B = bottom y-coordinate of worm) 53143 JR NC,53154 ; If a collision occurred then set worm's depth to zero and return 53145 LD (IX+4),B ; Set worm's top y-coordinate to same as its bottom y-coordinate 53148 LD HL,52735 ; Point HL at script data for worm rising from floor... 53151 JP 48098 ; ...and execute *53154 LD (IX+1),0 ; Set worm's depth to zero 53158 RET ; Return ; Pathfinding Data Table ; ; When built, this table has a header and a main data block. The header is three bytes long and contains the values: b53159 DEFB 0,0,0 53162 DEFB 0,0 53164 DEFB 0,0 53166 DEFB 0,0 53168 DEFB 0,0 53170 DEFB 0 ; Unused b53171 DEFB 0,0,0,0,0,0,0,0 53179 DEFB 0,0,0,0,0,0,0,0 53187 DEFB 0,0,100,100,100,100,100 ; Load A with Value Indicating Which Direction Room A Lies Relative to Room in State Data at IX ; ; Direction index value in A denotes which direction (left or right), e.g. Drutt, has to travel to reach the target ; room: Input: A Target room index (e.g. Berk's room or worm's room) IX Address of complex state data (current ; level) for Drutt Output: A Direction index c53194 PUSH HL ; Store HL 53195 PUSH IX ; Store IX 53197 LD E,A ; Load E with target room index 53198 LD A,(IX+0) ; Load D with Drutt's current room... 53201 LD D,A ; ... 53202 LD HL,53159 ; Set first two bytes of header to 255 (Start Marker)... 53205 LD (HL),255 ; ... 53207 INC HL ; ... 53208 LD (HL),255 ; ... 53210 INC HL ; Set third byte of header to index of Drutt's current room... 53211 LD (HL),A ; ... 53212 INC HL ; Advance HL to first byte of first entry 53213 CALL 54542 ; Load B with index of room to left of Drutt's current room... 53216 JR Z,53228 ; ...and if there is no such room then skip ahead to #R53228 53218 LD A,E ; If room to left of Drutt's current room is the target room... 53219 CP B ; ...then set Zero Flag 53220 LD A,2 ; Load A with 2 ("go left") 53222 JP Z,53336 ; If Zero Flag is set (room to left is target room) then restore registers and return 53225 CALL 53309 ; Add entry to Pathfinding Data Table stating room to left of Drutt is to the left *53228 CALL 54508 ; Load B with index of room to right of Drutt's room... 53231 JR Z,53243 ; ...and if there is no such room then skip ahead to #R53243 53233 LD A,E ; If room to right of Drutt's current room is the target room... 53234 CP B ; ...then set Zero Flag 53235 LD A,1 ; Load A with 1 ("go right") 53237 JP Z,53336 ; If Zero Flag is set (room to right is target room) then restore registers and return 53240 CALL 53309 ; Add entry to Pathfinding Data Table stating room to right of Drutt is to the right ; Now the Pathfinding Data Table has a header and zero, one or two records, depending upon the horizontal ; connectivity of Drutt's current room. *53243 LD IX,53162 ; Load IX with address of first entry in Pathfinding Data Table *53247 LD D,(IX+1) ; Load D with index of room from current entry in Pathfinding Data Table 53250 CALL 54542 ; Load B with index of room to left of room D... 53253 JR Z,53271 ; ...and if there is no such room then skip ahead to #R53271 53255 LD A,E ; If room to left of room D is the target room... 53256 CP B ; ... 53257 JP Z,53333 ; ...then load A with direction index for room D, restore registers and return 53260 CALL 53317 ; If room B already has an entry in Pathfinding Data Table... 53263 JR Z,53271 ; ...then skip ahead to #R53271 53265 LD A,(IX+0) ; Load A with current entry's direction index (room B must lie in same direction as room D) 53268 CALL 53309 ; Add entry to Pathfinding Data Table for room B lying in direction A *53271 CALL 54508 ; Load B with index of room to right of room D... 53274 JR Z,53292 ; ...and if there is no such room then skip ahead to #R53292 53276 LD A,E ; If room to right of room D is the target room... 53277 CP B ; ... 53278 JP Z,53333 ; ...then load A with direction index for room D, restore registers and return 53281 CALL 53317 ; If room B already has an entry in Pathfinding Data Table... 53284 JR Z,53292 ; ...then skip ahead to #R53292 53286 LD A,(IX+0) ; Load A with current entry's direction index (room B must lie in same direction as room D) 53289 CALL 53309 ; Add entry to Pathfinding Data Table for room B lying in direction A *53292 INC IX ; Advance IX by two bytes to next entry in Pathfinding Data Table... 53294 INC IX ; ... 53296 LD A,(IX+0) ; If byte at this location is not 255 (End Marker)... 53299 CP 255 ; ... 53301 JP NZ,53247 ; ...then loop back to #R53247 ; At this point, the search has checked all rooms and not found the target room. 53304 POP IX ; Restore IX 53306 POP HL ; Restore HL 53307 XOR A ; Set A to zero 53308 RET ; Return ; Add Entry to Pathfinding Data Table for Room B in Direction A ; ; B contains the room the pathfinding routine is currently looking at, and A contains a value that denotes which ; direction this room lies in relative to Drutt's current room. Input: A Direction index (1 or 2) B Index of room ; being examined HL Current address of end of Pathfinding Data Table c53309 LD (HL),A ; Store direction index 53310 INC HL ; Advance by one byte 53311 LD A,B ; Store index of room being examined... 53312 LD (HL),A ; ... 53313 INC HL ; Advance by one byte 53314 LD (HL),255 ; Store 255 (End Marker) 53316 RET ; Return ; Set Zero Flag if Room B Has an Entry in Pathfinding Data Table, Otherwise Reset ; ; Used by the routine at #R53194. Input: HL Address of end of Pathfinding Data Table B Index of room to check ; table for Output: F (Zero Flag) Set if room B is already stored in Pathfinding Data Table, reset otherwise c53317 PUSH HL ; Store HL (address of end of Pathfinding Data Table) *53318 DEC HL ; Move HL back to previous entry's room index... 53319 LD A,(HL) ; ...load into A... 53320 CP 255 ; ...and if this is 255 (Start Marker, so room B not found)... 53322 JR Z,53330 ; ...then skip ahead to #R53330 53324 DEC HL ; Move HL back to entry's direction index 53325 CP B ; If room to search for not the same as current entry's room... 53326 JR NZ,53318 ; ...then loop back to #R53318 to test next entry ; At this point, the room we're looking for (in B) is already stored in the Pathfinding Data Table and the Zero Flag ; is set. 53328 POP HL ; Restore HL (address of end of Pathfinding Data Table) 53329 RET ; Return *53330 POP HL ; Restore HL (address of end of Pathfinding Data Table) 53331 DEC A ; Reset Zero Flag 53332 RET ; Return ; Load A with Direction Index in Pathfinding Data Table entry at Address in IX, Restore Registers and Return ; ; Used by the routine at #R53194. Input: IX Address of an entry in Pathfinding Data Table c53333 LD A,(IX+0) ; Load A with direction index for entry at IX ; This entry point is used by the routine at #R53194. *53336 POP IX ; Restore IX 53338 POP HL ; Restore HL 53339 RET ; Return ; Graphic Layout Data Worm Looking ahead, animated b53340 DEFB 244,7 ; Set current graphic set to 7 53342 DEFB 250,254,1 ; Change cursor's x- and y-coordinates by +1 and -2 characters respectively 53345 DEFB 251,57,209 ; Process graphic layout data at #R53561 and upon returning, move cursor to base ; coordinates 53348 DEFB 250,255,1 ; Change cursor's x- and y-coordinates by +1 and -1 characters respectively 53351 DEFB 3,3,32,4,3,33 53357 DEFB 255 ; End Marker ; Looking left, normal 53358 DEFB 244,7 ; Set current graphic set to 7 53360 DEFB 250,255,0 ; Change cursor's x- and y-coordinates by 0 and -1 characters respectively 53363 DEFB 5,7,33,6,3,32 53369 DEFB 4,3,33 53372 DEFB 255 ; End Marker ; Looking right, normal 53373 DEFB 244,7 ; Set current graphic set to 7 53375 DEFB 250,255,1 ; Change cursor's x- and y-coordinates by +1 and -1 characters respectively 53378 DEFB 6,131,33,5,135,31 53384 DEFB 4,3,33 53387 DEFB 255 ; End Marker ; Looking left, alarmed 53388 DEFB 244,7 ; Set current graphic set to 7 53390 DEFB 250,255,0 ; Change cursor's x- and y-coordinates by 0 and -1 characters respectively 53393 DEFB 7,7,33,6,3,32 53399 DEFB 4,3,33 53402 DEFB 255 ; End Marker ; Looking right, alarmed 53403 DEFB 244,7 ; Set current graphic set to 7 53405 DEFB 250,255,1 ; Change cursor's x- and y-coordinates by +1 and -1 characters respectively 53408 DEFB 6,131,33,7,135,31 53414 DEFB 4,3,33 53417 DEFB 255 ; End Marker ; Unused 53418 DEFB 244,7 ; Set current graphic set to 7 53420 DEFB 250,254,1 ; Change cursor's x- and y-coordinates by +1 and -2 characters respectively 53423 DEFB 1,7,32,3,3,32 53429 DEFB 8,3,32,9,3,33 53435 DEFB 255 ; End Marker ; Unused 53436 DEFB 244,7 ; Set current graphic set to 7 53438 DEFB 250,254,1 ; Change cursor's x- and y-coordinates by +1 and -2 characters respectively 53441 DEFB 1,7,32,3,3,31 53447 DEFB 9,131,33,8,131,33 53453 DEFB 255 ; End Marker ; Crawling Left, Alarmed (Frame 1 / 2) 53454 DEFB 244,7 ; Set current graphic set to 7 53456 DEFB 7,7,33 53459 DEFB 248,219,208 ; Jump to #R53464 ; Crawling Left (Frame 1 / 2) 53462 DEFB 244,7 ; Set current graphic set to 7 53464 DEFB 5,7,33,10,3,33 53470 DEFB 10,3,33,9,3,33 53476 DEFB 255 ; End Marker ; Crawling Left (Frame 2 / 2) 53477 DEFB 244,7 ; Set current graphic set to 7 53479 DEFB 5,7,33,11,3,33 53485 DEFB 9,3,33 53488 DEFB 255 ; End Marker ; Crawling Left, Alarmed (Frame 2 / 2) 53489 DEFB 244,7 ; Set current graphic set to 7 53491 DEFB 7,7,33,11,3,33 53497 DEFB 9,3,33 53500 DEFB 255 ; End Marker ; Crawling Right (Frame 2 / 2) 53501 DEFB 244,7 ; Set current graphic set to 7 53503 DEFB 9,131,33,11,131,33 53509 DEFB 5,135,33 53512 DEFB 255 ; End Marker ; Worm Crawling Right, Alarmed (Frame 2 / 2) 53513 DEFB 244,7 ; Set current graphic set to 7 53515 DEFB 9,131,33,11,131,33 53521 DEFB 7,135,33 53524 DEFB 255 ; End Marker ; Crawling Right (Frame 1 / 2) 53525 DEFB 244,7 ; Set current graphic set to 7 53527 DEFB 250,0,255 ; Change cursor's x- and y-coordinates by -1 and 0 characters respectively 53530 DEFB 9,131,33,10,131,33 53536 DEFB 10,131,33,5,135,33 53542 DEFB 255 ; End Marker ; Crawling Right, Alarmed (Frame 1 / 2) 53543 DEFB 244,7 ; Set current graphic set to 7 53545 DEFB 250,0,255 ; Change cursor's x- and y-coordinates by -1 and 0 characters respectively 53548 DEFB 9,131,33,10,131,33 53554 DEFB 10,131,33,7,135,33 53560 DEFB 255 ; End Marker ; Eyes, looking ahead, animated 53561 DEFB 247,3 ; Jump to one of the 3 addresses in the following list, chosen at random: 53563 DEFB 65,209 ; #R53569 (eyes, looking ahead, open) 53565 DEFB 65,209 ; #R53569 (eyes, looking ahead, open) 53567 DEFB 69,209 ; #R53573 (eyes, looking ahead, closed) ; Eyes, looking ahead, open 53569 DEFB 1,7,33 53572 DEFB 255 ; End Marker ; Eyes, looking ahead, closed 53573 DEFB 2,3,33 53576 DEFB 255 ; End Marker ; Cycle Attributes (Long, Full-Screen) and Clear Display Buffers ; ; Used by the routine at #R53723. c53577 LD B,21 ; Set repeat counter to 21 53579 JR 53583 ; Flash screen when Berk is "killed" ; Cycle Attributes (Short, Full-Screen) and Clear Display Buffers ; ; Used by the routine at #R36616. c53581 LD B,7 ; Set repeat counter to 7 ; This entry point is used by the routine at #R53577. *53583 PUSH BC ; Store BC (B = remaining number of iterations required) 53584 LD HL,22528 ; Point HL at start of Attribute File 53587 LD BC,704 ; Set BC to 704 (i.e. gap between start of Attribute File and start of second-last row (timer ; figures)) *53590 LD A,(HL) ; Load current attribute at memory location HL into A 53591 AND 7 ; Strip out other components to leave only INK component 53593 JR Z,53602 ; If value is zero (black INK) then skip ahead to #R53602 53595 INC A ; Increase INK value to next colour 53596 AND 7 ; Strip out other components to leave only INK component 53598 JR NZ,53602 ; If value is not zero (black INK) then skip ahead to #R53602 53600 LD A,1 ; INK value was zero, so set now to blue INK *53602 LD E,A ; Load new INK value into E 53603 LD A,(HL) ; Load current attribute at memory location HL into A 53604 AND 56 ; Strip out other components to leave only PAPER component 53606 JR Z,53616 ; If black PAPER, then skip ahead to #R53616 53608 ADD A,8 ; Increase to next PAPER colour 53610 AND 56 ; Strip out other components to leave only PAPER component 53612 JR NZ,53616 ; If PAPER component is not black then skip ahead to #R53616 53614 LD A,8 ; PAPER value was zero, so set now to blue PAPER *53616 OR E ; Add INK component back in 53617 OR 64 ; Set BRIGHT flag 53619 LD (HL),A ; Paint new attribute back to current position in Attribute File 53620 AND 16 ; Set / reset speaker bit 53622 OR 2 ; Set RED bit to maintain red border 53624 OUT (254),A ; Set border and set / reset speaker state 53626 INC HL ; Advance to next byte of Attribute File 53627 DEC BC ; Decrease remaining number of character blocks to process 53628 LD A,B ; If number of remaining character blocks is not zero... 53629 OR C ; ... 53630 JR NZ,53590 ; ...then loop back to #R53590 53632 POP BC ; Restore BC (B = remaining number of iterations required) 53633 DJNZ 53583 ; Loop back for next iteration ; This entry point is used by the routine at #R53887. *53635 LD HL,61312 ; Clear Display Buffers 1 and 2... 53638 LD BC,4224 ; ... 53641 LD (HL),0 ; ... 53643 LD D,H ; ... 53644 LD E,L ; ... 53645 INC DE ; ... 53646 LDIR ; ... 53648 RET ; Return ; Fill Top 22 Rows of Attribute File with Attribute Value in A ; ; Used by the routines at #R46830 and #R53723. Input: A Attribute c53649 LD HL,22528 ; Point HL at start of Attribute File 53652 LD E,L ; Point DE one byte after this... 53653 LD D,H ; ... 53654 INC DE ; ... 53655 LD BC,703 ; Set counter to 703, as we are filling 704 characters (32*22) 53658 LD (HL),A ; Set first byte to A... 53659 LDIR ; ...and repeat for remaining 703 bytes 53661 LD B,3 ; Pause for three iterations... 53663 CALL 34675 ; ... 53666 RET ; Return ; Set "Berk Has Been Killed" Flag ; ; Used by the routines at #R36116, #R36390, #R37085, #R37639, #R38074, #R38219, #R38540, #R38592, #R39934, #R41498, ; #R41633, #R41961, #R42064, #R42266 and #R42486. c53667 LD A,(34208) ; Set "Berk Has Been Killed" Flag... 53670 SET 2,A ; ... 53672 LD (34208),A ; ... 53675 RET ; Return ; Table of Berk's Reset Complex State Data Addresses ; ; Addresses of complex state data reverted to by Berk after he is "killed" b53676 DEFW 53684 ; Level 1 53678 DEFW 53710 ; Level 2 53680 DEFW 53697 ; Level 3 53682 DEFW 53710 ; Level 4 ; Berk's Reset Complex State Data ; ; Complex state data reverted to by Berk after he is "killed" b53684 DEFB 4,1,103,231,85,113,91,118,31,1,192,192,10 ; Level 1 53697 DEFB 1,1,103,231,85,107,91,112,31,1,192,192,10 ; Level 3 53710 DEFB 1,1,103,231,85,113,91,118,31,1,192,192,10 ; Levels 2 & 4 ; If Berk Has Been Killed then Reset his Position and State, Flash Screen and Decrease Time / Lives ; ; Used by the routine at #R34438. c53723 LD HL,34208 ; Point HL at Game Flags 53726 RES 3,(HL) ; Reset "Reset Spiders to Initial State" Flag 53728 BIT 2,(HL) ; If "Berk Has Been Killed" Flag is not set... 53730 RET Z ; ...then return 53731 RES 2,(HL) ; Reset "Berk Has Been Killed" Flag 53733 SET 3,(HL) ; Set "Reset Spiders to Initial State" Flag 53735 LD IX,(34240) ; Load IX with address of current level's complex state data for Berk 53739 CALL 36296 ; Make Berk drop the entity he is holding and load IY with its complex state data address 53742 LD DE,53674 ; Point DE at location two bytes (1 WORD) before start of Table of Addresses of Berk Reset Data 53745 LD A,(34207) ; Load current level number into A 53748 CALL 53814 ; Load DE with that level's address (from table at #R53676) for complex state data to revert ; Berk to after he is killed 53751 EX DE,HL ; Swap HL (now address of complex state data to revert to) and DE 53752 LD DE,(34240) ; Load DE with address of current level's complex state data for Berk 53756 LD BC,13 ; Overwrite Berk's current complex state data... 53759 LDIR ; ...with reset data from table at #R53684 for current level 53761 LD HL,35363 ; Load HL with address of script data for Berk starting to fall... 53764 LD (35687),HL ; ...and store at #R35687 (as current position in Berk's script data) 53767 CALL 53577 ; Cycle attributes (long, full-screen) and clear display buffers 53770 LD A,127 ; Fill top 22 rows of Attribute File with white PAPER and white INK, BRIGHT... 53772 CALL 53649 ; ... 53775 CALL 53887 ; Paint red areas outside accessible areas of current character's current room 53778 CALL 47485 ; Decrease current time / lives by one if greater than zero and redraw Timer Figures 53781 RET ; Return ; Set Each Value in Primary Display Buffer Within Play Area to Zero ; ; Used by the routine at #R34438. c53782 LD HL,(34279) ; Load HL with start address of Primary Display Buffer 53785 LD BC,704 ; Set BC to 704, as there are 704 entries in a Display Buffer 53788 LD DE,3 ; Load DE with 3 as each entry in the Display Buffer is three bytes wide *53791 LD A,(HL) ; Read first byte in Display Buffer... 53792 INC A ; ...and add one 53793 JP Z,53806 ; If value is now zero (i.e. was previously 255 and therefore outside normal play area), then ; skip ahead to #R53806 53796 XOR A ; Set all values in current entry to zero... 53797 LD (HL),A ; ... 53798 INC HL ; ... 53799 LD (HL),A ; ... 53800 INC HL ; ... 53801 LD (HL),A ; ... 53802 INC HL ; ... 53803 JP 53807 ; Skip ahead to #R53807 *53806 ADD HL,DE ; Advance current position in Display Buffer to next entry *53807 DEC BC ; Decrease remaining number of entries to process 53808 LD A,B ; If remaining number of entries is not zero... 53809 OR C ; ... 53810 JP NZ,53791 ; ...then loop back to #R53791 53813 RET ; Return ; Advance DE by 2xA Bytes and Load WORD at this Location into DE ; ; Used by the routines at #R49010, #R51779 and #R53723. Input: A Index DE Base address Output: DE WORD value at ; DE (input) + 2 x A (input) c53814 PUSH HL ; Store HL 53815 ADD A,A ; Load HL with double index... 53816 LD L,A ; ... 53817 LD H,0 ; ... 53819 ADD HL,DE ; Add HL to DE as offset, in HL 53820 LD E,(HL) ; Load address at HL into DE... 53821 INC HL ; ... 53822 LD D,(HL) ; ... 53823 POP HL ; Restore HL 53824 RET ; Return ; Copy Room Dimension Data Entry for Current Character / Entity's Current Room to Temporary Store Location (34230) ; ; Used by the routines at #R34916 and #R53887. Input: IX (Entry at #R53848 only) Address of complex state data for ; an entity c53825 LD A,(34208) ; If Drutt Mode Flag is reset (Berk Mode)... 53828 BIT 0,A ; ... 53830 JR Z,53838 ; ...then skip ahead to #R53838 53832 LD IX,(34242) ; Load IX with address of current level's complex state data for Drutt 53836 JR 53842 ; Skip ahead to #R53842 *53838 LD IX,(34240) ; Load IX with address of current level's complex state data for Berk *53842 LD A,(IX+0) ; Store current character's current room at 34218... 53845 LD (34218),A ; ... ; This entry point is used by the routines at #R35689, #R37062, #R39278, #R51739, #R52837, #R53083, #R54480 and ; #R55525. *53848 LD A,(IX+0) ; Load entity's current room into A 53851 DEC A ; Subtract 1... 53852 LD E,A ; ...and multiply by 5... 53853 ADD A,A ; ... 53854 ADD A,A ; ... 53855 ADD A,E ; ... 53856 LD C,A ; Load into BC... 53857 LD B,0 ; ... 53859 LD HL,(34248) ; Load start address of current level's room dimension data into HL... 53862 ADD HL,BC ; ...and add BC as offset 53863 LD (34262),HL ; Store HL at #R34262 53866 LD C,5 ; Set BC to 5 (as entries are 5 bytes wide) 53868 LD DE,34230 ; Copy data entry in room dimension data for entity's current room to #R34230... 53871 LDIR ; ... 53873 LD A,(34231) ; Load position (chars) of left side of current room into E... 53876 LD E,A ; ... 53877 LD A,(34232) ; Subtract position (chars) of right side of current room in A... 53880 SUB E ; ... 53881 ADD A,100 ; ...and add 100 53883 LD (34235),A ; Store value (width of current room + 99) at #R34235 53886 RET ; Return ; Paint Red Areas Outside Accessible Areas of Current Character's Current Room ; ; Used by the routines at #R34438, #R34916, #R36616, #R48791, #R53723 and #R54456. c53887 CALL 53825 ; Copy room dimension data entry for current character's current room to temporary store ; location (#R34230) 53890 PUSH IX ; Store IX 53892 CALL 53635 ; Clear Display Buffers 1 & 2 53895 EXX ; Switch registers 53896 LD HL,61312 ; Point HL at Display Buffer 1 53899 LD DE,63424 ; Point DE at Display Buffer 2 53902 EXX ; Switch registers 53903 LD HL,(34231) ; For current character's current room, set H = room's right edge position and L = room's left ; edge position (chars) 53906 LD DE,(34233) ; For current character's current room, set D = room's bottom edge position and E = room's top ; edge position (chars) 53910 LD IX,22528 ; Point IX at first byte of Attribute File 53914 LD B,0 ; Set initial y-coordinate (characters) to zero *53916 LD A,B ; Load A with current y-coordinate 53917 CP E ; If y-coordinate of top of room is greater than current y-coordinate... 53918 JR C,53950 ; ...then skip ahead to #R53950 53920 LD A,D ; Load A with y-coordinate of bottom of room 53921 CP B ; If y-coordinate of bottom of room is less than current y-coordinate... 53922 JR C,53950 ; ...then skip ahead to #R53950 53924 LD C,0 ; Set initial x-coordinate to zero *53926 LD A,C ; Load A with current x-coordinate 53927 CP L ; If x-coordinate of left of room is greater than current x-coordinate... 53928 JR C,53940 ; ...then skip ahead to #R53940 53930 LD A,H ; Load A with x-coordinate of right of room 53931 CP C ; If x-coordinate of right of room is less than current x-coordinate... 53932 JR C,53940 ; ...then skip ahead to #R53940 53934 EXX ; Switch registers 53935 CALL 53977 ; Advance pointers in Display Buffers and Attribute File address to next character 53938 JR 53943 ; Skip ahead to #R53943 ; Current x-coordinate, C, is outside range of x-coordinates spanned by room *53940 CALL 53968 ; Print red cell to current Attribute File position (outside play area) and mark as unused in ; Display Buffers *53943 INC C ; Advance C by one (move right one character) 53944 BIT 5,C ; If bit 5 is not set (x-coordinate has not reached 32)... 53946 JR Z,53926 ; ...then loop back to #R53926 53948 JR 53959 ; Skip ahead to #R53959 ; Current y-coordinate, B, is outside range of y-coordinates spanned by room *53950 PUSH BC ; Store BC (B = current y-coordinate, C = current x-coordinate) 53951 LD B,32 ; Load counter with 32 (as there are 32 characters per row) *53953 CALL 53968 ; Print red cell to current Attribute File position (outside play area) and mark as unused in ; Display Buffers 53956 DJNZ 53953 ; Loop back to #R53953 for next character block 53958 POP BC ; Restore BC (B = current y-coordinate, C = current x-coordinate) *53959 INC B ; Increase current y-coordinate by one 53960 LD A,B ; If y-coordinate has not reached 22... 53961 CP 22 ; ... 53963 JR NZ,53916 ; ...then loop back to #R53916 53965 POP IX ; Restore IX 53967 RET ; Return ; Print Red Cell to Current Attribute File Position (Outside Play Area) and Mark as Unused in Display Buffers ; ; Used by the routine at #R53887. Input: IX Address of start of Attribute File (22528) HL' Current position in ; display buffer 1 (at #R61312) DE' Current position in display buffer 2 (at #R63424) c53968 LD (IX+0),18 ; Set attribute to red INK, red PAPER 53972 EXX ; Switch registers 53973 LD A,255 ; Load 255 into current positions in Display Buffers 1 and 2... 53975 LD (HL),A ; ... 53976 LD (DE),A ; ... ; This entry point is used by the routine at #R53887. *53977 INC HL ; Advance display buffer 1 pointer by three bytes to next entry... 53978 INC HL ; ... 53979 INC HL ; ... 53980 INC DE ; Advance display buffer 2 pointer by three bytes to next entry... 53981 INC DE ; ... 53982 INC DE ; ... 53983 EXX ; Switch registers 53984 INC IX ; Advance IX to next byte in Attribute File 53986 RET ; Return ; Reset Complex State Data for First Entity of Class A to that Stored in Initial-State Table at 59821 ; ; Used by the routines at #R37639 and #R48417. Input: A Entity class value IX (Entry at #R53994 only) Address of ; complex state data for an entity c53987 CALL 54019 ; Load IX with address of complex state data for first entry in current level that has class ; A... 53990 PUSH IY ; ... 53992 POP IX ; ... ; This entry point is used by the routine at #R42064. *53994 LD IY,59821 ; Point IY at start of Table of Initial-State Data for Complex Entities 53998 CALL 54023 ; Advance IY to first entry in copied complex state data that has class A 54001 PUSH IX ; Store IX (address of entry in complex state data to overwrite) 54003 LD B,E ; Load B with 13 (DE set to 13 in routine at #R54019) *54004 LD A,(IY+0) ; Overwrite IX data entry with IY data... 54007 LD (IX+0),A ; ... 54010 INC IX ; ... 54012 INC IY ; ... 54014 DJNZ 54004 ; ... 54016 POP IX ; Restore IX (address of entry in complex state data just overwritten) 54018 RET ; Return ; Point IY at First Entry in Current Level's Complex State Data that has Class A ; ; Used by the routines at #R36753 and #R53987. Input: A Value of an entity class Output: IY Address of complex ; state data for first entity of class A c54019 LD IY,(34238) ; Load start address of current level's complex state data into IY ; This entry point is used by the routine at #R53987. *54023 LD DE,13 ; Load DE with 13 (as entries in complex state data are 13 bytes wide) *54026 CP (IY+8) ; If current IY entity has class A... 54029 RET Z ; ...then return 54030 ADD IY,DE ; Advance to entry for next entity 54032 JR 54026 ; Loop back to #R54026 ; Draw Contents of Primary Display Buffer to Display ; ; If either the graphic index, or the graphic set index for the current entry in the Primary Display Buffer is zero, ; then only the attribute from that entry is rendered; the currently displayed bitmap data (from the previous frame) ; is preserved. c54034 LD IX,22528 ; Point IX at first byte of Attribute File 54038 LD HL,61312 ; Point HL at Display Buffer 1 54041 LD DE,63424 ; Point DE at Display Buffer 2 54044 LD A,(34271) ; If "Display Buffer 2 is Primary" Flag is reset... 54047 OR A ; ...i.e. Display Buffer 1 is Primary... 54048 JP Z,54052 ; ...then skip ahead to #R54052 54051 EX DE,HL ; Switch DE and HL (Display Buffer 1 is Secondary, Display Buffer 2 is Primary) *54052 PUSH DE ; Copy address of Secondary Display Buffer into IY... 54053 POP IY ; ... *54055 LD A,(HL) ; Read Graphic Set Index from Primary Display Buffer into A 54056 INC HL ; Advance HL to next byte (Graphic Index) in Primary Display Buffer 54057 OR A ; If Graphic Set Index is zero... 54058 JP Z,54130 ; ...then skip ahead to #R54130 54061 CP 255 ; If Graphic Set Index is 255 (character block outside room's dimensions)... 54063 JP Z,54140 ; ...then skip ahead to #R54140 54066 LD B,A ; Transfer Graphic Set Index into B 54067 LD E,0 ; Set E to zero 54069 CP (IY+0) ; If Graphic Set Index in Primary Display Buffer entry is different to Graphic Set Index in ; Secondary Display Buffer entry... 54072 JP NZ,54076 ; ...then skip ahead to #R54076 54075 INC E ; Increase E *54076 LD A,(HL) ; Load Graphic Index from Primary Display Buffer 54077 OR A ; If Graphic Index is zero... 54078 JP Z,54130 ; ...then skip ahead to #R54130 54081 LD C,A ; Transfer Graphic Index into C 54082 CP (IY+1) ; If Graphic Index in Primary Display Buffer is different to Graphic Index in Secondary Display ; Buffer... 54085 JP NZ,54089 ; ...then skip ahead to #R54089 54088 INC E ; Increase E *54089 INC HL ; Advance HL to third byte (attribute) in Primary Display Buffer entry 54090 LD A,(HL) ; Read attribute from Primary Display Buffer 54091 CP (IY+2) ; If attribute in Display Buffer entry A is different to attribute in Secondary Display Buffer ; entry... 54094 JP NZ,54102 ; ...then skip ahead to #R54102 54097 BIT 1,E ; If E is 2 (i.e. both Graphic Set Index and Graphic Index are the same)... 54099 JP NZ,54107 ; ...then skip ahead to #R54107, over drawing instructions (no need to redraw what is already ; there) *54102 PUSH HL ; Store HL (pointer to current position in Primary Display Buffer) 54103 CALL 54144 ; Draw a graphic character block to display 54106 POP HL ; Restore HL (pointer to current position in Primary Display Buffer) *54107 INC HL ; Advance HL to next byte in Primary Display Buffer (start of next entry) 54108 INC IX ; Advance IX to next byte in Attribute File 54110 PUSH IX ; Copy current Attribute File address from IX to DE... 54112 POP DE ; ... 54113 LD A,E ; If current Attribute File address is not at the start of the seventh row of a third of the ; display (i.e. row 7, 15 or 23)... 54114 CP 192 ; ... 54116 JR NZ,54122 ; ...then skip ahead to #R54122 54118 LD A,D ; If current Attribute File address is 23232 (256*90 + 192, i.e. at start of second last ; display character row)... 54119 CP 90 ; ... 54121 RET Z ; ...then return, as only timer figures appear in last two rows *54122 LD DE,3 ; Advance current position in Secondary Display Buffer by 3 bytes... 54125 ADD IY,DE ; ... 54127 JP 54055 ; Loop back to #R54055 *54130 INC HL ; Advance HL to third byte (attribute) in Primary Display Buffer entry 54131 LD A,(HL) ; Load attribute into A 54132 SET 6,A ; Set BRIGHT flag 54134 LD (IX+0),A ; Place attribute at current position in Attribute File 54137 JP 54107 ; Loop back to #R54107 *54140 INC HL ; Advance HL to third byte (attribute) in Primary Display Buffer entry 54141 JP 54107 ; Loop back to #R54107 ; Draw a Graphic Character Block to Display ; ; This routine uses the same technique as seen in the routine at #R47709 to convert from an Attribute File address ; to a Display File address. See the notes in #R47709 for more details. Input: A Attribute value (bit 7 is ; "mirror" flag, rather than FLASH) B Graphic set index C Graphic index IX Address in Attribute File c54144 SET 6,A ; Set Bright Flag 54146 LD (IX+0),A ; Load attribute value into current Attribute File address 54149 XOR A ; Load graphic set index into HL.. 54150 LD L,B ; ... 54151 LD H,A ; ... 54152 ADD HL,HL ; Double (as start address entries in table at #R27000 are two bytes wide)... 54153 LD DE,27000 ; ...and add as offset to #R27000 (in HL)... 54156 ADD HL,DE ; ... 54157 LD E,(HL) ; Load start address for this graphic set into DE... 54158 INC HL ; ... 54159 LD D,(HL) ; ... 54160 LD L,C ; Load graphic index into HL... 54161 LD H,A ; ... 54162 ADD HL,HL ; Multiply by eight, as graphic blocks are eight bytes long... 54163 ADD HL,HL ; ... 54164 ADD HL,HL ; ... 54165 ADD HL,DE ; Add to address of start of this graphic set as an offset in HL 54166 EX DE,HL ; Swap DE (now points to required graphic data) and HL (now address of start of graphic set ; from table at #R27000) 54167 PUSH IX ; Switch Attribute File address into HL... 54169 POP HL ; ... 54170 LD A,H ; Multiply the most significant byte (MSB) of the Attribute File address by eight... 54171 ADD A,A ; ...to put it on the same scale as the MSB of the Display File address MSB (see notes)... 54172 ADD A,A ; ... 54173 ADD A,A ; ... 54174 AND 91 ; Drop the most significant bit to point to the correct location in Display File 54176 LD H,A ; Load back into HL (L is unaffected, as it should be) 54177 EX DE,HL ; Switch DE (now Display File address) and HL (now pointer to graphic data) 54178 BIT 7,(IX+0) ; If mirror flag is set for Attribute File at current location... 54182 JP NZ,54194 ; ...then skip to #R54194 to draw mirrored version 54185 LD B,8 ; Set counter to 8 rows *54187 LD A,(HL) ; Read byte from graphic data... 54188 LD (DE),A ; ...and load into Display File 54189 INC D ; Move down one pixel row in Display File 54190 INC HL ; Advance to next byte of graphic data 54191 DJNZ 54187 ; Loop back for next row of pixels 54193 RET ; Return ; Draw Mirrored Graphic Character Block to Display File ; ; Used by the routine at #R54144. Input: HL Address of bitmap data to draw IX Address in Attribute File c54194 RES 7,(IX+0) ; Reset Bit 7 (Mirror Flag, shared with FLASH flag so would cause graphic to flash) 54198 LD B,8 ; Set counter to 8 rows *54200 PUSH BC ; Store BC (B = current counter value) 54201 LD A,(HL) ; Read byte from graphic data... 54202 PUSH HL ; Store HL (pointer to graphic data) 54203 LD HL,27030 ; Point HL at mirror graphic lookup table 54206 LD C,A ; Load graphic "value" into BC... 54207 LD B,0 ; ... 54209 ADD HL,BC ; ...and add to HL as offset 54210 LD A,(HL) ; Read byte at this location (mirror image of graphic data read by instruction at 54201) 54211 POP HL ; Restore HL (pointer to graphic data) 54212 LD (DE),A ; Load (mirrored) graphic data into Display File 54213 INC D ; Move down one pixel row in Display File 54214 INC HL ; Advance to next byte of graphic data 54215 POP BC ; Restore BC (B = current counter value) 54216 DJNZ 54200 ; Loop back for next row of pixels 54218 RET ; Return ; Data for Pseudo-Random Number Generator b54219 DEFW 0 ; Seed 54221 DEFB 0 ; Temporary store for range value ; Load A with a Pseudo-Random Number Between 0 and the Higher of 2 and A (Input) ; ; This routine uses a linear congruential generator to generate a new pseudo-random number based upon a seed value. ; The seed value is stored at #R54219, is initially set to the value in the least significant byte of the system ; variable FRAMES, and subsequently set to the previously generated pseudo-random number. On entering this routine, ; the A register holds the range for the random number (e.g. 5 means this routine will generate a random number in ; the range 0-4 inclusive). A range of less than 2 is not allowed, so if A is less than this then it will be set to ; 2. Input: A Range Output: A Generated random number c54222 CP 2 ; If range is less than 2... 54224 JP NC,54229 ; ...then set range to 2... 54227 LD A,2 ; ... *54229 LD (54221),A ; Store range at #R54211 54232 PUSH HL ; Store HL 54233 PUSH DE ; Store DE 54234 PUSH BC ; Store BC 54235 LD DE,(54219) ; Load DE with seed 54239 LD H,E ; Load least significant byte of random seed into H 54240 LD L,253 ; Set L to 253 54242 LD A,D ; Load most significant byte (MSB) of random seed into A ; At this point, the three registers A, H and L encode a 24-bit number whose value is (256 * seed + 253) 54243 OR A ; Reset carry flag 54244 SBC HL,DE ; Subtract seed from HL... 54246 SBC A,0 ; ...and decrement A if Carry Flag is set 54248 SBC HL,DE ; Subtract seed from HL... 54250 SBC A,0 ; ...and decrement A if Carry Flag is set ; At this point, the three registers A, H and L encode a 24-bit number whose value is (254 * seed + 253) 54252 LD E,A ; Calculate (AHL mod 65,537)... 54253 LD D,0 ; ...loading result into HL... 54255 SBC HL,DE ; ... 54257 JP NC,54261 ; ...and if this is negative... 54260 INC HL ; ...then add one (as zero in HL can represent both zero and 65,536) *54261 LD (54219),HL ; Store HL (new seed) at #R54219 ; At this point, HL contains a new pseudo-random 16-bit number 54264 PUSH HL ; Copy 16-bit pseudo-random number from HL into DE... 54265 POP DE ; ... 54266 LD A,(54221) ; Load A with range as stored previously 54269 DEC A ; Decrease range by 1 to get maximum value as we want the output to range from 0 to (A-1)... 54270 LD B,A ; ...and load into B (loop counter) ; In the following loop we are obtaining the number of times that 65,536 goes into RANGE x DE. In other words, ; (RANGE x DE) is divided by 65,536 and the integer part of the result is loaded into A. A is therefore limited to ; values between zero, and the value A had on entering this routine minus one, inclusive. 54271 XOR A ; Set A to zero *54272 ADD HL,DE ; Add DE to HL 54273 JP NC,54277 ; If DE has not crossed the 65,535 - 0 boundary then skip ahead to #R54277 54276 INC A ; Increase A (count of number of times DE rolls over from 65,535 to 0) *54277 DJNZ 54272 ; Decrease B and loop back to #R54272 54279 POP BC ; Restore BC 54280 POP DE ; Restore DE 54281 POP HL ; Restore HL 54282 RET ; Return ; Move Entity at IX into New Room (Left or Right) if it is at the Edge of its Current Room ; ; Used by the routines at #R35735 and #R55041. Input: IX Address of complex state data for an entity c54283 LD A,(34235) ; Load A with width of current room (chars) + 97... 54286 DEC A ; ... 54287 DEC A ; ... 54288 CP (IX+5) ; If x-coordinate of left side (+100) of entity is greater than this... 54291 JR C,54306 ; ...then skip ahead to #R54306 54293 LD A,(IX+7) ; If x-coordinate of right side (+100) of entity is not less than 102... 54296 CP 102 ; ... 54298 RET NC ; ...then return 54299 CALL 54539 ; Load B with index of room to left of entity's current room 54302 CALL 54419 ; Move entity at IX into room to left of its current room and update position of carried entity ; if moving entity is Berk 54305 RET ; Return *54306 CALL 54505 ; Load B with index of room to right of current character's current room 54309 CALL 54383 ; Move entity at IX into room to right of its current room and update position of carried ; entity if moving entity is Berk 54312 RET ; Return ; Move Entity at IX into Room to the Right, If Appropriate ; ; This routine moves an entity (e.g. Berk or Drutt) into the next room to the right, if there is one, in a way that ; is consistent with the point of view of the currently selected character. For example, if Berk is the selected ; character and he moves into a new room, he does so as soon as his leading side (left or right) crosses the edge of ; the screen. He essentially disappears immediately from his old room. However from Drutt's point of view, Berk ; should move across the boundary smoothly and not just vanish as soon as his leading side crosses the boundary. ; This routine (along with its counterpart at #R54348) ensures that this happens correctly. Input: IX Address of ; complex state data for an entity Output: A Zero if no room exists to the right, otherwise, x-coordinate of ; character's appropriate edge F (Carry Flag) Set if entity is not at edge of current room, or has moved into new ; room and has not collided. Reset otherwise (i.e. can't enter new room). c54313 LD A,(34235) ; Load C with width of entity's current room (chars) + 99... 54316 LD C,A ; ... 54317 LD A,(34208) ; If Drutt Mode Flag is reset (Berk Mode)... 54320 BIT 0,A ; ... 54322 JR Z,54329 ; ...then skip ahead to #R54329 54324 LD A,(IX+5) ; Load A with x-coordinate of Drutt's left edge 54327 JR 54332 ; Skip ahead to #R54332 *54329 LD A,(IX+7) ; Load A with x-coordinate of Berk's right edge *54332 CP C ; If x-coordinate of room's right edge is greater than x-coordinate in A... 54333 RET C ; ...then return 54334 CALL 54505 ; Load B with index of room to right of current character's current room 54337 JR Z,54381 ; If there is no room to the right, then jump to #R54381 54339 CALL 54383 ; Move entity at IX into room to right of its current room and update position of carried ; entity if moving entity is Berk 54342 CALL 54569 ; Check entity at IX for collision with another impassable / pushable entity immediately to the ; right... 54345 JR NC,54381 ; ...and if a collision occurred, then jump to #R54381 54347 RET ; Return ; Move Entity at IX into Room to the Left, If Appropriate ; ; This routine moves an entity (e.g. Berk or Drutt) into the next room to the right, if there is one, in a way that ; is consistent with the point of view of the currently selected character. For example, if Berk is the selected ; character and he moves into a new room, he does so as soon as his leading edge (left or right) crosses the edge of ; the screen. He essentially disappears immediately from his old room. However from Drutt's point of view, Berk ; should move across the boundary smoothly and not just vanish as soon as his leading edge crosses the boundary. ; This routine (along with its counterpart at #R54313) ensures that this happens correctly. Input: IX Address of ; complex state data for an entity Output: A Zero if no room exists to the left, otherwise, x-coordinate of ; character's appropriate edge F (Carry Flag) Set if entity is not at edge of current room, or has moved into new ; room and has not collided. Reset otherwise (i.e. can't enter new room). c54348 LD A,(34208) ; If Drutt Mode Flag is reset (Berk Mode)... 54351 BIT 0,A ; ... 54353 JR Z,54363 ; ...then skip ahead to #R54363 54355 LD A,100 ; If x-coordinate of Drutt's right edge is greater than 100 (x-coordinate of left-edge of ; room)... 54357 CP (IX+7) ; ... 54360 RET C ; ...then return 54361 JR 54369 ; Skip ahead to #R54369 *54363 LD A,100 ; If x-coordinate of Berk's left edge is greater than 100 (x-coordinate of left-edge of ; room)... 54365 CP (IX+5) ; ... 54368 RET C ; ...then return *54369 CALL 54539 ; Load B with index of room to left of entity's current room 54372 JR Z,54381 ; If there is no room to the left, then jump to #R54381 54374 CALL 54419 ; Move entity at IX into room to left of its current room and update position of carried entity ; if moving entity is Berk 54377 CALL 54666 ; Set Carry Flag if entity at IX has not collided with another impassable / pushable entity ; immediately to the left, reset otherwise 54380 RET ; Return ; This entry point is used by the routine at #R54313. *54381 XOR A ; Set A to zero 54382 RET ; Return ; Move Entity at IX into Room to Right of its Current Room and Update Position of Carried Entity if Moving Entity is ; Berk ; ; Used by the routines at #R48593, #R54283 and #R54313. Input: IX Address of complex state data for an entity c54383 CALL 54398 ; Set character's position to be left-hand side of new room to right 54386 CALL 54456 ; Paint red areas outside current character's room if IX points to current character's complex ; state data 54389 BIT 7,(IX+9) ; If entity is Berk and his Moving Upwards Flag (floating) is set... 54393 RET NZ ; ...then return 54394 CALL 48727 ; If entity is Berk then move carried entity to Berk's right as he faces right 54397 RET ; Return ; Set Entity's Position to be Left-Hand Side of New Room to Right ; ; Used by the routine at #R54383. Input: B Index of destination room IX Address of complex state data for an ; entity c54398 LD A,(34235) ; Load D with i.e. x-coordinate of right edge of room (width of current room (chars) + 99) ; minus x-coordinate of right-edge of current character... 54401 SUB (IX+7) ; ...(i.e. [negative] distance by which entity's right edge is to the right of right edge of ; room)... 54404 LD D,A ; ... 54405 CALL 54480 ; Set room of entity to B, store room size data for new room and load E with entity's width ; minus one 54408 LD A,99 ; Load A with x-coordinate of left edge of current (new) room 54410 SUB D ; Subtract D (negative)... 54411 LD (IX+7),A ; ...and set as new x-coordinate of entity's right edge 54414 SUB E ; Subtract (width - 1) of entity... 54415 LD (IX+5),A ; ...and set this as x-coordinate of entity's left edge 54418 RET ; Return ; Move Entity at IX into Room to Left of its Current Room and Update Position of Carried Entity if Moving Entity is ; Berk ; ; Used by the routines at #R48641, #R54283 and #R54348. c54419 CALL 54434 ; Set entity's position to be right-hand side of new room to left 54422 CALL 54456 ; Paint red areas outside current character's room if IX points to current character's complex ; state data 54425 BIT 7,(IX+9) ; If entity is Berk and his Moving Upwards Flag (floating) is set... 54429 RET NZ ; ...then return 54430 CALL 48738 ; If entity is Berk then move carried entity to Berk's left as he faces left 54433 RET ; Return ; Set Entity's Position to be Right-Hand Side of New Room to Left ; ; Used by the routine at #R54419. Input: B Index of destination room IX Address of complex state data for an ; entity c54434 LD A,100 ; Load D with x-coordinate of left edge of room minus x-coordinate of left edge of current ; entity... 54436 SUB (IX+5) ; ...(i.e. distance by which entity's left edge is to the left of left edge of room)... 54439 LD D,A ; ... 54440 CALL 54480 ; Set room of entity to B, store room size data for new room and load E with entity's width ; minus one 54443 LD A,(34235) ; Load A with width of current (new) room (chars) + 99 54446 SUB D ; Subtract D... 54447 INC A ; ...and add one to get x-coordinate of entity's left edge in new room 54448 LD (IX+5),A ; Set entity's left edge to this position 54451 ADD A,E ; Add (width - 1) of entity... 54452 LD (IX+7),A ; ...and set this as x-coordinate of entity's right edge 54455 RET ; Return ; Paint Red Areas Outside Current Character's Room if IX Points to Current Character's Complex State Data ; ; Used by the routines at #R54383, #R54419, #R55433 and #R55616. Input: IX Address of complex state data for an ; entity c54456 LD A,(34208) ; Set Zero Flag if Drutt Mode Flag is reset... 54459 BIT 0,A ; ... 54461 LD A,(IX+8) ; Load Entity Class Value of entity at IX into A 54464 JR NZ,54471 ; If Zero Flag is reset (i.e. Drutt Mode) then skip ahead to #R54471 54466 CP 31 ; If Entity Class is 31 (i.e. Berk)... 54468 JR Z,54474 ; ...then paint red areas outside accessible areas of current character's current room and ; return 54470 RET ; Return *54471 CP 18 ; If Entity Class is not 18 (i.e. Drutt)... 54473 RET NZ ; ...then return *54474 PUSH HL ; Store HL 54475 CALL 53887 ; Paint red areas outside accessible areas of current character's current room 54478 POP HL ; Restore HL 54479 RET ; Return ; Set Room of Entity at IX to B, Store Room Size Data for New Room and Load E with Entity's Width Minus One ; ; Used by the routines at #R54398, #R54434, #R55433 and #R55616. Input: B Destination room index IX Address of ; complex state data for an entity Output: E Entity's width, minus one (characters) c54480 LD A,B ; Set entity's current room to be destination room... 54481 LD (IX+0),A ; ... 54484 PUSH HL ; Store HL 54485 PUSH DE ; Store DE 54486 CALL 53848 ; Store room size data for entity's current room 54489 POP DE ; Restore DE 54490 POP HL ; Restore HL 54491 LD A,(IX+7) ; Load A with x-coordinate of entity's right... 54494 SUB (IX+5) ; ...subtract x-coordinate of entity's left... 54497 LD E,A ; ...and load result (entity's width minus one) into E 54498 RET ; Return ; Unused routine ; ; This routine is not used. It is assumed, since this routine flows into the routine at #R54505, that this unused ; routine was also intended to deal with room connectivity. As there are routines to deal with vertical and ; horizontal (left-right) connectivity, it is possible that this routine was originally intended to handle ; horizontal (forward-back) connectivity. c54499 LD IY,(34252) ; Load IY with address of Unused Data Block (09) 54503 JR 54512 ; Load B with index of room, as related to room of index D via data in Unused Data Block (09) ; Load B with Index of Room to Right of an Entity's Current Room ; ; Used by the routines at #R48593, #R52193, #R54283 and #R54313. Input: IX Address of complex state data for an ; entity IY (entry at #R54512 only) An entry in a room connectivity table D (entry at #R54508 and #R54512 only) ; Index of base room for check Output: B Index of room found if there is one, undefined otherwise F Zero Flag set ; if there is no room to the right, reset otherwise c54505 LD D,(IX+0) ; Load current room of entity pointed to by IX into D ; This entry point is used by the routine at #R53194. *54508 LD IY,(34250) ; Load start address of current level's Horizontal Room Connectivity Data into IY ; This entry point is used by the routine at #R54499. *54512 LD A,(IY+0) ; Load first byte (left room index) of current entry into A 54515 CP 255 ; If byte is 255 (i.e. the End Marker)... 54517 RET Z ; ...then return 54518 CP D ; If byte is not the same as the room index in D... 54519 JR NZ,54527 ; ...then skip ahead to #R54527 54521 LD B,(IY+1) ; Load second byte (right room index) of current entry into B 54524 CP 255 ; Reset zero flag (as current room cannot be 255) 54526 RET ; Return *54527 INC IY ; Advance by two bytes to the next entry... 54529 INC IY ; ... 54531 JR 54512 ; Loop back to #R54512 ; Unused routine ; ; This routine is not used. It is assumed, since this routine flows into the routine at #R54539, that this unused ; routine was also intended to deal with room connectivity. As there are routines to deal with vertical and ; horizontal (left-right) connectivity, it is possible that this routine was originally intended to handle ; horizontal (forward-back) connectivity. c54533 LD IY,(34252) ; Load IY with address of Unused Data Block (09) 54537 JR 54546 ; Load B with index of room, as related to room of index D via data in Unused Data Block (09) ; Load B with Index of Room to Left of an Entity's Current Room ; ; Used by the routines at #R48641, #R52098, #R54283 and #R54348. Input: IX Address of complex state data for an ; entity IY (entry at #R54546 only) An entry in a room connectivity table D (entry at #R54542 and #R54546 only) ; Index of base room for check Output: B Index of room found if there is one, undefined otherwise F Zero Flag set ; if there is no room to the left, reset otherwise c54539 LD D,(IX+0) ; Load current room of entity pointed to by IX into D ; This entry point is used by the routine at #R53194. *54542 LD IY,(34250) ; Load start address of current level's Horizontal Room Connectivity Data into IY ; This entry point is used by the routine at #R54533. *54546 INC IY ; Advance by one byte to second byte (right room index) of first entry *54548 LD A,(IY+0) ; Load second byte (right room index) of current entry into A 54551 CP 255 ; If byte is 255 (i.e. the End Marker)... 54553 RET Z ; ...then return 54554 CP D ; If byte is not the same as the room index in D... 54555 JR NZ,54563 ; ...then skip ahead to #R54563 54557 LD B,(IY-1) ; Load first byte (left room index) of current entry into B 54560 CP 255 ; Reset zero flag (as current room cannot be 255) 54562 RET ; Return *54563 INC IY ; Advance by two bytes to the next entry... 54565 INC IY ; ... 54567 JR 54548 ; Loop back to #R54548 ; Check Entity at IX for Collision With Another (Impassable / Pushable) Entity Immediately to the Right ; ; Used by the routines at #R36116, #R52148, #R52193, #R52889, #R52914, #R54313 and #R55041. Input: IX Address of ; complex state data for an entity Output: F Carry Flag set if no entity found, reset otherwise A Class of entity, ; if found, otherwise 255 IY Address of complex state data for colliding entity c54569 LD DE,13 ; Load DE with 13 (as entries in complex state data are 13 bytes wide) 54572 LD IY,(34238) ; Load start address of current level's complex state data into IY *54576 LD A,(IY+0) ; Load A with room index for current IY entity 54579 CP 255 ; If this is not 255 (i.e. End Marker)... 54581 JR NZ,54585 ; ...then skip ahead to #R54585 54583 SCF ; Set Carry Flag 54584 RET ; Return *54585 LD A,(IX+0) ; If room of entity at IX is not the same as room of entity at IY... 54588 CP (IY+0) ; ... 54591 JR NZ,54662 ; ...then advance IY to next entity 54593 BIT 5,(IY+10) ; If current entity at IY has its Is Being Carried Flag set... 54597 JP NZ,54662 ; ...then advance IY to next entity 54600 LD A,(IY+8) ; If current entity at IY has a class which is the same as the entity at IX... 54603 CP (IX+8) ; ... 54606 JR Z,54662 ; ...then advance IY to next entity 54608 BIT 7,A ; If entity at IY has its "Spans Full Depth" Flag is set... 54610 JR NZ,54620 ; ...then skip over depth check to #R54620 54612 LD A,(IY+1) ; If entity at IY has a depth which is not the same as the depth of the entity at IX... 54615 CP (IX+1) ; ... 54618 JR NZ,54662 ; ...then advance IY to next entity *54620 LD A,(IY+11) ; If entity at IY has its "Impassable / Pushable Rightwards" Flag reset... 54623 AND 32 ; ... 54625 JP Z,54662 ; ...then advance IY to next entity 54628 LD A,(IX+7) ; If the right side of entity at IX... 54631 INC A ; ... 54632 CP (IY+5) ; ...is not immediately to the left of the left side of the entity at IY... 54635 JR NZ,54662 ; ...then advance IY to next entity 54637 LD A,(IX+6) ; If the bottom of the entity at IX... 54640 CP (IY+4) ; ...is above the top of the entity at IY... 54643 JR C,54662 ; ...then advance IY to next entity 54645 LD A,(IY+6) ; If the bottom of the entity at IY... 54648 CP (IX+4) ; ...is above the top of the entity at IX... 54651 JR C,54662 ; ...then advance IY to next entity 54653 XOR A ; Set A to zero to reset Carry Flag 54654 LD (34258),IY ; Store pointer to current entity at #R34258 54658 LD A,(IY+8) ; Load A with class of entity at IY 54661 RET ; Return *54662 ADD IY,DE ; Advance IY pointer to next entity in complex state data block 54664 JR 54576 ; Loop back to #R54576 ; Check Entity at IX for Collision With Another (Impassable / Pushable) Entity Immediately to the Left ; ; Used by the routines at #R36116, #R52053, #R52098, #R52870, #R52914, #R54348 and #R55041. Input: IX Address of ; complex state data for an entity Output: F Carry Flag set if no entity found, reset otherwise A Class of entity, ; if found, otherwise 255 IY Address of complex state data for colliding entity c54666 LD DE,13 ; Load DE with 13 (as entries in complex state data are 13 bytes wide) 54669 LD IY,(34238) ; Load start address of current level's complex state data into IY *54673 LD A,(IY+0) ; Load A with room index for current IY entity 54676 CP 255 ; If this is not 255 (i.e. End Marker)... 54678 JR NZ,54682 ; ...then skip ahead to #R54682 54680 SCF ; Set Carry Flag 54681 RET ; Return *54682 LD A,(IX+0) ; If room of entity at IX is not the same as room of entity at IY... 54685 CP (IY+0) ; ... 54688 JR NZ,54760 ; ...then advance IY to next entity 54690 BIT 5,(IY+10) ; If current entity at IY has its Is Being Carried Flag set... 54694 JP NZ,54760 ; ...then advance IY to next entity 54697 LD A,(IY+8) ; If current entity at IY has a class which is the same as the entity at IX... 54700 CP (IX+8) ; ... 54703 JP Z,54760 ; ...then advance IY to next entity 54706 BIT 7,A ; If entity at IY has its "Spans Full Depth" Flag is set... 54708 JR NZ,54718 ; ...then skip over depth check to #R54620 54710 LD A,(IY+1) ; If entity at IY has a depth which is not the same as the depth of the entity at IX... 54713 CP (IX+1) ; ... 54716 JR NZ,54760 ; ...then advance IY to next entity *54718 LD A,(IY+11) ; If entity at IY has its "Impassable / Pushable Leftwards" Flag reset... 54721 AND 16 ; ... 54723 JP Z,54760 ; ...then advance IY to next entity 54726 LD A,(IX+5) ; If the left side of entity at IX... 54729 DEC A ; ... 54730 CP (IY+7) ; ...is not immediately to the right of the right side of the entity at IY... 54733 JR NZ,54760 ; ...then advance IY to next entity 54735 LD A,(IX+6) ; If the bottom of the entity at IX... 54738 CP (IY+4) ; ...is above the top of the entity at IY... 54741 JR C,54760 ; ...then advance IY to next entity 54743 LD A,(IY+6) ; If the bottom of the entity at IY... 54746 CP (IX+4) ; ...is above the top of the entity at IX... 54749 JR C,54760 ; ...then advance IY to next entity 54751 XOR A ; Set A to zero to reset Carry Flag 54752 LD (34258),IY ; Store pointer to current entity at #R34258 54756 LD A,(IY+8) ; Load A with class of entity at IY 54759 RET ; Return *54760 ADD IY,DE ; Advance IY pointer to next entity in complex state data block 54762 JR 54673 ; Loop back to #R54673 ; Check Entity at IX for Collision With Another Entity at Next Depth Level Out Of Screen Whose Interaction (11,6) ; Flag is Set ; ; Used by the routines at #R37639 and #R52315. Input: IX Address of complex state data for an entity Output: F ; Carry Flag set if no entity found, reset otherwise A Class of entity, if found, otherwise 255 IY Address of ; complex state data for colliding entity c54764 LD C,1 ; Set depth offset to 1 (i.e. check entities at next depth level out of screen) 54766 JR 54770 ; Jump to collision detection routine ; Check Entity at IX for Collision With Another Entity at Same Depth Whose Interaction (11,6) Flag is Set ; ; Used by the routines at #R36036, #R36542, #R37085, #R38074, #R38219, #R38540, #R38592, #R41498, #R41633, #R41961, ; #R42064, #R42266, #R42486, #R48487, #R51779, #R53083, #R55196 and #R55525. Input: IX Address of complex state ; data for an entity C (Entry at #R54770 only) Depth offset Output: F Carry Flag set if no entity found, reset ; otherwise A Class of entity, if found, otherwise 255 IY Address of complex state data for colliding entity c54768 LD C,0 ; Set depth offset to 0 (i.e. check entities at same depth) ; This entry point is used by the routine at #R54764. *54770 LD IY,(34238) ; Load start address of current level's complex state data into IY 54774 LD DE,13 ; Load DE with 13 (as entries in complex state data are 13 bytes wide) *54777 LD A,(IY+0) ; Load A with room index for current IY entity 54780 CP 255 ; If this is not 255 (i.e. End Marker)... 54782 JR NZ,54786 ; ...then skip ahead to #R54786 54784 SCF ; Set Carry Flag 54785 RET ; Return *54786 LD A,(IX+0) ; If room of entity at IX is not the same as room of entity at IY... 54789 CP (IY+0) ; ... 54792 JR NZ,54874 ; ...then advance IY to next entity 54794 BIT 5,(IY+10) ; If current entity at IY has its Is Being Carried Flag set... 54798 JP NZ,54874 ; ...then advance IY to next entity 54801 LD A,(IY+8) ; If current entity at IY has a class which is the same as the entity at IX... 54804 CP (IX+8) ; ... 54807 JR Z,54874 ; ...then advance IY to next entity 54809 BIT 7,A ; If entity at IY has its "Spans Full Depth" Flag is set... 54811 JR NZ,54822 ; ...then skip over depth check to #R54822 54813 LD A,(IY+1) ; If entity at IY has a depth which is not the same as the depth of the entity at IX... 54816 ADD A,C ; ...plus depth offset... 54817 CP (IX+1) ; ... 54820 JR NZ,54874 ; ...then advance IY to next entity *54822 LD A,(IY+11) ; If entity at IY has its Interaction (11,6) Flag reset... 54825 AND 64 ; ... 54827 JP Z,54874 ; ...then advance IY to next entity 54830 LD A,(IX+6) ; If the bottom of the entity at IX... 54833 CP (IY+4) ; ...is above the top of the entity at IY... 54836 JR C,54874 ; ...then advance IY to next entity 54838 LD A,(IY+6) ; If the bottom of the entity at IY... 54841 CP (IX+4) ; ...is above the top of the entity at IX... 54844 JR C,54874 ; ...then advance IY to next entity 54846 LD A,(IX+7) ; If the right side of entity IX... 54849 CP (IY+5) ; ...is to the left of the left side of the entity at IY... 54852 JR C,54874 ; ...then advance IY to next entity 54854 LD A,(IY+7) ; If the right side of entity IY... 54857 CP (IX+5) ; ...is to the left of the left side of the entity at IX... 54860 JR C,54874 ; ...then advance IY to next entity 54862 XOR A ; Set A to zero to reset Carry Flag 54863 LD (34258),IY ; Store pointer to current entity at #R34258 54867 LD A,(IY+8) ; Load A with class of entity at IY 54870 RET ; Return ; This entry point is used by the routines at #R55196 and #R55525. *54871 LD DE,13 ; Load DE with 13, as entries in complex state data are 13 bytes wide *54874 ADD IY,DE ; Advance IY pointer to next entity in complex state data block 54876 JR 54777 ; Loop back to #R54777 ; Check Entity at IX for Collision With Another Entity (Only those Defined Before, and in Reverse Order) at Same ; Depth Level Whose Interaction (11,7) Flag is Set ; ; Used by the routine at #R52315. Input: IX Address of complex state data for an entity Output: F Carry Flag set ; if no entity found, reset otherwise A Class of entity, if found, otherwise 254 IY Address of complex state data ; for colliding entity c54878 LD C,0 ; Set depth offset to 0 (i.e. check entities at same depth) 54880 PUSH IX ; Load IY with address in IX... 54882 POP IY ; ... 54884 LD DE,65523 ; Load DE with -13 54887 JP 54987 ; Move IY back to previous entity in complex state data and jump into collision check routine ; Check Entity at IX for Collision With Another Entity (in Reverse Order) at Next Depth Level Into Screen Whose ; Interaction (11,7) Flag is Set ; ; The address stored at #R34246 is the address of complex state data for the entity to start with when doing ; collision checks in reverse order. On levels 2, 3 and 4, the value stored here is the address of the complex state ; data of the last entity, which means that on these levels, all entities are checked. On Level 1, however, the ; value stored is the address of the complex state data of the sixth-last entity. The remaining five entities after ; this address on Level 1 are the three spiders, their webs and their arches. This means that on Level 1, these ; spiders, webs and arches are excluded from certain collision checks. Input: IX Address of complex state data for ; an entity C (Entry at #R54899 only) Depth offset Output: F Carry Flag set if no entity found, reset otherwise A ; Class of entity, if found, otherwise 254 IY Address of complex state data for colliding entity c54890 LD C,1 ; Set depth offset to 1 (i.e. check entities at next depth level into screen) 54892 LD DE,65523 ; Load DE with -13 (as entries in complex state data are 13 bytes wide) 54895 LD IY,(34246) ; Load IY with current level's start address for reverse-order collision checks *54899 LD A,(IX+0) ; If room of entity at IX is not the same as room of entity at IY... 54902 CP (IY+0) ; ... 54905 JR NZ,54987 ; ...then move IY back to previous entity 54907 BIT 5,(IY+10) ; If current entity at IY has its Is Being Carried Flag set... 54911 JP NZ,54987 ; ...then move IY back to previous entity 54914 LD A,(IY+8) ; If current entity at IY has a class which is the same as the entity at IX... 54917 CP (IX+8) ; ... 54920 JR Z,54987 ; ...then move IY back to previous entity 54922 BIT 7,A ; If entity at IY has its "Spans Full Depth" Flag is set... 54924 JR NZ,54935 ; ...then skip over depth check to #R54935 54926 LD A,(IY+1) ; If entity at IY has a depth which is not the same as the depth of the entity at IX... 54929 SUB C ; ...minus depth offset... 54930 CP (IX+1) ; ... 54933 JR NZ,54987 ; ...then move IY back to previous entity *54935 LD A,(IY+11) ; If entity at IY has its Interaction (11,7) Flag reset... 54938 AND 128 ; ... 54940 JP Z,54987 ; ...then move IY back to previous entity 54943 LD A,(IX+6) ; If the bottom of the entity at IX... 54946 CP (IY+4) ; ...is above the top of the entity at IY... 54949 JR C,54987 ; ...then move IY back to previous entity 54951 LD A,(IY+6) ; If the bottom of the entity at IY... 54954 CP (IX+4) ; ...is above the top of the entity at IX... 54957 JR C,54987 ; ...then move IY back to previous entity 54959 LD A,(IX+7) ; If the right side of entity IX... 54962 CP (IY+5) ; ...is to the left of the left side of the entity at IY... 54965 JR C,54987 ; ...then move IY back to previous entity 54967 LD A,(IY+7) ; If the right side of entity IY... 54970 CP (IX+5) ; ...is to the left of the left side of the entity at IX... 54973 JR C,54987 ; ...then move IY back to previous entity 54975 XOR A ; Set A to zero to reset Carry Flag 54976 LD (34258),IY ; Store pointer to current entity at #R34258 54980 LD A,(IY+8) ; Load A with class of entity at IY 54983 RET ; Return 54984 LD DE,65523 ; Load DE with -13 ; This entry point is used by the routine at #R54878. *54987 LD A,(IY-1) ; If byte before current IY position is 254 (i.e. end marker for simple state data)... 54990 CP 254 ; ... 54992 JP Z,55000 ; ...then skip ahead to #R55000 54995 ADD IY,DE ; Move IY back 13 bytes (i.e. to start of previous entry) 54997 JP 54899 ; Jump to #R54899 *55000 SCF ; Set Carry Flag 55001 RET ; Return ; Unused routine ; ; This routine seems to be involved with the relative positioning of two different entities, assuming that IX ; contains a complex state data address. c55002 LD IY,(34258) ; Load IY with address of complex state data for entity involved in last collision check 55006 LD A,(IY+7) ; Load A with width of this entity, minus one... 55009 SUB (IY+5) ; ... 55012 SRL A ; Divide result by two, clearing remainder... 55014 DEC A ; ...and subtract one 55015 ADD A,(IY+5) ; Add x-coordinate of entity's left edge 55018 CP (IX+5) ; 55021 RET ; Return ; Cached Control Input ; ; This value is set by the instruction at #R55066. It holds a value read from control input when handling ; characters' jumps. b55022 DEFB 0 ; Handle Drutt's Jump, and Load E with Jump State Index As Appropriate ; ; See description of routine at #R55041 for details. Output: E (via routine at #R55041) Jump state index (see ; #R55041) c55023 LD IX,(34242) ; Load IX with address of current level's complex state data for Drutt 55027 BIT 7,(IX+12) ; If Drutt's Is Jumping Flag is reset... 55031 RET Z ; ...then return ; Drutt's Is Jumping Flag is set 55032 LD A,(34208) ; If Drutt Mode Flag is reset (Berk Mode)... 55035 BIT 0,A ; ... 55037 JR Z,55065 ; ...then handle Drutt's jump, and load E with jump state index as appropriate based upon no ; control input 55039 JR 55060 ; Handle Drutt's jump, and load E with jump state index as appropriate based upon current ; control input ; Handle Berk's Jump, and Load E with Jump State Index As Appropriate ; ; This routine updates the position, direction and velocity of a jumping character (Berk if entry at #R55041 or ; Drutt if entry via routine at #R55023) based upon various conditions (control input, collisions with obstructions ; and the character's current position, direction and velocity). Register E is loaded (either by this routine, or ; the CALLed routine at #R55196) with a value determined by these conditions. The value in E in turn determines how ; the character's jump will progress. A given numeric value may result from more than one set of conditions. ; Possible output values in E are: Input: IX Address of complex state data (current level) for Berk (entry via ; #R55041) or Drutt (entry via #R55060 and #R55065) Output: E Jump state index (see table above) c55041 CALL 54283 ; Move Berk into new room (left or right) if he is at the edge of his current room 55044 LD IX,(34240) ; Load IX with address of current level's complex state data for Berk 55048 BIT 7,(IX+12) ; If Berk's Is Jumping Flag is reset... 55052 RET Z ; ...then return ; Berk's Is Jumping Flag is set 55053 LD A,(34208) ; If Drutt Mode Flag is set... 55056 BIT 0,A ; ... 55058 JR NZ,55065 ; ...then skip ahead to #R55065 ; From this point onwards, IX points to either Berk's complex state data (entry via #R55041) or Drutt's complex ; state data (entry via #R55060 or #R55065). This entry point is used by the routine at #R55023. *55060 LD A,(34219) ; Load A with control input 55063 JR 55066 ; Skip ahead to #R55066 ; This entry point is used by the routine at #R55023. *55065 XOR A ; Load A with zero *55066 LD (55022),A ; Store value in A at #R55022 55069 BIT 0,(IX+11) ; If jumper's Walking Right Flag is reset... 55073 JR Z,55128 ; ...then skip ahead to #R55128 ; Walking Right Flag is set 55075 LD B,2 ; Load B with 2 (as Berk and Drutt jump right by two characters) *55077 PUSH BC ; Store BC (B = remaining number of characters to move) 55078 CALL 54569 ; Check jumper for collision with another impassable / pushable entity immediately to the ; right... 55081 JR C,55108 ; ...and if a collision has not occurred, then skip ahead to #R55108 55083 CP 22 ; If collision was with an entity of class less than 22 (can be picked up)... 55085 JR C,55108 ; ...then skip ahead to #R55108 55087 CP 129 ; If collision was with entity of class 129 (causes other entities to start falling)... 55089 JR Z,55108 ; ...then skip ahead to #R55108 55091 CP 50 ; If collision was with entity of class 50 (causes Drutt to swap depth levels)... 55093 JR Z,55108 ; ...then skip ahead to #R55108 55095 CP 159 ; If collision was not with entity of class 159 (Berk floating)... 55097 JR NZ,55124 ; ...then skip ahead to #R55124 ; Collision with Berk, floating 55099 LD (IY+11),241 ; Set Berk's Walking Right, Impassable Leftwards, Impassable Rightwards, Interaction (11,6) ; and Interaction (11,7) flags and reset his Walking Left, Unused (11,2) and Unused (11,3) ; flags 55103 CALL 55187 ; Set Character Swap Pending Flag 55106 JR 55124 ; Skip ahead to #R55124 ; No collision, or collision with entity of class 50, 129 or less than 22 *55108 CALL 54313 ; Move jumper into room to the right, if appropriate... 55111 JR NC,55124 ; ...and if jumper can't enter new room then skip ahead to #R55124 55113 INC (IX+5) ; Move jumper right by one character... 55116 INC (IX+7) ; ... 55119 POP BC ; Restore BC (B = remaining number of characters to move) 55120 DJNZ 55077 ; Decrease remaining number of characters to move, and if not zero, loop back to #R55077 55122 JR 55196 ; Handle vertical component of jumper's jump, load E with Jump State Index and return ; Collision with other class of entity *55124 POP BC ; Restore BC (B = remaining number of characters to move) 55125 LD E,4 ; Load E with 4 (jumper has bounced off an obstruction to the right while jumping right) 55127 RET ; Return ; Walking Right Flag is reset *55128 BIT 1,(IX+11) ; If jumper's Walking Left Flag is reset... 55132 JR Z,55196 ; ...then skip ahead to #R55196 (handle vertical component of jumper's jump, load E with Jump ; State Index and return) ; Walking Left Flag is set 55134 LD B,2 ; Load B with 2 (as Berk and Drutt jump left by two characters) *55136 PUSH BC ; Store BC (B = remaining number of characters to move) 55137 CALL 54666 ; Check jumper for collision with another impassable / pushable entity immediately to the ; left... 55140 JR C,55167 ; ...and if a collision has not occurred, then skip ahead to #R55167 55142 CP 22 ; If collision was with an entity of class less than 22 (can be picked up)... 55144 JR C,55167 ; ...then skip ahead to #R55167 55146 CP 129 ; If collision was with entity of class 129 (causes other entities to start falling)... 55148 JR Z,55167 ; ...then skip ahead to #R55167 55150 CP 50 ; If collision was with entity of class 50 (causes Drutt to swap depth levels)... 55152 JR Z,55167 ; ...then skip ahead to #R55167 55154 CP 159 ; If collision was not with entity of class 159 (Berk floating)... 55156 JR NZ,55183 ; ...then skip ahead to #R55183 ; Collision with Berk, floating 55158 LD (IY+11),242 ; Set Berk's Walking Left, Impassable Leftwards, Impassable Rightwards, Interaction (11,6) and ; Interaction (11,7) flags and reset his Walking Right and Unused (11,2) and Unused (11,3) ; flags 55162 CALL 55187 ; Set Character Swap Pending Flag 55165 JR 55183 ; Skip ahead to #R55183 ; No collision, or collision with entity of class 50, 129 or less than 22 *55167 CALL 54348 ; Move jumper into room to the left, if appropriate... 55170 JR NC,55183 ; ...and if jumper can't enter new room then skip ahead to #R55183 55172 DEC (IX+5) ; Move jumper left by one character... 55175 DEC (IX+7) ; ... 55178 POP BC ; Restore BC (B = remaining number of characters to move) 55179 DJNZ 55136 ; Decrease remaining number of characters to move, and if not zero, loop back to #R55136 55181 JR 55196 ; Handle vertical component of jumper's jump, load E with Jump State Index and return ; Collision with other class of entity *55183 POP BC ; Restore BC (B = remaining number of characters to move) 55184 LD E,5 ; Load E with 5 (jumper has bounced off an obstruction to the left while jumping left) 55186 RET ; Return ; Set Character Swap Pending Flag ; ; Used by the routine at #R55041. c55187 LD A,(34208) ; Set Character Swap Pending Flag... 55190 SET 6,A ; ... 55192 LD (34208),A ; ... 55195 RET ; Return ; Handle Vertical Component of Character's Jump, and Load E with Jump State Index As Appropriate ; ; This routine handles the vertical component of Berk's or Drutt's jumping, checking for collisions (e.g. Berk or ; Drutt hitting an obstruction above, or Drutt knocking down an entity such as a key). The routine also checks the ; cached control input value at #R55022 to determine the outcome of the next "bounce" if the jumper is on the floor ; (for example, start a leftward jump if left was pressed). Input: IX Address of complex state data (current ; level) for Berk or Drutt Output: E Jump state index (see table in description of routine at #R55041) c55196 LD A,(IX+12) ; Load A with current velocity of jumper's jump... 55199 AND 15 ; ... 55201 BIT 6,(IX+12) ; If Downward Jump Phase Flag is set... 55205 JR NZ,55281 ; ...then skip ahead to #R55281 ; Downward Jump Phase Flag is reset, i.e. in upward phase of jump 55207 OR A ; If current velocity of jumper's jump is at least one... 55208 JR NZ,55234 ; ...then skip ahead to #R55234 ; Current velocity of jumper's jump is zero 55210 LD A,(55022) ; Load A with Cached Control Input... 55213 BIT 3,A ; ...and if Back Bit is reset... 55215 JR Z,55223 ; ...then skip ahead to #R55223 55217 DEC (IX+4) ; Move jumper up one character... 55220 DEC (IX+6) ; ... *55223 SET 6,(IX+12) ; Set Downward Jump Phase Flag 55227 CALL 55421 ; Increase current velocity of jumper's jump if less than 7 55230 LD A,1 ; Prepare to set velocity of jumper's jump to one, downwards 55232 JR 55284 ; Skip ahead to #R55284 (handle downward phase of jump) ; Current velocity of jumper's jump is at least 1 *55234 LD B,A ; Load B with current velocity of jumper's jump *55235 DEC (IX+4) ; Move jumper up one character... 55238 DEC (IX+6) ; ... 55241 CALL 54768 ; Check entity at IX for collision with another entity at same depth whose Interaction (11,6) ; Flag is set... 55244 JR C,55258 ; ...and if no collision occurred, then skip ahead to #R55258 55246 CP 130 ; If collision was not with entity of class 130 (causes Berk and Drutt to bounce off or bang ; head)... 55248 JR NZ,55258 ; ...then skip ahead to #R55258 ; Jumper has banged his head 55250 LD A,6 ; Set pending sound index to 6 (banging head) if it is currently zero, or lower priority... 55252 CALL 59613 ; ... 55255 LD E,6 ; Load E with 6 (jumper has banged his head on something above him) 55257 RET ; Return ; No collision, or collision with entity other than that of class 130 *55258 CP 22 ; If collision was with an entity of class of 22 or greater (can't be picked up, or 255 for no ; collision)... 55260 JR NC,55270 ; ...then skip ahead to #R55270 ; Drutt has knocked down an entity, e.g. Red Sweet on Level 1 55262 LD (IY+12),2 ; Set initial velocity factor of entity jumper collided with to 2... 55266 SET 6,(IY+10) ; ...and set its "Can Fall" flag *55270 CALL 55433 ; Change jumper's room up one if appropriate 55273 DJNZ 55235 ; Decrease B (remaining number of characters to move up) and loop back to #R55235 if not zero 55275 DEC (IX+12) ; Decrease current velocity of jumper's jump, slowing ascent 55278 LD E,0 ; Load E with zero (jumper jumping upwards, no collision) 55280 RET ; Return ; Downward Jump Phase Flag is set, i.e. in downward phase of jump *55281 CALL 55421 ; Increase current velocity of jumper's jump if less than 7, speeding descent, and load into A *55284 LD B,A ; Load B with velocity of jumper's jump *55285 INC (IX+4) ; Move jumper down one character... 55288 INC (IX+6) ; ... 55291 CALL 54768 ; Check jumper for collision with another entity at same depth whose Interaction (11,6) Flag is ; set... 55294 JR C,55300 ; ...and if no collision occurred, then skip ahead to #R55300 55296 CP 35 ; If collision was with an entity of class 35 (platform, Level 1 or Level 3)... 55298 JR Z,55363 ; ...then skip ahead to #R55363 ; No collision, or collision with entity other than that of class 35 *55300 LD A,(IX+6) ; Load A with y-coordinate of jumper's bottom edge... 55303 ADD A,(IX+1) ; ...and add jumper's depth 55306 CP 122 ; If A is 122 (i.e. jumper is at bottom of screen)... 55308 JR Z,55320 ; ...then skip ahead to #R55320 55310 DJNZ 55285 ; Decrease B (remaining number of characters to move down) and loop back to #R55285 if not zero 55312 PUSH HL ; Store HL 55313 CALL 55616 ; Change jumper's room down one if appropriate 55316 POP HL ; Restore HL 55317 LD E,0 ; Load E with zero (jumper jumping downwards, no collision) 55319 RET ; Return ; Jumper is at the bottom of the screen *55320 CALL 54768 ; Check jumper for collision with another entity at same depth whose Interaction (11,6) Flag is ; set... *55323 JR C,55363 ; ...and if no collision occurred, then skip ahead to #R55363 55325 CP 129 ; If collision was with entity of class 129 (causes other entities to start falling)... 55327 JR Z,55334 ; ...then skip ahead to #R55334 ; Collision was not with entity of class 129, so need to resume collision check from current position in entities ; list, i.e. entity that jumper did collide with 55329 CALL 54871 ; Resume checking jumper for collision with another entity at same depth whose Interaction ; (11,6) Flag is set 55332 JR 55323 ; ...and jump back to #R55323 ; Collision with entity of class 129 *55334 LD A,(IX+8) ; If jumper is not Berk... 55337 CP 31 ; ...(class = 31)..... 55339 JR NZ,55285 ; ...then jump back to #R55285 (continue moving downwards) 55341 LD A,(IX+5) ; If Berk's left edge... 55344 CP (IY+5) ; ...is at or to the right of the colliding entity's left edge... 55347 JR NC,55352 ; ...then skip ahead to #R55352 ; Berk's left edge is to the left of colliding entity's left edge 55349 LD E,7 ; Load E with 7 (jumper is Berk, his left edge is to the left of colliding, class=129, entity's ; left edge) 55351 RET ; Return ; Berk's left edge is at, or to the right of, colliding entity's left edge *55352 LD A,(IY+7) ; If Berk's right edge... 55355 CP (IX+7) ; ...is at or to the right of the colliding entity's right edge... 55358 JR NC,55285 ; ...then jump back to #R55285 (continue moving downwards) ; Berk's right edge is to the left of colliding entity's right edge 55360 LD E,8 ; Load E with 8 (jumper is Berk, and he is between left and right edges of colliding, ; class=129, entity) 55362 RET ; Return ; Downward phase, and collision with entity of class 35 (platform, Level 1 or Level 3) or no collision at bottom of ; screen *55363 RES 6,(IX+12) ; Reset Downward Jump Phase Flag (i.e. prepare to jump up again) 55367 LD A,(55022) ; Load A with Cached Control Input... 55370 BIT 3,A ; ...and if Back Bit is reset... 55372 JR Z,55377 ; ...then skip ahead to #R55377 55374 LD E,1 ; Load E with 1 (jumper landed on floor / platform and Back Control Input Bit set) 55376 RET ; Return ; Back Bit is reset *55377 LD A,(IX+12) ; If current velocity of jumper's jump is at least 4... 55380 AND 15 ; ... 55382 CP 4 ; ... 55384 JR NC,55393 ; ...then skip ahead to #R55393 55386 LD (IX+12),0 ; Reset jumper's Is Jumping Flag and set current velocity of jump to zero 55390 LD E,3 ; Load E with 3 (jumper's jump velocity less than 4, and back not pressed, i.e. terminate ; jumping) 55392 RET ; Return ; Current velocity of jumper's jump is at least 4, and Back Bit is reset *55393 LD A,(55022) ; Load A with Cached Control Input... 55396 BIT 1,A ; ...and if Left Bit is reset... 55398 JR Z,55404 ; ...then skip ahead to #R55404 ; Left Bit is set 55400 LD E,4 ; Load E with 4 (jumper's jump velocity at least 4 and Left Control Input Bit set) 55402 JR 55410 ; Decrease current velocity of jumper's jump by two and return ; Left Bit is reset *55404 BIT 0,A ; If Right Bit is reset... 55406 JR Z,55417 ; ...then skip ahead to #R55417 ; Right Bit is set 55408 LD E,5 ; Load E with 5 (jumper's jump velocity at least 4 and Right Control Input Bit set) *55410 DEC (IX+12) ; Decrease current velocity of jumper's jump by two... 55413 DEC (IX+12) ; ... 55416 RET ; Return ; Right Bit (and Left and Back bits) reset *55417 LD E,0 ; Load E with zero (current velocity of jumper's jump is at least 4 and Back, Left and Right ; Control Input bits are reset) 55419 JR 55410 ; Decrease current velocity of jumper's jump by two and return ; Increase Current Velocity of Character's Jump if Less Than 7 ; ; See pokes Input: IX Address of complex state data (current level) for Berk or Drutt c55421 LD A,(IX+12) ; Load A with current velocity of character's jump... 55424 AND 15 ; ... 55426 CP 7 ; ...and if this is 7 or more... 55428 RET NC ; ...then return 55429 INC (IX+12) ; Increase velocity of character's jump 55432 RET ; Return ; Change Entity's Room Up One if Appropriate ; ; Used by the routines at #R36542, #R48487 and #R55196. Input: IX Address of complex state data for an entity c55433 LD A,99 ; If y-coordinate of top of entity is larger than 99 (i.e. top of entity is below top of ; room)... 55435 CP (IX+4) ; ... 55438 RET C ; ...then return 55439 PUSH HL ; Store HL 55440 PUSH BC ; Store BC 55441 PUSH DE ; Store DE 55442 LD IY,(34254) ; Load start address of current level's Vertical Room Connectivity Data into IY 55446 INC IY ; Advance by one byte to second byte (lower room index) of first entry 55448 LD D,(IX+0) ; Load current room of entity into D *55451 LD A,(IY+0) ; Load second byte (lower room index) of current entry into A 55454 CP 255 ; If byte is 255 (i.e. the End Marker)... 55456 JR Z,55512 ; ...then skip ahead to #R55512 55458 CP D ; If byte is the same as the entity's current room... 55459 JR Z,55467 ; ...then skip ahead to #R55467 55461 INC IY ; Advance by two bytes to the next entry... 55463 INC IY ; ... 55465 JR 55451 ; Loop back to #R55451 *55467 LD B,(IY-1) ; Load first byte (upper room index) of current entry into B 55470 LD A,(34231) ; Load position (chars) of left side of current room (old, that entity is leaving) into D... 55473 LD D,A ; ... 55474 CALL 54480 ; Set room of entity to B, store room size data for new room and load E with entity's width ; minus one 55477 LD A,(34231) ; Load position (chars) of left side of current room (new, that entity has entered) into A 55480 SUB D ; Subtract x-coordinate of old room's left edge from x-coordinate of new room's left edge... 55481 LD D,A ; ...and place result in D 55482 LD A,(IX+5) ; Load A with x-coordinate of left of entity... 55485 SUB D ; ...subtract difference in positions of rooms' left edges... 55486 LD (IX+5),A ; ...and store 55489 ADD A,E ; Update x-coordinate of right of entity by adding entity's (width - 1) value... 55490 LD (IX+7),A ; ... 55493 LD A,(IX+4) ; Add 22 to y-coordinate of top of entity... 55496 ADD A,22 ; ... 55498 LD (IX+4),A ; ... 55501 LD A,(IX+6) ; Add 22 to y-coordinate of bottom of entity... 55504 ADD A,22 ; ... 55506 LD (IX+6),A ; ... 55509 CALL 54456 ; Paint red areas outside current character's room if IX points to current character's complex ; state data *55512 POP DE ; Restore DE 55513 POP BC ; Restore BC 55514 POP HL ; Restore HL 55515 RET ; Return ; Set Can Fall Flag and Set Initial Velocity Factor of 2 for Entity Defined at Address in IX ; ; Used by the routines at #R36638, #R39760, #R48417, #R51779, #R52098, #R52193 and #R52243. Input: IX Address of ; complex state data for an entity c55516 SET 6,(IX+10) ; Set entity's "Can Fall" flag 55520 LD (IX+12),2 ; Set entity's initial velocity factor to 2 55524 RET ; Return ; Move All Falling Entities Down by Distances Appropriate to their Current Velocity Factors ; ; If an entity's "velocity factor" is equal to its height in characters plus 3 (a proxy for its mass), then it has ; reached its terminal velocity. c55525 LD IX,(34238) ; Load IX with start address of current level's complex state data 55529 LD DE,13 ; Load DE with 13 (as entries in complex state data are 13 bytes wide) *55532 LD A,(IX+0) ; If first byte of entry is 255 (i.e. End Marker)... 55535 CP 255 ; ... 55537 RET Z ; ...then return 55538 BIT 6,(IX+10) ; If current entity's "Can Fall" flag is reset... 55542 JR Z,55592 ; ...then skip ahead to #R55592 (advance to next entity) ; Current entity's "Can Fall" Flag is set 55544 PUSH DE ; Store DE 55545 CALL 53848 ; Store room size data for current entity's current room 55548 POP DE ; Restore DE 55549 LD A,(IX+6) ; Load C with height (of entity defined by entry) + 3... 55552 SUB (IX+4) ; ... 55555 ADD A,4 ; ... 55557 LD C,A ; ... 55558 LD A,(IX+12) ; Load B with velocity factor... 55561 LD B,A ; ... 55562 CP C ; If C is less than or equal to this (i.e. "terminal velocity" reached)... 55563 JR NC,55569 ; ...then skip ahead to #R55569 55565 INC A ; Increase velocity factor by one and store for next pass (i.e. acceleration)... 55566 LD (IX+12),A ; ... *55569 SRL B ; Divide current (i.e. not increased) velocity factor by 2 *55571 LD A,(IX+6) ; If sum of y-coordinate of entity's bottom and entity's depth is 122... 55574 ADD A,(IX+1) ; ...(i.e. entity is at ground-level)... 55577 CP 122 ; ... 55579 JR Z,55596 ; ...then skip ahead to #R55596 *55581 INC (IX+4) ; Move entity down by one character... 55584 INC (IX+6) ; ... 55587 CALL 55616 ; Change entity's room down one if appropriate 55590 DJNZ 55571 ; Decrease B (current velocity factor, i.e. remaining number of characters to drop entity) and ; if non-zero, loop back to #R55571 *55592 ADD IX,DE ; Advance IX by 13 bytes to next entry 55594 JR 55532 ; Loop back to #R55532 ; Entity's position is such that sum of y-coordinate of bottom + depth = 122 (i.e. at ground-level) *55596 CALL 54768 ; Check entity at IX for collision with another entity at same depth whose Interaction (11,6) ; Flag is set... *55599 JR C,55610 ; ...and if no collision occurred, then skip ahead to #R55610 55601 CP 129 ; If collision was with entity of class 129 (causes other entities to start falling)... 55603 JR Z,55581 ; ...then jump to #R55581 (entity may fall down into next room) ; Collision was not with entity of class 129, so need to resume collision check from current position in entities ; list, i.e. entity that character did collide with 55605 CALL 54871 ; Resume checking entity for collision with another entity at same depth whose Interaction ; (11,6) Flag is set... 55608 JR 55599 ; ... ; Entity has landed (i.e. is at ground-level and has not collided with a marker of class 129) *55610 RES 6,(IX+10) ; Reset entity's "Can Fall" flag as entity has landed 55614 JR 55592 ; Loop back for next entity ; Change Entity's Room Down One if Appropriate ; ; Used by the routines at #R55196 and #R55525. Input: IX Address of complex state data for an entity c55616 LD A,122 ; If y-coordinate of bottom of entity is smaller than 122 (i.e. bottom of entity is above ; bottom of room)... 55618 CP (IX+6) ; ... 55621 RET NC ; ...then return 55622 PUSH BC ; Store BC 55623 PUSH DE ; Store DE 55624 LD IY,(34254) ; Load start address of current level's Vertical Room Connectivity Data into IY 55628 LD D,(IX+0) ; Load current room of entity into D *55631 LD A,(IY+0) ; Load first byte (upper room index) of current entry into A 55634 CP 255 ; If byte is 255 (i.e. the End Marker)... 55636 JR Z,55695 ; ...then skip ahead to #R55695 55638 CP D ; If byte is the same as the entity's current room... 55639 JR Z,55647 ; ...then skip ahead to #R55647 55641 INC IY ; Advance by two bytes to the next entry... 55643 INC IY ; ... 55645 JR 55631 ; Loop back to #R55631 *55647 LD B,(IY+1) ; Load second byte (lower room index) of current entry into B 55650 LD A,(34231) ; Load position (chars) of left side of current room (old, that entity is leaving) into D... 55653 LD D,A ; ... 55654 CALL 54480 ; Set room of entity to B, store room size data for new room and load E with entity's width ; minus one 55657 LD A,(34231) ; Load position (chars) of left side of current room (new, that entity has entered) into A 55660 SUB D ; Subtract x-coordinate of old room's left edge from x-coordinate of new room's left edge... 55661 LD D,A ; ...and place result in D 55662 LD A,(IX+5) ; Load A with x-coordinate of left of entity... 55665 SUB D ; ...subtract difference in positions of rooms' left edges... 55666 LD (IX+5),A ; ...and store 55669 ADD A,E ; Update x-coordinate of right of entity by adding entity's (width - 1) value... 55670 LD (IX+7),A ; ... 55673 LD A,(IX+4) ; Subtract 20 from y-coordinate of top of entity... 55676 SUB 20 ; ... 55678 LD (IX+4),A ; ... 55681 LD A,(IX+6) ; Subtract 20 from y-coordinate of bottom of entity... 55684 SUB 20 ; ... 55686 LD (IX+6),A ; ... 55689 CALL 54456 ; Paint red areas outside current character's room if IX points to current character's complex ; state data 55692 POP DE ; Restore DE 55693 POP BC ; Restore BC 55694 RET ; Return *55695 POP DE ; Restore DE 55696 POP BC ; Restore BC 55697 RET ; Return ; Graphic Layout Data Berk Stepping right, right foot out and forward, arm and eye animated b55698 DEFB 251,232,217 ; Process graphic layout data at #R55784 and upon returning, move cursor to base ; coordinates 55701 DEFB 251,213,217 ; Process graphic layout data at #R55765 and upon returning, move cursor to base ; coordinates 55704 DEFB 250,4,254 ; Change cursor's x- and y-coordinates by -2 and +4 characters respectively 55707 DEFB 248,122,218 ; Jump to #R55930 (Berk's feet, right foot raised and forward, facing right) ; Stepping right, right foot out, arm and eye animated 55710 DEFB 251,232,217 ; Process graphic layout data at #R55784 and upon returning, move cursor to base ; coordinates 55713 DEFB 251,213,217 ; Process graphic layout data at #R55765 and upon returning, move cursor to base ; coordinates 55716 DEFB 250,4,254 ; Change cursor's x- and y-coordinates by -2 and +4 characters respectively 55719 DEFB 248,88,218 ; Jump to #R55896 (Berk's feet, right foot raised and to the side, facing right) ; Facing right, arm and eye animated 55722 DEFB 251,232,217 ; Process graphic layout data at #R55784 and upon returning, move cursor to base ; coordinates 55725 DEFB 250,4,254 ; Change cursor's x- and y-coordinates by -2 and +4 characters respectively 55728 DEFB 251,245,218 ; Process graphic layout data at #R56053 and upon returning, move cursor to base ; coordinates 55731 DEFB 248,213,217 ; Jump to #R55765 (Berk's hand, animated, right-facing) ; Walking right, animated 55734 DEFB 251,232,217 ; Process graphic layout data at #R55784 and upon returning, move cursor to base ; coordinates 55737 DEFB 251,191,217 ; Process graphic layout data at #R55743 and upon returning, move cursor to base ; coordinates 55740 DEFB 248,213,217 ; Jump to #R55765 (Berk's hand, animated, right-facing) ; Lower half of body, walking right, animated 55743 DEFB 250,4,254 ; Change cursor's x- and y-coordinates by -2 and +4 characters respectively 55746 DEFB 243,0,7 ; Increase current state value n (initially 0), up to maximum of 7, resetting to zero ; if maximum reached and jump to n-th address in following list (see trivia): 55749 DEFB 88,218 ; #R55896 (Berk's feet, right foot raised and to the side, facing right) 55751 DEFB 122,218 ; #R55930 (Berk's feet, right foot raised and forward, facing right) 55753 DEFB 159,218 ; #R55967 (lower half of body and feet, facing right, right foot forward) 55755 DEFB 199,218 ; #R56007 (lower half of body and feet, facing right, left foot behind) 55757 DEFB 245,218 ; #R56053 (lower half of body and feet, facing right, standing) 55759 DEFB 26,219 ; #R56090 (lower half of body and feet, facing right, left foot forward) 55761 DEFB 66,219 ; #R56130 (lower half of body and feet, facing right, left foot forward, right foot ; behind) 55763 DEFB 103,219 ; #R56167 (lower half of body and feet, facing right, left foot forward, right foot ; out and behind) ; Arm, facing right, animated 55765 DEFB 243,0,7 ; Increase current state value n (initially 0), up to maximum of 7, resetting to zero ; if maximum reached and jump to n-th address in following list (see trivia): 55768 DEFB 17,218 ; #R55825 (arm, facing right, up) 55770 DEFB 17,218 ; #R55825 (arm, facing right, up) 55772 DEFB 17,218 ; #R55825 (arm, facing right, up) 55774 DEFB 17,218 ; #R55825 (arm, facing right, up) 55776 DEFB 51,218 ; #R55859 (arm, facing right, down) 55778 DEFB 51,218 ; #R55859 (arm, facing right, down) 55780 DEFB 51,218 ; #R55859 (arm, facing right, down) 55782 DEFB 51,218 ; #R55859 (arm, facing right, down) ; Upper body without arm, facing right, eye animated 55784 DEFB 244,2 ; Set current graphic set to 2 55786 DEFB 254,0,2 ; Change cursor's x- and y-coordinates by +2 and 0 characters respectively and store ; as new base coordinates 55789 DEFB 236,6,1,1,1,1,2,3 ; Modify following instruction to display graphic of random index, chosen from 1, 1, ; 1, 1, 2 and 3 55797 DEFB 1,7,159,5,65,33 55803 DEFB 0,9,30,6,65,33 55809 DEFB 0,9,31,7,65,33 55815 DEFB 0,9,33,0,9,33 55821 DEFB 0,9,33 55824 DEFB 255 ; End Marker ; Arm, facing right, up 55825 DEFB 250,1,1 ; Change cursor's x- and y-coordinates by +1 and +1 characters respectively 55828 DEFB 8,65,33,9,65,33 55834 DEFB 10,1,29,11,65,161 55840 DEFB 12,65,161,13,65,33 55846 DEFB 14,1,30,15,65,161 55852 DEFB 16,1,33,17,1,32 55858 DEFB 255 ; End Marker ; Arm, facing right, down 55859 DEFB 250,1,1 ; Change cursor's x- and y-coordinates by +1 and +1 characters respectively 55862 DEFB 6,129,31,18,65,161 55868 DEFB 19,65,33,20,65,33 55874 DEFB 21,1,29,89,65,161 55880 DEFB 22,65,161,23,65,33 55886 DEFB 24,1,30,25,65,161 55892 DEFB 26,1,32 55895 DEFB 255 ; End Marker ; Lower half of body and feet, facing right, right foot out 55896 DEFB 27,65,33,28,33,33 55902 DEFB 29,33,33,30,65,29 55908 DEFB 31,65,33,32,33,33 55914 DEFB 33,33,33,34,65,30 55920 DEFB 35,1,33,36,1,33 55926 DEFB 37,1,32 55929 DEFB 255 ; End Marker ; Lower half of body and feet, facing right, right foot out and forward 55930 DEFB 27,65,33,0,9,33 55936 DEFB 38,33,33,39,33,33 55942 DEFB 40,4,28,41,65,33 55948 DEFB 0,9,33,42,33,33 55954 DEFB 43,68,29,53,1,33 55960 DEFB 36,1,33,44,1,32 55966 DEFB 255 ; End Marker ; Lower half of body and feet, facing right, right foot forward 55967 DEFB 27,65,33,0,9,33 55973 DEFB 45,65,33,46,65,33 55979 DEFB 47,1,28,48,65,33 55985 DEFB 49,65,33,50,65,33 55991 DEFB 51,65,33,52,1,27 55997 DEFB 53,1,33,54,1,33 56003 DEFB 55,1,32 56006 DEFB 255 ; End Marker ; Lower half of body and feet, facing right, left foot behind 56007 DEFB 27,65,33,0,9,33 56013 DEFB 0,9,33,0,9,28 56019 DEFB 56,1,33,57,65,33 56025 DEFB 0,9,33,45,65,33 56031 DEFB 58,65,33,59,65,28 56037 DEFB 60,1,33,61,1,33 56043 DEFB 62,1,33,54,1,33 56049 DEFB 63,1,32 56052 DEFB 255 ; End Marker ; Lower half of body and feet, facing right, standing 56053 DEFB 27,65,33,0,9,33 56059 DEFB 0,9,33,0,9,29 56065 DEFB 64,65,33,45,65,161 56071 DEFB 58,65,161,59,65,29 56077 DEFB 65,1,33,62,1,33 56083 DEFB 54,1,33,63,1,32 56089 DEFB 255 ; End Marker ; Lower half of body and feet, facing right, left foot forward 56090 DEFB 27,65,33,0,9,33 56096 DEFB 0,9,33,0,9,29 56102 DEFB 64,65,33,66,65,161 56108 DEFB 67,65,161,68,65,33 56114 DEFB 69,1,28,65,1,33 56120 DEFB 70,1,33,71,1,33 56126 DEFB 72,1,32 56129 DEFB 255 ; End Marker ; Lower half of body and feet, facing right, left foot forward, right foot behind 56130 DEFB 27,65,33,0,9,33 56136 DEFB 0,9,33,0,9,29 56142 DEFB 73,65,33,74,65,161 56148 DEFB 0,9,33,75,65,33 56154 DEFB 76,1,28,77,1,33 56160 DEFB 78,1,33,79,1,32 56166 DEFB 255 ; End Marker ; Lower half of body and feet, facing right, left foot forward, right foot out and behind 56167 DEFB 80,33,33,81,33,33 56173 DEFB 0,9,33,30,65,29 56179 DEFB 82,68,33,83,33,33 56185 DEFB 84,65,33,85,65,33 56191 DEFB 59,65,28,86,4,33 56197 DEFB 87,4,33,88,1,33 56203 DEFB 54,1,33,63,1,32 56209 DEFB 255 ; End Marker ; Graphic Layout Data Berk Walking Left Upper body without arm, facing left, eye animated b56210 DEFB 244,2 ; Set current graphic set to 2 56212 DEFB 254,0,2 ; Change cursor's x- and y-coordinates by +2 and 0 characters respectively and ; store as new base coordinates 56215 DEFB 236,6,1,1,1,1,2,3 ; Modify following instruction to display graphic of random index, chosen from 1, ; 1, 1, 1, 2 and 3 56223 DEFB 1,135,160,0,9,33 56229 DEFB 5,129,32,0,9,33 56235 DEFB 6,129,30,0,9,33 56241 DEFB 0,9,33,7,193,32 56247 DEFB 255 ; End Marker ; Stepping left, left foot out, arm and eye animated 56248 DEFB 251,146,219 ; Process graphic layout data at #R56210 and upon returning, move cursor to base ; coordinates 56251 DEFB 251,239,219 ; Process graphic layout data at #R56303 and upon returning, move cursor to base ; coordinates 56254 DEFB 248,73,220 ; Jump to #R56393 (lower half of body and feet, facing left, left foot out) ; Stepping left, left foot out and forward, arm and eye animated 56257 DEFB 251,146,219 ; Process graphic layout data at #R56210 and upon returning, move cursor to base ; coordinates 56260 DEFB 251,239,219 ; Process graphic layout data at #R56303 and upon returning, move cursor to base ; coordinates 56263 DEFB 248,110,220 ; Jump to #R56430 (lower half of body and feet, facing left, left foot out and ; forward) ; Facing left, arm and eye animated 56266 DEFB 251,146,219 ; Process graphic layout data at #R56210 and upon returning, move cursor to base ; coordinates 56269 DEFB 251,242,220 ; Process graphic layout data at #R56562 and upon returning, move cursor to base ; coordinates 56272 DEFB 248,239,219 ; Jump to #R56303 (Arm, facing left, animated) ; Walking left, animated 56275 DEFB 251,146,219 ; Process graphic layout data at #R56210 and upon returning, move cursor to base ; coordinates 56278 DEFB 251,220,219 ; Process graphic layout data at #R56284 and upon returning, move cursor to base ; coordinates 56281 DEFB 248,239,219 ; Jump to #R56303 (Arm, facing left, animated) ; Lower half of body, walking left, animated 56284 DEFB 243,0,7 ; Increase current state value n (initially 0), up to maximum of 7, resetting to ; zero if maximum reached and jump to n-th address in following list (see trivia): 56287 DEFB 73,220 ; #R56393 (lower half of body and feet, facing left, left foot out) 56289 DEFB 110,220 ; #R56430 (lower half of body and feet, facing left, left foot out and forward) 56291 DEFB 150,220 ; #R56470 (lower half of body and feet, facing left, left foot forward) 56293 DEFB 193,220 ; #R56513 (lower half of body and feet, facing left, right foot behind) 56295 DEFB 242,220 ; #R56562 (lower half of body and feet, facing left, standing) 56297 DEFB 26,221 ; #R56602 (lower half of body and feet, facing left, right foot forward) 56299 DEFB 69,221 ; #R56645 (lower half of body and feet, facing left, right foot forward, left foot ; behind) 56301 DEFB 109,221 ; #R56685 (lower half of body and feet, facing left, right foot forward, left foot ; out and behind) ; Arm, facing left, animated 56303 DEFB 243,0,7 ; Increase current state value n (initially 0), up to maximum of 7, resetting to ; zero if maximum reached and jump to n-th address in following list (see trivia): 56306 DEFB 2,220 ; #R56322 (arm, facing left, up) 56308 DEFB 2,220 ; #R56322 (arm, facing left, up) 56310 DEFB 2,220 ; #R56322 (arm, facing left, up) 56312 DEFB 2,220 ; #R56322 (arm, facing left, up) 56314 DEFB 36,220 ; #R56356 (arm, facing left, down) 56316 DEFB 36,220 ; #R56356 (arm, facing left, down) 56318 DEFB 36,220 ; #R56356 (arm, facing left, down) 56320 DEFB 36,220 ; #R56356 (arm, facing left, down) ; Arm, facing left, up 56322 DEFB 250,1,253 ; Change cursor's x- and y-coordinates by -3 and +1 characters respectively 56325 DEFB 10,129,33,9,129,33 56331 DEFB 8,193,30,14,193,33 56337 DEFB 13,193,33,12,193,161 56343 DEFB 11,193,157,17,129,33 56349 DEFB 16,193,33,15,193,161 56355 DEFB 255 ; End Marker ; Arm, facing left, down 56356 DEFB 250,1,255 ; Change cursor's x- and y-coordinates by -1 and +1 characters respectively 56359 DEFB 6,1,30,21,129,33 56365 DEFB 20,193,33,19,193,33 56371 DEFB 18,193,157,24,129,33 56377 DEFB 23,193,33,22,193,161 56383 DEFB 89,193,158,26,129,33 56389 DEFB 25,193,161 56392 DEFB 255 ; End Marker ; Lower half of body and feet, facing left, left foot out 56393 DEFB 250,4,255 ; Change cursor's x- and y-coordinates by -1 and +4 characters respectively 56396 DEFB 30,193,33,29,225,33 56402 DEFB 28,225,33,27,193,29 56408 DEFB 34,129,33,33,225,33 56414 DEFB 32,161,33,31,129,29 56420 DEFB 37,129,33,36,1,33 56426 DEFB 35,129,33 56429 DEFB 255 ; End Marker ; Lower half of body and feet, facing left, left foot out and forward 56430 DEFB 250,4,254 ; Change cursor's x- and y-coordinates by -2 and +4 characters respectively 56433 DEFB 40,132,33,39,161,33 56439 DEFB 38,225,33,0,9,33 56445 DEFB 0,9,29,43,132,33 56451 DEFB 42,225,33,0,9,33 56457 DEFB 41,193,30,44,129,33 56463 DEFB 36,1,33,53,129,33 56469 DEFB 255 ; End Marker ; Lower half of body and feet, facing left, left foot forward 56470 DEFB 250,4,254 ; Change cursor's x- and y-coordinates by -2 and +4 characters respectively 56473 DEFB 47,129,33,46,193,161 56479 DEFB 45,193,161,0,9,33 56485 DEFB 27,193,28,52,129,33 56491 DEFB 51,193,33,50,193,161 56497 DEFB 49,193,161,48,193,159 56503 DEFB 55,129,33,54,1,33 56509 DEFB 53,129,33 56512 DEFB 255 ; End Marker ; Lower half of body and feet, facing left, right foot behind 56513 DEFB 250,4,255 ; Change cursor's x- and y-coordinates by -1 and +4 characters respectively 56516 DEFB 30,193,33,0,9,33 56522 DEFB 0,9,33,27,193,28 56528 DEFB 59,193,33,58,193,161 56534 DEFB 45,193,161,0,9,33 56540 DEFB 57,193,161,56,129,27 56546 DEFB 63,129,33,54,1,33 56552 DEFB 62,129,33,61,129,33 56558 DEFB 60,129,33 56561 DEFB 255 ; End Marker ; Lower half of body and feet, facing left, standing 56562 DEFB 250,4,255 ; Change cursor's x- and y-coordinates by -1 and +4 characters respectively 56565 DEFB 30,193,33,0,9,33 56571 DEFB 0,9,33,27,193,29 56577 DEFB 59,193,33,58,193,161 56583 DEFB 45,193,161,64,193,29 56589 DEFB 63,129,33,54,1,33 56595 DEFB 62,129,33,65,129,33 56601 DEFB 255 ; End Marker ; Lower half of body and feet, facing left, right foot forward 56602 DEFB 250,4,255 ; Change cursor's x- and y-coordinates by -1 and +4 characters respectively 56605 DEFB 30,193,33,0,9,33 56611 DEFB 0,9,33,27,193,28 56617 DEFB 69,129,33,68,193,161 56623 DEFB 67,193,161,66,193,161 56629 DEFB 64,193,29,72,129,33 56635 DEFB 71,129,33,70,129,33 56641 DEFB 65,129,33 56644 DEFB 255 ; End Marker ; Lower half of body and feet, facing left, right foot forward, left foot behind 56645 DEFB 250,4,255 ; Change cursor's x- and y-coordinates by -1 and +4 characters respectively 56648 DEFB 30,193,33,0,9,33 56654 DEFB 0,9,33,27,193,28 56660 DEFB 76,129,33,75,193,161 56666 DEFB 0,9,33,74,193,161 56672 DEFB 73,193,158,79,129,33 56678 DEFB 78,129,33,77,129,33 56684 DEFB 255 ; End Marker ; Lower half of body and feet, facing left, right foot forward, left foot out and behind 56685 DEFB 250,4,255 ; Change cursor's x- and y-coordinates by -1 and +4 characters respectively 56688 DEFB 30,193,33,0,9,33 56694 DEFB 81,225,33,80,225,28 56700 DEFB 59,193,33,85,193,161 56706 DEFB 84,193,161,83,225,33 56712 DEFB 82,196,28,63,129,33 56718 DEFB 54,1,33,88,129,33 56724 DEFB 87,132,33,86,132,33 56730 DEFB 255 ; End Marker ; Graphic Layout Data Berk Facing Out of Screen Arms outstretched, animated b56731 DEFB 251,48,222 ; Process graphic layout data at #R56880 and upon returning, move cursor to base ; coordinates 56734 DEFB 251,7,225 ; Process graphic layout data at #R57607 and upon returning, move cursor to base ; coordinates 56737 DEFB 251,38,225 ; Process graphic layout data at #R57638 and upon returning, move cursor to base ; coordinates 56740 DEFB 248,237,221 ; Jump to #R56813 ; Arms raised, eating, animated 56743 DEFB 251,48,222 ; Process graphic layout data at #R56880 and upon returning, move cursor to base ; coordinates 56746 DEFB 251,237,221 ; Process graphic layout data at #R56813 and upon returning, move cursor to base ; coordinates 56749 DEFB 250,0,254 ; Change cursor's x- and y-coordinates by -2 and 0 characters respectively 56752 DEFB 172,1,33,217,1,35 56758 DEFB 217,129,33,172,129,27 56764 DEFB 137,65,33,138,65,163 56770 DEFB 138,193,161,137,193,27 56776 DEFB 139,1,33,140,65,163 56782 DEFB 140,193,161,139,129,28 56788 DEFB 147,65,35,147,193,29 56794 DEFB 64,65,35,64,193,33 56800 DEFB 255 ; End Marker ; With wings, animated 56801 DEFB 251,42,228 ; Process graphic layout data at #R58410 and upon returning, move cursor to base ; coordinates 56804 DEFB 251,48,222 ; Process graphic layout data at #R56880 and upon returning, move cursor to base ; coordinates 56807 DEFB 251,232,224 ; Process graphic layout data at #R57576 and upon returning, move cursor to base ; coordinates 56810 DEFB 251,201,224 ; Process graphic layout data at #R57545 and upon returning, move cursor to base ; coordinates 56813 DEFB 251,6,222 ; Process graphic layout data at #R56838 and upon returning, move cursor to base ; coordinates 56816 DEFB 250,5,254 ; Change cursor's x- and y-coordinates by -2 and +5 characters respectively 56819 DEFB 59,193,33,58,193,161 56825 DEFB 45,193,158,63,129,33 56831 DEFB 54,1,33,62,129,33 56837 DEFB 255 ; End Marker ; Left foot 56838 DEFB 250,5,1 ; Change cursor's x- and y-coordinates by +1 and +5 characters respectively 56841 DEFB 45,65,161,58,65,161 56847 DEFB 59,65,30,62,1,33 56853 DEFB 54,1,33,63,1,33 56859 DEFB 255 ; End Marker ; Middle of body, facing into screen 56860 DEFB 254,0,2 ; Change cursor's x- and y-coordinates by +2 and 0 characters respectively and ; store as new base coordinates 56863 DEFB 244,2 ; Set current graphic set to 2 56865 DEFB 93,65,33,93,65,31 56871 DEFB 0,9,33,0,9,31 56877 DEFB 248,144,222 ; Jump to #R56976 ; Middle of body, facing out of screen, eyes and mouth animated 56880 DEFB 254,0,2 ; Change cursor's x- and y-coordinates by +2 and 0 characters respectively and ; store as new base coordinates 56883 DEFB 244,2 ; Set current graphic set to 2 56885 DEFB 249,4,1 ; If state n (initially 1) has remaining time of zero then reset its time to ; maximum and randomly select a new state, n, from the 4 in the following list. ; Jump to the address specified in the current state and decrease its remaining ; time: 56888 DEFB 10,10,99,222 ; #R56931 (for 10 ticks) 56892 DEFB 5,5,72,222 ; #R56904 (for 5 ticks) 56896 DEFB 5,5,81,222 ; #R56913 (for 5 ticks) 56900 DEFB 3,3,90,222 ; #R56922 (for 3 ticks) ; Middle of body, facing out of screen, mouth animated, eyes looking to left 56904 DEFB 91,7,161,91,7,159 56910 DEFB 248,105,222 ; Jump to #R56937 ; Middle of body, facing out of screen, mouth animated, eyes looking to right 56913 DEFB 92,7,161,92,7,159 56919 DEFB 248,105,222 ; Jump to #R56937 ; Middle of body, facing out of screen, mouth animated, eyes closed 56922 DEFB 93,1,33,93,1,31 56928 DEFB 248,105,222 ; Jump to #R56937 ; Middle of body, facing out of screen, mouth animated, eyes looking ahead 56931 DEFB 90,7,161,90,7,159 56937 DEFB 249,3,1 ; If state n (initially 1) has remaining time of zero then reset its time to ; maximum and randomly select a new state, n, from the 3 in the following list. ; Jump to the address specified in the current state and decrease its remaining ; time: 56940 DEFB 6,6,120,222 ; #R56952 (for 6 ticks) 56944 DEFB 6,6,138,222 ; #R56970 (for 6 ticks) 56948 DEFB 2,2,129,222 ; #R56961 (for 2 ticks) ; Middle of body, facing out of screen, mouth 1, no eyes 56952 DEFB 94,65,161,95,65,159 56958 DEFB 248,144,222 ; Jump to #R56976 ; Middle of body, facing out of screen, mouth 2, no eyes 56961 DEFB 98,65,161,99,65,159 56967 DEFB 248,144,222 ; Jump to #R56976 ; Middle of body, facing out of screen, mouth 3, no eyes 56970 DEFB 96,65,161,97,65,159 56976 DEFB 0,9,33,0,9,31 56982 DEFB 0,9,33,0,9,31 56988 DEFB 0,9,33,0,9,33 56994 DEFB 255 ; End Marker ; Stepping forward, frame 1, animated 56995 DEFB 251,48,222 ; Process graphic layout data at #R56880 and upon returning, move cursor to base ; coordinates 56998 DEFB 251,7,225 ; Process graphic layout data at #R57607 and upon returning, move cursor to base ; coordinates 57001 DEFB 251,232,224 ; Process graphic layout data at #R57576 and upon returning, move cursor to base ; coordinates 57004 DEFB 251,217,225 ; Process graphic layout data at #R57817 and upon returning, move cursor to base ; coordinates 57007 DEFB 248,6,222 ; Jump to #R56838 (left foot) ; Stepping forward, frame 2, animated 57010 DEFB 251,48,222 ; Process graphic layout data at #R56880 and upon returning, move cursor to base ; coordinates 57013 DEFB 251,7,225 ; Process graphic layout data at #R57607 and upon returning, move cursor to base ; coordinates 57016 DEFB 251,103,225 ; Process graphic layout data at #R57703 and upon returning, move cursor to base ; coordinates 57019 DEFB 251,140,225 ; Process graphic layout data at #R57740 and upon returning, move cursor to base ; coordinates 57022 DEFB 248,170,225 ; Jump to #R57770 ; Stepping forward, frame 3, animated 57025 DEFB 251,48,222 ; Process graphic layout data at #R56880 and upon returning, move cursor to base ; coordinates 57028 DEFB 251,201,224 ; Process graphic layout data at #R57545 and upon returning, move cursor to base ; coordinates 57031 DEFB 251,38,225 ; Process graphic layout data at #R57638 and upon returning, move cursor to base ; coordinates 57034 DEFB 251,240,221 ; Process graphic layout data at #R56816 and upon returning, move cursor to base ; coordinates 57037 DEFB 248,239,225 ; Jump to #R57839 (left foot raised and part of lower body, facing towards ; screen) ; Stepping forward, frame 4, animated 57040 DEFB 251,48,222 ; Process graphic layout data at #R56880 and upon returning, move cursor to base ; coordinates 57043 DEFB 251,69,225 ; Process graphic layout data at #R57669 and upon returning, move cursor to base ; coordinates 57046 DEFB 251,38,225 ; Process graphic layout data at #R57638 and upon returning, move cursor to base ; coordinates 57049 DEFB 251,195,225 ; Process graphic layout data at #R57795 and upon returning, move cursor to base ; coordinates 57052 DEFB 248,155,225 ; Jump to #R57755 ; With wings and holding something, animated 57055 DEFB 251,42,228 ; Process graphic layout data at #R58410 and upon returning, move cursor to base ; coordinates 57058 DEFB 251,48,222 ; Process graphic layout data at #R56880 and upon returning, move cursor to base ; coordinates 57061 DEFB 251,30,223 ; Process graphic layout data at #R57118 and upon returning, move cursor to base ; coordinates 57064 DEFB 251,240,221 ; Process graphic layout data at #R56816 and upon returning, move cursor to base ; coordinates 57067 DEFB 248,6,222 ; Jump to #R56838 (left foot) ; Holding something while stepping forward, frame 1 57070 DEFB 251,48,222 ; Process graphic layout data at #R56880 and upon returning, move cursor to base ; coordinates 57073 DEFB 251,30,223 ; Process graphic layout data at #R57118 and upon returning, move cursor to base ; coordinates 57076 DEFB 251,217,225 ; Process graphic layout data at #R57817 and upon returning, move cursor to base ; coordinates 57079 DEFB 248,6,222 ; Jump to #R56838 (left foot) ; Holding something while stepping forward, frame 2 57082 DEFB 251,48,222 ; Process graphic layout data at #R56880 and upon returning, move cursor to base ; coordinates 57085 DEFB 251,30,223 ; Process graphic layout data at #R57118 and upon returning, move cursor to base ; coordinates 57088 DEFB 251,140,225 ; Process graphic layout data at #R57740 and upon returning, move cursor to base ; coordinates 57091 DEFB 248,170,225 ; Jump to #R57770 ; Holding something while stepping forward, frame 3 57094 DEFB 251,48,222 ; Process graphic layout data at #R56880 and upon returning, move cursor to base ; coordinates 57097 DEFB 251,30,223 ; Process graphic layout data at #R57118 and upon returning, move cursor to base ; coordinates 57100 DEFB 251,240,221 ; Process graphic layout data at #R56816 and upon returning, move cursor to base ; coordinates 57103 DEFB 248,239,225 ; Jump to #R57839 (left foot raised and part of lower body, facing towards ; screen) ; Holding something while stepping forward, frame 4 57106 DEFB 251,48,222 ; Process graphic layout data at #R56880 and upon returning, move cursor to base ; coordinates 57109 DEFB 251,30,223 ; Process graphic layout data at #R57118 and upon returning, move cursor to base ; coordinates 57112 DEFB 251,195,225 ; Process graphic layout data at #R57795 and upon returning, move cursor to base ; coordinates 57115 DEFB 248,155,225 ; Jump to #R57755 ; Arms holding something, variable width 57118 DEFB 253 ; Jump to n-th address in following list where n is the width of the entity ; currently held by Berk: 57119 DEFB 39,223 ; #R57127 (arms holding something, width 1) 57121 DEFB 85,223 ; #R57173 (arms holding something, width 2) 57123 DEFB 131,223 ; #R57219 (arms holding something, width 3) 57125 DEFB 186,223 ; #R57274 (arms holding something, width 4) ; Arms holding something, width 1 57127 DEFB 250,1,254 ; Change cursor's x- and y-coordinates by -2 and +1 characters respectively 57130 DEFB 101,1,33,135,65,34 57136 DEFB 135,193,33,101,129,28 57142 DEFB 137,65,33,138,65,162 57148 DEFB 138,193,161,137,193,28 57154 DEFB 139,1,33,140,65,162 57160 DEFB 140,193,161,142,65,29 57166 DEFB 141,65,163,0,9,33 57172 DEFB 255 ; End Marker ; Arms holding something, width 2 57173 DEFB 250,1,254 ; Change cursor's x- and y-coordinates by -2 and +1 characters respectively 57176 DEFB 101,1,33,135,65,35 57182 DEFB 135,193,33,101,129,27 57188 DEFB 137,65,33,138,65,163 57194 DEFB 138,193,161,137,193,27 57200 DEFB 139,1,33,140,65,163 57206 DEFB 140,193,161,139,129,28 57212 DEFB 141,65,163,141,193,163 57218 DEFB 255 ; End Marker ; Arms holding something, width 3 57219 DEFB 250,1,253 ; Change cursor's x- and y-coordinates by -3 and +1 characters respectively 57222 DEFB 101,1,33,143,65,33 57228 DEFB 144,65,35,135,193,33 57234 DEFB 101,129,26,137,65,33 57240 DEFB 138,65,161,0,9,35 57246 DEFB 138,193,161,137,193,26 57252 DEFB 139,1,33,140,65,161 57258 DEFB 0,9,35,140,193,161 57264 DEFB 139,129,28,0,9,35 57270 DEFB 141,193,33 57273 DEFB 255 ; End Marker ; Arms holding something, width 4 57274 DEFB 250,1,253 ; Change cursor's x- and y-coordinates by -3 and +1 characters respectively 57277 DEFB 101,1,33,143,65,33 57283 DEFB 144,65,35,144,193,33 57289 DEFB 143,193,33,101,129,25 57295 DEFB 137,65,33,138,65,161 57301 DEFB 0,9,35,0,9,33 57307 DEFB 138,193,161,137,193,25 57313 DEFB 139,1,33,140,65,161 57319 DEFB 0,9,35,0,9,33 57325 DEFB 140,193,161,139,129,27 57331 DEFB 0,9,35,0,9,33 57337 DEFB 255 ; End Marker ; Graphic Layout Data Berk Facing Into Screen Arms out to the sides b57338 DEFB 251,28,222 ; Process graphic layout data at #R56860 and upon returning, move cursor to base ; coordinates 57341 DEFB 251,7,225 ; Process graphic layout data at #R57607 and upon returning, move cursor to base ; coordinates 57344 DEFB 251,38,225 ; Process graphic layout data at #R57638 and upon returning, move cursor to base ; coordinates 57347 DEFB 251,192,225 ; Process graphic layout data at #R57792 and upon returning, move cursor to base ; coordinates 57350 DEFB 248,167,225 ; Jump to #R57767 (right foot and part of lower body, facing into screen) ; Arms down 57353 DEFB 251,28,222 ; Process graphic layout data at #R56860 and upon returning, move cursor to base ; coordinates 57356 DEFB 251,49,226 ; Process graphic layout data at #R57905 and upon returning, move cursor to base ; coordinates 57359 DEFB 251,80,226 ; Process graphic layout data at #R57936 and upon returning, move cursor to base ; coordinates 57362 DEFB 251,192,225 ; Process graphic layout data at #R57792 and upon returning, move cursor to base ; coordinates 57365 DEFB 248,167,225 ; Jump to #R57767 (right foot and part of lower body, facing into screen) ; Stepping into screen, frame 1 57368 DEFB 251,28,222 ; Process graphic layout data at #R56860 and upon returning, move cursor to base ; coordinates 57371 DEFB 251,69,225 ; Process graphic layout data at #R57669 and upon returning, move cursor to base ; coordinates 57374 DEFB 251,80,226 ; Process graphic layout data at #R57936 and upon returning, move cursor to base ; coordinates 57377 DEFB 251,5,226 ; Process graphic layout data at #R57861 and upon returning, move cursor to base ; coordinates 57380 DEFB 248,167,225 ; Jump to #R57767 (right foot and part of lower body, facing into screen) ; Stepping into screen, frame 2 57383 DEFB 251,28,222 ; Process graphic layout data at #R56860 and upon returning, move cursor to base ; coordinates 57386 DEFB 251,7,225 ; Process graphic layout data at #R57607 and upon returning, move cursor to base ; coordinates 57389 DEFB 251,111,226 ; Process graphic layout data at #R57967 and upon returning, move cursor to base ; coordinates 57392 DEFB 251,192,225 ; Process graphic layout data at #R57792 and upon returning, move cursor to base ; coordinates 57395 DEFB 248,152,225 ; Jump to #R57752 (left foot and part of lower body, facing towards screen) ; Stepping into screen, frame 3 57398 DEFB 251,28,222 ; Process graphic layout data at #R56860 and upon returning, move cursor to base ; coordinates 57401 DEFB 251,49,226 ; Process graphic layout data at #R57905 and upon returning, move cursor to base ; coordinates 57404 DEFB 251,38,225 ; Process graphic layout data at #R57638 and upon returning, move cursor to base ; coordinates 57407 DEFB 251,192,225 ; Process graphic layout data at #R57792 and upon returning, move cursor to base ; coordinates 57410 DEFB 248,27,226 ; Jump to #R57883 (right foot raised and part of lower body, facing into screen) ; Stepping into screen, frame 4 57413 DEFB 251,28,222 ; Process graphic layout data at #R56860 and upon returning, move cursor to base ; coordinates 57416 DEFB 251,145,226 ; Process graphic layout data at #R58001 and upon returning, move cursor to base ; coordinates 57419 DEFB 251,38,225 ; Process graphic layout data at #R57638 and upon returning, move cursor to base ; coordinates 57422 DEFB 251,137,225 ; Process graphic layout data at #R57737 and upon returning, move cursor to base ; coordinates 57425 DEFB 248,167,225 ; Jump to #R57767 (right foot and part of lower body, facing into screen) ; Holding something 57428 DEFB 251,129,224 ; Process graphic layout data at #R57473 and upon returning, move cursor to base ; coordinates 57431 DEFB 251,192,225 ; Process graphic layout data at #R57792 and upon returning, move cursor to base ; coordinates 57434 DEFB 248,167,225 ; Jump to #R57767 (right foot and part of lower body, facing into screen) ; Holding something while stepping into screen, frame 1 57437 DEFB 251,129,224 ; Process graphic layout data at #R57473 and upon returning, move cursor to base ; coordinates 57440 DEFB 251,5,226 ; Process graphic layout data at #R57861 and upon returning, move cursor to base ; coordinates 57443 DEFB 248,167,225 ; Jump to #R57767 (right foot and part of lower body, facing into screen) ; Holding something while stepping into screen, frame 2 57446 DEFB 251,129,224 ; Process graphic layout data at #R57473 and upon returning, move cursor to base ; coordinates 57449 DEFB 251,192,225 ; Process graphic layout data at #R57792 and upon returning, move cursor to base ; coordinates 57452 DEFB 248,152,225 ; Jump to #R57752 (left foot and part of lower body, facing towards screen) ; Holding something while stepping into screen, frame 3 57455 DEFB 251,129,224 ; Process graphic layout data at #R57473 and upon returning, move cursor to base ; coordinates 57458 DEFB 251,192,225 ; Process graphic layout data at #R57792 and upon returning, move cursor to base ; coordinates 57461 DEFB 248,27,226 ; Jump to #R57883 (right foot raised and part of lower body, facing into screen) ; Holding something while stepping into screen, frame 4 57464 DEFB 251,129,224 ; Process graphic layout data at #R57473 and upon returning, move cursor to base ; coordinates 57467 DEFB 251,137,225 ; Process graphic layout data at #R57737 and upon returning, move cursor to base ; coordinates 57470 DEFB 248,167,225 ; Jump to #R57767 (right foot and part of lower body, facing into screen) ; Upper body, holding something 57473 DEFB 244,2 ; Set current graphic set to 2 57475 DEFB 254,0,2 ; Change cursor's x- and y-coordinates by +2 and 0 characters respectively and ; store as new base coordinates 57478 DEFB 93,65,33,93,65,30 57484 DEFB 155,65,33,0,9,33 57490 DEFB 0,9,33,155,193,28 57496 DEFB 158,65,33,167,65,161 57502 DEFB 0,9,33,0,9,33 57508 DEFB 167,193,161,158,193,27 57514 DEFB 168,65,33,169,65,161 57520 DEFB 0,9,33,0,9,33 57526 DEFB 169,193,161,168,193,28 57532 DEFB 0,9,33,0,9,33 57538 DEFB 0,9,33,0,9,33 57544 DEFB 255 ; End Marker ; Graphic Layout Data Berk Body Parts Right arm b57545 DEFB 250,1,255 ; Change cursor's x- and y-coordinates by -1 and +1 characters respectively 57548 DEFB 100,1,30,101,1,33 57554 DEFB 102,65,33,103,65,158 57560 DEFB 104,1,33,0,9,33 57566 DEFB 106,65,159,107,1,33 57572 DEFB 108,65,161 57575 DEFB 255 ; End Marker ; Left arm 57576 DEFB 250,1,2 ; Change cursor's x- and y-coordinates by +2 and +1 characters respectively 57579 DEFB 100,129,32,103,193,161 57585 DEFB 102,193,33,101,129,30 57591 DEFB 106,193,161,0,9,33 57597 DEFB 104,129,30,108,193,161 57603 DEFB 107,129,33 57606 DEFB 255 ; End Marker ; Right arm raised 57607 DEFB 250,0,254 ; Change cursor's x- and y-coordinates by -2 and 0 characters respectively 57610 DEFB 109,1,31,110,65,33 57616 DEFB 111,65,33,112,65,30 57622 DEFB 113,65,33,114,65,33 57628 DEFB 115,65,32,7,65,32 57634 DEFB 0,9,33 57637 DEFB 255 ; End Marker ; Left arm raised 57638 DEFB 250,0,3 ; Change cursor's x- and y-coordinates by +3 and 0 characters respectively 57641 DEFB 109,129,31,112,193,33 57647 DEFB 111,193,33,110,193,30 57653 DEFB 115,193,33,114,193,33 57659 DEFB 113,193,30,7,193,32 57665 DEFB 27,193,33 57668 DEFB 255 ; End Marker ; Right arm, walking into or out of screen 57669 DEFB 250,1,255 ; Change cursor's x- and y-coordinates by -1 and +1 characters respectively 57672 DEFB 100,65,29,116,1,33 57678 DEFB 117,1,33,118,65,33 57684 DEFB 119,65,157,120,1,33 57690 DEFB 121,65,33,122,65,33 57696 DEFB 123,65,160,27,65,33 57702 DEFB 255 ; End Marker ; Left arm, walking into or out of screen 57703 DEFB 250,1,2 ; Change cursor's x- and y-coordinates by +2 and +1 characters respectively 57706 DEFB 100,193,32,119,193,161 57712 DEFB 118,193,33,117,129,33 57718 DEFB 116,129,29,123,193,161 57724 DEFB 122,193,33,121,193,33 57730 DEFB 120,129,29,27,193,33 57736 DEFB 255 ; End Marker ; Right foot and part of lower body, facing towards screen 57737 DEFB 250,1,0 ; Change cursor's x- and y-coordinates by 0 and +1 characters respectively 57740 DEFB 250,4,255 ; Change cursor's x- and y-coordinates by -1 and +4 characters respectively 57743 DEFB 27,65,33,0,9,30 57749 DEFB 248,243,221 ; Jump to #R56819 ; Left foot and part of lower body, facing towards screen 57752 DEFB 250,1,0 ; Change cursor's x- and y-coordinates by 0 and +1 characters respectively 57755 DEFB 250,4,1 ; Change cursor's x- and y-coordinates by +1 and +4 characters respectively 57758 DEFB 0,9,33,27,193,31 57764 DEFB 248,9,222 ; Jump to #R56841 ; Right foot and part of lower body, facing into screen 57767 DEFB 250,1,0 ; Change cursor's x- and y-coordinates by 0 and +1 characters respectively 57770 DEFB 250,4,1 ; Change cursor's x- and y-coordinates by +1 and +4 characters respectively 57773 DEFB 0,9,33,124,65,161 57779 DEFB 59,1,30,125,65,33 57785 DEFB 126,65,33,63,1,33 57791 DEFB 255 ; End Marker ; Left foot and part of lower body, facing into screen 57792 DEFB 250,1,0 ; Change cursor's x- and y-coordinates by 0 and +1 characters respectively 57795 DEFB 250,4,254 ; Change cursor's x- and y-coordinates by -2 and +4 characters respectively 57798 DEFB 59,129,33,124,193,161 57804 DEFB 0,9,30,63,129,33 57810 DEFB 126,193,33,125,193,33 57816 DEFB 255 ; End Marker ; Right foot raised and part of lower body, facing towards screen 57817 DEFB 250,4,255 ; Change cursor's x- and y-coordinates by -1 and +4 characters respectively 57820 DEFB 80,97,33,81,97,31 57826 DEFB 82,68,33,83,97,31 57832 DEFB 86,4,33,87,4,33 57838 DEFB 255 ; End Marker ; Left foot raised and part of lower body, facing towards screen 57839 DEFB 250,4,1 ; Change cursor's x- and y-coordinates by +1 and +4 characters respectively 57842 DEFB 81,225,33,80,225,31 57848 DEFB 83,225,33,82,196,31 57854 DEFB 87,132,33,86,132,33 57860 DEFB 255 ; End Marker ; Left foot raised and part of lower body, facing into screen 57861 DEFB 250,4,254 ; Change cursor's x- and y-coordinates by -2 and +4 characters respectively 57864 DEFB 130,65,32,131,65,33 57870 DEFB 132,65,161,0,9,31 57876 DEFB 133,1,33,125,193,33 57882 DEFB 255 ; End Marker ; Right foot raised and part of lower body, facing into screen 57883 DEFB 250,4,3 ; Change cursor's x- and y-coordinates by +3 and +4 characters respectively 57886 DEFB 130,193,30,0,9,33 57892 DEFB 132,193,161,131,193,30 57898 DEFB 125,65,33,133,129,33 57904 DEFB 255 ; End Marker ; Left arm down, facing into screen 57905 DEFB 250,1,255 ; Change cursor's x- and y-coordinates by -1 and +1 characters respectively 57908 DEFB 100,65,30,101,1,33 57914 DEFB 102,65,33,127,65,158 57920 DEFB 104,1,33,0,9,33 57926 DEFB 128,65,159,107,65,33 57932 DEFB 129,65,161 57935 DEFB 255 ; End Marker ; Right arm down, facing into screen 57936 DEFB 250,1,2 ; Change cursor's x- and y-coordinates by +2 and +1 characters respectively 57939 DEFB 100,193,32,127,193,161 57945 DEFB 102,193,33,101,129,30 57951 DEFB 128,193,161,0,9,33 57957 DEFB 104,129,30,129,193,161 57963 DEFB 107,193,33 57966 DEFB 255 ; End Marker ; Right arm raised, facing into screen 57967 DEFB 250,1,2 ; Change cursor's x- and y-coordinates by +2 and +1 characters respectively 57970 DEFB 100,193,32,127,193,161 57976 DEFB 118,193,33,117,129,33 57982 DEFB 116,129,29,128,193,161 57988 DEFB 122,193,33,105,1,33 57994 DEFB 134,129,29,0,9,33 58000 DEFB 255 ; End Marker ; Left arm raised, facing into screen 58001 DEFB 250,1,255 ; Change cursor's x- and y-coordinates by -1 and +1 characters respectively 58004 DEFB 100,65,29,116,1,33 58010 DEFB 117,1,33,118,65,33 58016 DEFB 127,65,157,134,1,33 58022 DEFB 105,1,33,122,65,33 58028 DEFB 128,65,160,0,9,33 58034 DEFB 255 ; End Marker ; Upper body, pushing to the right 58035 DEFB 244,2 ; Set current graphic set to 2 58037 DEFB 254,0,4 ; Change cursor's x- and y-coordinates by +4 and 0 characters respectively and ; store as new base coordinates 58040 DEFB 250,1,1 ; Change cursor's x- and y-coordinates by +1 and +1 characters respectively 58043 DEFB 236,4,1,1,2,3 ; Modify following instruction to display graphic of random index, chosen from 1, ; 1, 2 and 3 58049 DEFB 1,7,157,172,1,33 58055 DEFB 173,65,33,174,65,33 58061 DEFB 175,1,157,176,65,33 58067 DEFB 0,9,33,177,1,161 58073 DEFB 178,1,161 58076 DEFB 255 ; End Marker ; Upper body, pushing to the left 58077 DEFB 244,2 ; Set current graphic set to 2 58079 DEFB 254,0,1 ; Change cursor's x- and y-coordinates by +1 and 0 characters respectively and ; store as new base coordinates 58082 DEFB 250,1,255 ; Change cursor's x- and y-coordinates by -1 and +1 characters respectively 58085 DEFB 236,4,1,1,2,3 ; Modify following instruction to display graphic of random index, chosen from 1, ; 1, 2 and 3 58091 DEFB 1,135,160,175,129,161 58097 DEFB 174,129,161,173,193,33 58103 DEFB 172,129,29,178,129,161 58109 DEFB 177,129,161,0,9,33 58115 DEFB 176,193,33 58118 DEFB 255 ; End Marker ; Graphic Layout Data Berk in Action Facing out of screen, bending down (see bugs) b58119 DEFB 244,2 ; Set current graphic set to 2 58121 DEFB 250,2,1 ; Change cursor's x- and y-coordinates by +1 and +2 characters respectively 58124 DEFB 145,1,33,136,15,33 58130 DEFB 136,15,33,145,129,28 58136 DEFB 146,1,33,171,65,161 58142 DEFB 0,9,33,0,9,33 58148 DEFB 171,193,161,146,129,27 58154 DEFB 137,65,33,138,65,161 58160 DEFB 0,9,33,0,9,33 58166 DEFB 138,193,161,137,65,27 58172 DEFB 147,65,33,140,65,161 58178 DEFB 45,193,161,45,65,161 58184 DEFB 140,193,161,147,193,27 58190 DEFB 65,1,33,148,1,33 58196 DEFB 62,129,33,62,1,33 58202 DEFB 148,129,33,65,129,33 58208 DEFB 255 ; End Marker ; Facing into screen, bending down 58209 DEFB 254,0,2 ; Change cursor's x- and y-coordinates by +2 and 0 characters respectively and ; store as new base coordinates 58212 DEFB 244,2 ; Set current graphic set to 2 58214 DEFB 251,192,225 ; Process graphic layout data at #R57792 and upon returning, move cursor to base ; coordinates 58217 DEFB 251,167,225 ; Process graphic layout data at #R57767 and upon returning, move cursor to base ; coordinates 58220 DEFB 250,1,0 ; Change cursor's x- and y-coordinates by 0 and +1 characters respectively 58223 DEFB 161,1,33,161,129,30 58229 DEFB 162,1,33,163,65,33 58235 DEFB 163,193,33,162,129,28 58241 DEFB 164,1,33,165,65,161 58247 DEFB 0,9,33,0,9,33 58253 DEFB 165,193,161,164,129,27 58259 DEFB 166,65,33,0,9,33 58265 DEFB 0,9,33,0,9,33 58271 DEFB 0,9,33,166,129,27 58277 DEFB 255 ; End Marker ; Facing into screen, stretching upwards 58278 DEFB 244,2 ; Set current graphic set to 2 58280 DEFB 250,253,1 ; Change cursor's x- and y-coordinates by +1 and -3 characters respectively 58283 DEFB 170,1,33,149,1,33 58289 DEFB 149,129,33,170,129,29 58295 DEFB 150,65,33,151,1,33 58301 DEFB 151,129,33,150,129,29 58307 DEFB 152,65,33,153,121,33 58313 DEFB 153,121,33,152,193,29 58319 DEFB 154,1,33,0,9,33 58325 DEFB 0,9,33,154,129,29 58331 DEFB 6,1,33,0,9,33 58337 DEFB 0,9,33,6,129,29 58343 DEFB 7,65,33,0,9,33 58349 DEFB 0,9,33,7,193,29 58355 DEFB 0,9,33,0,9,33 58361 DEFB 0,9,33,0,9,29 58367 DEFB 27,193,33,0,9,33 58373 DEFB 0,9,33,27,193,28 58379 DEFB 156,65,33,157,65,33 58385 DEFB 125,193,33,125,65,33 58391 DEFB 157,193,33,156,193,27 58397 DEFB 159,1,33,160,1,35 58403 DEFB 160,129,33,159,129,33 58409 DEFB 255 ; End Marker ; Wings, animated 58410 DEFB 244,6 ; Set current graphic set to 6 58412 DEFB 243,0,2 ; Increase current state value n (initially 0), up to maximum of 2, resetting to ; zero if maximum reached and jump to n-th address in following list: 58415 DEFB 51,228 ; #R58419 (wings, raised) 58417 DEFB 148,228 ; #R58516 (wings, lowered) ; Wings, raised 58419 DEFB 250,254,254 ; Change cursor's x- and y-coordinates by -2 and -2 characters respectively 58422 DEFB 52,5,33,53,69,33 58428 DEFB 54,5,30,34,5,33 58434 DEFB 55,69,161,56,69,161 58440 DEFB 57,69,29,58,5,33 58446 DEFB 59,5,33,60,69,161 58452 DEFB 61,69,159,62,69,161 58458 DEFB 0,45,32,63,69,32 58464 DEFB 64,69,33 58467 DEFB 250,251,3 ; Change cursor's x- and y-coordinates by +3 and -5 characters respectively 58470 DEFB 54,133,33,53,197,33 58476 DEFB 52,133,29,57,133,33 58482 DEFB 56,197,161,55,197,161 58488 DEFB 34,133,29,61,197,161 58494 DEFB 60,197,161,59,133,33 58500 DEFB 58,133,29,0,45,33 58506 DEFB 62,197,159,63,197,32 58512 DEFB 64,197,33 58515 DEFB 255 ; End Marker ; Wings, lowered 58516 DEFB 41,5,29,42,5,33 58522 DEFB 43,69,33,44,69,161 58528 DEFB 45,69,161,46,69,29 58534 DEFB 47,5,33,48,69,33 58540 DEFB 49,69,161,0,45,31 58546 DEFB 50,5,33,51,69,33 58552 DEFB 250,253,3 ; Change cursor's x- and y-coordinates by +3 and -3 characters respectively 58555 DEFB 41,133,31,46,197,33 58561 DEFB 45,197,161,44,197,161 58567 DEFB 43,197,33,42,133,28 58573 DEFB 0,45,33,49,197,161 58579 DEFB 48,197,33,47,133,29 58585 DEFB 51,197,33,50,133,33 58591 DEFB 255 ; End Marker ; Facing right, falling, arms forward 58592 DEFB 244,2 ; Set current graphic set to 2 58594 DEFB 250,2,1 ; Change cursor's x- and y-coordinates by +1 and +2 characters respectively 58597 DEFB 5,1,33,183,1,33 58603 DEFB 184,1,33,2,7,28 58609 DEFB 6,1,33,0,9,33 58615 DEFB 0,9,33,18,1,33 58621 DEFB 19,65,33,20,1,33 58627 DEFB 21,1,26,7,65,33 58633 DEFB 0,9,33,0,9,33 58639 DEFB 89,65,161,22,65,161 58645 DEFB 23,65,33,24,1,25 58651 DEFB 4,1,33,58,65,161 58657 DEFB 179,65,33,0,9,33 58663 DEFB 43,1,33,182,1,33 58669 DEFB 26,1,26,62,1,33 58675 DEFB 54,1,33,63,1,33 58681 DEFB 180,1,33 58684 DEFB 255 ; End Marker ; Facing left, falling, arms forward 58685 DEFB 244,2 ; Set current graphic set to 2 58687 DEFB 250,2,1 ; Change cursor's x- and y-coordinates by +1 and +2 characters respectively 58690 DEFB 2,135,33,184,129,33 58696 DEFB 183,129,33,5,129,27 58702 DEFB 21,129,33,20,129,33 58708 DEFB 19,193,33,18,129,33 58714 DEFB 0,9,33,0,9,33 58720 DEFB 6,129,26,24,129,33 58726 DEFB 23,129,33,22,193,33 58732 DEFB 89,193,33,0,9,33 58738 DEFB 0,9,33,7,193,27 58744 DEFB 26,129,33,182,129,33 58750 DEFB 43,129,33,0,9,33 58756 DEFB 179,193,33,58,193,33 58762 DEFB 4,129,29,180,129,33 58768 DEFB 63,129,33,54,129,33 58774 DEFB 62,129,33 58777 DEFB 255 ; End Marker ; Facing right, falling, arms to sides 58778 DEFB 244,2 ; Set current graphic set to 2 58780 DEFB 250,2,1 ; Change cursor's x- and y-coordinates by +1 and +2 characters respectively 58783 DEFB 188,1,33,189,65,33 58789 DEFB 190,65,33,2,7,28 58795 DEFB 6,1,33,191,65,161 58801 DEFB 192,65,161,193,65,161 58807 DEFB 186,1,28,7,65,161 58813 DEFB 194,65,161,195,65,161 58819 DEFB 0,9,33,187,1,27 58825 DEFB 4,1,33,58,65,161 58831 DEFB 179,65,33,0,9,33 58837 DEFB 43,1,28,62,1,33 58843 DEFB 54,1,33,63,1,33 58849 DEFB 180,1,33 58852 DEFB 255 ; End Marker ; Facing left, falling, arms to sides 58853 DEFB 244,2 ; Set current graphic set to 2 58855 DEFB 250,2,1 ; Change cursor's x- and y-coordinates by +1 and +2 characters respectively 58858 DEFB 2,135,33,190,193,33 58864 DEFB 189,193,33,188,193,29 58870 DEFB 186,193,33,193,193,33 58876 DEFB 192,193,33,191,193,33 58882 DEFB 6,129,28,187,129,33 58888 DEFB 0,9,33,195,193,33 58894 DEFB 194,193,33,7,193,29 58900 DEFB 43,129,33,0,9,33 58906 DEFB 179,193,33,58,193,33 58912 DEFB 4,129,29,180,129,33 58918 DEFB 63,129,33,54,129,33 58924 DEFB 62,129,33 58927 DEFB 255 ; End Marker ; Being thrown right 58928 DEFB 244,2 ; Set current graphic set to 2 58930 DEFB 109,1,34,215,7,33 58936 DEFB 215,7,28,110,1,33 58942 DEFB 111,65,33,112,65,33 58948 DEFB 98,65,161,99,65,161 58954 DEFB 186,1,33,109,129,26 58960 DEFB 113,1,33,196,65,33 58966 DEFB 197,65,161,0,9,33 58972 DEFB 0,9,33,198,65,33 58978 DEFB 111,193,33,110,129,26 58984 DEFB 7,65,33,0,9,33 58990 DEFB 0,9,33,0,9,33 58996 DEFB 115,193,33,114,1,33 59002 DEFB 113,129,25,199,1,33 59008 DEFB 74,65,161,0,9,33 59014 DEFB 0,9,33,0,9,33 59020 DEFB 34,1,27,77,1,33 59026 DEFB 71,1,33,200,1,33 59032 DEFB 201,1,33,202,65,161 59038 DEFB 156,193,31,160,129,33 59044 DEFB 159,129,33 59047 DEFB 255 ; End Marker ; Being thrown left 59048 DEFB 244,2 ; Set current graphic set to 2 59050 DEFB 250,0,2 ; Change cursor's x- and y-coordinates by +2 and 0 characters respectively 59053 DEFB 215,135,33,215,135,34 59059 DEFB 109,129,27,109,1,33 59065 DEFB 186,129,33,99,193,33 59071 DEFB 98,193,33,112,193,33 59077 DEFB 111,193,33,110,129,25 59083 DEFB 110,1,33,111,65,33 59089 DEFB 198,193,33,0,9,33 59095 DEFB 0,9,33,197,193,33 59101 DEFB 196,193,33,113,129,25 59107 DEFB 113,1,33,114,1,33 59113 DEFB 115,65,33,0,9,33 59119 DEFB 0,9,33,0,9,33 59125 DEFB 7,193,28,34,129,33 59131 DEFB 238,3 ; Set Repeat Counter A to 3 59133 DEFB 0,9,33 59136 DEFB 239 ; Decrement Repeat Counter A and loop back to #R59133 if not zero 59137 DEFB 74,193,33,199,129,27 59143 DEFB 156,65,33,202,193,33 59149 DEFB 201,193,33,200,129,33 59155 DEFB 71,129,33,77,129,27 59161 DEFB 159,1,33,160,1,33 59167 DEFB 255 ; End Marker ; Floating / starting to fall, animated 59168 DEFB 251,48,222 ; Process graphic layout data at #R56880 and upon returning, move cursor to base ; coordinates 59171 DEFB 251,87,231 ; Process graphic layout data at #R59223 and upon returning, move cursor to base ; coordinates 59174 DEFB 251,95,231 ; Process graphic layout data at #R59231 and upon returning, move cursor to base ; coordinates 59177 DEFB 250,5,253 ; Change cursor's x- and y-coordinates by -3 and +5 characters respectively 59180 DEFB 40,132,33,39,161,33 59186 DEFB 38,161,33,0,9,33 59192 DEFB 0,9,33,38,33,33 59198 DEFB 39,33,33,40,4,26 59204 DEFB 43,132,33,42,225,33 59210 DEFB 61,1,33,61,129,33 59216 DEFB 42,33,33,43,4,33 59222 DEFB 255 ; End Marker ; Right arm, animated 59223 DEFB 247,3 ; Jump to one of the 3 addresses in the following list, chosen at random: 59225 DEFB 201,224 ; #R57545 (right arm) 59227 DEFB 7,225 ; #R57607 (right arm raised) 59229 DEFB 69,225 ; #R57669 (right arm, walking into or out of screen) ; Right arm, animated 59231 DEFB 247,3 ; Jump to one of the 3 addresses in the following list, chosen at random: 59233 DEFB 232,224 ; #R57576 (left arm) 59235 DEFB 38,225 ; #R57638 (left arm raised) 59237 DEFB 103,225 ; #R57703 (left arm, walking into or out of screen) ; Falling downwards 59239 DEFB 244,2 ; Set current graphic set to 2 59241 DEFB 250,2,0 ; Change cursor's x- and y-coordinates by 0 and +2 characters respectively 59244 DEFB 251,10,225 ; Process graphic layout data at #R57610 and upon returning, move cursor to base ; coordinates 59247 DEFB 250,2,5 ; Change cursor's x- and y-coordinates by +5 and +2 characters respectively 59250 DEFB 251,41,225 ; Process graphic layout data at #R57641 and upon returning, move cursor to base ; coordinates 59253 DEFB 250,2,2 ; Change cursor's x- and y-coordinates by +2 and +2 characters respectively 59256 DEFB 207,1,33,207,129,31 59262 DEFB 185,15,33,185,15,31 59268 DEFB 98,65,161,99,65,157 59274 DEFB 203,1,33,204,65,161 59280 DEFB 0,9,33,0,9,33 59286 DEFB 204,193,161,203,129,27 59292 DEFB 205,1,33,206,65,161 59298 DEFB 201,129,33,201,1,33 59304 DEFB 206,193,161,205,129,33 59310 DEFB 255 ; End Marker ; Lying on floor, animated 59311 DEFB 244,2 ; Set current graphic set to 2 59313 DEFB 250,6,2 ; Change cursor's x- and y-coordinates by +2 and +6 characters respectively 59316 DEFB 251,231,231 ; Process graphic layout data at #R59367 and upon returning, move cursor to base ; coordinates 59319 DEFB 250,5,0 ; Change cursor's x- and y-coordinates by 0 and +5 characters respectively 59322 DEFB 208,1,33,209,65,161 59328 DEFB 183,65,33,183,193,33 59334 DEFB 209,193,33,208,129,26 59340 DEFB 236,2,210,211 ; Modify following instruction to display graphic of random index, chosen from ; 210 and 211 59344 DEFB 210,1,33,212,65,33 59350 DEFB 213,65,35,213,193,33 59356 DEFB 212,193,33 59359 DEFB 236,2,210,211 ; Modify following instruction to display graphic of random index, chosen from ; 210 and 211 59363 DEFB 210,129,33 59366 DEFB 255 ; End Marker ; Stunned eyes, animated 59367 DEFB 238,2 ; Set Repeat Counter A to 2 59369 DEFB 236,4,91,92,214,215 ; Modify following instruction to display graphic of random index, chosen from ; 91, 92, 214 and 215 59375 DEFB 91,15,33 59378 DEFB 239 ; Decrement Repeat Counter A and loop back to #R59375 if not zero 59379 DEFB 255 ; End Marker ; Getting up, frame 1, animated 59380 DEFB 244,2 ; Set current graphic set to 2 59382 DEFB 250,4,2 ; Change cursor's x- and y-coordinates by +2 and +4 characters respectively 59385 DEFB 251,231,231 ; Process graphic layout data at #R59367 and upon returning, move cursor to base ; coordinates 59388 DEFB 250,3,2 ; Change cursor's x- and y-coordinates by +2 and +3 characters respectively 59391 DEFB 207,1,33,207,129,30 59397 DEFB 100,1,35,100,129,26 59403 DEFB 116,1,33,117,1,33 59409 DEFB 118,65,33,119,65,161 59415 DEFB 98,65,161,99,65,161 59421 DEFB 119,193,33,118,193,33 59427 DEFB 117,129,33,116,129,23 59433 DEFB 120,1,33,121,1,33 59439 DEFB 122,1,33,216,65,33 59445 DEFB 125,65,33,125,193,33 59451 DEFB 216,193,33,122,129,33 59457 DEFB 121,129,33,120,129,33 59463 DEFB 255 ; End Marker ; Getting up, frame 2 / banging head 59464 DEFB 244,2 ; Set current graphic set to 2 59466 DEFB 250,1,0 ; Change cursor's x- and y-coordinates by 0 and +1 characters respectively 59469 DEFB 251,10,225 ; Process graphic layout data at #R57610 and upon returning, move cursor to base ; coordinates 59472 DEFB 250,1,5 ; Change cursor's x- and y-coordinates by +5 and +1 characters respectively 59475 DEFB 251,41,225 ; Process graphic layout data at #R57641 and upon returning, move cursor to base ; coordinates 59478 DEFB 250,1,2 ; Change cursor's x- and y-coordinates by +2 and +1 characters respectively 59481 DEFB 207,1,33,207,129,31 59487 DEFB 214,15,33,214,15,31 59493 DEFB 94,65,161,95,65,159 59499 DEFB 0,9,33,0,9,29 59505 DEFB 4,1,33,48,65,161 59511 DEFB 49,65,161,49,193,161 59517 DEFB 48,193,161,4,129,27 59523 DEFB 53,1,33,54,1,33 59529 DEFB 53,129,33,53,1,33 59535 DEFB 54,129,33,53,129,33 59541 DEFB 255 ; End Marker ; Unused b59542 DEFB 175 ; Unused routine ; ; This routine appears to have been set up to load visual data into the Display and Attribute files and then to load ; the game code and data into RAM, from address #R27000 onwards. This routine was probably used during development. ; Input: A New value for system variable DF SZ c59543 LD (23659),A ; Set System Variable DF SZ to value in A 59546 LD DE,6912 ; Set data length to 6912 59549 LD IX,40000 ; Set base address for load to 40000 59553 LD A,255 ; Load A with 255 to denote a data block 59555 SCF ; Set Carry Flag as we are LOADing, not VERIFYing 59556 CALL 1366 ; Call ROM routine to load game data 59559 LD HL,40000 ; Copy data just loaded to Display File / Attribute File... 59562 LD DE,16384 ; ... 59565 LD BC,6912 ; ... 59568 LDIR ; ... 59570 LD DE,32860 ; Set data length to 32860 59573 LD IX,27000 ; Set base address for load to 27000 59577 LD A,255 ; Load A with 255 to denote a data block 59579 SCF ; Set Carry Flag as we are LOADing, not VERIFYing 59580 CALL 1366 ; Call ROM routine to load game data 59583 JP 34200 ; Jump to code entry point ; Unused b59586 DEFB 0,0,0,0,0,0,0,0 59594 DEFB 0,0,0,0,0,0,0 ; If Current Character is in Same Room as Target Entity at IX then Set Pending Sound to A ; ; If the requested sound has a lower index than the sound already pending then the requested sound overrides the ; pending sound (i.e. lower index has higher priority). Input: A Index of requested sound IX Address of complex ; state data for target entity c59601 PUSH AF ; Store AF (A = index of requested sound) 59602 LD A,(34218) ; If current character's current room is the same as current room of target entity... 59605 CP (IX+0) ; ... 59608 JR Z,59612 ; ...then skip ahead to #R59612 59610 POP AF ; Restore AF (A = index of requested sound) 59611 RET ; Return *59612 POP AF ; Restore AF (A = index of requested sound) ; At this point, A will hold the index of a requested sound, and RAM address #R34273 will contain the index of a ; pending sound. If the index of the requested sound is lower than the index of the pending sound, then the pending ; sound's index at #R34273 will be overwritten by the index of the requested sound in A. Sounds with lower indices ; therefore take priority over sounds with higher indices. This entry point is used by the routines at #R46284, ; #R55196 and #R59722. *59613 OR A ; If index of requested sound is zero... 59614 RET Z ; ...then return 59615 PUSH DE ; Store DE 59616 LD E,A ; Load E with index of requested sound 59617 LD A,(34273) ; Load index of pending sound into A... 59620 OR A ; ...and if this is zero (i.e. no sound pending)... 59621 JR Z,59628 ; ...then skip ahead to #R59628 59623 CP E ; If index of requested sound is less than or equal to index of pending sound... 59624 JR NC,59628 ; ...then skip ahead to #R59628 59626 POP DE ; Restore DE 59627 RET ; Return *59628 LD A,E ; Set requested sound to be new pending sound... 59629 LD (34273),A ; ... 59632 POP DE ; Restore DE 59633 RET ; Return ; Table of Sound Parameters ; ; #TABLE(default,centre,:w) ; { =h Offset | =h Meaning } ; { 0 | Index (unused) } ; { 1 | Outer repeat counter } ; { 2 | Inner repeat counter } ; { 3 | Delay constant (controls speed, higher value is slower) } ; { 4 | Delay constant (controls speed / pitch, higher value is slower / lower) } ; { 5 | Increment for delay constant D } ; { 6 | Increment for delay constant E } ; { 7 | Most significant byte of pseudo-random address plus No Pause Flag } ; TABLE# b59634 DEFB 1,4,168,29,167,254,3,1 ; (01) - Out of time 59642 DEFB 2,3,160,57,6,1,0,128 ; (02) - Main Menu sound (three blips) 59650 DEFB 3,15,141,214,46,1,253,128 ; (03) - Unused 59658 DEFB 4,1,40,82,59,253,1,6 ; (04) - Explosion 59666 DEFB 5,1,84,93,115,4,251,11 ; (05) - Berk landing 59674 DEFB 6,1,190,58,25,0,250,128 ; (06) - Berk/Drutt banging head on ceiling 59682 DEFB 7,1,30,180,12,0,252,128 ; (07) - Spider sound 59690 DEFB 8,1,134,55,58,251,4,128 ; (08) - Drutt eating a worm 59698 DEFB 9,1,10,60,187,253,247,128 ; (09) - Drutt hopping 59706 DEFB 10,1,68,160,79,254,254,128 ; (10) - Unused 59714 DEFB 11,1,122,123,102,205,0,128 ; (11) - Unused ; Set Sound of Index A as Pending if Appropriate, then Play and Clear Pending Sound ; ; The sound with index A will become the pending sound if the currently pending sound index is either zero, or of ; higher index than A (i.e. lower priority). Input: A Sound index L Undefined, pseudo-random value c59722 CALL 59613 ; Set pending sound index to A if it is currently zero, or lower priority ; This entry point is used by the routine at #R34438. *59725 LD A,(34273) ; Load index of pending sound into A... 59728 OR A ; ...and if this is zero... 59729 RET Z ; ...then return 59730 DEC A ; Decrease A to give zero-based sound index 59731 PUSH IX ; Store IX 59733 LD IX,59635 ; Point IX at second byte of first entry in Sound Parameters Table 59737 ADD A,A ; Multiply sound index by eight... 59738 ADD A,A ; ...as sound data entries in table at #R59634 are eight bytes wide... 59739 ADD A,A ; ... 59740 LD C,A ; ...and load into BC... 59741 LD B,0 ; ... 59743 ADD IX,BC ; Add BC to IX as offset to point to sound data for pending sound 59745 LD A,B ; Set index of pending sound to zero... 59746 LD (34273),A ; ... 59749 LD C,(IX+0) ; Load outer repeat count into C *59752 LD B,(IX+1) ; Load inner repeat count into B 59755 LD E,(IX+2) ; Load delay constant E into E 59758 LD D,(IX+3) ; Load delay constant D into D 59761 LD H,(IX+6) ; Load most significant byte of pseudo-random address into H *59764 PUSH BC ; Store BC (B = inner repeat count, C = outer repeat count) 59765 LD A,(34217) ; Load current border colour into A 59768 SET 4,A ; Set Speaker Bit 59770 OUT (254),A ; Write Speaker Bit and border colour to Port 254 59772 LD B,D ; Apply delay based upon delay constant D... *59773 NOP ; ... 59774 DJNZ 59773 ; ... 59776 BIT 7,H ; If No Pause Flag is set... 59778 JR NZ,59794 ; ...then skip ahead to #R59794 59780 LD B,(HL) ; Load B with value from pseudo-random address 59781 INC HL ; Advance HL *59782 BIT 0,(IX+0) ; Do nothing (pause) for period B... 59786 NOP ; ... 59787 NOP ; ... 59788 NOP ; ... 59789 NOP ; ... 59790 NOP ; ... 59791 NOP ; ... 59792 DJNZ 59782 ; ... *59794 RES 4,A ; Reset Speaker Bit 59796 OUT (254),A ; Write Speaker Bit and border colour to Port 254 59798 LD B,E ; Do nothing for E cycles... *59799 NOP ; ... 59800 DJNZ 59799 ; ... 59802 LD A,(IX+4) ; Adjust value of delay constant D... 59805 ADD A,D ; ... 59806 LD D,A ; ... 59807 LD A,(IX+5) ; Adjust value of delay constant E... 59810 ADD A,E ; ... 59811 LD E,A ; ... 59812 POP BC ; Restore BC (B = inner repeat count, C = outer repeat count) 59813 DJNZ 59764 ; Loop back to #R59764 59815 DEC C ; Decrease outer repeat count 59816 JR NZ,59752 ; If non-zero (i.e. more repeats to process) then loop back to #R59752 59818 POP IX ; Restore IX 59820 RET ; Return ; Table of Initial-State Data for Complex Entities ; ; This table is used to store the initial states of the various entities in the game, so that they can be reset when ; a new game is started. b59821 DEFB 49,50,51,52,53,54,55,56,57,48 ; Do nothing ; ; Used by the routine at #R34428 c59831 RET ; Return ; Unused s59832 DEFS 1480 ; Display Buffer 1 ; ; Three bytes per entry, 32 x 22 entries, one for each cell of Attribute File within play area. Bytes are in order: b61312 DEFB 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 61408 DEFB 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 61504 DEFB 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 61600 DEFB 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 61696 DEFB 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 61792 DEFB 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 61888 DEFB 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 61984 DEFB 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 62080 DEFB 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 62176 DEFB 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 62272 DEFB 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 62368 DEFB 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 62464 DEFB 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 62560 DEFB 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 62656 DEFB 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 62752 DEFB 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 62848 DEFB 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 62944 DEFB 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ; Load loading screen and main game code The following instructions set the system variable DF SZ to zero. This ; prevents a press of the break key returning us to basic while the game is loading. c63000 XOR A ; Set system variable DF SZ to zero 63001 LD (23659),A ; 63004 LD DE,6912 ; Load loading screen to 40000 and copy into Display File 63007 LD IX,40000 ; 63011 LD A,255 ; 63013 SCF ; 63014 CALL 1366 ; 63017 LD HL,40000 ; 63020 LD DE,16384 ; 63023 LD BC,6912 ; 63026 LDIR ; 63028 LD DE,32860 ; Load 32860 bytes to 27000 63031 LD IX,27000 ; 63035 LD A,255 ; 63037 SCF ; 63038 CALL 1366 ; 63041 JP 34200 ; Jump to start-up code ; The remaining display buffer #1 bytes s63044 DEFB 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 63136 DEFB 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 63232 DEFB 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 63328 DEFB 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ; Display Buffer 2 ; ; Three bytes per entry, 32 x 22 entries, one for each cell of Attribute File within play area. Bytes are in order: b63424 DEFB 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 63520 DEFB 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 63616 DEFB 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 63712 DEFB 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 63808 DEFB 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 63904 DEFB 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 64000 DEFB 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 64096 DEFB 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 64192 DEFB 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 64288 DEFB 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 64384 DEFB 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 64480 DEFB 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 64576 DEFB 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 64672 DEFB 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 64768 DEFB 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 64864 DEFB 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 64960 DEFB 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 65056 DEFB 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 65152 DEFB 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 65248 DEFB 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 65344 DEFB 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 65440 DEFB 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0