Routines |
Prev: A83B | Up: Map | Next: A8A0 |
|
||||||||
The location of the object to draw is stored at A838.
This routine is a copy of code used in Pyjamarama, the previous game in the series.
|
||||||||
A83D | DI | Disable interrupts. | ||||||
A83E | EXX | Exchange all main registers. | ||||||
A83F | PUSH AF | Remember the object ID. | ||||||
A840 | LD ($A83B),SP | Remember the current stack pointer in A83B. | ||||||
A844 | LD L,A | Put the object ID in HL. | ||||||
A845 | LD H,$00 | |||||||
A847 | ADD HL,HL | Multiply by 32 to get a suitable offset. | ||||||
A848 | ADD HL,HL | |||||||
A849 | ADD HL,HL | |||||||
A84A | ADD HL,HL | |||||||
A84B | ADD HL,HL | |||||||
A84C | LD SP,$8378 | Point the stack at the start of the graphics buffer. (8378) | ||||||
A84F | ADD HL,SP | Add the offset so the stack is at the start of the graphic data. | ||||||
A850 | LD SP,HL | |||||||
A851 | LD A,($A838) | Get the x co-ordinate. | ||||||
A854 | LD B,A | Set this in B. | ||||||
A855 | AND $07 | Get the bottom 3 bits, which are the frame ID. | ||||||
A857 | INC A | Add 1 to this and modifiy A87B which is executed later. | ||||||
A858 | LD ($A87B),A | |||||||
A85B | LD A,B | Get the top 5 bits of the x co-ordinate, which are the byte. | ||||||
A85C | AND $F8 | |||||||
A85E | RRCA | |||||||
A85F | RRCA | |||||||
A860 | RRCA | |||||||
A861 | LD ($EFAF),A | Change the routine at EF91 to use a different pointer in the buffer. | ||||||
A864 | ADD A,$02 | Move forward two columns and store this in E. | ||||||
A866 | LD E,A | |||||||
A867 | LD A,($A839) | Get the Y co-ordinate. | ||||||
A86A | SUB $40 | Subtract 40 to get an offset on screen. | ||||||
A86C | LD L,A | Put this in HL. | ||||||
A86D | LD H,$00 | |||||||
A86F | ADD HL,HL | Multiply by 32 so it points at the start of a row. | ||||||
A870 | ADD HL,HL | |||||||
A871 | ADD HL,HL | |||||||
A872 | ADD HL,HL | |||||||
A873 | ADD HL,HL | |||||||
A874 | LD D,$6B | Point the high byte of DE at the sprite buffer. (6B00) | ||||||
A876 | ADD HL,DE | Add this to the offset so HL points to the correct row. | ||||||
A877 | LD C,$10 | 16 rows to copy. | ||||||
A879 | POP DE | Put the next graphic data in DE. | ||||||
A87A | LD B,$00 | Skip a number of frames. (This code was modified earlier in the routine) | ||||||
A87C | DEC B | If this is frame 0, it sits on a byte boundary and there is one less byte to update. | ||||||
A87D | JR Z,$A889 | |||||||
A87F | XOR A | Start with a value of 0 ie: all bits off. | ||||||
A880 | SRL E | Shift E, putting 0 in bit 7. | ||||||
A882 | RR D | Rotate D, respecting carry. | ||||||
A884 | RRA | Rotate A, respecting carry. | ||||||
A885 | DJNZ $A880 | Loop until we get the right frame. | ||||||
A887 | OR (HL) | Do a logical OR of the byte with the data in A. | ||||||
A888 | LD (HL),A | |||||||
A889 | DEC HL | Move back a byte. | ||||||
A88A | LD A,(HL) | Do a logical OR of the byte with the data in D. | ||||||
A88B | OR D | |||||||
A88C | LD (HL),A | |||||||
A88D | DEC HL | Move back a byte. | ||||||
A88E | LD A,(HL) | Do a logical OR of the byte with the data in D. | ||||||
A88F | OR E | |||||||
A890 | LD (HL),A | |||||||
A891 | LD DE,$0022 | Move to the next row | ||||||
A894 | ADD HL,DE | |||||||
A895 | DEC C | Decrement the number of rows to copy. | ||||||
A896 | JP NZ,$A879 | Loop while there is more to draw. | ||||||
A899 | LD SP,($A83B) | Restore the stack pointer. | ||||||
A89D | POP AF | Restore the object ID in A. | ||||||
A89E | EXX | Swap back all main registers and return. | ||||||
A89F | RET |
Prev: A83B | Up: Map | Next: A8A0 |