Dun Darach | Routines |
Prev: 811A | Up: Map |
Used by the routine at _79b7.
|
|||||||
Check for new day
|
|||||||
Game_Main | 8121 | LD HL,Flag_dayNight | |||||
8124 | BIT 5,(IY+$3F) | FRAMES + 1 | |||||
8128 | JR NZ,Game_Main_0 | ||||||
812A | LD A,(HL) | ||||||
812B | AND A | ||||||
812C | JR Z,Game_Main_1 | ||||||
812E | LD (HL),$00 | Reset to nighttime. | |||||
8130 | LD HL,BankAccountLow | Add 1% to bank account. | |||||
8133 | LD DE,BankAccountMid | ||||||
8136 | CALL ValueAddAsBCDCarry | ||||||
8139 | CALL Search_NonZero | Look for digit that is not zero. | |||||
Data for non-zero search, the address of which gets put onto stack in above call.
|
|||||||
813C | DEFW BankAccountLow | ||||||
813E | DEFB $04 | ||||||
Above call returns to here.
|
|||||||
813F | CALL NZ,Inv_Update | Display value if there is money in account. | |||||
8142 | JR Game_Main_1 | ||||||
Game_Main_0 | 8144 | LD (HL),$01 | Reset to daytime. | ||||
Message display countdown.
|
|||||||
Game_Main_1 | 8146 | LD A,(Msg_CountDown) | See if a message is still on display. | ||||
8149 | AND A | ||||||
814A | JR Z,Game_Main_2 | ||||||
814C | DEC A | Countdown and skip if not the end. | |||||
814D | LD (Msg_CountDown),A | ||||||
8150 | JR NZ,Game_Main_2 | ||||||
8152 | CALL Block_ClearMem | Clear the message from the screen. | |||||
8155 | DEFW ATTR_Message | Parameters for block copy. | |||||
8157 | DEFB $19 | ||||||
Game_Main_2 | 8158 | LD A,(Flag_DoorEntry) | See if player is going through a door. | ||||
815B | BIT 0,A | ||||||
815D | JP NZ,Door_HandleEntry | ||||||
8160 | LD A,(Hero_ArrestCount) | See if an arrest is in progress. | |||||
8163 | AND A | ||||||
8164 | JP NZ,Hero_Arrest | ||||||
8167 | LD A,(Offer_Count) | See if an offer is in progress and handle it. | |||||
816A | AND A | ||||||
816B | JP NZ,Offer_Handle | ||||||
816E | LD A,(Skar_ShowCount) | See if Skar is being viewed on the Telestone. | |||||
8171 | AND A | ||||||
8172 | JP NZ,Skar_View | ||||||
8175 | CALL Keyboard_Handle | ||||||
Enter
|
|||||||
8178 | LD A,(KeyCmd_Enter) | ||||||
817B | AND A | ||||||
817C | CALL NZ,Action_Enter | ||||||
817F | LD A,(Hero_Frame) | ||||||
8182 | CP $10 | ||||||
8184 | JR NZ,Game_Main_3 | ||||||
8186 | LD A,(Mode_Demo) | ||||||
8189 | AND A | ||||||
818A | JR Z,Game_Main_3 | ||||||
818C | OR $08 | ||||||
818E | LD (KeyCmd),A | ||||||
Game_Main_3 | 8191 | LD A,(KeyCmd) | |||||
8194 | AND $0C | ||||||
8196 | JR Z,Game_Main_6 | ||||||
8198 | LD A,($BB2D) | ||||||
819B | AND $0C | ||||||
819D | JP NZ,Stage_Draw | ||||||
81A0 | LD A,(KeyCmd) | ||||||
81A3 | LD ($BB2D),A | ||||||
81A6 | AND $0C | ||||||
81A8 | CP $0C | ||||||
81AA | JP Z,Stage_Draw | ||||||
Rotate Camera
|
|||||||
81AD | BIT 2,A | ||||||
81AF | JR Z,Game_Main_4 | ||||||
81B1 | LD A,(Camera_Compass) | ||||||
81B4 | INC A | ||||||
81B5 | JR Game_Main_5 | ||||||
Game_Main_4 | 81B7 | LD A,(Camera_Compass) | |||||
81BA | DEC A | ||||||
Game_Main_5 | 81BB | AND $03 | |||||
81BD | LD (Camera_Compass),A | ||||||
81C0 | JP Room_Initialise | ||||||
Actions
|
|||||||
Game_Main_6 | 81C3 | LD A,(KeyCmd) | |||||
81C6 | AND $F0 | ||||||
81C8 | JR Z,Game_Main_9 | ||||||
81CA | LD A,($BB2D) | ||||||
81CD | AND $70 | ||||||
81CF | JR NZ,Game_Main_9 | ||||||
81D1 | LD A,(KeyCmd) | ||||||
81D4 | BIT 7,A | ||||||
81D6 | JR Z,Game_Main_7 | ||||||
81D8 | LD A,($BB2D) | ||||||
81DB | BIT 7,A | ||||||
81DD | JR NZ,Game_Main_7 | ||||||
81DF | CALL Inv_SelectNext | ||||||
81E2 | JR Game_Main_9 | ||||||
Game_Main_7 | 81E4 | LD A,(KeyCmd) | |||||
81E7 | LD ($BB2D),A | ||||||
81EA | BIT 4,A | ||||||
81EC | CALL NZ,Offer_Action | ||||||
81EF | LD A,(Offer_Count) | ||||||
81F2 | AND A | ||||||
81F3 | JP NZ,Game_Main_29 | ||||||
81F6 | LD A,(KeyCmd) | ||||||
81F9 | AND $60 | ||||||
81FB | CP $60 | ||||||
81FD | JR Z,Game_Main_9 | ||||||
81FF | BIT 5,A | ||||||
8201 | JR Z,Game_Main_8 | ||||||
8203 | CALL Hero_PickUp | ||||||
8206 | JR Game_Main_9 | ||||||
Game_Main_8 | 8208 | BIT 6,A | |||||
820A | CALL NZ,Hero_Drop | ||||||
Game_Main_9 | 820D | LD A,(KeyCmd) | |||||
8210 | LD ($BB2D),A | ||||||
8213 | LD A,(Hero_Frame) | Check for key frames | |||||
8216 | LD HL,_811a | ||||||
8219 | LD BC,$0007 | ||||||
821C | CPIR | ||||||
821E | JP NZ,Game_Main_25 | ||||||
8221 | LD HL,(Coords_EW) | Get coords for axis of movement along with offset for movement. | |||||
8224 | LD DE,$0007 | ||||||
8227 | LD A,(Camera_Compass) | ||||||
822A | BIT 0,A | ||||||
822C | JR Z,Game_Main_10 | ||||||
822E | LD HL,(Coords_NS) | ||||||
Game_Main_10 | 8231 | BIT 1,A | |||||
8233 | JR Z,Game_Main_11 | ||||||
8235 | LD DE,$FFF9 | ||||||
Game_Main_11 | 8238 | LD A,(KeyCmd) | Mask out movement keys, Making sure only one key is pressed. | ||||
823B | AND $03 | ||||||
823D | CP $03 | ||||||
823F | JR NZ,Game_Main_12 | ||||||
8241 | XOR A | ||||||
Game_Main_12 | 8242 | LD (TempAl),A | |||||
8245 | LD A,(Hero_Frame) | ||||||
8248 | CP $04 | ||||||
824A | JP Z,Game_Main_20 | ||||||
824D | CP $0B | ||||||
824F | JP Z,Game_Main_20 | ||||||
8252 | CP $07 | ||||||
8254 | JP Z,Game_Main_25 | ||||||
8257 | CP $0E | ||||||
8259 | JP Z,Game_Main_25 | ||||||
825C | LD A,(TempAl) | Get movement key pressed. | |||||
825F | AND A | ||||||
8260 | JP Z,Game_Main_29 | Skip all if not key pressed. | |||||
8263 | LD BC,(Hero_LastDirection) | Last direction is the same as last key pressed. | |||||
8267 | CP C | ||||||
8268 | JR Z,Game_Main_13 | ||||||
Change of direction.
|
|||||||
826A | LD A,(Hero_Frame) | See if 'standing' frame. | |||||
826D | CP $10 | ||||||
826F | JR NZ,Game_Main_13 | ||||||
8271 | LD A,$13 | Set to 'facing' camera frame. | |||||
8273 | LD (Hero_Frame),A | ||||||
8276 | LD A,(Camera_Compass) | ||||||
8279 | XOR $02 | ||||||
827B | LD (Hero_CompassFacing),A | ||||||
827E | JP Game_Main_29 | ||||||
Game_Main_13 | 8281 | LD A,(TempAl) | |||||
8284 | CP $02 | ||||||
8286 | JR Z,Game_Main_14 | ||||||
8288 | AND A | ||||||
8289 | ADC HL,DE | ||||||
828B | JR Game_Main_15 | ||||||
Game_Main_14 | 828D | SBC HL,DE | |||||
Game_Main_15 | 828F | JP M,Game_Main_18 | |||||
8292 | JR Z,Game_Main_18 | ||||||
8294 | LD E,L | ||||||
8295 | LD D,H | ||||||
8296 | LD IX,(Hero_PathPtr) | ||||||
829A | LD L,(IX+$02) | ||||||
829D | LD H,(IX+$03) | ||||||
82A0 | SCF | ||||||
82A1 | SBC HL,DE | ||||||
82A3 | JP NC,Game_Main_16 | ||||||
82A6 | LD L,(IX+$04) | ||||||
82A9 | LD H,(IX+$05) | ||||||
82AC | EX DE,HL | ||||||
82AD | SCF | ||||||
82AE | SBC HL,DE | ||||||
82B0 | JP C,Game_Main_18 | ||||||
Game_Main_16 | 82B3 | LD A,(TempAl) | |||||
82B6 | LD (Hero_LastDirection),A | ||||||
82B9 | LD C,$01 | ||||||
82BB | CP $01 | ||||||
82BD | JR Z,Game_Main_17 | ||||||
82BF | LD C,$FF | ||||||
Game_Main_17 | 82C1 | LD A,(Camera_Compass) | |||||
82C4 | ADD A,C | ||||||
82C5 | AND $03 | ||||||
82C7 | LD (Hero_CompassFacing),A | ||||||
82CA | LD A,$10 | ||||||
82CC | LD (Hero_Frame),A | ||||||
82CF | JP Game_Main_29 | ||||||
Game_Main_18 | 82D2 | LD A,(TempAl) | |||||
82D5 | LD (Hero_LastDirection),A | ||||||
82D8 | LD C,$01 | ||||||
82DA | CP $01 | ||||||
82DC | JR Z,Game_Main_19 | ||||||
82DE | LD C,$FF | ||||||
Game_Main_19 | 82E0 | LD A,(Camera_Compass) | |||||
82E3 | ADD A,C | ||||||
82E4 | AND $03 | ||||||
82E6 | LD (Hero_CompassFacing),A | ||||||
82E9 | LD A,(Hero_LastStepFrame) | ||||||
82EC | ADD A,$02 | ||||||
82EE | LD (Hero_Frame),A | ||||||
82F1 | JR Game_Main_28 | ||||||
Game_Main_20 | 82F3 | LD A,(Hero_Frame) | |||||
82F6 | LD (Hero_LastStepFrame),A | ||||||
82F9 | LD A,(Hero_LastDirection) | ||||||
82FC | CP $02 | ||||||
82FE | JR Z,Game_Main_21 | ||||||
8300 | AND A | ||||||
8301 | ADC HL,DE | ||||||
8303 | JR Game_Main_22 | ||||||
Game_Main_21 | 8305 | SBC HL,DE | |||||
Game_Main_22 | 8307 | JP M,Game_Main_23 | |||||
830A | JR Z,Game_Main_23 | ||||||
830C | LD E,L | ||||||
830D | LD D,H | ||||||
830E | LD IX,(Hero_PathPtr) | ||||||
8312 | LD L,(IX+$02) | ||||||
8315 | LD H,(IX+$03) | ||||||
8318 | AND A | ||||||
8319 | SBC HL,DE | ||||||
831B | JR NC,Game_Main_24 | ||||||
831D | LD L,(IX+$04) | ||||||
8320 | LD H,(IX+$05) | ||||||
8323 | EX DE,HL | ||||||
8324 | AND A | ||||||
8325 | SBC HL,DE | ||||||
8327 | JR NC,Game_Main_24 | ||||||
Game_Main_23 | 8329 | LD A,(TempAl) | |||||
832C | LD HL,Hero_LastDirection | ||||||
832F | CP (HL) | ||||||
8330 | JR Z,Game_Main_25 | ||||||
Game_Main_24 | 8332 | LD A,$10 | |||||
8334 | JR Game_Main_27 | ||||||
Game_Main_25 | 8336 | LD A,(Hero_Frame) | |||||
Game_Main_26 | 8339 | INC A | |||||
833A | CP $0F | ||||||
833C | JR NZ,Game_Main_27 | ||||||
833E | LD A,$02 | ||||||
Game_Main_27 | 8340 | CP $01 | |||||
8342 | JR Z,Game_Main_26 | ||||||
8344 | CP $08 | ||||||
8346 | JR Z,Game_Main_26 | ||||||
8348 | LD (Hero_Frame),A | ||||||
Game_Main_28 | 834B | CALL BG_ScrollInDirection | |||||
This entry point is used by the routines at Door_HandleEntry and Hero_Arrest.
|
|||||||
Game_Main_29 | 834E | LD A,(Hero_Frame) | |||||
8351 | JP Stage_Draw_0 |
Prev: 811A | Up: Map |