![]() |
Routines |
| Prev: B205 | Up: Map | Next: B339 |
| B258 | PUSH DE | Save DE | ||
| B259 | OR A | is entity facing left? | ||
| B25A | JP NZ,$B2C1 | Jump if so | ||
|
Entity facing right. Computes address of graphic data for entity and address destination on room buffer
|
||||
| B25D | LD A,($A0AF) | Set A to the x-position of entity | ||
| B260 | AND $07 | Set A to the bit position of the entity (bits2-0) | ||
| B262 | LD E,A | Set HL to the address pointer of offset for sprite movement | ||
| B263 | LD D,$00 | |||
| B265 | ADD HL,DE | |||
| B266 | LD E,(HL) | Set DE to the corresponding offset based on the position of the sprite | ||
| B267 | LD D,$00 | |||
| B269 | POP HL | Recover HL (graphics data of the sprite) | ||
| B26A | ADD HL,DE | Set HL to the address of the corresponding sprite based on the offset | ||
| B26B | LD A,($A0AF) | Computes at HL the address into room graphic data buffer for the entity | ||
| B26E | SRL A | |||
| B270 | SRL A | |||
| B272 | SRL A | |||
| B274 | LD ($A0AF),A | |||
| B277 | PUSH HL | |||
| B278 | LD A,($A0B0) | |||
| B27B | LD L,A | |||
| B27C | LD H,$00 | |||
| B27E | ADD HL,HL | |||
| B27F | ADD HL,HL | |||
| B280 | ADD HL,HL | |||
| B281 | ADD HL,HL | |||
| B282 | ADD HL,HL | |||
| B283 | LD DE,$E8FF | |||
| B286 | ADD HL,DE | |||
| B287 | LD A,($A0AF) | |||
| B28A | LD E,A | |||
| B28B | LD D,$00 | |||
| B28D | ADD HL,DE | |||
| B28E | EX DE,HL | Exchange DE and HL | ||
| B28F | POP HL | Recover HL (the address of the corresponding sprite based on the offset) | ||
| B290 | PUSH DE | Save DE | ||
| B291 | LD A,($A0B1) | Set A to the width of the sprite (in bytes) | ||
| B294 | LD ($B2B0),A | Configure LD opcode at B2AB to set B register to the width of the sprite | ||
| B297 | LD A,($A0B2) | Set A to the height of the sprite (in pixels) | ||
| B29A | LD ($B2AC),A | Configure LD opcode at B2AF to set B register to the height of the sprite | ||
| B29D | EX DE,HL | Exchange DE and HL | ||
| B29E | LD A,($A033) | Check bit for Graphic Data Select | ||
| B2A1 | BIT 7,A | |||
| B2A3 | JP Z,$B2AA | Jump if graphic data is based in animation offsets | ||
| B2A6 | LD DE,($A034) | Set DE to the graphic data for static (non animated) sprite | ||
|
Entity facing right. Draw entity (enemy, object or Rex)
|
||||
| B2AA | POP HL | Restore HL | ||
| B2AB | LD B,$00 | Set B to the width of the sprite | ||
| B2AD | PUSH BC | Save BC and HL | ||
| B2AE | PUSH HL | |||
| B2AF | LD B,$00 | Set B to the height of the sprite | ||
| B2B1 | LD A,(DE) | Set A to the graphic data to copy | ||
| B2B2 | OR (HL) | Blend the graphic data with the graphic data on the room | ||
| B2B3 | LD (HL),A | Copy graphics data to the room buffer | ||
| B2B4 | INC DE | Increment sprite graphic data and room graphic data destination | ||
| B2B5 | INC HL | |||
| B2B6 | DJNZ $B2B1 | Jump back if the are more sprite rows o draw | ||
| B2B8 | POP HL | Restore HL | ||
| B2B9 | LD BC,$0020 | Increment one row for the room graphic data | ||
| B2BC | ADD HL,BC | |||
| B2BD | POP BC | Restore BC | ||
| B2BE | DJNZ $B2AD | Jump back until all rows drawn | ||
| B2C0 | RET | |||
|
Entity facing left. Computes address of graphic data for entity and address destination on room buffer
|
||||
| B2C1 | LD A,($A0AF) | Set A to the x-position | ||
| B2C4 | LD DE,$0007 | Set HL to point to the last byte of the offset animation | ||
| B2C7 | ADD HL,DE | |||
| B2C8 | AND $07 | And substract the position bit2-0 for the sprite x-position to point to the correspondent offset | ||
| B2CA | LD E,A | |||
| B2CB | LD D,$00 | |||
| B2CD | AND A | |||
| B2CE | SBC HL,DE | |||
| B2D0 | LD E,(HL) | Set DE to the offset animation value | ||
| B2D1 | LD D,$00 | |||
| B2D3 | POP HL | Recover HL (address pointer for graphic data of sprite) | ||
| B2D4 | ADD HL,DE | And adds the offset | ||
| B2D5 | LD A,($A0AF) | Computes at HL the address into room graphic data buffer for the entity | ||
| B2D8 | SRL A | |||
| B2DA | SRL A | |||
| B2DC | SRL A | |||
| B2DE | LD ($A0AF),A | |||
| B2E1 | PUSH HL | |||
| B2E2 | LD A,($A0B0) | |||
| B2E5 | LD L,A | |||
| B2E6 | LD H,$00 | |||
| B2E8 | ADD HL,HL | |||
| B2E9 | ADD HL,HL | |||
| B2EA | ADD HL,HL | |||
| B2EB | ADD HL,HL | |||
| B2EC | ADD HL,HL | |||
| B2ED | LD DE,$E8FF | |||
| B2F0 | ADD HL,DE | |||
| B2F1 | LD A,($A0AF) | |||
| B2F4 | LD E,A | |||
| B2F5 | LD D,$00 | |||
| B2F7 | ADD HL,DE | |||
| B2F8 | EX DE,HL | Exchange DE an HL | ||
| B2F9 | POP HL | Restore HL | ||
| B2FA | PUSH DE | Save DE | ||
| B2FB | LD A,($A0B1) | Set A to the width of the sprite (in bytes) | ||
| B2FE | LD ($B31C),A | Configure LD opcode at B317 to set B register to the width of the sprite | ||
| B301 | LD A,($A0B2) | Set A to the height of the sprite (in pixels) | ||
| B304 | LD ($B318),A | Configure LD opcode at B31B to set B register to the height of the sprite | ||
| B307 | EX DE,HL | Exchange DE and HL | ||
| B308 | LD A,($A033) | Check bit for Graphic Data Select | ||
| B30B | BIT 7,A | |||
| B30D | JP Z,$B314 | Jump if graphic data is based in animation offsets | ||
| B310 | LD DE,($A034) | Set DE to the graphic data for static (non animated) sprite | ||
|
Entity facing left. Draw entity (enemy, object or Rex)
|
||||
| B314 | POP HL | Restore HL (address pointer to room graphic buffer) | ||
| B315 | INC HL | Increment address pointer to draw backwards from here | ||
| B316 | INC HL | |||
| B317 | LD B,$00 | Set B to the width of the sprite | ||
| B319 | PUSH BC | Save BC and REGhl | ||
| B31A | PUSH HL | |||
| B31B | LD B,$00 | Set B to the height of the sprite | ||
| B31D | LD A,(DE) | Set A to the byte of the graphic data | ||
| B31E | PUSH DE | Save DE and HL | ||
| B31F | PUSH HL | |||
| B320 | LD E,A | Point graphic value into Invert byte lookup table | ||
| B321 | LD D,$00 | |||
| B323 | LD HL,$AD5D | |||
| B326 | ADD HL,DE | |||
| B327 | LD A,(HL) | Set A to the corresponent inverted byte | ||
| B328 | POP HL | Restore HL and DE | ||
| B329 | POP DE | |||
| B32A | OR (HL) | Blend byte with graphic data of room | ||
| B32B | LD (HL),A | Set graphic data into room | ||
| B32C | INC DE | Increment address to graphic data | ||
| B32D | DEC HL | Decrement address to room graphic buffer | ||
| B32E | DJNZ $B31D | Jump back until the row is completed | ||
| B330 | POP HL | Restore HL | ||
| B331 | LD BC,$0020 | Add one row to the address pointer for the room graphic data | ||
| B334 | ADD HL,BC | |||
| B335 | POP BC | Restore BC | ||
| B336 | DJNZ $B319 | Jump back until all the rows has been draw | ||
| B338 | RET | |||
| Prev: B205 | Up: Map | Next: B339 |