Prev: CB41 Up: Map Next: CD44
CB77: Configure entity for the current room
Used by the routines at C9E3 and CB41.
Input
IY Address for the object definition of the current room
IX Address for the enemy/object configuration buffer
CB77 LD A,(IY+$00) Set A to the type of static enemy (with reverse bit)
This entry point is used by the routine at CA69.
CB7A LD (IX+$0E),$03 Initialize the width of the sprite (in bytes) to $03
CB7E LD (IX+$0F),$10 Initialize the height of the sprite (in pixels) to $10
CB82 LD (IX+$10),$02 Initialize speed to $02
CB86 LD (IX+$15),$00 Initialize bubble energy to $00
CB8A AND $7F Set to 0 the reverse bit of the type of enemy
CB8C LD (IX+$09),A Initialize the enemy type
CB8F OR A enemy type = $00?
CB90 CALL Z,$CC05 Configure FOOT MAN
CB93 CP $01 enemy type = $01?
CB95 CALL Z,$CC40 Configure CATERPILLAR
CB98 CP $02 enemy type = $02?
CB9A CALL Z,$CC75 Configure DROP
CB9D CP $03 enemy type = $03?
CB9F CALL Z,$CC53 Configure BRAIN
CBA2 CP $04 enemy type = $04?
CBA4 CALL Z,$CC9D Configure PINE
CBA7 CP $05 enemy type = $05?
CBA9 CALL Z,$CCF3 Configure PLANT
CBAC CP $09 enemy type = $09?
CBAE CALL Z,$CCD1 Configure BULB
CBB1 CP $06 enemy type = $06?
CBB3 CALL Z,$CC18 Confgiure FOOT MAN CROUCHED
CBB6 CP $0E enemy type = $0E?
CBB8 CALL Z,$CD15 Configure TRIANGLE
CBBB CP $7C enemy type = $7C?
CBBD CALL Z,$CCBF Configure QUESTION
CBC0 LD (IX+$16),E Save address for graphic data of animated sprite
CBC3 LD (IX+$17),D
CBC6 LD (IX+$0A),L Save address for animation offset
CBC9 LD (IX+$0B),H
CBCC LD A,(IY+$01) Set A to the x-position of sprite
CBCF LD (IX+$00),A Save x-position into enemy configuration buffer
CBD2 LD A,(IY+$02) Set A to the y-position of sprite
CBD5 SLA A Copy bits 7-3 to the y-position for the enemy configuration buffer
CBD7 SLA A
CBD9 SLA A
CBDB LD (IX+$01),A
CBDE LD A,(IY+$00) If bit 7 of enemy type is set then set the reverse sprite indicator in enemy configuration buffer
CBE1 AND $80
CBE3 SRL A
CBE5 SRL A
CBE7 SRL A
CBE9 SRL A
CBEB SRL A
CBED SRL A
CBEF SRL A
CBF1 LD (IX+$02),A
CBF4 LD (IX+$03),$00 Reset FOOT MAN jumping or explosion debris expansion counter
CBF8 LD (IX+$06),$00 Reset FOOT MAN falling
CBFC LD (IX+$0C),$01 Set sprite active (alive)
CC00 LD (IX+$0D),$00 Reset explosion counter
CC04 RET
Configure FOOT MAN
CC05 LD HL,$AF52 Set HL to the offset animation table
CC08 LD (IX+$11),$00 Set state counter to $00
CC0C LD (IX+$12),$00 Set FOOT MAN walking
CC10 LD (IX+$14),$02 Set health to $02
CC14 LD DE,$8198 Set DE to the graphics data for the enemy
CC17 RET
Configure FOOT MAN CROUCHED
CC18 LD HL,$8318 Set address of graphic data for crouched FOOT MAN
CC1B LD (IX+$04),L
CC1E LD (IX+$05),H
CC21 LD (IX+$11),$C8 Set state counter to fixed FOOT MAN crouched
CC25 LD (IX+$12),$01 Set FOOT MAN crouched
CC29 LD (IX+$10),$00 Set enemy stopped
CC2D LD (IX+$0E),$02 Set width of the sprite (in bytes)
CC31 LD (IX+$09),$80 Set graphic data from static sprite & enemy type FOOT MAN
CC35 LD (IX+$14),$02 Set health
CC39 LD HL,$AF52 Set HL to the offset animation table
CC3C LD DE,$8198 Set DE to the graphics data for the enemy
CC3F RET
Configure CATERPILLAR
CC40 LD (IX+$10),$02 Set enemy speed
CC44 LD (IX+$14),$0A Set health to $0A
CC48 LD (IX+$15),$01 Set big energy bubble
CC4C LD HL,$AF52 Set HL to the offset animation table
CC4F LD DE,$8F00 Set DE to the graphics data for the enemy
CC52 RET
Configure BRAIN
CC53 LD (IX+$14),$02 Set health to $02
CC57 LD (IX+$15),$01 Set big energy bubble
CC5B LD (IX+$0E),$02 Set sprite width to 2 bytes
CC5F LD (IX+$11),$00 Set wound state
CC63 LD HL,$8BE0 Set address of graphic data for BRAIN
CC66 LD (IX+$04),L
CC69 LD (IX+$05),H
CC6C LD (IX+$12),$05 Set recover counter
CC70 SET 7,(IX+$09) Set graphics data from static sprite
CC74 RET
Configure DROP
CC75 LD (IX+$14),$02 Set health to $02
CC79 LD (IX+$15),$01 Set big energy bubble
CC7D LD (IX+$0E),$02 Set sprite width to 2 bytes
CC81 LD HL,$8D20 Set address of graphic data for DROP
CC84 LD (IX+$04),L
CC87 LD (IX+$05),H
CC8A LD (IX+$11),$00 Set enemy state to stand-by in ceil
CC8E CALL $A530 Set status change counter a random number between 100 and 227
CC91 AND $7F
CC93 ADD A,$64
CC95 LD (IX+$12),A
CC98 LD (IX+$09),$82 Set graphics data from static sprite
CC9C RET
Configure PINE
CC9D LD (IX+$14),$08 Set health to $08
CCA1 LD (IX+$15),$01 Set big energy bubble
CCA5 LD (IX+$0E),$02 Set sprite width to 2 bytes
CCA9 LD HL,$8FC0 Set address of graphic data for PINE
CCAC LD (IX+$04),L
CCAF LD (IX+$05),H
CCB2 LD (IX+$11),$00 Set movement downwards
CCB6 LD (IX+$12),$00 Set animation state to stand-by
CCBA SET 7,(IX+$09) Set graphics data from static sprite
CCBE RET
Configure QUESTION
CCBF LD HL,$8BC0 Set address of graphic data for QUESTION
CCC2 LD (IX+$04),L
CCC5 LD (IX+$05),H
CCC8 LD (IX+$0E),$02 Set sprite width to 2 bytes
CCCC SET 7,(IX+$09) Set graphics data from static sprite
CCD0 RET
Configure BULB
CCD1 LD HL,$9040 Set address of graphic data for BULB
CCD4 LD (IX+$04),L
CCD7 LD (IX+$05),H
CCDA LD (IX+$0E),$02 Set sprite width to 2 bytes
CCDE LD (IX+$14),$0E Set health to $0E
CCE2 LD (IX+$11),$00 Set state to stand-by
CCE6 LD (IX+$15),$01 Set big energy bubble
CCEA LD (IX+$12),$05 Set state change counter
CCEE SET 7,(IX+$09) Set graphics data from static sprite
CCF2 RET
Configure PLANT
CCF3 LD HL,$8E20 Set address of graphic data for PLANT
CCF6 LD (IX+$04),L
CCF9 LD (IX+$05),H
CCFC LD (IX+$0E),$02 Set sprite width to 2 bytes
CD00 LD (IX+$14),$0C Set health to $0C
CD04 LD (IX+$11),$00 Set enemy state to stand-by
CD08 LD (IX+$15),$01 Set big energy bubble
CD0C LD (IX+$12),$05 Set state change counter
CD10 SET 7,(IX+$09) Set graphics data from static sprite
CD14 RET
Configure TRIANGLE
CD15 LD (IX+$14),$02 Set health to $02
CD19 LD (IX+$06),$00
CD1D LD (IX+$0E),$02 Set sprite width to 2 bytes
CD21 LD (IX+$0F),$08 Set sprite height to 8 pixels
CD25 LD (IX+$10),$01 Set enemy speed to 1
CD29 LD (IX+$04),$00 Reset x-delta and y-delta for enemy movement
CD2D LD (IX+$05),$00
CD31 LD (IX+$11),$10 Set state change counter
CD35 LD (IX+$12),$00 Set to not change movement
CD39 LD (IX+$15),$FF Set no bubble bonus
CD3D LD HL,$AF6A Set HL to the offset animation table
CD40 LD DE,$9100 Set graphic data for sprite
CD43 RET
Prev: CB41 Up: Map Next: CD44