Prev: 27008 Up: Map Next: 27145
27068: Draw PlayArea
Used by the routine at CreateWindow.
DrawPlayArea 27068 LD HL,(23606) Stash CHARS on the stack.
27071 PUSH HL
27072 LD HL,29873 Write UDG_Tiles to CHARS.
27075 LD (23606),HL
27078 LD HL,30353 HL=SidebarLayoutData.
27081 LD DE,30545 DE=SidebarAttributes.
27084 EXX Switch to the shadow registers.
27085 LD HL,16384 HL'=16384 (screen buffer).
27088 LD DE,22528 DE'=22528 (attributes buffer).
27091 LD C,24 C'=24 (height of the sidebar).
27093 LD A,8 Write 8 (width of the sidebar) to WidthCounter.
27095 LD (24108),A
DrawPlayArea_Loop 27098 LD A,(24108) B'=WidthCounter.
27101 LD B,A
27102 PUSH HL Stash HL and DE on the stack.
27103 PUSH DE
DrawPlayArea_LineLoop 27104 EXX Switch back to the normal registers.
27105 LD A,(HL) A=fetch the sidebar layout data.
27106 INC HL Increment the sidebar layout data pointer by one.
27107 EXX Switch to the shadow registers.
Now using the screen data held by the shadow registers.
27108 CALL PrintScreen Call PrintScreen.
27111 EXX Switch back to the normal registers.
27112 LD A,(DE) A=fetch the sidebar attribute data.
27113 INC DE Increment the sidebar attribute data pointer by one.
27114 EXX Switch to the shadow registers.
27115 LD (DE),A Write the sidebar attribute data to the attribute buffer.
27116 INC DE Increment the attribute buffer pointer by one.
27117 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.
27119 POP HL Restore HL from the stack.
27120 CALL 26896 Call 26896.
27123 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.
27124 POP HL Restore HL from the stack.
27125 CALL 26896 Call 26896.
Account for the Spectrum screen layout in memory.
27128 LD A,L A=L.
27129 AND %11100000 Keep only bits 5-7.
27131 JR NZ,DrawPlayArea_Skip Jump to DrawPlayArea_Skip if we're not crossing a screen section.
27133 LD A,H Else H=H+7.
27134 ADD A,7
27136 LD H,A
DrawPlayArea_Skip 27137 DEC C Decrease the height counter by one.
27138 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.
27140 POP HL Restore CHARSET from the stack and write it back to CHARS.
27141 LD (23606),HL
27144 RET Return.
Prev: 27008 Up: Map Next: 27145