![]() |
Routines |
| Prev: A59D | Up: Map | Next: A5F4 |
|
Moves the length of a gauge by one pixel towards its target, and draws or erases the end of the bar.
|
||||||||
| UpdateGauge | A5A5 | LD A,(IX+$00) | Fetch the current length of the bar. | |||||
| A5A8 | CP (IX+$03) | Compare it with the target length. | ||||||
| A5AB | RET Z | Return if it is already at the target. | ||||||
| A5AC | JR NC,UpdateGauge_Shrink | Jump to UpdateGauge_Shrink if the target is lower. | ||||||
| A5AE | INC A | Add one to the length. | ||||||
| A5AF | CP $55 | Compare it with 55 the longest length. | ||||||
| A5B1 | RET NC | Return if the length is too long. | ||||||
| A5B2 | JR UpdateGauge_Grow | Jump to UpdateGauge_Grow. | ||||||
| UpdateGauge_Shrink | A5B4 | AND A | Test the length. | |||||
| A5B5 | RET Z | Return if the length is zero. | ||||||
| A5B6 | DEC (IX+$00) | Decrease the length by one. | ||||||
| A5B9 | JR UpdateGauge_Draw | Jump to UpdateGauge_Draw. | ||||||
| UpdateGauge_Grow | A5BB | LD (IX+$00),A | Store the new length. | |||||
| A5BE | AND A | Test it. | ||||||
| A5BF | RET Z | Return if it is zero. | ||||||
| UpdateGauge_Draw | A5C0 | LD C,A | Keep the length in C. | |||||
| A5C1 | RRA | Divide it by eight... | ||||||
| A5C2 | RRA | ...to find the number of whole bytes... | ||||||
| A5C3 | RRA | ...in the bar. | ||||||
| A5C4 | AND %00011111 | Keep the number of bytes. | ||||||
| A5C6 | ADD A,(IX+$01) | Add the column of the left end of the bar. | ||||||
| A5C9 | LD L,A | Set the low byte of the screen address. | ||||||
| A5CA | LD H,$55 | Set the high byte of the screen address for the bottom pixel line. | ||||||
| A5CC | LD A,C | Fetch the length again. | ||||||
| A5CD | AND %00000111 | Keep the number of pixels in the last byte. | ||||||
| A5CF | INC A | Add one. | ||||||
| A5D0 | LD B,A | Use it as a counter. | ||||||
| A5D1 | XOR A | Clear A. | ||||||
| A5D2 | SCF | Set the carry flag. | ||||||
| UpdateGauge_Mask | A5D3 | RRA | Rotate the set bit into position. | |||||
| A5D4 | DJNZ UpdateGauge_Mask | Jump back until it is in the right place. | ||||||
| A5D6 | LD E,A | Keep the mask in E. | ||||||
| A5D7 | LD A,C | Fetch the length again. | ||||||
| A5D8 | CP $03 | Jump to UpdateGauge_Pixel if the length is short. | ||||||
| A5DA | JR C,UpdateGauge_Pixel | |||||||
| A5DC | PUSH HL | Save the screen address. | ||||||
| A5DD | LD A,(HL) | Fetch the byte of the bottom pixel line. | ||||||
| A5DE | XOR E | Flip the pixel of the end of the bar. | ||||||
| A5DF | LD (HL),A | Store it. | ||||||
| A5E0 | LD H,$52 | Move to the top pixel line. | ||||||
| A5E2 | LD A,(HL) | Fetch the byte of the top pixel line. | ||||||
| A5E3 | XOR E | Flip the pixel of the end of the bar. | ||||||
| A5E4 | LD (HL),A | Store it. | ||||||
| A5E5 | POP HL | Restore the screen address. | ||||||
| UpdateGauge_Pixel | A5E6 | DEC H | Move up a pixel line. | |||||
| A5E7 | RRC E | Move the mask one pixel to the right. | ||||||
| A5E9 | JR NC,UpdateGauge_Rest | Jump to UpdateGauge_Rest unless the mask moved to the next byte. | ||||||
| A5EB | INC L | Move onto the next byte. | ||||||
| UpdateGauge_Rest | A5EC | LD A,E | Fetch the mask. | |||||
| A5ED | XOR (HL) | Flip the pixel of the end of the bar. | ||||||
| A5EE | LD (HL),A | Store it. | ||||||
| A5EF | DEC H | Move up a pixel line. | ||||||
| A5F0 | LD A,E | Fetch the mask. | ||||||
| A5F1 | XOR (HL) | Flip the pixel of the end of the bar. | ||||||
| A5F2 | LD (HL),A | Store it. | ||||||
| A5F3 | RET | Return. | ||||||
| Prev: A59D | Up: Map | Next: A5F4 |