Dun Darach | Routines |
Prev: 8EEE | Up: Map |
|
|||||||
Room_jvGambling | 8F43 | LD HL,$0200 | |||||
8F46 | LD (Account_Cost),HL | ||||||
8F49 | LD IX,Gamble_Dice1 | ||||||
8F4D | LD HL,Gamble_Counter | ||||||
8F50 | LD A,(HL) | ||||||
8F51 | AND A | ||||||
8F52 | JR NZ,Room_jvGambling_5 | ||||||
Restart the game cycle.
|
|||||||
8F54 | LD (Room_Flags),A | ||||||
8F57 | LD HL,$BB7A | ||||||
8F5A | LD (HL),$FF | ||||||
8F5C | LD DE,$BB7B | ||||||
8F5F | LD BC,$0007 | ||||||
8F62 | LDIR | ||||||
8F64 | CALL Message_Display | ||||||
8F67 | DEFM "place your bets" | ||||||
8F76 | DEFB $5E | ||||||
Update state counter.
|
|||||||
Room_jvGambling_0 | 8F77 | LD HL,Gamble_Counter | |||||
8F7A | INC (HL) | ||||||
Draw dice.
|
|||||||
Room_jvGambling_1 | 8F7B | LD IX,Gamble_Dice1 | |||||
8F7F | LD B,$02 | ||||||
Room_jvGambling_2 | 8F81 | PUSH BC | |||||
8F82 | CALL char_BlitScrolledVert | ||||||
8F85 | LD BC,$000C | ||||||
8F88 | ADD IX,BC | ||||||
8F8A | POP BC | ||||||
8F8B | DJNZ Room_jvGambling_2 | ||||||
8F8D | LD HL,Gamble_leftValue | ||||||
8F90 | LD DE,$BB7A | ||||||
8F93 | LD BC,$0008 | ||||||
8F96 | LD A,(_7f6e) | ||||||
8F99 | AND A | ||||||
8F9A | JR NZ,Room_jvGambling_4 | ||||||
Room_jvGambling_3 | 8F9C | LD A,(DE) | |||||
8F9D | CP (HL) | ||||||
8F9E | JP NZ,Room_jvGambling_4 | ||||||
8FA1 | INC HL | ||||||
8FA2 | INC DE | ||||||
8FA3 | DEC C | ||||||
8FA4 | JR NZ,Room_jvGambling_3 | ||||||
8FA6 | RET | ||||||
Room_jvGambling_4 | 8FA7 | LDIR | |||||
8FA9 | XOR A | ||||||
8FAA | LD (_7f6e),A | ||||||
8FAD | JP Gamble_DisplayStakes | ||||||
Game cycle.
|
|||||||
Room_jvGambling_5 | 8FB0 | CP $50 | |||||
8FB2 | JR C,Room_jvGambling_0 | < $50, "place bets" mode, just update. | |||||
8FB4 | JR NZ,Room_jvGambling_6 | > $50,other modes | |||||
8FB6 | LD (Room_Flags),A | ||||||
No more bets mode.
|
|||||||
8FB9 | CALL Message_Display | ||||||
8FBC | DEFM "no more bets" | ||||||
8FC8 | DEFB $5E | ||||||
8FC9 | LD A,(_b11e) | Put random value into role countdown for both dice. | |||||
8FCC | ADD A,(IY+$3E) | ||||||
8FCF | LD B,A | ||||||
8FD0 | AND $0F | ||||||
8FD2 | ADD A,$12 | ||||||
8FD4 | LD (IX+$03),A | ||||||
8FD7 | LD A,B | ||||||
8FD8 | RRA | ||||||
8FD9 | RRA | ||||||
8FDA | RRA | ||||||
8FDB | RRA | ||||||
8FDC | AND $0F | ||||||
8FDE | ADD A,$12 | ||||||
8FE0 | LD (IX+$0F),A | ||||||
8FE3 | JP Room_jvGambling_0 | ||||||
Room_jvGambling_6 | 8FE6 | CP $53 | |||||
8FE8 | JR NC,Room_jvGambling_12 | ||||||
8FEA | PUSH IX | ||||||
8FEC | LD B,$02 | Two dice. | |||||
Room_jvGambling_7 | 8FEE | LD A,(IX+$03) | Check countdown for dice. | ||||
8FF1 | AND A | ||||||
8FF2 | JR Z,Room_jvGambling_11 | Skip if hit zero. | |||||
8FF4 | LD A,(IX+$04) | Increase offset by 2 | |||||
8FF7 | ADD A,$02 | ||||||
8FF9 | CP $08 | Until it gets to 8, move onto the next character. | |||||
8FFB | JR C,Room_jvGambling_10 | ||||||
8FFD | LD A,(IX+$00) | ||||||
9000 | INC A | ||||||
9001 | CP (IX+$02) | Check to see if the current character is out of bounds and reset back to the first. | |||||
9004 | JR C,Room_jvGambling_8 | ||||||
9006 | LD A,(IX+$01) | ||||||
Room_jvGambling_8 | 9009 | LD (IX+$00),A | Update current character. | ||||
900C | DEC (IX+$03) | Count down. | |||||
900F | JR NZ,Room_jvGambling_9 | ||||||
9011 | INC (HL) | Increase current mode to show this dice has stopped. | |||||
Room_jvGambling_9 | 9012 | XOR A | Reset bitmap offset so that full dice face is shown. | ||||
Room_jvGambling_10 | 9013 | LD (IX+$04),A | |||||
Room_jvGambling_11 | 9016 | LD DE,$000C | Move onto next dice. | ||||
9019 | ADD IX,DE | ||||||
901B | DJNZ Room_jvGambling_7 | ||||||
901D | POP IX | Get first dice info address. | |||||
901F | JP Room_jvGambling_1 | ||||||
Room_jvGambling_12 | 9022 | CP $5A | |||||
9024 | JP NZ,Room_jvGambling_0 | ||||||
Display results
|
|||||||
9027 | XOR A | ||||||
9028 | LD (Room_Flags),A | ||||||
902B | LD (HL),$D7 | Clear message line. | |||||
902D | CALL Message_Display | ||||||
9030 | DEFB $5E | ||||||
9031 | LD A,(IX+$00) | ||||||
9034 | ADD A,(IX+$0C) | ||||||
9037 | SUB $A0 | ||||||
9039 | PUSH AF | Display the value. | |||||
903A | LD C,A | ||||||
903B | LD B,$00 | ||||||
903D | CALL $1A1B | ||||||
9040 | CALL Print_StrFromStack | ||||||
9043 | DEFM ": " | ||||||
9045 | DEFB $5E | ||||||
9046 | POP AF | ||||||
9047 | CP $07 | ||||||
9049 | JP Z,Room_Gambling_HouseWins | ||||||
904C | CP $05 | ||||||
904E | JR C,Room_Gambling_CheckA | ||||||
9050 | CP $0A | ||||||
9052 | JR NC,Room_Gambling_CheckA | ||||||
9054 | JP Room_Gambling_CheckB | ||||||
Check for 'A' winning.
|
|||||||
Room_Gambling_CheckA | 9057 | CALL Search_NonZero | See if stake 'A' holds any money. | ||||
905A | DEFW Gamble_leftValue | ||||||
905C | DEFB $04 | ||||||
905D | JP Z,Room_Gambling_HouseWins | ||||||
9060 | LD HL,Gamble_leftValue | '2:1' Add double the amount staked into winnings. | |||||
9063 | LD DE,TempAl | ||||||
9066 | LD BC,$0004 | ||||||
9069 | LDIR | ||||||
906B | LD HL,TempAl | ||||||
906E | LD DE,TempAl | ||||||
9071 | CALL ValueAddAsBCDCarry | ||||||
9074 | LD HL,Gamble_leftValue | ||||||
9077 | LD DE,TempAl | ||||||
907A | CALL ValueAddAsBCDCarry | ||||||
907D | CALL Print_StrFromStack | Display message. | |||||
9080 | DEFM "a wins " | ||||||
9087 | DEFB $5E | ||||||
9088 | LD HL,TempAl | Along with the new amount. | |||||
908B | CALL Display_DecimalValue. | ||||||
908E | CALL Block_ClearMem | Clear stake 'B' | |||||
9091 | DEFW Gamble_rightValue | ||||||
9093 | DEFB $04 | ||||||
9094 | LD HL,(Room_CurrentInfoDataPtr) | Update the background. | |||||
9097 | INC HL | ||||||
9098 | INC HL | ||||||
9099 | LD A,(HL) | ||||||
909A | LD (HL),$00 | ||||||
909C | AND A | ||||||
909D | CALL NZ,Bg_DrawAll | ||||||
90A0 | JP Room_jvGambling_0 | ||||||
Check for 'B' winning.
|
|||||||
Room_Gambling_CheckB | 90A3 | CALL Search_NonZero | See if stake 'B' is zero. | ||||
90A6 | DEFW Gamble_rightValue | Ptr to stake 'B' | |||||
90A8 | DEFB $04 | number ofbytes to test. | |||||
90A9 | JR Z,Room_Gambling_HouseWins | ||||||
90AB | LD HL,Gamble_rightValue | 'evens' : Double the amount in the stake. | |||||
90AE | LD DE,TempAl | ||||||
90B1 | LD BC,$0004 | ||||||
90B4 | LDIR | ||||||
90B6 | LD HL,Gamble_rightValue | ||||||
90B9 | LD DE,TempAl | ||||||
90BC | CALL ValueAddAsBCDCarry | ||||||
90BF | CALL Print_StrFromStack | Display message. | |||||
90C2 | DEFM "b wins " | ||||||
90C9 | DEFB $5E | ||||||
90CA | LD HL,TempAl | ||||||
90CD | CALL Display_DecimalValue. | Display updated stake. | |||||
90D0 | CALL Block_ClearMem | Clear stake 'A'. | |||||
90D3 | DEFW Gamble_leftValue | ||||||
90D5 | DEFB $04 | ||||||
90D6 | LD HL,(Room_CurrentInfoDataPtr) | Update the background. | |||||
90D9 | INC HL | ||||||
90DA | LD A,(HL) | ||||||
90DB | LD (HL),$00 | ||||||
90DD | AND A | ||||||
90DE | CALL NZ,Bg_DrawAll | ||||||
90E1 | JP Room_jvGambling_0 | ||||||
House Wins
|
|||||||
Room_Gambling_HouseWins | 90E4 | CALL Block_ClearMem | Clear all stakes. | ||||
90E7 | DEFW Gamble_leftValue | Ptr to stake that lost. | |||||
90E9 | DEFB $08 | ||||||
90EA | LD HL,(Room_CurrentInfoDataPtr) | Redraw the background. | |||||
90ED | INC HL | ||||||
90EE | LD A,(HL) | ||||||
90EF | LD (HL),$00 | ||||||
90F1 | INC HL | ||||||
90F2 | OR (HL) | ||||||
90F3 | LD (HL),$00 | ||||||
90F5 | CALL NZ,Bg_DrawAll | ||||||
90F8 | CALL Print_StrFromStack | Display the message. | |||||
90FB | DEFM "house wins" | ||||||
9105 | DEFB $5E | ||||||
9106 | JP Room_jvGambling_0 |
Prev: 8EEE | Up: Map |