Prev: B951 Up: Map Next: B9AC
B952: Draw a room's background graphics
Used by the routines at 813B, 8155, AC06, ED2A and EDF7.
B952 LD A,$B8 Set the fork lift's position on the ground.
B954 LD ($AF88),A
B957 CALL $B902 Clear the playing area.
B95A LD A,(IY+$0F) Get the current room in A.
B95D ADD A,A Double it to get a word offset.
B95E LD E,A Put this in DE.
B95F LD D,$00
B961 LD HL,$CDB5 Add the base address of the room data. (CDB5)
B964 ADD HL,DE
B965 LD E,(HL) Put the actual address in DE.
B966 INC HL
B967 LD D,(HL)
B968 EX DE,HL Swap DE and HL.
This entry point is used by the routines at EFC7 and F177. At this point, HL points to the room graphics data.
B969 LD D,(HL) Put the first two bytes in DE.
B96A INC HL
B96B LD E,(HL)
B96C INC HL
B96D LD A,D Get the first byte and reset bit 7.
B96E AND $7F
B970 CP $7F Should the screen be refreshed now?
B972 JR Z,$B9A8 Jump forward if so.
B974 CP $7E Is this data flag dependent?
B976 JR NZ,$B982 Jump forward if not.
These graphics are flag dependent.
B978 LD A,E Put the second byte in A.
B979 CALL $EC1D Is the flag set?
B97C JR NZ,$B969 Jump forward if so.
B97E INC HL Otherwise skip over this entry as it shouldn't be drawn.
B97F INC HL
B980 JR $B969
The graphics can be drawn.
B982 PUSH HL Store HL.
B983 LD B,A Put the first byte as the block ID in B.
B984 LD A,E Get the second value.
B985 AND $F8 Put only the top 5 bits as a value in C.
B987 RRA
B988 RRA
B989 RRA
B98A LD C,A
B98B RL D Double D.
B98D RL E Double E and add the top bit of the previous value of D.
B98F LD A,E Get the top four bits of the second value.
B990 AND $0F
B992 ADD A,$05 Start drawing from row 5.
B994 LD D,A Put the row in D.
B995 LD E,C Put the column in E.
B996 LD L,B Put the block ID in HL.
B997 LD H,$00
B999 ADD HL,HL Double it to get a word offset.
B99A LD BC,$BD86 Add the basic offset of the room block components (BD86)
B99D ADD HL,BC
B99E LD A,(HL) Put the address found in HL.
B99F INC HL
B9A0 LD H,(HL)
B9A1 LD L,A
B9A2 CALL $B84B Draw the graphic string.
B9A5 POP HL Restore HL.
B9A6 JR $B969 Jump back to draw some more.
B9A8 CALL $B9AC Copy the data to the working buffer.
B9AB RET
Prev: B951 Up: Map Next: B9AC