Prev: 39032 Up: Map Next: 39237
39066: Advance graphic layout data pointer by two bytes, And Process Data
Used by the routines at 39482, 39498, 39673, 39688 and 39706.
Input
IX Address of graphic layout data to draw
B 0 if current position in display buffer needs to be recalculated. 1 otherwise
39066 INC IX Advance IX by one byte.
This entry point is used by the routines at 39530, 39541 and 39552.
39068 INC IX Advance IX by one byte.
This entry point is used by the routines at 39032, 39319, 39514, 39563, 39593, 39609, 39706, 39727, 39741, 39845, 39862, 39881, 39898 and 39917.
39070 LD A,(IX+0) If first byte of graphic layout data entry is at least 230 i.e. IX points to an instruction, then jump to appropriate graphic layout routine.
39073 CP 230
39075 JP NC,Jump_GraphicLayoutRoutine
At this point, the graphic layout data pointed to by IX is graphical data, not an instruction. We only draw the graphics if they lie within the display area (i.e. have x- and y-coordinates less than 32 and 24 respectively, see trivia).
39078 LD A,H If x-coordinate is greater than 31 or y-coordinate is greater than 23 then skip ahead to 39218.
39079 CP 32
39081 JP NC,39218
39084 LD A,L
39085 CP 24
39087 JP NC,39218
39090 PUSH HL Store HL (H = x-coordinate, L = y-coordinate).
39091 DEC B Decrease value of do-not-recalculate-display-buffer-address flag.
39092 JP Z,39118 If we don't need to recalculate current position in display buffer then skip ahead to 39118.
If B was 1 then we need to load DE with the address of the current position in the primary display buffer.
39095 LD A,H Load BC with three times x-coordinate and DE with double y-coordinate.
39096 ADD A,A
39097 ADD A,H
39098 LD C,A
39099 LD A,L
39100 ADD A,A
39101 LD E,A
39102 LD D,0
39104 LD B,D
39105 LD HL,38005 Load DE with multiple of 96 corresponding to y-coordinate.
39108 ADD HL,DE
39109 LD E,(HL)
39110 INC HL
39111 LD D,(HL)
The operand of the instruction at 39112 represents the address of the primary display buffer. This is modified by the instruction at 38969.
39112 LD HL,0
39115 ADD HL,DE
39116 ADD HL,BC
39117 EX DE,HL
39118 LD A,(DE)
39119 INC A
39120 JP Z,39217
39123 LD A,(28053)
39126 LD (DE),A
39127 INC DE
39128 LD A,(IX+0)
39131 LD (DE),A
39132 INC DE
39133 LD A,(28055)
39136 OR A
39137 JR NZ,39144
39139 INC IX
39141 LD A,(IX+0)
39144 BIT 7,(IX+1)
39148 JP NZ,39178
39151 LD L,A
39152 AND 56
39154 LD A,L
39155 JP NZ,39178
39158 AND 192
39160 LD B,A
39161 LD A,L
39162 AND 63
39164 LD C,A
39165 LD A,(DE)
39166 BIT 6,A
39168 JP Z,39174
39171 ADD A,A
39172 ADD A,A
39173 ADD A,A
39174 AND 56
39176 OR B
39177 OR C
39178 LD (DE),A
39179 POP HL
39180 LD A,(IX+1)
39183 CP 255
39185 JP Z,39664
39188 AND 127
39190 SUB 33
39192 JP Z,39207
39195 JP NC,39199
39198 INC L
39199 INC A
39200 ADD A,H
39201 LD H,A
39202 LD B,0
39204 JP 39066
39207 INC DE
39208 INC H
39209 JP Z,39202
39212 LD B,1
39214 JP 39066
39217 POP HL
39218 LD A,(28055)
39221 OR A
39222 JP NZ,39227
39225 INC IX
39227 LD A,(IX+1)
39230 AND 127
39232 SUB 33
39234 JP 39195
Prev: 39032 Up: Map Next: 39237