Prev: 40263 Up: Map Next: 40352
40303: Set Attributes Rotated Left
The handler of SetGraphicAttributes for a graphic that is turned a quarter turn anti-clockwise. This is the same as SetAttributes_Upright, except that each row of the screen is made from a column of the attributes, from the right-hand side to the left-hand side.
SetAttributes_RotatedLeft 40303 POP BC Restore the attribute and graphic ID from the stack.
40304 CALL GetGraphicAttributeDetails Call GetGraphicAttributeDetails to get the details of the attributes.
40307 LD A,B Fetch the width.
40308 EXX Switch to the shadow registers.
40309 LD B,A Keep the number of columns in B'.
40310 EXX Switch back to the main registers.
40311 CALL AddWidthToAddress Call AddWidthToAddress to move DE on to the second row.
SetAttributes_RotatedLeft_Row 40314 DEC DE Move DE back to the previous column (at first, the last byte of the first row).
40315 PUSH BC Stash the width and height on the stack.
40316 PUSH DE Stash the position in the attributes on the stack.
40317 PUSH HL Stash the attribute buffer address on the stack.
SetAttributes_RotatedLeft_Cell 40318 LD A,(DE) Fetch the next attribute.
40319 AND A Jump to SetAttributes_RotatedLeft_Next if it is 0.
40320 JR Z,SetAttributes_RotatedLeft_Next
40322 CP 255 Jump to SetAttributes_RotatedLeft_Write if it is not 255.
40324 JR NZ,SetAttributes_RotatedLeft_Write
40326 LD A,(24090) Fetch the room attribute from CurrentRoom_Attribute.
SetAttributes_RotatedLeft_Write 40329 LD (HL),A Write A to the attribute buffer.
SetAttributes_RotatedLeft_Next 40330 CALL AddWidthToAddress Call AddWidthToAddress to move down to the next row of the attributes.
40333 INC L Move HL on to the next cell.
40334 DEC C Decrease the height by one and loop back to SetAttributes_RotatedLeft_Cell until all of the rows have been set.
40335 JR NZ,SetAttributes_RotatedLeft_Cell
40337 POP HL Restore the attribute buffer address from the stack.
40338 LD BC,32 BC=0032 (the size of a row of the attribute buffer).
40341 AND A Move up a row.
40342 SBC HL,BC
40344 POP DE Restore the position in the attributes from the stack.
40345 POP BC Restore the width and height from the stack.
40346 EXX Switch to the shadow registers.
40347 DEC B Decrease the number of columns by one.
40348 EXX Switch back to the main registers.
40349 JR NZ,SetAttributes_RotatedLeft_Row Jump to SetAttributes_RotatedLeft_Row until all of the columns are done.
40351 RET Return.
Prev: 40263 Up: Map Next: 40352