Prev: 6980 Up: Map Next: 6A09
69BC: Draw PlayArea
Used by the routine at CreateWindow.
DrawPlayArea 69BC LD HL,($5C36) Stash CHARS on the stack.
69BF PUSH HL
69C0 LD HL,$74B1 Write UDG_Tiles to CHARS.
69C3 LD ($5C36),HL
69C6 LD HL,$7691 HL=SidebarLayoutData.
69C9 LD DE,$7751 DE=SidebarAttributes.
69CC EXX Switch to the shadow registers.
69CD LD HL,$4000 HL'=4000 (screen buffer).
69D0 LD DE,$5800 DE'=5800 (attributes buffer).
69D3 LD C,$18 C'=18 (height of the sidebar).
69D5 LD A,$08 Write 08 (width of the sidebar) to WidthCounter.
69D7 LD ($5E2C),A
DrawPlayArea_Loop 69DA LD A,($5E2C) B'=WidthCounter.
69DD LD B,A
69DE PUSH HL Stash HL and DE on the stack.
69DF PUSH DE
DrawPlayArea_LineLoop 69E0 EXX Switch back to the normal registers.
69E1 LD A,(HL) A=fetch the sidebar layout data.
69E2 INC HL Increment the sidebar layout data pointer by one.
69E3 EXX Switch to the shadow registers.
Now using the screen data held by the shadow registers.
69E4 CALL PrintScreen Call PrintScreen.
69E7 EXX Switch back to the normal registers.
69E8 LD A,(DE) A=fetch the sidebar attribute data.
69E9 INC DE Increment the sidebar attribute data pointer by one.
69EA EXX Switch to the shadow registers.
69EB LD (DE),A Write the sidebar attribute data to the attribute buffer.
69EC INC DE Increment the attribute buffer pointer by one.
69ED DJNZ DrawPlayArea_LineLoop Decrease counter by one and loop back to DrawPlayArea_LineLoop until counter is zero.
Restore the attribute buffer address for the start of this line.
69EF POP HL Restore HL from the stack.
69F0 CALL $6910 Call 6910.
69F3 EX DE,HL DE=HL (ignoring the exchange as HL is instantly overwritten below).
Restore the screen buffer address for the start of this line.
69F4 POP HL Restore HL from the stack.
69F5 CALL $6910 Call 6910.
Account for the Spectrum screen layout in memory.
69F8 LD A,L A=L.
69F9 AND %11100000 Keep only bits 5-7.
69FB JR NZ,DrawPlayArea_Skip Jump to DrawPlayArea_Skip if we're not crossing a screen section.
69FD LD A,H Else H=H+07.
69FE ADD A,$07
6A00 LD H,A
DrawPlayArea_Skip 6A01 DEC C Decrease the height counter by one.
6A02 JR NZ,DrawPlayArea_Loop Keep jumping back to DrawPlayArea_Loop until the height counter is zero.
All done! Finish by reverting the change to CHARS and returning.
6A04 POP HL Restore CHARSET from the stack and write it back to CHARS.
6A05 LD ($5C36),HL
6A08 RET Return.
Prev: 6980 Up: Map Next: 6A09