![]() |
Routines |
| Prev: F833 | Up: Map | Next: F9EE |
|
Used by the routine at JumpTable_DrawEntity.
Draws the entity pointed to by IX.
|
||||||||
| Draw_Entity | F8B4 | XOR A | Clear the self-modified OR at Draw_Entity_Merge. | |||||
| F8B5 | LD ($F929),A | |||||||
| F8B8 | LD H,A | Stash *CHARS on the stack. | ||||||
| F8B9 | LD DE,($5C36) | |||||||
| F8BD | PUSH DE | |||||||
| F8BE | PUSH IY | Stash IY and IX on the stack. | ||||||
| F8C0 | PUSH IX | |||||||
| F8C2 | LD A,$07 | Write 07-*IX+02 to the shift count at F917. | ||||||
| F8C4 | SUB (IX+$02) | |||||||
| F8C7 | LD ($F917),A | |||||||
| F8CA | LD E,(IX+$04) | DE=the sprite width and height. | ||||||
| F8CD | LD D,(IX+$05) | |||||||
| F8D0 | LD C,D | IY=5CBE+(height+01)*08. | ||||||
| F8D1 | INC C | |||||||
| F8D2 | SLA C | |||||||
| F8D4 | SLA C | |||||||
| F8D6 | SLA C | |||||||
| F8D8 | LD B,$00 | |||||||
| F8DA | LD IY,$5CBE | |||||||
| F8DE | ADD IY,BC | |||||||
| F8E0 | LD A,E | Write the width*08 to the stride at F936. | ||||||
| F8E1 | SLA A | |||||||
| F8E3 | SLA A | |||||||
| F8E5 | SLA A | |||||||
| F8E7 | LD ($F936),A | |||||||
| F8EA | LD A,(IX+$07) | Jump to Advance_Entity_Target if bit 7 of the colour is set. | ||||||
| F8ED | BIT 7,A | |||||||
| F8EF | JP NZ,Advance_Entity_Target | |||||||
| F8F2 | LD ($5C8F),A | Write the colour to *ATTR_T. | ||||||
| F8F5 | LD DE,($5C36) | DE=*CHARS. | ||||||
| F8F9 | LD L,(IX+$06) | Point HL at this frame's source UDGs. | ||||||
| F8FC | LD H,$00 | |||||||
| F8FE | ADD HL,HL | |||||||
| F8FF | ADD HL,HL | |||||||
| F900 | ADD HL,HL | |||||||
| F901 | ADD HL,DE | |||||||
| F902 | LD D,(IX+$05) | DE=the sprite width and height. | ||||||
| F905 | LD E,(IX+$04) | |||||||
| F908 | PUSH HL | Copy HL to IX (using the stack). | ||||||
| F909 | POP IX | |||||||
| F90B | LD HL,$5CBE | HL=5CBE. | ||||||
| Draw_Entity_Continue | F90E | PUSH IX | Stash the source pointer and remaining size. | |||||
| F910 | PUSH DE | |||||||
| Draw_Entity_Continue2 | F911 | PUSH IX | Stash the source pointer on the stack. | |||||
| F913 | LD B,$08 | B=08. | ||||||
| Draw_Entity_Target | F915 | PUSH BC | Stash the row count. | |||||
| Draw_Entity_ShiftCount | F916 | LD B,$FF | B=the shift count (self-modified). | |||||
| F918 | XOR A | A=00. | ||||||
| F919 | CP B | Test the shift count. | ||||||
| F91A | LD C,A | C=00. | ||||||
| F91B | LD A,(IX+$00) | A=the next source byte. | ||||||
| F91E | JR Z,Draw_Entity_Skip | Jump to Draw_Entity_Skip if the shift count is zero. | ||||||
| Draw_Entity_Target2 | F920 | SRL A | Shift one source bit into the overflow byte. | |||||
| F922 | RR C | |||||||
| F924 | DJNZ Draw_Entity_Target2 | |||||||
| Draw_Entity_Skip | F926 | LD (IY+$00),C | Write the overflow bits to the next column. | |||||
| Draw_Entity_Merge | F929 | NOP | Self-modified: NOP or OR (HL). | |||||
| F92A | LD (HL),A | Write the rotated byte. | ||||||
| F92B | INC HL | Advance the destination and source pointers. | ||||||
| F92C | INC IX | |||||||
| F92E | INC IY | |||||||
| F930 | POP BC | Restore the row count from the stack. | ||||||
| F931 | DJNZ Draw_Entity_Target | Decrease the count and loop back to Draw_Entity_Target. | ||||||
| F933 | POP IX | Restore the source pointer from the stack. | ||||||
| Draw_Entity_Stride | F935 | LD BC,$0000 | BC=the stored stride (self-modified). | |||||
| F938 | ADD IX,BC | Advance to the next source column and loop back to Draw_Entity_Continue2. | ||||||
| F93A | DEC D | |||||||
| F93B | JR NZ,Draw_Entity_Continue2 | |||||||
| F93D | LD A,$B6 | Write OR (HL) into *Draw_Entity_Merge. | ||||||
| F93F | LD ($F929),A | |||||||
| F942 | XOR A | A=00. | ||||||
| F943 | LD B,$08 | B=08. | ||||||
| Draw_Entity_Target3 | F945 | LD (HL),A | Clear one overflow byte and loop back to Draw_Entity_Target3. | |||||
| F946 | LD (IY+$00),A | |||||||
| F949 | INC HL | |||||||
| F94A | INC IY | |||||||
| F94C | DJNZ Draw_Entity_Target3 | |||||||
| F94E | POP DE | Step to the next source character and loop back to Draw_Entity_Continue. | ||||||
| F94F | POP IX | |||||||
| F951 | LD BC,$0008 | |||||||
| F954 | ADD IX,BC | |||||||
| F956 | DEC E | |||||||
| F957 | JR NZ,Draw_Entity_Continue | |||||||
|
This entry point is used by the routine at Advance_Entity_Target.
|
||||||||
| Draw_Entity_Target4 | F959 | LD HL,$5BB6 | Point *CHARS at the shifted workspace plus the fine-Y. | |||||
| F95C | POP IX | |||||||
| F95E | LD E,(IX+$03) | |||||||
| F961 | INC E | |||||||
| F962 | LD D,A | |||||||
| F963 | ADD HL,DE | |||||||
| F964 | LD ($5C36),HL | |||||||
| F967 | LD D,(IX+$05) | Increase the printed width when the fine-X is not 07. | ||||||
| F96A | LD A,(IX+$02) | |||||||
| F96D | CP $07 | |||||||
| F96F | LD E,(IX+$04) | |||||||
| F972 | JR Z,Draw_Entity_Skip2 | |||||||
| F974 | INC E | |||||||
| Draw_Entity_Skip2 | F975 | INC D | Store the printed height in *6414. | |||||
| F976 | LD A,D | |||||||
| F977 | LD ($6414),A | |||||||
| F97A | LD A,$07 | Decrease the height when the fine-Y is 07. | ||||||
| F97C | CP (IX+$03) | |||||||
| F97F | JR NZ,Draw_Entity_Continue3 | |||||||
| F981 | DEC D | |||||||
| Draw_Entity_Continue3 | F982 | LD B,(IX+$01) | Call Draw_Entity_Target5 at the entity column and row. | |||||
| F985 | LD C,(IX+$00) | |||||||
| F988 | POP IY | |||||||
| F98A | CALL Draw_Entity_Target5 | |||||||
| F98D | POP HL | Restore *CHARS from the stack. | ||||||
| F98E | LD ($5C36),HL | Write it back to *CHARS. | ||||||
| F991 | RET | Return. | ||||||
|
Print the shifted sprite inside the clip window.
|
||||||||
| Draw_Entity_Target5 | F992 | LD L,$1F | Write the remaining width into the load at F99A. | |||||
| F994 | LD A,E | |||||||
| F995 | LD ($F99A),A | |||||||
| Draw_Entity_Target6 | F998 | INC L | Advance the glyph base. | |||||
| Draw_Entity_Width | F999 | LD E,$00 | E=the remaining width (self-modified). | |||||
| F99B | LD A,($6419) | Jump to Draw_Entity_Branch if this row is inside *ClipWindow. | ||||||
| F99E | CP B | |||||||
| F99F | JR NC,Draw_Entity_Branch | |||||||
| Draw_Entity_Target7 | F9A1 | DEC D | Skip down until the row is inside the clip window. | |||||
| F9A2 | RET Z | |||||||
| F9A3 | INC L | |||||||
| F9A4 | DEC B | |||||||
| F9A5 | CP B | |||||||
| F9A6 | JR NC,Draw_Entity_Branch | |||||||
| F9A8 | JR Draw_Entity_Target7 | |||||||
| Draw_Entity_Branch | F9AA | LD A,($641C) | Return if this column is past *641C. | |||||
| F9AD | CP C | |||||||
| F9AE | RET NC | |||||||
| F9AF | LD A,($641A) | Return if this row is below *ClipWindow_MaximumRow. | ||||||
| F9B2 | CP B | |||||||
| F9B3 | RET NC | |||||||
| F9B4 | PUSH BC | Jump to Draw_Entity_Branch3 if this column is inside *ClipWindow_MinimumColumn. | ||||||
| F9B5 | LD A,($641B) | |||||||
| F9B8 | CP C | |||||||
| F9B9 | JR NC,Draw_Entity_Branch3 | |||||||
| F9BB | LD H,L | Copy the glyph base into H. | ||||||
| Draw_Entity_Branch2 | F9BC | DEC E | Jump to Draw_Entity_Skip3 if the remaining width is zero. | |||||
| F9BD | JR Z,Draw_Entity_Skip3 | |||||||
| F9BF | LD A,($6414) | Skip left until the column is inside the clip window. | ||||||
| F9C2 | ADD A,H | |||||||
| F9C3 | LD H,A | |||||||
| F9C4 | DEC C | |||||||
| F9C5 | LD A,($641B) | |||||||
| F9C8 | CP C | |||||||
| F9C9 | JR C,Draw_Entity_Branch2 | |||||||
| F9CB | CALL Set_PrintPosition | Call Set_PrintPosition. | ||||||
| F9CE | LD A,H | A=the clipped glyph. | ||||||
| F9CF | JR Draw_Entity_Continue4 | Jump to Draw_Entity_Continue4. | ||||||
| Draw_Entity_Branch3 | F9D1 | CALL Set_PrintPosition | Call Set_PrintPosition with the unclipped glyph. | |||||
| F9D4 | LD A,L | |||||||
| Draw_Entity_Continue4 | F9D5 | CALL Print_Character | Call Print_Character and keep the glyph in H. | |||||
| F9D8 | LD H,A | |||||||
| F9D9 | DEC C | Jump to Draw_Entity_Skip3 if this column is past *641C. | ||||||
| F9DA | LD A,($641C) | |||||||
| F9DD | CP C | |||||||
| F9DE | JP NC,Draw_Entity_Skip3 | |||||||
| F9E1 | LD A,($6414) | Advance the glyph and loop back to Draw_Entity_Continue4. | ||||||
| F9E4 | ADD A,H | |||||||
| F9E5 | DEC E | |||||||
| F9E6 | JR NZ,Draw_Entity_Continue4 | |||||||
| Draw_Entity_Skip3 | F9E8 | POP BC | Restore the position from the stack. | |||||
| F9E9 | DEC D | Return if the remaining height is zero. | ||||||
| F9EA | RET Z | |||||||
| F9EB | DEC B | Move up one row. | ||||||
| F9EC | JR Draw_Entity_Target6 | Jump to Draw_Entity_Target6. | ||||||
|
View the equivalent code in Booty.
|
||||||||
| Prev: F833 | Up: Map | Next: F9EE |