Prev: AE4E Up: Map Next: AF5D
AE77: Enter a new room
Used by the routine at AA65.
AE77 LD HL,($A422) Get current room number in L
AE7A LD H,$00
AE7C PUSH HL Remember this
Get the room flags, to work out what we should draw
AE7D LD DE,$7DC0 Get the base address of the room flags
AE80 ADD HL,DE Advance to the current room's one
AE81 LD A,(HL) Put it in A and L
AE82 LD L,A
AE83 LD ($A457),A And store it
AE86 AND $03
AE88 LD ($A461),A Put just the moving object flags here
AE8B LD A,L Get the static object part of the flags
AE8C RRCA
AE8D RRCA
AE8E AND $1F
AE90 LD ($A462),A Store it here
AE93 POP HL Restore HL
AE94 ADD HL,HL Convert room number to 16-bit pointer
AE95 LD DE,($A471) Get pointer to room offset data
AE99 ADD HL,DE Get the pointer to the room
AE9A LD E,(HL) Store it in DE
AE9B INC HL
AE9C LD D,(HL)
AE9D LD HL,($A473) Get the pointer to base room data
AEA0 ADD HL,DE Add our offset - HL now points to the room data
AEA1 LD DE,$A421 Get current border colour variable in A
AEA4 LD A,(DE)
AEA5 AND $F8 Strip out ink flags
AEA7 OR (HL) Preserve border colour
AEA8 LD (DE),A Store it
AEA9 INC HL Get background colour in A
AEAA LD A,(HL)
AEAB LD ($A402),A Store it
AEAE INC HL Put pointer to UDG store in IX
AEAF PUSH HL
AEB0 POP IX
Clear the screen
AEB2 LD HL,$9000 Blank screen 2 store
AEB5 LD DE,$9001
AEB8 LD BC,$0FFF
AEBB LD (HL),$00
AEBD LDIR
AEBF LD HL,$A200 Blank screen 2 attributes
AEC2 LD DE,$A201
AEC5 LD BC,$01FF
AEC8 LD (HL),A
AEC9 LDIR
Put objects on the screen
AECB LD HL,$C2C1 Store pointer to static UDGs here
AECE LD ($A423),HL
AED1 LD HL,$7FD0 Store pointer to conveyor belt data here
AED4 LD ($A455),HL
AED7 XOR A Set first frame of conveyor belts
AED8 LD ($A444),A
AEDB LD (HL),A
AEDC LD A,$90
AEDE LD ($A45C),A
AEE1 LD DE,$A200 Read static UDG information into attributes 2
AEE4 CALL $B5FD
AEE7 LD A,$80
AEE9 LD ($A45C),A
AEEC LD A,$FF
AEEE LD ($A444),A
AEF1 CALL $B5FA
AEF4 LD HL,($A455)
AEF7 LD (HL),$00
AEF9 CALL $B5FA
AEFC PUSH IX
AEFE POP HL
Draw any task buttons
AEFF LD A,(HL) Get next value
AF00 INC HL Increment to next pointer in the room data
AF01 AND A Is the next value zero?
AF02 CALL NZ,$B203 If not, there are task buttons, so process them
Initialize moving objects
AF05 LD ($A41D),HL
AF08 XOR A
AF09 LD ($A42A),A
AF0C CP (HL)
AF0D INC HL
AF0E JR NZ,$AF0C
AF10 CP (HL)
AF11 INC HL
AF12 JR NZ,$AF10
AF14 LD ($A41F),HL
AF17 CP (HL)
AF18 INC HL
AF19 JR NZ,$AF17
AF1B LD IX,$7E00
AF1F CALL $B4A5
AF22 LD (IX+$00),$00
AF26 LD (IX+$01),$00
AF2A INC HL
Draw the title and status area
AF2B CALL $B140
Make the copy of the screen live
AF2E LD HL,$9000 Copy screen 2 to screen 1
AF31 LD DE,$8000
AF34 LD BC,$1000
AF37 LDIR
AF39 LD HL,$A200 Copy attributes 2 to attributes 1
AF3C LD DE,$A000
AF3F LD B,$02
AF41 LDIR
AF43 LD HL,$8000 Make screen 1 live
AF46 LD DE,$4000
AF49 LD B,$10
AF4B LDIR
AF4D LD HL,$A000 Make attributes 1 live
AF50 LD DE,$5800
AF53 LD B,$02
AF55 LDIR
AF57 LD A,($A421) Set the border colour
AF5A OUT ($FE),A
AF5C RET
Prev: AE4E Up: Map Next: AF5D