Prev: 52717 Up: Map Next: 52924
52820: Room drawing: Advance HL to next display file address to be drawn to (apply-horizontal-mirror flag set)
Used when apply-horizontal-mirror flag is set
Used by the routine at 52714.
Input
HL A display file address
Output
A 1 (if returning via 52792, drawing complete), otherwise zero
F Zero flag reset (if returning via 52792, drawing complete)
52820 LD A,(23449) Increase pixel row counter...
52823 DEC A ...
52824 AND 7 ...and reset to 7 if it falls below zero...
52826 LD (23449),A ...
52829 CP 7 If new value of pixel row counter is 7 (i.e. we have rolled over to a new character block)...
52831 JR Z,52836 ...then advance HL to next character block to be drawn and return
52833 DEC H Decrease display file address by 256 bytes (i.e. move to next pixel row up)
52834 XOR A Set A to zero
52835 RET Return
This next section advances HL to next character block to be drawn
52836 LD A,(23450) Load A with apply-horizontal-mirror and apply-vertical-mirror flags
52839 AND 1 If apply-vertical-mirror flag is set...
52841 JP NZ,52897 ...then skip ahead to 52897
52844 PUSH BC Store BC
52845 LD A,(23444) Load x-coordinate of character block currently being drawn into A...
52848 INC A ...increase by one...
52849 LD B,A ...and load into B
52850 LD A,(23495) Load (x-coordinate + 1) of right of graphic being drawn into A
52853 CP B If both x-coordinates are the same (i.e. we have moved beyond graphic's right edge)...
52854 JR Z,52874 ...then jump to 52874
52856 LD A,B Store increased x-coordinate at 23444...
52857 LD (23444),A ...
52860 LD BC,(23444) Load BC with coordinates of new character block to draw
52864 CALL 54132 Move virtual cursor (bitmap) to display file address for coordinates x=C, y=B and load address into HL
52867 LD A,7 Advance HL down seven pixel rows to bottom of character block...
52869 ADD A,H ...
52870 LD H,A ...
52871 XOR A Set A to zero
52872 POP BC Restore BC
52873 RET Return
This next section advances HL to next character row to be drawn
52874 LD A,(23493) Load A with x-coordinate of left of graphic to draw...
52877 LD (23444),A ...and set current x-coordinate to match
52880 LD A,(23445) Load current y-coordinate into C, decreasing by one...
52883 DEC A ...
52884 LD C,A ...
52885 LD A,(23494) Load y-coordinate of top of graphic being drawn into A
52888 CP C If both y-coordinates are the same (i.e. we have moved beyond graphic's top edge)...
52889 JR Z,52788 ...then jump to 52788 (load A with 1, reset zero flag and return)
52891 LD A,C Store increased y-coordinate at 23445...
52892 LD (23445),A ...
52895 JR 52860 Move virtual cursor (bitmap) to display file address for coordinates x=C, y=B and load address into HL then return
This next section advances HL to next character block to be drawn where the apply-vertical-mirror flag is set
52897 PUSH BC Store BC
52898 LD A,(23444) Load x-coordinate of character block currently being drawn into A...
52901 DEC A ...decrease by one...
52902 LD B,A ...and load into B
52903 LD A,(23493) Load x-coordinate of left of graphic being drawn into A...
52906 DEC A ...and decrease by one
52907 CP B If both x-coordinates are the same (i.e. we have moved beyond graphic's left edge)...
52908 JR Z,52917 ...then jump to 52917
52910 LD A,B Store decreased x-coordinate at 23444...
52911 LD (23444),A ...
52914 JP 52860 Move virtual cursor (bitmap) to display file address for coordinates x=C, y=B and load address into HL then return
52917 LD A,(23495) Load x-coordinate of right of graphic being drawn into A...
52920 DEC A ...
52921 JP 52877 Move current character position down one character row and return
Prev: 52717 Up: Map Next: 52924