![]() |
Routines |
| Prev: 9F8F | Up: Map | Next: A0A5 |
|
Used by the routine at 9470.
|
||||
| 9F9B | LD A,($A1F8) | Return if atoms are not flushing on teleporting | ||
| 9F9E | OR A | |||
| 9F9F | RET Z | |||
| 9FA0 | LD IY,$A0AD | Set IY to the address for the Rex atoms data buffer during teleporting | ||
| 9FA4 | LD B,$14 | Set BC to the number of 'Rex atoms' (20) | ||
|
This entry point is used by the routine at 9FEB.
|
||||
| 9FA6 | PUSH BC | Save BC | ||
| 9FA7 | LD A,(IY+$00) | If atom is not configured jump to iniciatise atom data | ||
| 9FAA | OR A | |||
| 9FAB | JP Z,$A023 | |||
| 9FAE | LD A,($A24F) | Set A093 the x-position of the atom, based on x-offset of atom and x-position of Rex | ||
| 9FB1 | ADD A,(IY+$01) | |||
| 9FB4 | LD ($A22C),A | |||
| 9FB7 | AND $07 | Set A the graphic data for atom based on bit2-0 x-position of atom | ||
| 9FB9 | LD E,A | |||
| 9FBA | LD D,$00 | |||
| 9FBC | LD HL,$A0A5 | |||
| 9FBF | ADD HL,DE | |||
| 9FC0 | LD A,(HL) | |||
| 9FC1 | PUSH AF | Save AF | ||
| 9FC2 | LD A,(IY+$02) | Computes into HL the address into room graphic data of the atom | ||
| 9FC5 | LD L,A | |||
| 9FC6 | LD H,$00 | |||
| 9FC8 | ADD HL,HL | |||
| 9FC9 | ADD HL,HL | |||
| 9FCA | ADD HL,HL | |||
| 9FCB | ADD HL,HL | |||
| 9FCC | ADD HL,HL | |||
| 9FCD | LD A,($A22C) | |||
| 9FD0 | SRL A | |||
| 9FD2 | SRL A | |||
| 9FD4 | SRL A | |||
| 9FD6 | LD E,A | |||
| 9FD7 | LD D,$00 | |||
| 9FD9 | ADD HL,DE | |||
| 9FDA | LD DE,$EAFF | |||
| 9FDD | ADD HL,DE | |||
| 9FDE | POP AF | Restore AF | ||
| 9FDF | OR (HL) | Put the graphic data atom in this location | ||
| 9FE0 | LD (HL),A | |||
| 9FE1 | LD A,($A1FB) | if teleporting Rex at game begin jump to update atom position | ||
| 9FE4 | OR A | |||
| 9FE5 | JP Z,$A070 | |||
| 9FE8 | JP $A08D | Jump to update atom position | ||
|
Process another atom
|
||||
| 9FEB | LD DE,$0003 | Point IY to the next atom into Rex atom data table | ||
| 9FEE | ADD IY,DE | |||
| 9FF0 | POP BC | Restore BC | ||
| 9FF1 | DJNZ $9FA6 | Jump back until all atoms has been processed | ||
|
All atoms processed
|
||||
| 9FF3 | LD A,($A1FB) | Jump forward if Rex is teleporing on init game | ||
| 9FF6 | OR A | |||
| 9FF7 | JP Z,$A006 | |||
| 9FFA | LD A,($A250) | Decrement y-position of Rex if y-position less than 24 | ||
| 9FFD | DEC A | |||
| 9FFE | CP $18 | |||
| A000 | JP C,$A006 | |||
| A003 | LD ($A250),A | |||
| A006 | LD A,($A1FA) | Decrement teleporting loop counter | ||
| A009 | DEC A | |||
| A00A | LD ($A1FA),A | |||
| A00D | OR A | Return if loop counter is not zero | ||
| A00E | RET NZ | |||
|
Loop counter for teleporting finished
|
||||
| A00F | LD A,$01 | Set Rex visible | ||
| A011 | LD ($A1F6),A | |||
| A014 | XOR A | Finish teleporting | ||
| A015 | LD ($A1F8),A | |||
| A018 | LD ($A1F9),A | |||
| A01B | LD A,($A1EE) | Jump to resume game after Rex is dead | ||
| A01E | OR A | |||
| A01F | JP NZ,$9D68 | |||
| A022 | RET | |||
|
Initialise data for Rex atoms during teleporting
|
||||
| A023 | LD A,($A1FB) | Jump forward if teleporting Rex after dead | ||
| A026 | OR A | |||
| A027 | JP NZ,$A04B | |||
|
Rex is teleporting on game begin
|
||||
| A02A | LD A,($A1FA) | If teleporting loop counter < 50 jump to process next atom | ||
| A02D | CP $32 | |||
| A02F | JP C,$9FEB | |||
| A032 | CALL $A530 | Set A a random number between 4 and 19 | ||
| A035 | AND $0F | |||
| A037 | ADD A,$04 | |||
| A039 | LD (IY+$00),A | Set this number as y-delta into data buffer for atom y-position variation | ||
| A03C | CALL $A530 | Set A a random number between 0 and 15 | ||
| A03F | AND $0F | |||
| A041 | LD (IY+$01),A | Set this number as x-offset into the teleporting data buffer | ||
| A044 | LD (IY+$02),$00 | Set 0 as y-position of Rex atoms into the teleporting data buffer | ||
| A048 | JP $9FEB | Jump to process next atom | ||
|
Rex is teleporting after dead
|
||||
| A04B | LD A,($A1FA) | If teleporting loop counter < 50 jump to process next atom | ||
| A04E | CP $32 | |||
| A050 | JP C,$9FEB | |||
| A053 | CALL $A530 | Set A a random number between 4 and 19 | ||
| A056 | AND $0F | |||
| A058 | ADD A,$04 | |||
| A05A | LD (IY+$00),A | Set this number as y-delta into data buffer for atom y-position variation | ||
| A05D | CALL $A530 | Set A a random number between 0 and 15 | ||
| A060 | AND $0F | |||
| A062 | LD (IY+$01),A | Set this number as x-offset into the teleporting data buffer | ||
| A065 | LD A,($A250) | Set the y-position of Rex minus 4 the y-position for Rex atoms during teleporting | ||
| A068 | SUB $04 | |||
| A06A | LD (IY+$02),A | |||
| A06D | JP $9FEB | Jump to process next atom | ||
|
Update data for the atom when teleporting Rex at game begin
|
||||
| A070 | LD A,(IY+$02) | Set A the y-position of atom | ||
| A073 | ADD A,(IY+$00) | Add to A the y-offset of atom | ||
| A076 | LD HL,$A250 | Compare atom y-position with Rex y-position | ||
| A079 | CP (HL) | |||
| A07A | JP C,$A087 | Jump forward if Rex y-position is greater than y-position of atom | ||
| A07D | LD (IY+$00),$00 | Reset y-offset | ||
| A081 | CALL $9E05 | Set Rex visible | ||
| A084 | JP $9FEB | Jump to process next atom | ||
| A087 | LD (IY+$02),A | Set the new y-position for the atom | ||
| A08A | JP $9FEB | Jump to process next atom | ||
|
Update data for the atom when teleporting Rex afer dead
|
||||
| A08D | LD A,(IY+$02) | Set A the y-position of atom | ||
| A090 | SUB (IY+$00) | substract to A the y-offset of atom | ||
| A093 | CP $DF | Jump forward if atom y-position greater than 32 | ||
| A095 | JP C,$A09F | |||
| A098 | LD (IY+$00),$00 | Reset y-offset | ||
| A09C | JP $9FEB | Jump to process next atom | ||
| A09F | LD (IY+$02),A | Set the new y-position for the atom | ||
| A0A2 | JP $9FEB | Jump to process next atom | ||
| Prev: 9F8F | Up: Map | Next: A0A5 |