Routines |
Prev: 93BB | Up: Map | Next: 9456 |
Used by the routine at 89AD.
|
||||
93D1 | LD H,$A4 | Page 0xA4 holds the first byte of each entry in the item table | ||
93D3 | LD A,($A3FF) | Pick up the index of the first item from A3FF | ||
93D6 | LD L,A | Point HL at the first byte of the first entry in the item table | ||
The item-drawing loop begins here.
|
||||
93D7 | LD C,(HL) | Pick up the first byte of the current entry in the item table | ||
93D8 | RES 7,C | Reset bit 7; bit 6 holds the collection flag, and bits 0-5 hold the room number | ||
93DA | LD A,($8420) | Pick up the number of the current room from 8420 | ||
93DD | OR $40 | Set bit 6 (corresponding to the collection flag) | ||
93DF | CP C | Is the item in the current room and still uncollected? | ||
93E0 | JR NZ,$9452 | If not, jump to consider the next entry in the item table | ||
This item is in the current room and has not been collected yet.
|
||||
93E2 | LD A,(HL) | Pick up the first byte of the current entry in the item table | ||
93E3 | RLCA | Point DE at the location of the item in the attribute buffer at 5C00 | ||
93E4 | AND $01 | |||
93E6 | ADD A,$5C | |||
93E8 | LD D,A | |||
93E9 | INC H | |||
93EA | LD E,(HL) | |||
93EB | DEC H | |||
93EC | LD A,(DE) | Pick up the current attribute byte at the item's location | ||
93ED | AND $07 | Is the INK white (which happens if Willy is touching the item, or the room's background tile has white INK, as in Swimming Pool)? | ||
93EF | CP $07 | |||
93F1 | JR NZ,$9430 | Jump if not | ||
Willy is touching this item (or the room's background tile has white INK), so add it to his collection.
|
||||
93F3 | LD IX,$857C | Point IX at the number of items collected at 857C | ||
93F7 | INC (IX+$02) | Increment a digit of the number of items collected | ||
93FA | LD A,(IX+$02) | Was the digit originally '9'? | ||
93FD | CP $3A | |||
93FF | JR NZ,$9409 | Jump if not | ||
9401 | LD (IX+$02),$30 | Set the digit to '0' | ||
9405 | DEC IX | Move back to the digit on the left | ||
9407 | JR $93F7 | Jump back to increment this digit | ||
9409 | LD A,($80DE) | Pick up the border colour for the current room from 80DE | ||
940C | LD C,$80 | Produce the sound effect for collecting an item | ||
940E | OUT ($FE),A | |||
9410 | XOR $18 | |||
9412 | LD E,A | |||
9413 | LD A,$90 | |||
9415 | SUB C | |||
9416 | LD B,A | |||
9417 | LD A,E | |||
9418 | DJNZ $9418 | |||
941A | DEC C | |||
941B | DEC C | |||
941C | JR NZ,$940E | |||
941E | LD A,($85DE) | Update the counter of items remaining at 85DE, and set the zero flag if there are no more items to collect | ||
9421 | INC A | |||
9422 | LD ($85DE),A | |||
9425 | JR NZ,$942C | Jump if there are any items still to be collected | ||
9427 | LD A,$01 | Update the game mode indicator at 85DF to 1 (all items collected) | ||
9429 | LD ($85DF),A | |||
942C | RES 6,(HL) | Reset bit 6 of the first byte of the entry in the item table: the item has been collected | ||
942E | JR $9452 | Jump to consider the next entry in the item table | ||
Willy is not touching this item, so draw it and cycle its INK colour.
|
||||
9430 | LD A,($85CB) | Generate the INK colour for the item from the value of the minute counter at 85CB (0x00-0xFF) and the index of the item in the item table (0xAD-0xFF) | ||
9433 | ADD A,L | |||
9434 | AND $03 | |||
9436 | ADD A,$03 | |||
9438 | LD C,A | |||
9439 | LD A,(DE) | Change the INK colour of the item in the attribute buffer at 5C00 | ||
943A | AND $F8 | |||
943C | OR C | |||
943D | LD (DE),A | |||
943E | LD A,(HL) | Point DE at the location of the item in the screen buffer at 6000 | ||
943F | RLCA | |||
9440 | RLCA | |||
9441 | RLCA | |||
9442 | RLCA | |||
9443 | AND $08 | |||
9445 | ADD A,$60 | |||
9447 | LD D,A | |||
9448 | PUSH HL | Save HL briefly | ||
9449 | LD HL,$80E1 | Point HL at the item graphic for the current room (at 80E1) | ||
944C | LD B,$08 | There are eight pixel rows to copy | ||
944E | CALL $969B | Draw the item to the screen buffer at 6000 | ||
9451 | POP HL | Restore the item table pointer to HL | ||
The current item has been dealt with (skipped, collected or drawn) as appropriate. Time to consider the next one.
|
||||
9452 | INC L | Point HL at the first byte of the next entry in the item table | ||
9453 | JR NZ,$93D7 | Jump back unless we've examined every entry | ||
9455 | RET |
Prev: 93BB | Up: Map | Next: 9456 |