Routines |
Prev: A83D | Up: Map | Next: A921 |
|
||||||||
The co-ordinates to update are stored in A838.
|
||||||||
A8A0 | EXX | Exchange main registers. | ||||||
A8A1 | PUSH AF | Remember AF. | ||||||
A8A2 | LD ($A83B),SP | Store the stack pointer in A83B. | ||||||
A8A6 | LD SP,$8378 | Set the stack pointer to the start of the object graphics. (8378) | ||||||
A8A9 | LD L,A | Put the sprite ID in HL. | ||||||
A8AA | LD H,$00 | |||||||
A8AC | ADD HL,HL | Multiply by 32. | ||||||
A8AD | ADD HL,HL | |||||||
A8AE | ADD HL,HL | |||||||
A8AF | ADD HL,HL | |||||||
A8B0 | ADD HL,HL | |||||||
A8B1 | ADD HL,SP | Use this to set the stack pointer at the graphic data for this object. | ||||||
A8B2 | LD SP,HL | |||||||
A8B3 | LD A,($A838) | Put the X co-ordinate in B. | ||||||
A8B6 | LD B,A | |||||||
A8B7 | AND $07 | Get the bottom 3 bytes, which represents the frame number. | ||||||
A8B9 | INC A | Add 1, and set this in A8E0 and A8FC which modifies later routines. | ||||||
A8BA | LD ($A8E0),A | |||||||
A8BD | LD ($A8FC),A | |||||||
A8C0 | LD A,B | Put the bottom 5 bits, which represents the byte, in EFAF. This changes the logic in the routine to draw the fountain in the town square at EF91. | ||||||
A8C1 | AND $F8 | |||||||
A8C3 | RRCA | |||||||
A8C4 | RRCA | |||||||
A8C5 | RRCA | |||||||
A8C6 | LD ($EFAF),A | |||||||
A8C9 | ADD A,$02 | Add 2 to the byte and store it in E. | ||||||
A8CB | LD E,A | |||||||
A8CC | LD C,$10 | 10 rows to update. | ||||||
A8CE | LD A,($A839) | Get the Y co-ordinate. | ||||||
A8D1 | SUB $40 | Subtract 40 to get an offset in the sprite buffer. | ||||||
A8D3 | LD L,A | Put this in HL. | ||||||
A8D4 | LD H,$00 | |||||||
A8D6 | ADD HL,HL | Multiply by 32 to get a row offset. | ||||||
A8D7 | ADD HL,HL | |||||||
A8D8 | ADD HL,HL | |||||||
A8D9 | ADD HL,HL | |||||||
A8DA | ADD HL,HL | |||||||
A8DB | LD D,$6B | Set the high byte of DE to an offset in the sprite buffer. (6B00) | ||||||
A8DD | ADD HL,DE | Add this. | ||||||
A8DE | POP DE | Get the next value (the mask) in DE. | ||||||
If this is not frame 0, it doesn't sit on a byte boundary and bits need shifting forwards.
|
||||||||
A8DF | LD B,$00 | Set B to the number of frames to loop around. (This code is modified earlier) | ||||||
A8E1 | DEC B | If this is frame 0, there is one less byte to update. | ||||||
A8E2 | JR Z,$A8F0 | |||||||
A8E4 | SCF | Set the carry flag, to use in rotating bits. | ||||||
A8E5 | LD A,$FF | Start with a mask of FF ie: all bits on. | ||||||
A8E7 | RR E | Rotate E and D, respecting carry. | ||||||
A8E9 | RR D | |||||||
A8EB | RRA | Rotate A, respecting carry. | ||||||
A8EC | DJNZ $A8E7 | Loop until we get to the right frame number. | ||||||
A8EE | AND (HL) | Do a logical AND of the mask in A against the byte in the sprite buffer. | ||||||
A8EF | LD (HL),A | |||||||
A8F0 | DEC HL | Move back a byte. | ||||||
A8F1 | LD A,(HL) | Do a logical AND of the mask in D against the byte in the sprite buffer. | ||||||
A8F2 | AND D | |||||||
A8F3 | LD (HL),A | |||||||
A8F4 | DEC HL | Move back a byte. | ||||||
A8F5 | LD A,(HL) | Do a logical AND of the mask in E against the byte in the sprite buffer. | ||||||
A8F6 | AND E | |||||||
A8F7 | LD (HL),A | |||||||
A8F8 | INC HL | Move forward to the next byte in the buffer. | ||||||
A8F9 | INC HL | |||||||
A8FA | POP DE | Get the next value (the data) in DE. | ||||||
A8FB | LD B,$00 | Set B to the number of frames to loop around. (This code is modified earlier) | ||||||
A8FD | DEC B | If this is frame 0, there is one less byte to update. | ||||||
A8FE | JR Z,$A90A | |||||||
A900 | XOR A | Start with data of 0 ie: all bits off | ||||||
A901 | SRL E | Shift E to the right, putting 0 on bit 7. | ||||||
A903 | RR D | Rotate D respecting carry. | ||||||
A905 | RRA | Rotate A repsecting carry. | ||||||
A906 | DJNZ $A901 | Loop until we get to the right frame number. | ||||||
A908 | OR (HL) | Do a logical OR of the data in A against the byte in the sprite buffer. | ||||||
A909 | LD (HL),A | |||||||
A90A | DEC HL | Move back a byte. | ||||||
A90B | LD A,(HL) | Do a logical OR of the data in D against the byte in the sprite buffer. | ||||||
A90C | OR D | |||||||
A90D | LD (HL),A | |||||||
A90E | DEC HL | Move back a byte. | ||||||
A90F | LD A,(HL) | Do a logical OR of the data in D against the byte in the sprite buffer. | ||||||
A910 | OR E | |||||||
A911 | LD (HL),A | |||||||
A912 | LD DE,$0022 | Move forward a row and two columns. | ||||||
A915 | ADD HL,DE | |||||||
A916 | DEC C | Decrement the row count. | ||||||
A917 | JP NZ,$A8DE | Loop while there are more rows to draw. | ||||||
A91A | EXX | Restore main registers. | ||||||
A91B | LD SP,($A83B) | Restore the stack pointer. | ||||||
A91F | POP AF | Restore AF and return. | ||||||
A920 | RET |
Prev: A83D | Up: Map | Next: A921 |