Prev: 9BD2 Up: Map Next: 9C2F
9BEA: Draw the room the player is in
Used by the routine at ENTER_ROOM.
Looks the room up twice. Its own entry in ROOM_TABLE gives a colour and a shape number; the shape number then selects an entry in ROOM_SHAPES, which carries how far the player may walk and where the outline's geometry lives. Rooms therefore share outlines freely -- only the colour and the shape number are per-room.
Verified against a running game: in room $00 the table gives colour $42 and shape $00, shape $00 gives 56 by 56 and the two pointers SHAPE_VERTI_00 and SHAPE_EDGES_00, and the machine's own $5E1A, $5E1D and $5E1E read back $42, 56 and 56 with the attribute file filled with $42.
DRAW_ROOM 9BEA XOR A
9BEB LD ($5E14),A
9BEE LD A,($EA91) The room the player is in.
This entry point is used by the routine at TRAPDOOR_FALL.
DRAW_ROOM_A 9BF1 LD BC,ROOM_TABLE Two bytes per room...
9BF4 LD L,A ...so double the room number to index it.
9BF5 LD H,$00
9BF7 ADD HL,HL
9BF8 ADD HL,BC
9BF9 LD A,(HL) First byte: the colour the whole room is drawn in.
9BFA INC HL
9BFB LD ($5E1A),A
9BFE EXX
9BFF LD HL,$5800 24 by 24 character cells -- the play area, the same extent CLEAR_PLAY_AREA blanks.
9C02 LD BC,$1818
9C05 LD A,($5E1A)
9C08 CALL FILL_BLOCK Flood the attribute file with the room's colour in one go.
9C0B EXX
9C0C LD L,(HL) Second byte is the shape number; six bytes per shape, so multiply by 6 the cheap way, as x2 + x4.
9C0D LD H,$00
9C0F ADD HL,HL
9C10 LD C,L
9C11 LD B,H
9C12 ADD HL,HL
9C13 ADD HL,BC
9C14 LD BC,ROOM_SHAPES
9C17 ADD HL,BC
9C18 LD A,(HL) How far from the centre the player may walk -- MOVE_ACTOR reads these back out of $5E1D.
9C19 INC HL
9C1A LD ($5E1D),A
9C1D LD A,(HL) The vertical limit.
9C1E INC HL
9C1F LD ($5E1E),A
9C22 LD E,(HL) Where the shape's vertices are.
9C23 INC HL
9C24 LD D,(HL)
9C25 INC HL
9C26 LD A,(HL) Where its edge list is.
9C27 INC HL
9C28 LD H,(HL)
9C29 LD L,A
9C2A PUSH DE The vertices are indexed through IX.
9C2B POP IX
9C2D PUSH BC
This entry point is used by the routine at DRAW_OUTLINE.
OUTLINE_DONE 9C2E POP BC
Prev: 9BD2 Up: Map Next: 9C2F