Prev: 50990 Up: Map Next: 51116
51053: Draw Block Bytes
Used by the routines at TestBlockRow_Draw and DrawBlockSection.
Draws the bytes of a row of a block into the screen buffer. A column below 16 is off the view, and a column of 192 is drawn only when bits 1-2 of DrawingFlags are clear. The tile is read through the stack. Those bits clear draw the bytes plain, with 50705; otherwise DrawShiftedRows_Two shifts them.
Input
A The column
HL The address of the data
DrawBlockBytes 51053 CP 16 A column below 16 is off the view.
51055 RET C
51056 LD C,A Keep the column.
51057 CP 192 A column of 192 needs the drawing flags.
51059 JR NZ,DrawBlockBytes_Return
51061 LD A,(23792) Read the drawing flags.
51064 AND %00000110 Use bits 1-2 of the drawing flags.
51066 JR Z,DrawBlockBytes_Offset Draw when those bits are clear.
DrawBlockBytes_Return 51068 RET NC Leave a shifted column of 192 undrawn.
DrawBlockBytes_Offset 51069 SRL C The byte offset is the column divided by eight.
51071 SRL C
51073 SRL C
51075 LD (23770),SP Remember the stack pointer.
51079 LD SP,HL Read the tile through the stack.
51080 LD HL,(23739) Fetch the strip address.
51083 LD B,0 Add the byte offset to the strip.
51085 ADD HL,BC
51086 LD A,(23792) Read the drawing flags again.
51089 AND %00000110 Use bits 1-2 of the drawing flags.
51091 LD B,8 Draw the plain bytes when those bits are clear.
51093 JP Z,DrawBlockRow_Loop
51096 EX DE,HL Keep the strip address aside.
51097 ADD A,248 The shift selects the page of the shifted rows.
51099 LD HL,46344 Use the two-byte shifted rows.
51102 LD (46388),HL Give that routine to the shifted drawer.
51105 LD (46393),HL
51108 LD H,A Keep the page.
51109 LD A,8 The shifted row count is 8.
51111 EX AF,AF'
51112 LD A,(DE) Read the first screen byte.
51113 JP DrawShiftedRows_Two Draw the shifted rows.
Prev: 50990 Up: Map Next: 51116