Prev: 9278 Up: Map Next: 949C
92E1: Draws objects (right hand version).
Input
B ?
IX ?
IY ?
DE Address of arg, e.g. $6B0C
draw_object_right 92E1 XOR A A = 0
92E2 LD ($933E),A Self modify 'LD D,x' @ draw_object_right_8 to load A
92E5 LD A,B A = min(B,10)
92E6 CP $0A
92E8 JR C,draw_object_right_0
92EA LD A,$0A
draw_object_right_0 92EC EX DE,HL Put arg address in HL
92ED LD E,(HL) DE = wordat(HL); HL++ -- loads address of turn_sign_lods
92EE INC HL
92EF LD D,(HL)
92F0 RLCA HL += A * 2 - 1 -- index the table
92F1 DEC A
92F2 LD C,A
92F3 LD B,$00
92F5 ADD HL,BC
92F6 LD B,(HL) B = *HL++
92F7 INC HL
92F8 LD L,(HL) HL = *HL + DE -- read as byte
92F9 LD H,$00
92FB ADD HL,DE
draw_object_right_stretchy_entrypt 92FC LD A,(IX+$00) A = IX[0]
92FF BIT 7,B Test B's sign
9301 JR Z,draw_object_right_1 Jump if +ve
9303 ADD A,B A += B
9304 JR draw_object_right_2 Jump
draw_object_right_1 9306 ADD A,B A += B
9307 RET C Return if carry
draw_object_right_2 9308 RET Z Return if zero
This entry point is used by the routines at sub_A9DE, helicopter_stuff and draw_hazards.
draw_object_right_3 9309 CP $F7 Return if A >= $F7
930B RET NC
930C LD C,$00 C = 0
This entry point is used by the routine at draw_object_left.
draw_object_right_4 930E AND $FC A = (A & $FC) >> 2
9310 RRCA
9311 RRCA
9312 LD ($9396),A Self modify 'LD A,x' at $9395 to load A
9315 RRA A >>= 1
9316 LD B,A B = A
9317 LD E,(HL) E = *HL
9318 CPL A = ~A + 32 -- (31 - A)
9319 ADD A,$20
931B CP E Is E < A?
931C JR C,draw_object_right_5 Jump if so
931E LD A,E A = E
draw_object_right_5 931F INC HL HL++
9320 LD D,(HL) D = *HL >> 1
9321 SRL D
9323 JP Z,draw_object_right_6 Jump if zero
9326 LD C,A C = A
9327 EX AF,AF'
9328 LD A,E C = E - C
9329 SUB C
932A LD C,A
This entry point is used by the routine at draw_object_left.
draw_object_common 932B LD A,($9396) Self modify 'LD A,x' at 9395 to be (~x)
932E CPL
932F LD ($9396),A
9332 EX AF,AF'
This entry point is used by the routine at draw_object_left.
draw_object_right_6 9333 JR NC,draw_object_right_7
9335 EX AF,AF'
9336 SLA C
9338 SLA E
933A EX AF,AF'
draw_object_right_7 933B EX AF,AF'
933C INC HL HL++
draw_object_right_8 933D LD D,$00 D = <self modified>
933F LD A,(IY+$00) A = IY[0] - IY[$35]
9342 SUB (IY+$35)
9345 JR NZ,draw_object_right_11
draw_object_right_9 9347 LD A,(IY+$35) A = IY[$35] + D
934A ADD A,D
934B RET M
934C PUSH AF
934D INC A A++
934E LD D,(HL) D = *HL
934F SUB D A -= D
9350 JR C,draw_object_right_10
9352 XOR A A = 0
draw_object_right_10 9353 ADD A,D A += D
9354 INC HL HL++
9355 LD D,$01 D = 1
9357 JR draw_object_right_15
draw_object_right_11 9359 BIT 7,D Jump if D is -ve
935B JR NZ,draw_object_right_12
935D SUB D A -= D
935E JP draw_object_right_13
draw_object_right_12 9361 ADD A,D A += D
draw_object_right_13 9362 LD D,A D = A
9363 JP Z,draw_object_right_9
9366 JP M,draw_object_right_9
9369 LD A,(IY+$35) A = IY[$35]
936C PUSH AF
936D LD A,(HL) A = *HL - 1 - D
936E DEC A
936F SUB D
9370 JP NC,draw_object_right_14 Jump if no carry
9373 POP AF
9374 LD A,($93C1) Read A from 'LD A,x' @ 93C0 below
9377 AND A Set flags
9378 RET Z Return if zero
9379 LD A,($933E) Read A from 'LD D,x' @ draw_object_right_8 above
937C LD D,(HL) D = *HL
937D SUB D A -= D
937E RET P Return if positive
937F LD ($933E),A *$933E = A
9382 LD A,($9405) A = *$9405 - D
9385 SUB D
9386 RET C Return if carry or zero
9387 RET Z
9388 LD ($9405),A *$9405 = A
938B JR draw_object_right_8 Loop?
draw_object_right_14 938D INC A A++
938E INC D D++
938F INC HL HL++
draw_object_right_15 9390 PUSH BC
9391 PUSH DE
9392 LD D,A D = A
9393 LD B,$00 B = 0 -- not self modified AFAICT
9395 LD A,$00 A = <self modified>
9397 RRA
9398 JR NC,draw_object_right_16
939A INC HL HL += 2
939B INC HL
draw_object_right_16 939C LD A,(HL) HL = wordat(HL) + BC
939D INC HL
939E LD H,(HL)
939F LD L,A
93A0 ADD HL,BC
93A1 LD ($9413),HL Self modify 'LD HL,xxxx' @ 9412 to load HL
93A4 LD C,E C = E
93A5 POP AF
93A6 DEC A A--
93A7 JR Z,draw_object_right_18
draw_object_right_17 93A9 ADD HL,BC HL += BC
93AA DEC A A--
93AB JP NZ,draw_object_right_17
draw_object_right_18 93AE LD B,D B = D
93AF LD D,$00 D = 0 -- not self modified AFAICT
93B1 EXX
93B2 POP BC
93B3 POP AF
93B4 LD D,A D = A
93B5 AND $0F H = (A & $0F) + $F0
93B7 ADD A,$F0
93B9 LD H,A
93BA LD A,D A = D
93BB AND $70 L = (A & $70) * 2 + B
93BD ADD A,A
93BE ADD A,B
93BF LD L,A
93C0 LD A,$00 A = <self modified>
93C2 AND A Set flags
93C3 JP Z,draw_object_right_19
93C6 DEC A A--
93C7 JR NZ,draw_object_right_21
93C9 EX AF,AF'
93CA JP C,sub_b7ef
93CD JP draw_object_right_28
draw_object_right_19 93D0 EX AF,AF'
93D1 JR NZ,draw_object_right_20
93D3 JP C,sub_b67c_5 prob plot_sprite_flipped
93D6 JP plot_sprite Exit via plot_sprite
draw_object_right_20 93D9 JP C,plot_masked_sprite_flipped Exit via plot_masked_sprite_flipped
93DC JP plot_sprite_flipped Exit via plot_sprite_flipped
draw_object_right_21 93DF EX AF,AF'
93E0 JP C,draw_object_right_25
93E3 SRL A A >>= 1
93E5 JP C,plot_sprite_xxx_odd
93E8 LD IX,$94C8 IX = Base of jump table
93EC CPL (~A + 5) is (4 - A)
93ED ADD A,$05
93EF LD C,A IX += A * 5
93F0 RLCA
93F1 RLCA
93F2 ADD A,C
93F3 LD C,A
93F4 LD B,$00
93F6 ADD IX,BC
93F8 LD BC,$94B1 BC = &plot_sprite_entry
draw_object_right_22 93FB LD ($9410),BC Self modify CALL at $940F
93FF LD ($941E),BC Self modify JP at $941D
9403 EXX
draw_object_right_23 9404 LD A,$00 A = <self modified> - B
9406 SUB B
9407 JR Z,draw_object_right_24
9409 JR C,draw_object_right_24
940B LD ($9405),A Self modify 'LD A,x' @ draw_object_right_23
940E EXX
940F CALL plot_sprite_entry Call <self modified> [e.g. plot_sprite_entry]
9412 LD HL,$0000 HL = <self modified by $93A1>
9415 LD B,$00 B = <self modified by $9239>
9417 JP draw_object_right_23
draw_object_right_24 941A ADD A,B A += B
941B LD B,A B = A
941C EXX
941D JP plot_sprite_entry Exit via <self modified> [e.g. plot_sprite_entry]
plot_sprite_xxx_odd 9420 INC A Increment A for upcoming calculation
9421 LD IX,$951A Point IX at start of plot instructions
9425 CPL (~A + 5) is (4 - A) is the number of plot operations to skip
9426 ADD A,$05
9428 LD C,A Multiply A by 5: the length of an individual plot operation
9429 RLCA
942A RLCA
942B ADD A,C Move result to BC
942C LD C,A
942D LD B,$00
942F ADD IX,BC Add it to IX to complete the jump target
9431 LD BC,$9503 BC = $9503
9434 JR draw_object_right_22
draw_object_right_25 9436 LD IX,$B729 IX = $B729
943A CPL (~A + 9) is (8 - A)
943B ADD A,$09
943D RLCA IX += A * 6
943E LD C,A
943F RLCA
9440 ADD A,C
9441 LD C,A
9442 LD B,$00
9444 ADD IX,BC
9446 LD BC,($9413) *$946D = *$9413 -- Self modify LD HL at $946C to load ?
944A LD ($946D),BC
944E LD A,($9416) *$9470 = *$9416
9451 LD ($9470),A
9454 LD A,($9405) *$9460 = *$9405
9457 LD ($9460),A
945A LD B,$0F B = $0F
945C EXX
945D LD D,$00 D = $00
draw_object_right_26 945F LD A,$00 A = 0 - B
9461 SUB B
9462 JR C,draw_object_right_27
9464 JR Z,draw_object_right_27
9466 LD ($9460),A *$9460 = A
9469 CALL plot_masked_sprite Call plot_masked_sprite
946C LD HL,$0000 HL = <self modified> -- Self modified by $9446
946F LD B,$00 B = $00
9471 JP draw_object_right_26
draw_object_right_27 9474 ADD A,B B += A
9475 LD B,A
9476 JP plot_masked_sprite Exit via plot_masked_sprite
draw_object_right_28 9479 EX AF,AF'
947A EXX
947B LD D,$00 D = 0 -- not self modified AFAICT
947D PUSH BC
947E PUSH HL
947F LD H,D H = D
9480 LD L,D L = D
9481 LD A,B A = B
9482 LD B,$05 B = 5
9484 DEC A A--
9485 RLA A <<= 2
9486 RLA
loop_9487 9487 RLA A <<= 1
9488 JR NC,draw_object_right_29 If carried out then HL += DE
948A ADD HL,DE
draw_object_right_29 948B ADD HL,HL HL += HL
948C DJNZ loop_9487 Loop to loop_9487 while B
948E RLA
948F JR NC,draw_object_right_30
9491 ADD HL,DE HL += DE
draw_object_right_30 9492 POP BC
9493 ADD HL,BC HL += BC
9494 POP BC
9495 DEC D D--
9496 LD A,E E = -E
9497 NEG
9499 LD E,A
949A EXX
949B EX AF,AF' fall through
Prev: 9278 Up: Map Next: 949C