Prev: 57439 Up: Map Next: 57576
57513: Release Bubble
Used by the routine at Handle_Static_Object.
Lets an object (the object of type 84 see Handle_Static_Object) release a bubble every now and then. The bubble takes one of the four bubble records that start at First_Bubble_Record, if one is free. A bubble is only made when the low byte of the frame counter plus the low byte of the address of the object has its low six bits clear.
The record is a copy of the record of the object, with the type 88 and an x position that is 12 more. The room is the room that Sabreman is in.
Input
IX Object record of the object that releases the bubble
Release_Bubble 57513 LD HL,36698 Point HL at the first bubble record.
57516 LD DE,16 Set DE to the size of an object record.
57519 LD B,4 Set a counter in B for the four bubble records.
Release_Bubble_Find_Record 57521 LD A,(HL) Fetch the type of the record.
57522 AND A Jump to Release_Bubble_Create if the record is free.
57523 JR Z,Release_Bubble_Create
57525 ADD HL,DE Move on to the next record.
57526 DJNZ Release_Bubble_Find_Record Decrease the record counter and loop back for the next record.
57528 RET Return, as all four bubble records are in use.
Release_Bubble_Create 57529 PUSH IX Point HL at the record of the object, and DE at the free record.
57531 EX DE,HL Exchange DE and HL.
57532 POP HL Restore HL from the stack.
57533 LD A,(23672) Fetch the low byte of the frame counter.
57536 ADD A,L Add the low byte of the address of the record of the object.
57537 AND %00111111 Keep only the low six bits.
57539 RET NZ Return unless they are zero.
57540 LD BC,15 Set a counter of 15 bytes.
57543 PUSH DE Stash the address of the bubble record.
57544 LDIR Copy the record of the object to the bubble record, except for the redraw flags.
57546 POP HL Restore the address of the bubble record to HL.
57547 LD A,88 Set the type to 88.
57549 LD (HL),A
57550 LD A,(IX+1) Fetch the x position of the object.
57553 ADD A,12 Add 12.
57555 INC HL Move to the x position.
57556 LD (HL),A Set the x position.
57557 INC HL Move to the room x.
57558 LD A,(36636) Fetch the room x of Sabreman.
57561 LD (HL),A Set the room x.
57562 INC HL Move to the room y.
57563 INC HL
57564 LD A,(36638) Fetch the room y of Sabreman.
57567 LD (HL),A Set the room y.
57568 LD A,1 A=1 (the value of the redraw flags).
57570 LD DE,11 Set the offset to the redraw flags of the record (11).
57573 ADD HL,DE Move to the redraw flags.
57574 LD (HL),A Set the redraw flags to 1 so that the bubble is drawn without being erased first.
57575 RET Return.
View the equivalent code in;
Prev: 57439 Up: Map Next: 57576