Prev: 153A Up: Map Next: 16A9
1551: OELRoutine02
OELRoutine02 1551 LD B,$00 Set B to zero as counter.
1553 LD HL,(lone_table_values) Load lone_table_values into HL.
1556 LD DE,(lone_table_pointers) Load lone_table_pointers into DE.
lone_table_loop 155A LD A,B Copy counter into A.
155B CP $1B If byte equals $1B, $9B, $7C, or $FC, jump to lone_table_escape.
155D JR Z,lone_table_escape
155F CP $9B
1561 JR Z,lone_table_escape
1563 CP $7C
1565 JR Z,lone_table_escape
1567 CP $FC
1569 JR Z,lone_table_escape
156B LD A,L Else store HL at address in DE and increment.
156C LD (DE),A
156D INC DE
156E LD A,H
156F LD (DE),A
1570 INC DE
1571 LD (HL),$24 Store $24 followed by the counter value at address in HL and increment.
1573 INC HL
1574 LD (HL),B
1575 INC HL
1576 JR lone_table_skip Then jump forwards to lone_table_skip.
lone_table_escape 1578 LD A,L Store HL at address in DE and increment.
1579 LD (DE),A
157A INC DE
157B LD A,H
157C LD (DE),A
157D INC DE
157E LD (HL),$3C Store $3C followed by address of OELRoutine11 at address in HL and increment.
1580 INC HL
1581 PUSH BC
1582 LD BC,OELRoutine11
1585 LD (HL),C
1586 INC HL
1587 LD (HL),B
1588 INC HL
1589 POP BC
lone_table_skip 158A INC B Increment counter and loop until all 256 values have been generated.
158B JR NZ,lone_table_loop
158D LD B,$00 Set B to zero as counter.
158F LD HL,(escape_table_values) Load escape_table_values into HL.
1592 LD DE,(escape_table_pointers) Load escape_table_pointers into DE.
escape_table_loop 1596 LD A,B Copy counter into A.
1597 CP $1B If byte equals $1B, $9B, $7C, or $FC, jump to escape_table_escape.
1599 JR Z,escape_table_escape
159B CP $9B
159D JR Z,escape_table_escape
159F CP $7C
15A1 JR Z,escape_table_escape
15A3 CP $FC
15A5 JR Z,escape_table_escape
15A7 LD A,L Else store HL at address in DE and increment.
15A8 LD (DE),A
15A9 INC DE
15AA LD A,H
15AB LD (DE),A
15AC INC DE
15AD LD (HL),$3C Store $3C followed by address of OELRoutine11 at address in HL and increment.
15AF INC HL
15B0 PUSH BC
15B1 LD BC,OELRoutine11
15B4 LD (HL),C
15B5 INC HL
15B6 LD (HL),B
15B7 INC HL
15B8 POP BC
15B9 JR escape_table_skip Then jump forwards to lone_table_skip.
escape_table_escape 15BB LD A,L Store HL at address in DE and increment.
15BC LD (DE),A
15BD INC DE
15BE LD A,H
15BF LD (DE),A
15C0 INC DE
15C1 LD (HL),$24 Store $24 followed by the counter value at address in HL and increment.
15C3 INC HL
15C4 LD (HL),B
15C5 INC HL
escape_table_skip 15C6 INC B Increment counter and loop until all 256 values have been generated.
15C7 JR NZ,escape_table_loop
15C9 LD HL,(escape_table_pointers) Load escape_table_pointers into HL and add offset to entry $61.
15CC LD BC,$00C2
15CF ADD HL,BC
15D0 LD E,(HL) Load pointer into DE.
15D1 INC HL
15D2 LD D,(HL)
15D3 LD HL,(escape_table_pointers) Load escape_table_pointers into HL and add offset to entry $E1.
15D6 LD BC,$01C2
15D9 ADD HL,BC
15DA LD C,(HL) Load pointer into BC.
15DB INC HL
15DC LD B,(HL)
15DD LD HL,command_pointers_1 Set HL to address of command_pointers_1 and set A to zero as counter.
15E0 XOR A
commands_loop_1 15E1 PUSH AF Copy from the address in HL to the locations in BC and DE.
15E2 CALL copy_pointer_to_escape_table
15E5 POP AF
15E6 INC A Increment counter and loop through 25 pointers.
15E7 CP $19
15E9 JR NZ,commands_loop_1
15EB LD HL,(escape_table_pointers) Load escape_table_pointers into HL and add offset to entry $42.
15EE LD BC,$0084
15F1 ADD HL,BC
15F2 LD E,(HL) Load pointer into DE.
15F3 INC HL
15F4 LD D,(HL)
15F5 LD HL,(escape_table_pointers) Load escape_table_pointers into HL and add offset to entry $C2.
15F8 LD BC,$0184
15FB ADD HL,BC
15FC LD C,(HL) Load pointer into BC.
15FD INC HL
15FE LD B,(HL)
15FF LD HL,command_pointers_2 Set HL to address of command_pointers_2 and set A to zero as counter.
1602 XOR A
commands_loop_2 1603 PUSH AF Copy from the address in HL to the locations in BC and DE.
1604 CALL copy_pointer_to_escape_table
1607 POP AF
1608 INC A Increment counter and loop through 6 pointers.
1609 CP $06
160B JR NZ,commands_loop_2
160D INC DE Skip forward two entries (to entry $4A and $CA)
160E INC DE
160F INC DE
1610 INC DE
1611 INC DE
1612 INC DE
1613 INC BC
1614 INC BC
1615 INC BC
1616 INC BC
1617 INC BC
1618 INC BC
1619 CALL copy_pointer_to_escape_table Copy from the address in HL to the locations in BC and DE.
161C LD A,$01
161E LD (OELVariable02),A
1621 LD HL,$1A91
1624 LD (OELWord12),HL
1627 LD A,$03
1629 LD (OELVariable12),A
162C LD A,$40
162E LD (OELVariable01),A
1631 CALL OELRoutine14_1
1634 LD A,$41
1636 LD (OELVariable01),A
1639 CALL OELRoutine14_1
163C LD A,$44
163E LD (OELVariable01),A
1641 CALL OELRoutine14_1
1644 LD A,$45
1646 LD (OELVariable01),A
1649 CALL OELRoutine14_1
164C LD A,$C0
164E LD (OELVariable01),A
1651 CALL OELRoutine14_1
1654 LD A,$C1
1656 LD (OELVariable01),A
1659 CALL OELRoutine14_1
165C LD A,$C4
165E LD (OELVariable01),A
1661 CALL OELRoutine14_1
1664 LD A,$C5
1666 LD (OELVariable01),A
1669 CALL OELRoutine14_1
166C LD A,$47 Set A to $47 as a counter.
OELRoutine02_0 166E PUSH AF Call OELRoutine14_1 with counter in OELVariable01.
166F LD (OELVariable01),A
1672 CALL OELRoutine14_1
1675 POP AF
1676 INC A Increment A and loop until counter reaches $60.
1677 CP $60
1679 JR NZ,OELRoutine02_0
167B LD A,$C7 Set A to $C7 as a counter.
OELRoutine02_1 167D PUSH AF Call OELRoutine14_1 with counter in OELVariable01.
167E LD (OELVariable01),A
1681 CALL OELRoutine14_1
1684 POP AF
1685 INC A Increment A and loop until counter reaches $E0.
1686 CP $E0
1688 JR NZ,OELRoutine02_1
168A LD DE,OELBytes01 Load escape_table_pointers into BC and OELBytes01 into A.
168D LD BC,(escape_table_pointers)
1691 LD A,(DE)
OELRoutine02_2 1692 LD L,A
1693 LD H,$00
1695 ADD HL,HL
1696 ADD HL,BC
1697 PUSH HL
1698 INC DE
1699 CALL OELRoutine13
169C POP HL
169D INC H
169E CALL OELRoutine13
16A1 INC DE Move DE on to next entry and load value into A.
16A2 INC DE
16A3 LD A,(DE)
16A4 CP $3D Loop until A equals $3D and return.
16A6 JR NZ,OELRoutine02_2
16A8 RET
Prev: 153A Up: Map Next: 16A9