![]() |
Routines |
| Prev: 42397 | Up: Map | Next: 42484 |
|
Moves the length of a gauge by one pixel towards its target, and draws or erases the end of the bar.
|
||||||||
| UpdateGauge | 42405 | LD A,(IX+0) | Fetch the current length of the bar. | |||||
| 42408 | CP (IX+3) | Compare it with the target length. | ||||||
| 42411 | RET Z | Return if it is already at the target. | ||||||
| 42412 | JR NC,UpdateGauge_Shrink | Jump to UpdateGauge_Shrink if the target is lower. | ||||||
| 42414 | INC A | Add one to the length. | ||||||
| 42415 | CP 85 | Compare it with 85 the longest length. | ||||||
| 42417 | RET NC | Return if the length is too long. | ||||||
| 42418 | JR UpdateGauge_Grow | Jump to UpdateGauge_Grow. | ||||||
| UpdateGauge_Shrink | 42420 | AND A | Test the length. | |||||
| 42421 | RET Z | Return if the length is zero. | ||||||
| 42422 | DEC (IX+0) | Decrease the length by one. | ||||||
| 42425 | JR UpdateGauge_Draw | Jump to UpdateGauge_Draw. | ||||||
| UpdateGauge_Grow | 42427 | LD (IX+0),A | Store the new length. | |||||
| 42430 | AND A | Test it. | ||||||
| 42431 | RET Z | Return if it is zero. | ||||||
| UpdateGauge_Draw | 42432 | LD C,A | Keep the length in C. | |||||
| 42433 | RRA | Divide it by eight... | ||||||
| 42434 | RRA | ...to find the number of whole bytes... | ||||||
| 42435 | RRA | ...in the bar. | ||||||
| 42436 | AND %00011111 | Keep the number of bytes. | ||||||
| 42438 | ADD A,(IX+1) | Add the column of the left end of the bar. | ||||||
| 42441 | LD L,A | Set the low byte of the screen address. | ||||||
| 42442 | LD H,85 | Set the high byte of the screen address for the bottom pixel line. | ||||||
| 42444 | LD A,C | Fetch the length again. | ||||||
| 42445 | AND %00000111 | Keep the number of pixels in the last byte. | ||||||
| 42447 | INC A | Add one. | ||||||
| 42448 | LD B,A | Use it as a counter. | ||||||
| 42449 | XOR A | Clear A. | ||||||
| 42450 | SCF | Set the carry flag. | ||||||
| UpdateGauge_Mask | 42451 | RRA | Rotate the set bit into position. | |||||
| 42452 | DJNZ UpdateGauge_Mask | Jump back until it is in the right place. | ||||||
| 42454 | LD E,A | Keep the mask in E. | ||||||
| 42455 | LD A,C | Fetch the length again. | ||||||
| 42456 | CP 3 | Jump to UpdateGauge_Pixel if the length is short. | ||||||
| 42458 | JR C,UpdateGauge_Pixel | |||||||
| 42460 | PUSH HL | Save the screen address. | ||||||
| 42461 | LD A,(HL) | Fetch the byte of the bottom pixel line. | ||||||
| 42462 | XOR E | Flip the pixel of the end of the bar. | ||||||
| 42463 | LD (HL),A | Store it. | ||||||
| 42464 | LD H,82 | Move to the top pixel line. | ||||||
| 42466 | LD A,(HL) | Fetch the byte of the top pixel line. | ||||||
| 42467 | XOR E | Flip the pixel of the end of the bar. | ||||||
| 42468 | LD (HL),A | Store it. | ||||||
| 42469 | POP HL | Restore the screen address. | ||||||
| UpdateGauge_Pixel | 42470 | DEC H | Move up a pixel line. | |||||
| 42471 | RRC E | Move the mask one pixel to the right. | ||||||
| 42473 | JR NC,UpdateGauge_Rest | Jump to UpdateGauge_Rest unless the mask moved to the next byte. | ||||||
| 42475 | INC L | Move onto the next byte. | ||||||
| UpdateGauge_Rest | 42476 | LD A,E | Fetch the mask. | |||||
| 42477 | XOR (HL) | Flip the pixel of the end of the bar. | ||||||
| 42478 | LD (HL),A | Store it. | ||||||
| 42479 | DEC H | Move up a pixel line. | ||||||
| 42480 | LD A,E | Fetch the mask. | ||||||
| 42481 | XOR (HL) | Flip the pixel of the end of the bar. | ||||||
| 42482 | LD (HL),A | Store it. | ||||||
| 42483 | RET | Return. | ||||||
| Prev: 42397 | Up: Map | Next: 42484 |