Prev: 5F66 Up: Map Next: 6074
5F89: Print objects on the playing field
Used by the routines at 62CB, 65B3, 663D, 6711, 69E3, 6AC2 and 6B71.
5F89 LD IX,$6D73 Point IX to the tree sprite table at 6D73
5F8D LD DE,$FFE0 Move forward $20 bytes with each iteration
5F90 LD HL,$7F81 Point HL to front row of trees
5F93 LD BC,$1E01
5F96 PUSH IX
5F98 PUSH DE
5F99 PUSH HL
5F9A PUSH BC
5F9B PUSH BC
5F9C LD C,$01
5F9E LD A,($5DEC) Get current speed
5FA1 LD B,A If we're not running on full speed (A=0),
5FA2 DEC BC put a time delay in
5FA3 LD A,B so updates only happen after a pause
5FA4 OR C
5FA5 JR NZ,$5FA2 Loop until delay finished
5FA7 POP BC
5FA8 LD B,$18
5FAA LD A,(HL) Have we got any tree here?
5FAB CP $20
5FAD JR NC,$5FB8 Jump forward if we have
5FAF ADD HL,DE Scan next piece of this line
5FB0 INC IX
5FB2 INC IX
5FB4 INC IX
5FB6 DJNZ $5FAA
5FB8 CP $40 Have we got a large tree here?
5FBA JR Z,$5FE0 Jump forward if we have
5FBC LD A,(IX+$00) Is this a large tree?
5FBF CP $00
5FC1 JR Z,$5FD8 Jump forward if it is
5FC3 LD L,(IX+$01) Copy the next screen point into the working store
5FC6 LD H,(IX+$02)
5FC9 PUSH BC
5FCA LD BC,$0036
5FCD LD DE,$7C27 Put the graphic in the storage buffer for display
5FD0 LDIR
5FD2 POP BC
5FD3 LD DE,$7BFA
5FD6 JR $5FE6
5FD8 LD E,(IX+$01)
5FDB LD D,(IX+$02)
5FDE JR $5FE6
5FE0 LD E,(IX-$08)
5FE3 LD D,(IX-$07)
5FE6 LD B,$12 Large trees are 18 characters deep
5FE8 LD IX,$64F4 64F4 - screen offset table
5FEC LD A,C Work out where this should be put on screen
5FED CP $0D
5FEF JR C,$5FF7
5FF1 CP $14
5FF3 JR NC,$5FF7
5FF5 LD B,$10 Small trees are 16 characters deep
Copy the tree onto screen
5FF7 PUSH BC Store for later
5FF8 LD A,C Get the offset
5FF9 ADD A,(IX+$00) Add it to the attribute position
5FFC LD L,A and store it in HL
5FFD LD H,(IX+$02) Get the other part of the screen position
6000 LD A,(DE) Get the next byte from the tree store
6001 LD (HL),A Put it on screen
6002 INC DE
6003 LD H,(IX+$01) Get the screen offset
6006 LD B,$08 8 lines
6008 LD A,(DE) Put it on screen
6009 LD (HL),A
600A INC H Move to the next line
600B INC DE Onto the next section of tree
600C DJNZ $6008
600E EX AF,AF'
600F XOR $10 Toggle the speaker, so a sound effect is played
6011 OUT ($FE),A
6013 EX AF,AF'
6014 POP BC
6015 INC IX
6017 INC IX
6019 INC IX
601B DJNZ $5FF7
601D POP BC
Display enemies
601E PUSH BC
601F LD A,($5DC6) Is enemy bike 1 here?
6022 CP C
6023 JR NZ,$6033 Jump forward if not
6025 LD A,($5DC4)
6028 LD ($5DC1),A
602B LD A,$06
602D LD ($5DC0),A
6030 CALL $6150 Draw an enemy bike
6033 POP BC
6034 PUSH BC
6035 LD A,($5DC7) Is enemy bike 2 here?
6038 CP C
6039 JR NZ,$6049 Jump forward if not
603B LD A,($5DC5)
603E LD ($5DC1),A
6041 LD A,$01
6043 LD ($5DC0),A
6046 CALL $6150
6049 LD A,($5DCB) Is there a tank here?
604C BIT 1,A
604E CALL NZ,$6453 Draw it if there is
6051 POP BC
6052 PUSH BC
6053 LD A,($5DCB) Is there a plane here?
6056 BIT 0,A
6058 CALL NZ,$63FC Draw it if there is
605B POP BC
605C PUSH BC
605D LD A,($5DD7) Are we firing a photon bolt?
6060 BIT 0,A
6062 CALL NZ,$6802 Draw it if we are
6065 POP BC
6066 POP HL
6067 POP DE
6068 POP IX
606A INC HL
606B INC C
606C XOR A
606D DEC B
606E OR B
606F JP NZ,$5F96 Back round to the next screen position
6072 RET
Prev: 5F66 Up: Map Next: 6074