![]() |
Routines |
| Prev: 53836 | Up: Map | Next: 54028 |
|
Used by the routines at Primary_Enemy_Entity_Handler, Handle_Homing_Enemy, Handle_Horizontal_Enemy_Entity, Process_Tracked_Enemy_Entity, Process_Cluster_Entity, Process_Player_Tracking_Enemy, Process_Wall_Bouncing_Enemy and Process_Final_Phase_Enemy_Entity.
Player-death transition. Strips the paper and bright bits from every attribute cell in the attribute area (22528–23295), keeping only the ink colour, then calls Fade_Screen to fade the screen pixel data to black with a flashing border effect. On return, two levels of call stack are discarded via back-to-back POP DE, aborting the current game-loop callers and returning to the outer death-handling code.
|
||||
| Strip_Attributes_And_Fade | 53948 | LD HL,22528 | Point HL to the start of the attribute area at 22528. | |
| 53951 | LD B,7 | Load the ink-colour mask 7 into B. | ||
| Strip_Attributes_Loop | 53953 | LD A,(HL) | Mask out the paper and bright bits from the current attribute cell. | |
| 53954 | AND B | |||
| 53955 | LD (HL),A | |||
| 53956 | INC HL | Advance to the next cell and loop until the end of the attribute area at 23296. | ||
| 53957 | LD A,H | |||
| 53958 | CP 91 | |||
| 53960 | JP NZ,Strip_Attributes_Loop | |||
| 53963 | CALL Fade_Screen | Call the screen fade routine at Fade_Screen. | ||
| 53966 | POP DE | Discard two return addresses from the stack and return to the outer death handler. | ||
| 53967 | POP DE | |||
| 53968 | RET | |||
|
Screen fade: AND-masks the entire pixel area in 20 passes, cycling the border between black and white on each pass to create a flash effect.
|
||||
| Fade_Screen | 53969 | LD B,20 | Set the fade pass counter to 20. | |
| 53971 | LD HL,0 | Initialise the pixel mask pointer to 0. | ||
| Fade_Screen_Outer_Loop | 53974 | PUSH HL | Stash the mask pointer and point DE to the start of the pixel area at 16384. | |
| 53975 | LD DE,16384 | |||
| Fade_Screen_Inner_Loop | 53978 | LD A,(DE) | AND each pixel byte with the corresponding mask byte; loop across the current 256-byte row until E wraps. | |
| 53979 | AND (HL) | |||
| 53980 | LD (DE),A | |||
| 53981 | INC DE | |||
| 53982 | INC HL | |||
| 53983 | LD A,E | |||
| 53984 | AND A | |||
| 53985 | JR NZ,Fade_Screen_Inner_Loop | |||
| 53987 | LD A,0 | Set the border to black ( BLACK) via port 254. | ||
| 53989 | OUT (254),A | |||
| 53991 | LD A,B | Scale the pass counter for the delay loop duration. | ||
| 53992 | SLA A | |||
| 53994 | SLA A | |||
| Fade_Screen_Black_Delay | 53996 | DEC A | Busy-wait for the black border period. | |
| 53997 | JR NZ,Fade_Screen_Black_Delay | |||
| 53999 | LD A,24 | Load the white border value 24. | ||
| 54001 | AND %00011000 | Mask to border bits only. | ||
| 54003 | OUT (254),A | Set the border to white via port 254. | ||
| 54005 | LD A,B | Scale the pass counter for the second delay loop duration. | ||
| 54006 | SLA A | |||
| 54008 | SLA A | |||
| Fade_Screen_White_Delay | 54010 | DEC A | Busy-wait for the white border period. | |
| 54011 | JR NZ,Fade_Screen_White_Delay | |||
| 54013 | LD A,D | Continue masking screen rows until the full pixel area (16384– 22527) has been processed. | ||
| 54014 | CP 88 | |||
| 54016 | JR NZ,Fade_Screen_Inner_Loop | |||
| 54018 | POP HL | Restore the mask pointer, advance the mask page, and repeat for the next fade pass. | ||
| 54019 | INC H | |||
| 54020 | DJNZ Fade_Screen_Outer_Loop | |||
| 54022 | RET | Return. | ||
|
Restore the border colour to white after the fade.
|
||||
| Restore_Border_White | 54023 | LD A,7 | Set the border to white ( WHITE) via port 254 and return. | |
| 54025 | OUT (254),A | |||
| 54027 | RET | |||
| Prev: 53836 | Up: Map | Next: 54028 |