Routines |
Prev: 95B8 | Up: Map | Next: 967A |
Used by the routine at CAST_S.
|
||||
routine06 | 95C7 | CALL CLS | call CLS | |
95CA | CALL set_IM2_mode | switch to interrupt mode 2 | ||
95CD | CALL routine50 | call routine50 ??? | ||
95D0 | HALT | do nothing for two video frames | ||
95D1 | HALT | |||
95D2 | LD A,$00 | set current_player to zero | ||
95D4 | LD (current_player),A | |||
routine06_0 | 95D7 | LD HL,unknown_table_3 | set HL to address of unknown_table_3 | |
95DA | LD A,(current_player) | add current_player to address as offset | ||
95DD | LD D,$00 | |||
95DF | LD E,A | |||
95E0 | ADD HL,DE | |||
95E1 | LD A,(HL) | load at HL into A | ||
95E2 | BIT 4,(HL) | if bit 4 is set then jump to routine06_6 ??? | ||
95E4 | JP NZ,routine06_6 | |||
95E7 | CALL routine12 | else call routine12 ??? | ||
95EA | CALL get_player_controlled_flag | if player is computer controlled then jump to routine08 | ||
95ED | OR A | |||
95EE | JP NZ,routine08 | |||
95F1 | LD HL,cast_table | else set HL to the sixteen byte table used by CAST_S ??? and add current_player as an offset ??? | ||
95F4 | LD D,$00 | |||
95F6 | LD A,(current_player) | |||
95F9 | LD E,A | |||
95FA | ADD HL,DE | |||
95FB | LD A,(HL) | copy byte from table into CURSP | ||
95FC | LD (CURSP),A | |||
95FF | OR A | if zero then jump forward to routine06_6 | ||
9600 | JP Z,routine06_6 | |||
9603 | CALL GETHIS | call GETHIS which updates HISPEL and returns with the address of the player's spell table in HL | ||
9606 | LD B,$13 | set B to 19 as a loop counter | ||
9608 | LD A,(CURSP) | if CURSP equals one then jump forward to routine06_3 | ||
960B | CP $01 | |||
960D | JR Z,routine06_3 | |||
routine06_1 | 960F | LD E,(HL) | load spell number from the address in HL into E | |
9610 | CP E | if the spell number in E is equal to CURSP then jump forward to routine06_2 | ||
9611 | JR NZ,routine06_2 | |||
9613 | LD (HL),$00 | else zero that entry in spell table (two bytes) and jump out of loop to routine06_3 | ||
9615 | JR routine06_3 | |||
routine06_2 | 9617 | INC HL | address to move on two bytes to next spell in player's spell table | |
9618 | INC HL | |||
9619 | DJNZ routine06_1 | loop back to routine06_1 18 times | ||
routine06_3 | 961B | CALL CHAN_C | call CHAN_C ??? | |
961E | CALL display_wizard_spell_range | Display wizard name, the spell being cast, and spell casting range | ||
9621 | CALL wait_key_seed | wait for a keypress | ||
9624 | CALL clear_bottom_row | clear bottom of screen (line 22) | ||
9627 | LD HL,illusion_table | set HL to cast_table+8 (second half of 16 byte table used by CAST_S) ??? | ||
962A | LD D,$00 | add current_player as offset in table | ||
962C | LD A,(current_player) | |||
962F | LD E,A | |||
9630 | ADD HL,DE | |||
9631 | LD A,(HL) | copy byte at offset into unknown02 ??? | ||
9632 | LD (unknown02),A | if byte is non zero then jump forward to routine06_4 | ||
9635 | OR A | |||
9636 | JR NZ,routine06_4 | |||
9638 | CALL get_random | else get a random number from 0 to 9 in A | ||
963B | LD HL,casting_chance | load casting_chance into E, increment it, and compare with random value | ||
963E | LD E,(HL) | |||
963F | INC E | |||
9640 | CP E | |||
9641 | JP M,routine06_4 | if casting_chance + 1 is greater than random value then skip to routine06_4 | ||
9644 | LD A,$00 | else set spell successful flag to zero and skip forward to routine06_5 ??? | ||
9646 | LD (spell_success_flag),A | |||
9649 | JP routine06_5 | |||
routine06_4 | 964C | LD A,$01 | set spell successful flag to one | |
964E | LD (spell_success_flag),A | |||
9651 | LD A,(spell_chaos_law) | add spell_chaos_law to CH_LAW and store result in CH_LAW ??? | ||
9654 | LD HL,CH_LAW | |||
9657 | ADD A,(HL) | |||
9658 | LD (HL),A | |||
routine06_5 | 9659 | LD L,(IX+$05) | load call address for spell from spell table into HL (IX set by earlier call to CHAN_C) | |
965C | LD H,(IX+$06) | |||
965F | LD ($9663),HL | overwrite the address of the following CALL instruction (self modifying code) | ||
spell_cast_function_call | 9662 | CALL creature_cast_spell | call CreatureCast spell | |
routine06_6 | 9665 | CALL clear_bottom_row | clear bottom of screen (line 22) | |
This entry point is used by the routine at routine08.
|
||||
routine06_7 | 9668 | LD HL,STRENG | set HL to address of STRENG and call routine01 ??? | |
966B | CALL routine01 | |||
966E | LD HL,current_player | increment current_player variable | ||
9671 | INC (HL) | |||
9672 | LD A,(NO_PLA) | if current_player equals NO_PLA then return else loop back to routine06_0 | ||
9675 | CP (HL) | |||
9676 | JP NZ,routine06_0 | |||
9679 | RET |
Prev: 95B8 | Up: Map | Next: 967A |