Prev: 9878 Up: Map Next: 9945
989A: Advance graphic layout data pointer by two bytes, And Process Data
Used by the routines at 9A3A, 9A4A, 9AF9, 9B08 and 9B1A.
Input
IX Address of graphic layout data to draw
B 00 if current position in display buffer needs to be recalculated. 01 otherwise
989A INC IX Advance IX by one byte.
This entry point is used by the routines at 9A6A, 9A75 and 9A80.
989C INC IX Advance IX by one byte.
This entry point is used by the routines at 9878, 9997, 9A5A, 9A8B, 9AA9, 9AB9, 9B1A, 9B2F, 9B3D, 9BA5, 9BB6, 9BC9, 9BDA and 9BED.
989E LD A,(IX+$00) If first byte of graphic layout data entry is at least E6 i.e. IX points to an instruction, then jump to appropriate graphic layout routine.
98A1 CP $E6
98A3 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 20 and 18 respectively, see trivia).
98A6 LD A,H If x-coordinate is greater than 1F or y-coordinate is greater than 17 then skip ahead to 9932.
98A7 CP $20
98A9 JP NC,$9932
98AC LD A,L
98AD CP $18
98AF JP NC,$9932
98B2 PUSH HL Store HL (H = x-coordinate, L = y-coordinate).
98B3 DEC B Decrease value of do-not-recalculate-display-buffer-address flag.
98B4 JP Z,$98CE If we don't need to recalculate current position in display buffer then skip ahead to 98CE.
If B was 01 then we need to load DE with the address of the current position in the primary display buffer.
98B7 LD A,H Load BC with three times x-coordinate and DE with double y-coordinate.
98B8 ADD A,A
98B9 ADD A,H
98BA LD C,A
98BB LD A,L
98BC ADD A,A
98BD LD E,A
98BE LD D,$00
98C0 LD B,D
98C1 LD HL,$9475 Load DE with multiple of 60 corresponding to y-coordinate.
98C4 ADD HL,DE
98C5 LD E,(HL)
98C6 INC HL
98C7 LD D,(HL)
The operand of the instruction at 98C8 represents the address of the primary display buffer. This is modified by the instruction at 9839.
98C8 LD HL,$0000
98CB ADD HL,DE
98CC ADD HL,BC
98CD EX DE,HL
98CE LD A,(DE)
98CF INC A
98D0 JP Z,$9931
98D3 LD A,($6D95)
98D6 LD (DE),A
98D7 INC DE
98D8 LD A,(IX+$00)
98DB LD (DE),A
98DC INC DE
98DD LD A,($6D97)
98E0 OR A
98E1 JR NZ,$98E8
98E3 INC IX
98E5 LD A,(IX+$00)
98E8 BIT 7,(IX+$01)
98EC JP NZ,$990A
98EF LD L,A
98F0 AND $38
98F2 LD A,L
98F3 JP NZ,$990A
98F6 AND $C0
98F8 LD B,A
98F9 LD A,L
98FA AND $3F
98FC LD C,A
98FD LD A,(DE)
98FE BIT 6,A
9900 JP Z,$9906
9903 ADD A,A
9904 ADD A,A
9905 ADD A,A
9906 AND $38
9908 OR B
9909 OR C
990A LD (DE),A
990B POP HL
990C LD A,(IX+$01)
990F CP $FF
9911 JP Z,$9AF0
9914 AND $7F
9916 SUB $21
9918 JP Z,$9927
991B JP NC,$991F
991E INC L
991F INC A
9920 ADD A,H
9921 LD H,A
9922 LD B,$00
9924 JP $989A
9927 INC DE
9928 INC H
9929 JP Z,$9922
992C LD B,$01
992E JP $989A
9931 POP HL
9932 LD A,($6D97)
9935 OR A
9936 JP NZ,$993B
9939 INC IX
993B LD A,(IX+$01)
993E AND $7F
9940 SUB $21
9942 JP $991B
Prev: 9878 Up: Map Next: 9945