Prev: 936F Up: Map Next: 93A1
9388: Handle new position attributes when sprite is at screen top (row 0).
Same $03DF wrap handling as set_attr_wrap_old but for new position. Wraps attribute writes to bottom of viewport to preserve row 0 as black.
set_attr_wrap_new 9388 LD BC,$03DF Add $03DF to HL to correct wrapped address. Restore and re-save BC.
938B ADD HL,BC
938C POP BC
938D PUSH BC
set_attr_wrap_new_loop 938E LD (HL),A Inner loop: write attribute A to HL, increment HL, decrement C, repeat for row width.
938F INC HL
9390 DEC C
9391 JR NZ,set_attr_wrap_new_loop
9393 POP BC After row: restore BC, add stride DE, decrement B, re-save BC. Subtract $03DF from HL to maintain wrap. Jump back to set_attr_new_outer_loop for next row.
9394 ADD HL,DE
9395 DEC B
9396 PUSH BC
9397 LD BC,$03DF
939A OR A
939B SBC HL,BC
939D POP BC
939E JP set_attr_new_outer_loop
Prev: 936F Up: Map Next: 93A1