#include "asm86.h" #include "ti86asm.inc" #include "ti86abs.inc" cur_square_ptr = _textShadow player_x_square = _textShadow + 2 cur_money_ptr = _textShadow + 10 player_x_money = _textShadow + 12 whose_turn = _textShadow + 30 num_players = _textShadow + 31 the_dice = _textShadow + 32 doubles_counter = _textShadow + 34 owners_property = _textShadow + 35 chance_card = _textShadow + 63 cchest_card = _textShadow + 64 player_stats = _textShadow + 65 auction_bidder = _textShadow + 163 auction_price = _textShadow + 164 save_the_stack = _textShadow + 166 #define SAVESIZE 65 find_10percent = $4044 .org _asm_exec_ram call _runindicoff call $49DC call _clrlcd ld (save_the_stack),sp ld a,$76 out (0),a ld hl,_asapvar rst 20h rst 10h jr c,dew_as_normal cp $0C jr nz,dew_as_normal ld a,b ex de,hl call $521D push hl ld hl,SAVESIZE or a sbc hl,de pop hl jr nz,dew_as_normal call _SET_ABS_SRC_ADDR xor a ld hl,_textShadow call _SET_ABS_DEST_ADDR ld hl,SAVESIZE call _SET_MM_NUM_BYTES call _mm_ldir jp werp_doubles dew_as_normal: ld hl,$0002 ld (_curRow),hl ld hl,title_str set 3,(iy+5) call _puts res 3,(iy+5) call _newline call _puts call lets_see_it get_num_players: halt call _getky or a jr z,get_num_players call key_to_num sub 1 jr c,get_num_players num_play_done: ld hl,_textShadow ld de,_textShadow+1 ld bc,$00A7 ld (hl),$00 ldir ld (num_players),a ld (save_the_stack),sp ld hl,1500 ld (player_x_money),hl ld hl,player_x_money ld (cur_money_ptr),hl ld de,player_x_money+2 ld bc,14 ldir ld hl,player_x_square ld (cur_square_ptr),hl ld de,chance_card ld hl,chance_table call shuffle_cards ld de,cchest_card ld hl,cchest_table call shuffle_cards playing_the_game: ld a,1 ld (doubles_counter),a werp_doubles: ld hl,_textShadow ld de,_cmdShadow ld bc,SAVESIZE ldir ld hl,0 ld (the_dice),hl ld hl,25 ld (modify_rail_x),hl ld a,3 ld (modify_util_x),a ld hl,(cur_square_ptr) ld a,(hl) cp 40 jr c,pay_off_jailer sub 40 abcabc: ld bc,$012F ld hl,pay_fifty call show_notice cp K_9 jr z,pay_off_jailer ; cp K_COS ; jr z,oooh_boy cp K_0 jr nz,abcabc ld a,(whose_turn) ld e,8 ld bc,50 call transfer_money ld hl,(cur_square_ptr) ld (hl),10 ; jr pay_off_jailer ;oooh_boy: ; ld hl,(cur_square_ptr) ; ld (hl),10 ; call cheat_okay ; jr nz,pay_off_jailer ; ld a,(whose_turn) ; ld c,a ; ld b,22 ; ld hl,owners_property-1 ;oooh_boy_: ; inc hl ; ld a,(hl) ; and %00000111 ; jr z,oooh_boy__ ; ld a,(hl) ; rlca \ rlca \ rlca ; and 7 ; cp c ; jr nz,oooh_boy__ ; ld a,(hl) ; and %11100000 ; add a,7 ; ld (hl),a ;oooh_boy__: ; djnz oooh_boy_ pay_off_jailer: call what_to_do ld b,5 call Random ld (the_dice),a ld c,a wait_for_release: ;create a random factor for second die halt ;by waiting until the 2nd key is released ld a,%10111111 ;otherwise the value of the 2nd die is not out (1),a ;even slightly random nop \ nop \ nop \ nop in a,(1) bit 5,a jr z,wait_for_release ld b,5 call Random ld (the_dice+1),a ld b,a cp c jr nz,no_doubles ld hl,(cur_square_ptr) ld a,(hl) cp 40 jr c,not_jail_boo ld a,$C2 ld (laura_fix),a ld (hl),10 not_jail_boo: ld hl,doubles_counter inc (hl) bit 2,(hl) call nz,go_to_jail no_doubles: ld a,b add a,c ld b,a ld hl,(cur_square_ptr) ld a,(hl) cp 40 jr c,move_loop inc (hl) cp 42 jp c,in_jail_i_was push bc ld (hl),10 ld hl,pay_fifty_must ld bc,$012F call show_notice ld a,(whose_turn) ld e,8 ld bc,50 call transfer_money pop bc move_loop: push bc ld hl,(cur_square_ptr) ld a,(hl) change_this_thing: inc a cp 40 jr c,inc_okay ld bc,200 ld a,(whose_turn) ld e,a ld a,8 call transfer_money xor a ld hl,(cur_square_ptr) inc_okay: ld (hl),a call show_board call lets_see_it ld b,$20 delay: halt djnz delay pop bc djnz move_loop ld hl,change_this_thing ld (hl),$3C call reference_cross cp 28 jp nc,not_property ld c,a call find_property ld a,(hl) and %00000111 cp 1 jp z,laura jr nc,already_bought ld a,c ld b,0 call get_numerical_value add hl,hl push hl ld de,buy_yn_str+12 ld b,2 call disp_hl_deci pop bc defdef: push bc ld hl,buy_yn_str ld bc,$022C call show_notice_ pop bc cp K_0 jr z,xyzxyz cp K_9 jr nz,defdef wxywxy: call auction_property jp laura xyzxyz: ld a,(whose_turn) ld e,8+128 call transfer_money jr nz,wxywxy call find_property ld a,(whose_turn) rrca \ rrca \ rrca add a,2 ld (hl),a jp laura already_bought: call find_property push af ld a,(hl) rlca \ rlca \ rlca and %00000111 ld c,a add a,'1' ld (you_owe_player),a ld a,(hl) and %00000111 dec a ld b,a pop af push bc ld e,a ld a,(whose_turn) cp c jp z,laura ld a,e ld c,a cp 22 jr nc,calc_rail_util call get_numerical_value ld a,b cp 1 jr nz,return_rail_util ld a,c push hl ld hl,mono_jump_1 ld (monopoly_jump),hl call see_if_monopoly jr nz,forget_doubling pop hl add hl,hl push hl forget_doubling: pop hl return_rail_util: ld de,you_owe_money ld b,3 push hl call disp_hl_deci ld hl,you_owe_str ld bc,$022C call show_notice_ pop bc pop de ld a,(whose_turn) call transfer_money jp laura calc_rail_util: cp 26 jr nc,calc_util_rail ld a,(hl) and %11100000 ld c,a modify_rail_x = $ + 1 ld hl,25 ld de,owners_property+21 ld b,4 calc_rail_util_loop: inc de ld a,(de) and %11100000 cp c jr nz,calc_rail_util_skip ld a,(de) and %00000111 jr z,calc_rail_util_skip add hl,hl calc_rail_util_skip: djnz calc_rail_util_loop srl h rr l jr return_rail_util calc_util_rail: modify_util_x = $ + 1 ld b,3 ld a,(the_dice) ld d,a ld a,(the_dice+1) add a,d ld d,a ld a,(owners_property+26) ld c,a and %00000111 jr z,calc_util_rail_skip ld a,c and %11100000 ld e,a ld a,(owners_property+27) ld c,a and %00000111 jr z,calc_util_rail_skip ld a,c and %11100000 cp e jr nz,calc_util_rail_skip ld b,9 calc_util_rail_skip: ld a,d calc_util_rail_loop: add a,d djnz calc_util_rail_loop ld h,0 ld l,a jr return_rail_util not_property: ;cp cchest, cp chance cp 29 jr z,cchest_bong cp 30 jr z,incometax_bong cp 31 jr z,chance_bong cp 35 jr z,luxurytax_bong cp 34 call z,go_to_jail jp laura incometax_bong: ;i need to find wealth here (erg) ld bc,200 ld a,(whose_turn) ld e,8 call transfer_money jp laura luxurytax_bong: ld bc,75 ld a,(whose_turn) ld e,8 call transfer_money jp laura cchest_bong: ld a,(cchest_card) ld hl,cchest_table add a,a ld d,0 ld e,a add hl,de ld a,(hl) inc hl ld h,(hl) ld l,a ld c,(hl) inc hl ld b,(hl) inc hl call do_menu_str push hl call lets_see_it call wait_for_key ld hl,cchest_card inc (hl) bit 4,(hl) jr z,cchest_okay ld (hl),0 ; ld de,cchest_card ; ld hl,cchest_table ; call shuffle_cards cchest_okay: pop hl call jump_hl jr laura chance_bong: ld a,(chance_card) ld hl,chance_table add a,a ld d,0 ld e,a add hl,de ld a,(hl) inc hl ld h,(hl) ld l,a ld c,(hl) inc hl ld b,(hl) inc hl call do_menu_str push hl call lets_see_it call wait_for_key ld hl,chance_card inc (hl) bit 4,(hl) jr z,chance_okay ; ld de,chance_card ; ld hl,chance_table ; call shuffle_cards ld (hl),0 chance_okay: pop hl call jump_hl laura: ld a,(the_dice) ld c,a ld a,(the_dice+1) cp c laura_fix: jp z,werp_doubles ld a,$CA ld (laura_fix),a in_jail_i_was: call what_to_do ld hl,(cur_square_ptr) inc hl ld (cur_square_ptr),hl ld hl,(cur_money_ptr) inc hl inc hl ld (cur_money_ptr),hl ld hl,whose_turn inc (hl) ld a,(num_players) cp (hl) jp nc,playing_the_game ld (hl),0 ld hl,player_x_square ld (cur_square_ptr),hl ld hl,player_x_money ld (cur_money_ptr),hl jp playing_the_game wait_for_key: halt call _getky or a jr z,wait_for_key cp K_CLEAR ret nz exit_routine: ld sp,(save_the_stack) ld hl,_asapvar rst 20h rst 10h call nc,_delvar ld hl,SAVESIZE call _createstrng ld a,b ex de,hl ld de,2 add hl,de adc a,0 call _SET_ABS_DEST_ADDR xor a ld hl,_cmdShadow call _SET_ABS_SRC_ADDR ld hl,SAVESIZE call _SET_MM_NUM_BYTES call _mm_ldir call _clrscrn call _homeup ld a,$7C out (0),a ret what_to_do: ld hl,main_options_str ld bc,$022C call show_notice cp K_SECOND ret z cp K_F1 jr nz,what_to_do ld hl,what_to_do push hl property_info: ld hl,(cur_square_ptr) ld a,(hl) push af ld (hl),1 property_view: ld hl,view_property_str ld bc,$0426 call show_notice cp K_RIGHT jr z,pv_next_prop cp K_LEFT jr z,pv_prev_prop cp K_8 jr z,mortgage_this cp K_PLUS jp z,add_houses cp K_MINUS jp z,rem_houses cp K_STO ;dumb trading logic, for now jp z,trade_temp cp K_EXIT ; jr z,property_done ; cp K_COS jr nz,property_view ; ;cheater ;) ; call cheat_okay ; jr nz,property_view ; ld hl,cheat_card ; ld (cchest_table),hl ; xor a ; ld (cchest_card),a ; jr property_view property_done: pop af ld hl,(cur_square_ptr) ld (hl),a ret pv_next_prop: ld hl,(cur_square_ptr) ld a,(hl) cp 39 jr nz,pv_next_loop ld (hl),1 jr property_view pv_next_loop: push hl inc (hl) ld a,(hl) call reference_cross pop hl cp 28 jr c,property_view jr pv_next_loop pv_prev_prop: ld hl,(cur_square_ptr) ld a,(hl) cp 1 jr nz,pv_prev_loop ld (hl),39 jr property_view pv_prev_loop: push hl dec (hl) ld a,(hl) call reference_cross_ pop hl cp 28 jr c,property_view jr pv_prev_loop mortgage_this: call find_property ld c,a ld a,(hl) and %00000111 jr z,property_view cp 2 jr z,mortgage_this_m jp nc,property_view mortgage_this_u: ld a,(hl) and %11100000 rlca \ rlca \ rlca push af ld a,c ld b,0 call get_numerical_value push hl call find_10percent pop de add hl,de push hl ld de,unmortgage_yn_fix ld b,2 call disp_hl_deci ghighi: ld hl,unmortgage_yn_str ld bc,$022C call show_notice cp K_9 jr z,goto_property_view cp K_0 jr nz,ghighi pop bc pop af ld e,8+128 jr mortgage_this_common mortgage_this_m: ld a,c cp 22 jr nc,mmmm_okay push hl ld hl,mono_jump_3 ld (monopoly_jump),hl call see_if_monopoly pop hl jp nz,property_view mmmm_okay: ld a,(hl) and %11100000 rlca \ rlca \ rlca push af ld a,c ld b,0 call get_numerical_value push hl ld de,mortgage_yn_fix ld b,2 call disp_hl_deci jkljkl: ld hl,mortgage_yn_str ld bc,$022C call show_notice cp K_9 jr z,goto_property_view cp K_0 jr nz,jkljkl pop bc pop af ld e,a ld a,8 mortgage_this_common: call transfer_money jp nz,property_view call find_property ld a,(hl) xor %00000011 ld (hl),a jp property_view goto_property_view: pop bc pop af jp property_view add_houses: call find_property ld c,a ld a,(hl) and %00000111 cp 2 jp c,property_view cp 7 jp z,property_view ld a,c cp 22 jp nc,property_view push hl ld hl,$0000 ld (mono_jump_fixup),hl ld hl,mono_jump_2 ld (monopoly_jump),hl call see_if_monopoly pop hl jp nz,property_view push hl ld a,c ld b,7 call get_numerical_value add hl,hl ld b,h ld c,l pop hl push hl ld a,(hl) and %11100000 rlca \ rlca \ rlca ld e,8+128 call transfer_money pop hl jp nz,property_view inc (hl) jp property_view rem_houses: call find_property ld c,a ld a,(hl) and %00000111 cp 3 jp c,property_view ld a,c cp 22 jp nc,property_view push hl ld hl,$44ED ld (mono_jump_fixup),hl ld hl,mono_jump_2 ld (monopoly_jump),hl call see_if_monopoly pop hl jp nz,property_view push hl ld a,c ld b,7 call get_numerical_value ld b,h ld c,l pop hl push hl ld a,(hl) and %11100000 rlca \ rlca \ rlca ld e,a ld a,8 call transfer_money pop hl dec (hl) jp property_view trade_temp: call find_property ld a,(num_players) inc a ld b,a ld a,(hl) ld c,a and %00000111 jp z,property_view ld a,c and %11100000 rlca rlca rlca inc a cp b jr c,trade_temp_ xor a ;erg trade_temp_: rrca rrca rrca ld b,a ld a,c and %00000111 add a,b ld (hl),a jp property_view ;auctions the property given by (cur_square_ptr -> A) ;bids start at 10% of property value, each bid is 125% of the previous one. auction_property: call find_property ld b,0 call get_numerical_value add hl,hl call find_10percent xor a auction_loop: ld (auction_bidder),a push hl ld de,auction_fix ld b,3 call disp_hl_deci auction_loopier: ld hl,auction_str ld bc,$022C call show_notice cp K_SECOND jr z,auction_sold call key_to_num or a jr z,auction_loopier ld hl,auction_bidder ld c,(hl) cp c jr z,auction_loopier pop hl ld (auction_price),hl ld d,h ld e,l srl d rr e srl d rr e add hl,de jr auction_loop auction_sold: ld a,(auction_bidder) sub 1 jr c,auction_loopier pop hl ld bc,(auction_price) ld e,8+128 call transfer_money ;erg jr nz,auction_property call find_property ld a,(auction_bidder) dec a rrca rrca rrca add a,2 ld (hl),a ret key_to_num: cp K_EE jr nc,key_to_num_ret sub K_3 jr c,key_to_num_ret ld hl,key_to_num_table ld d,0 ld e,a add hl,de ld a,(hl) ret key_to_num_ret: xor a ret show_board: ;display the board ld hl,mono_gfx ld de,$FC00 ld bc,$0400 ldir ld hl,$015D ld (_penCol),hl ld hl,player_str call _vputs ld a,(whose_turn) add a,'1' call _vputmap ld hl,$075E ld (_penCol),hl ld a,'$' call _vputmap ld hl,_OP2-1 ld (hl),0 dec hl ex de,hl ld hl,(cur_money_ptr) ld a,(hl) inc hl ld h,(hl) ld l,a ld b,4 call disp_hl_deci ex de,hl call _vputs set 3,(iy+5) call reference_cross push af ld hl,board_titles or a jr z,skip_database add a,a ld b,a lookup_database: ld a,(hl) inc hl or a jr nz,lookup_database djnz lookup_database skip_database: ld bc,$0212 call do_menu_str res 3,(iy+5) pop af cp 28 jr nc,stupid_action ld hl,$2078 ld (_penCol),hl call find_property ld a,(hl) push af or a jr z,nobody_owner rlca \ rlca \ rlca and %00000111 add a,'1' push af ld a,' ' call _vputmap ld a,' ' call _vputmap pop af call _vputmap nobody_owner: pop af ld hl,$2045 ld (_penCol),hl ld hl,stati and %00000111 jr z,forget_db ld b,a lookup_db: ld a,(hl) inc hl or a jr nz,lookup_db djnz lookup_db forget_db: call _vputs stupid_action: ld a,(the_dice) ld de,$0547 call draw_dice ld a,(the_dice+1) ld de,$0552 call draw_dice ld hl,(cur_square_ptr) ld a,(hl) cp 40 jr c,draw_as_normal xor a jr first_row draw_as_normal: sub 10 jr nc,first_row cpl ld c,a add a,a add a,a add a,c add a,10 ld e,a ld d,55 ld bc,$0408 cp 55 jr c,first_row_not ld b,$08 first_row_not: call invert_pixels ret first_row: sub 10 jr nc,second_row cpl ld c,a add a,a add a,a add a,c add a,10 ld d,a ld e,1 ld bc,$0804 cp 55 jr c,second_row_not ld c,$08 second_row_not: call invert_pixels ret second_row: sub 10 jr nc,third_row add a,10 ld c,a add a,a add a,a add a,c add a,5 ld e,a ld d,1 ld bc,$0408 cp 9 jr nc,third_row_not ld b,$08 sub 4 ld e,a third_row_not: call invert_pixels ret third_row: ld c,a add a,a add a,a add a,c add a,5 ld d,a ld e,55 ld bc,$0804 cp 9 jr nc,fourth_row_not ld c,$08 sub 4 ld d,a fourth_row_not: call invert_pixels ret lets_see_it: halt ld hl,$FC00 ld de,$F600 ld bc,$0400 ldir ret find_property: call reference_cross ld hl,owners_property ld d,0 ld e,a add hl,de ret ;input - A, which property see_if_monopoly: push af cp 2 jr nc,sim_0 ld bc,$0100 jr sim_x sim_0: cp 5 jr nc,sim_1 ld bc,$0202 jr sim_x sim_1: cp 8 jr nc,sim_2 ld bc,$0205 jr sim_x sim_2: cp 11 jr nc,sim_3 ld bc,$0208 jr sim_x sim_3: cp 14 jr nc,sim_4 ld bc,$020B jr sim_x sim_4: cp 17 jr nc,sim_5 ld bc,$020E jr sim_x sim_5: cp 20 jr nc,sim_6 ld bc,$0211 jr sim_x sim_6: ld bc,$0114 sim_x: ld hl,owners_property ld d,0 ld e,c add hl,de pop de monopoly_jump = $ + 1 jp $0000 mono_jump_1: ;load mono_jump_1 into monopoly_jump ;then call see_if_monopoly ;returns Z if color group monopoly, NZ if not ld a,(hl) or a jr z,make_not_zero and %11100000 ld e,a mono_jump_1_: inc hl ld a,(hl) or a jr z,make_not_zero and %11100000 cp e ret nz djnz mono_jump_1_ xor a ret make_not_zero: or $FF ret mono_jump_2: ;load mono_jump_2 into monopoly_jump ;then call see_if_monopoly ;returns Z if house okay, NZ if not okay push hl ld hl,owners_property ld c,d ld e,d ld d,0 add hl,de pop de inc b mono_jump_2_: ld a,(de) sub (hl) mono_jump_fixup: nop \ nop cp 2 jr nc,make_not_zero inc de djnz mono_jump_2_ xor a ret mono_jump_3: ;load mono_jump_3 into monopoly_jump ;then call see_if_monopoly ;returns Z if mortgage okay, NZ if not okay inc b mono_jump_3_: ld a,(hl) and %00000111 cp 3 jr nc,make_not_zero inc hl djnz mono_jump_3_ xor a ret reference_cross: ld hl,(cur_square_ptr) ld a,(hl) reference_cross_: ld hl,cross_reference ld d,0 ld e,a add hl,de ld a,(hl) ret do_menu_str: ld a,c ld (_penRow),a do_menu_str_loop: ld a,(hl) ld (_penCol),a inc hl call _vputs ld de,_penRow ld a,(de) add a,6 ld (de),a djnz do_menu_str_loop ret ;draws a die A at (E,D) draw_dice: cp 4 call nc,FindPixel inc d \ inc d cp 6 call nc,FindPixel inc d \ inc d cp 2 call nc,FindPixel inc e \ inc e inc e \ inc e cp 4 call nc,FindPixel dec d \ dec d cp 6 call nc,FindPixel dec d \ dec d cp 2 call nc,FindPixel inc d \ inc d dec e \ dec e and %00000001 ret z ;Dan Eble's FindPixel routine modified to save A and put pixel always FindPixel: ld b,a call GetPixel or (hl) ld (hl),a ld a,b ret GetPixel: ld hl,FP_Bits ld a,e and $07 ; a = bit offset add a,l ld l,a adc a,h sub l ld h,a ld c,(hl) ; c = bitmask for (hl) ;48 t-states up to this point ld hl,FP_RLD ld (hl),d ld a,e ; a = x/8 (byte offset within row) rrca rrca rrca rld or $FC ld l,(hl) ld h,a ; hl -> byte in vid mem ld a,c ; now a = bitmask for (hl) ;121 t-states up to this point ret ;inverts (B,C) pixels at (E,D) invert_pixels: push bc call GetPixel pop bc ld d,b invert_pixel_1: push af push hl invert_pixel_2: ld e,a xor (hl) ld (hl),a ld a,e rrca jr nc,no_increase inc hl no_increase: djnz invert_pixel_2 pop hl pop af ld b,d push de ld de,16 add hl,de pop de dec c jr nz,invert_pixel_1 ret ;A = transfer from; E = transfer to; BC = how much transfer_money: ld d,a cp e ret z ld hl,$FFFF ld (player_x_money+16),hl push de ld hl,player_x_money ld d,0 ld e,a add hl,de add hl,de push hl ld a,(hl) inc hl ld h,(hl) ld l,a or a sbc hl,bc jr c,transfer_abort ex de,hl pop hl ld (hl),e inc hl ld (hl),d ld hl,player_x_money pop de ld d,0 res 7,e add hl,de add hl,de push hl ld a,(hl) inc hl ld h,(hl) ld l,a or a add hl,bc ex de,hl pop hl ld (hl),e inc hl ld (hl),d xor a ret transfer_abort: pop de pop af push af push bc add a,'1' ld (must_pay_player),a ld a,h cpl ld h,a ld a,l cpl ld l,a inc hl ld de,must_pay_money ld b,3 call disp_hl_deci ld hl,must_pay_str ld bc,$0329 call show_notice ; cp K_COS ; jr z,wants_to_cheat ;) cp K_SIN jr z,wants_to_cancel ;oopsie: call property_info pop bc pop de ld a,d jr transfer_money ;wants_to_cheat: ; call cheat_okay ; jr nz,oopsie ; pop bc ; pop de ; ld a,8 ; jr transfer_money wants_to_cancel: pop bc pop de bit 7,e ret nz ;bankruptcy logic or $FF ret shuffle_cards: xor a ld (de),a ld b,32 shuffle_cards_loop: push bc push hl ld a,r and %00011110 ld d,0 ld e,a add hl,de ld c,(hl) inc hl ld b,(hl) ex de,hl pop hl push hl push de ld a,r and %00011110 ld d,0 ld e,a add hl,de ld e,(hl) inc hl ld d,(hl) ld (hl),b dec hl ld (hl),c pop hl ld (hl),d dec hl ld (hl),e pop hl pop bc djnz shuffle_cards_loop ret ;cheat_okay: ; ld hl,cheat_code ; ld b,18 ;cheat_okay_: ; halt ; push hl ; call _getky ; pop hl ; or a ; jr z,cheat_okay_ ; cp (hl) ; ret nz ; inc hl ; ld a,(hl) ; or a ; jr nz,cheat_okay_ ; ret ;cheat_code: ; .db K_7,K_LOG,K_1,K_5,K_LOG ; .db K_7,K_RAISE,K_RIGHTPAR,K_EE,K_LEFTPAR ; .db K_LOG,K_9,K_TAN,K_RAISE,K_5,K_6,K_STAR,K_9 ; .db 0 ;input B=what # to get; A=for what property get_numerical_value: cp 22 jr nc,rail_util ld hl,numerical_values add a,a add a,a add a,a add a,b ld d,0 ld e,a add hl,de add hl,de ld a,(hl) inc hl ld h,(hl) ld l,a ret rail_util: cp 26 jr nc,is_utility ld hl,100 ret is_utility: ld hl,75 ret disp_hl_deci: xor a call $404c add a,'0' ld (de),a disp_hl_loop: dec de call $4044 add a,'0' ld (de),a djnz disp_hl_loop ret ;bc, hl -> in show_notice: push hl \ push bc call show_board pop bc \ pop hl show_notice_: call do_menu_str call lets_see_it jp wait_for_key move_to_space: pop hl ld hl,(cur_square_ptr) ld b,(hl) sub b ld b,a jp nc,move_loop add a,40 ld b,a jp move_loop jump_hl: jp (hl) Random: ;By Jimmy Mardell ld a,r add a,a ld h,0 ld l,a ld d,h ld e,l RMul: add hl,de djnz RMul ld a,h inc a ret FP_RLD: .db $00 FP_Bits: .db $80,$40,$20,$10,$08,$04,$02,$01 ;converts a board location to its property number cross_reference: .db 28 ;go go .db 0 ;medit .db 29 ;c chest .db 1 ;baltic .db 30 ;inc tax .db 22 ;reading .db 2 ;oriental .db 31 ;chance .db 3 ;vermont .db 4 ;connect .db 32 ;just visiting .db 5 ;st. char .db 26 ;electric co .db 6 ;states .db 7 ;virginia .db 23 ;penn rr .db 8 ;st james .db 29 ;c chest .db 9 ;tenn .db 10 ;ny .db 33 ;parking .db 11 ;kentucky .db 31 ;chance .db 12 ;indiana .db 13 ;illinois .db 24 ;b o rr .db 14 ;atlantic .db 15 ;ventnor .db 27 ;water wrk .db 16 ;marvin .db 34 ;gotojail .db 17 ;pacific .db 18 ;n carolina .db 29 ;c chest .db 19 ;penn ave .db 25 ;short line .db 31 ;chance .db 20 ;park place .db 35 ;lux tax .db 21 ;board walk .db 36 ;in jail .db 36 ;in jail .db 36 ;in jail ;mortgage value, rent, 1, 2, 3, 4, hotel, house cost / 2 numerical_values: .dw 30, 2, 10, 30, 90, 160, 250, 25 .dw 30, 4, 20, 60, 180, 320, 450, 25 .dw 50, 6, 30, 90, 270, 400, 550, 25 .dw 50, 6, 30, 90, 270, 400, 550, 25 .dw 60, 8, 40, 100, 300, 450, 600, 25 .dw 70, 10, 50, 150, 450, 625, 750, 50 .dw 70, 10, 50, 150, 450, 625, 750, 50 .dw 80, 12, 60, 180, 500, 700, 900, 50 .dw 90, 14, 70, 200, 550, 750, 950, 50 .dw 90, 14, 70, 200, 550, 750, 950, 50 .dw 100, 16, 80, 220, 600, 800, 1000, 50 .dw 110, 18, 90, 250, 700, 875, 1050, 75 .dw 110, 18, 90, 250, 700, 875, 1050, 75 .dw 120, 20, 100, 300, 750, 925, 1100, 75 .dw 130, 22, 110, 330, 800, 975, 1150, 75 .dw 130, 22, 110, 330, 800, 975, 1150, 75 .dw 140, 24, 120, 360, 850, 1025, 1200, 75 .dw 150, 26, 130, 390, 900, 1100, 1275, 100 .dw 150, 26, 130, 390, 900, 1100, 1275, 100 .dw 160, 28, 150, 450, 1000, 1200, 1400, 100 .dw 175, 35, 175, 500, 1100, 1300, 1500, 100 .dw 200, 50, 200, 600, 1400, 1700, 2000, 100 title_str: .db " Monopoly(R) - v0.74 " .db "written by Kirk Meyer",0 .db "How many tokens (2-8)",0 pay_fifty: .db 72,"Pay $50 (Y/N)?",0 pay_fifty_must: .db 69,"You must pay $50",0 player_str: .db "Player ",0 buy_yn_str: .db 76,"Buy for $ ",0 .db 77,"[Y]es or [N]o",0 auction_str: .db 70,"Do I have $ " auction_fix: .db " ?",0,69,"If not press [2nd].",0 mortgage_yn_str: .db 81,"Mortgage",0 .db 71,"for $ " mortgage_yn_fix: .db " (Y/N)?",0 unmortgage_yn_str: .db 75,"Unmortgage",0 .db 71,"for $ " unmortgage_yn_fix: .db " (Y/N)?",0 you_owe_str: .db 77,"You must pay",0 .db 72,"player " you_owe_player: .db " $ " you_owe_money: .db ' ',0 must_pay_str: .db 74,"Player " must_pay_player: .db " needs",0 .db 70,"a further $ " must_pay_money: .db " .",0 .db 77,"[B]ankrupt?",0 main_options_str: .db 74,"[2nd] Continue",0 .db 75,"[F1] Property",0 view_property_str: .db 78,"[M]ortgage",0 .db 77,"[2nd] Select",0 .db 73,"[+/-] Buildings",0 .db 70,'[',$CF,'/',$05,"] Prev/Next",0 stati: .db "For Sale ",0 .db "Mortgaged ",0 .db "Sold ",0 .db "One House ",0 .db "Two Houses ",0 .db "Three Houses ",0 .db "Four Houses ",0 .db "Hotel ",0 chance_table: .dw chance_0,chance_1,chance_2,chance_3 .dw chance_4,chance_5,chance_6,chance_7 .dw chance_8,chance_9,chance_A,chance_B .dw chance_C,chance_D,chance_E,chance_F cchest_table: .dw cchest_0,cchest_1,cchest_2,cchest_3 .dw cchest_4,cchest_5,cchest_6,cchest_7 .dw cchest_8,cchest_9,cchest_A,cchest_B .dw cchest_C,cchest_D,cchest_E,cchest_F chance_0: .db 44,2 .db 74,"Take a walk on",0 .db 72,"the Board Walk!",0 ld a,39 jp move_to_space chance_1: .db 38,4 .db 72,"You are elected",0 .db 72,"Chairman of the",0 .db 72,"Board. Pay each",0 .db 73,"player $50.00.",0 ld e,0 chance_1_: push de ld bc,50 ld a,(whose_turn) call transfer_money pop de inc e ld a,(num_players) cp e jr nc,chance_1_ ret chance_2: .db 47,1 .db 70,"Go back 3 spaces.",0 ld hl,change_this_thing inc (hl) pop hl ld b,3 jp move_loop chance_3: .db 44,2 .db 75,"Take a ride on",0 .db 78,"the Reading!",0 ld a,5 jp move_to_space chance_4: .db 44,2 .db 83,"Pay poor",0 .db 80,"tax of $15.",0 ld a,(whose_turn) ld e,8 ld bc,15 jp transfer_money chance_5: .db 38,4 .db 76,"Go to nearest",0 .db 70,"railroad and pay",0 .db 74,"double rent or",0 .db 72,"buy if unowned.",0 jr next_railroad chance_B: .db 38,4 .db 76,"Go to nearest",0 .db 70,"railroad and pay",0 .db 74,"double rent or",0 .db 72,"buy if unowned.",0 next_railroad: ld hl,50 ld (modify_rail_x),hl ld hl,(cur_square_ptr) ld a,(hl) cp 7 jr z,seven_rr cp 22 jr z,two2_rr ld a,5 jr three6_rr seven_rr: ld a,15 jr three6_rr two2_rr: ld a,25 three6_rr: jp move_to_space ret chance_6: .db 44,2 .db 75,"Bank pays you",0 .db 71,"dividend of $50.",0 ld a,(whose_turn) ld e,a ld a,8 ld bc,50 jp transfer_money chance_7: .db 44,2 .db 82,"Get out of",0 .db 82,"jail free!",0 ;to do ret chance_8: .db 47,1 .db 74,"Advance to GO!",0 xor a jp move_to_space chance_9: .db 44,2 .db 80,"Advance to",0 .db 73,"Illinois Avenue!",0 ld a,24 jp move_to_space chance_C: .db 41,3 .db 69,"Your building and",0 .db 75,"loan matures.",0 .db 75,"Collect $150.",0 ld a,(whose_turn) ld e,a ld a,8 ld bc,150 jp transfer_money chance_D: .db 44,2 .db 75,"Advance to St.",0 .db 74,"Charles Place!",0 ld a,11 jp move_to_space chance_E: .db 38,4 .db 71,"Move to nearest",0 .db 75,"utility. Throw",0 .db 72,"dice and pay ten",0 .db 74,"times the roll.",0 ld a,9 ld (modify_util_x),a ld hl,(cur_square_ptr) ld a,(hl) cp 22 jr z,two2_x ld a,12 jr one2_x two2_x: ld a,28 one2_x: jp move_to_space chance_F: .db 38,4 .db 71,"General repairs",0 .db 69,"on your property",0 .db 73,"$25 per house,",0 .db 72,"$100 per hotel.",0 ld a,(whose_turn) rrca \ rrca \ rrca ld c,a ld b,22 ld de,owners_property ld hl,0 chance_F_: ld a,(de) and %11100000 cp c jr nz,chance_F__ ld a,(de) and %00000111 sub 3 jr c,chance_F__ push de push hl ld hl,chance_F___ ld d,0 ld e,a add hl,de ld e,(hl) ld d,0 pop hl add hl,de pop de chance_F__: inc de djnz chance_F_ ld b,h ld c,l ld a,(whose_turn) ld e,8 jp transfer_money chance_F___: .db 25,50,75,100,100 chance_A: .db 41,3 go_to_jail_str: .db 71,"Go to jail. Do not",0 .db 74,"pass go, do not",0 .db 75,"collect $200.",0 jr already_shown_go go_to_jail: ld bc,$0329 ld hl,go_to_jail_str call show_notice already_shown_go: pop hl ld hl,(cur_square_ptr) ld a,40 ld (hl),a jp in_jail_i_was cchest_A: .db 41,3 .db 71,"Go to jail. Do not",0 .db 74,"pass go, do not",0 .db 75,"collect $200.",0 jr already_shown_go cchest_0: .db 44,2 .db 77,"Doctor",39,"s fee!",0 .db 78,"Pay $50.00.",0 ld a,(whose_turn) ld e,8 ld bc,50 jp transfer_money cchest_1: .db 38,4 .db 69,"The Grand Opera!",0 .db 69,"Collect $50 from",0 .db 72,"each player for",0 .db 76,"their tickets.",0 ld d,0 cchest_1_: push de ld bc,50 ld a,(whose_turn) ld e,a ld a,d call transfer_money pop de inc d ld a,(num_players) cp d jr nc,cchest_1_ ret cchest_2: .db 44,2 .db 76,"Bank error in",0 .db 69,"your favor: $200",0 ld a,(whose_turn) ld e,a ld a,8 ld bc,200 jp transfer_money cchest_3: .db 38,4 .db 76,"You have won",0 .db 73,"second prize in",0 .db 70,"a beauty contest.",0 .db 72,"Collect $10.00.",0 ld a,(whose_turn) ld e,a ld a,8 ld bc,10 jp transfer_money cchest_4: .db 44,2 .db 78,"Pay hospital",0 .db 78,"fee of $100.",0 ld a,(whose_turn) ld e,8 ld bc,100 jp transfer_money cchest_5: .db 47,1 .db 69,"You inherit $100.",0 ld a,(whose_turn) ld e,a ld a,8 ld bc,100 jp transfer_money cchest_6: .db 41,3 .db 73,"Your Christmas",0 .db 75,"fund matures.",0 .db 75,"Collect $100.",0 ld a,(whose_turn) ld e,a ld a,8 ld bc,100 jp transfer_money cchest_7: .db 44,2 .db 82,"Get out of",0 .db 82,"jail free!",0 ;to do ret cchest_8: .db 47,1 .db 74,"Advance to GO!",0 xor a jp move_to_space cchest_9: .db 44,2 .db 77,"Receive $25",0 .db 77,"for services.",0 ld a,(whose_turn) ld e,a ld a,8 ld bc,25 jp transfer_money cchest_B: .db 44,2 .db 69,"You get $45 from",0 .db 76,"sale of stock.",0 ld a,(whose_turn) ld e,a ld a,8 ld bc,45 jp transfer_money cchest_C: .db 44,2 .db 80,"Income tax",0 .db 77,"refund: $20.",0 ld a,(whose_turn) ld e,a ld a,8 ld bc,20 jp transfer_money cchest_D: .db 44,2 .db 74,"Pay school tax",0 .db 79,"of $150.00.",0 ld a,(whose_turn) ld e,8 ld bc,150 jp transfer_money cchest_E: .db 44,2 .db 74,"Life insurance",0 .db 72,"matures: $100.",0 ld a,(whose_turn) ld e,a ld a,8 ld bc,100 jp transfer_money cchest_F: .db 38,4 .db 71,"You are assessed",0 .db 73,"for lot repairs.",0 .db 73,"$40 per house,",0 .db 72,"$115 per hotel.",0 ld a,(whose_turn) rrca \ rrca \ rrca ld c,a ld b,22 ld de,owners_property ld hl,0 cchest_F_: ld a,(de) and %11100000 cp c jr nz,cchest_F__ ld a,(de) and %00000111 sub 3 jr c,cchest_F__ push de push hl ld hl,cchest_F___ ld d,0 ld e,a add hl,de ld e,(hl) ld d,0 pop hl add hl,de pop de cchest_F__: inc de djnz cchest_F_ ld b,h ld c,l ld a,(whose_turn) ld e,8 jp transfer_money cchest_F___: .db 40,80,120,160,115 cheat_card: .db 38,4 .db 76,"Lenin is back.",0 .db 74,"Give the other",0 .db 77,"player all of",0 .db 77,"your money.",0 ld a,(whose_turn) add a,a ld d,0 ld e,a ld hl,player_x_money add hl,de ld c,(hl) inc hl ld b,(hl) ld a,(whose_turn) push af xor 1 ld e,a pop af jp transfer_money board_titles: .db 72,"Mediterranean",0 .db 86,"Avenue",0 .db 88,"Baltic",0 .db 86,"Avenue",0 .db 84,"Oriental",0 .db 86,"Avenue",0 .db 83,"Vermont",0 .db 86,"Avenue",0 .db 78,"Connecticut",0 .db 86,"Avenue",0 .db 82,"St. Charles",0 .db 88,"Place",0 .db 87,"States",0 .db 86,"Avenue",0 .db 85,"Virginia",0 .db 86,"Avenue",0 .db 82,"St. James",0 .db 88,"Place",0 .db 81,"Tennessee",0 .db 86,"Avenue",0 .db 82,"New York",0 .db 86,"Avenue",0 .db 82,"Kentucky",0 .db 86,"Avenue",0 .db 86,"Indiana",0 .db 86,"Avenue",0 .db 86,"Illinois",0 .db 86,"Avenue",0 .db 84,"Atlantic",0 .db 86,"Avenue",0 .db 84,"Ventnor",0 .db 86,"Avenue",0 .db 86,"Marvin",0 .db 84,"Gardens",0 .db 86,"Pacific",0 .db 86,"Avenue",0 .db 73,"North Carolina",0 .db 86,"Avenue",0 .db 76,"Pennsylvania",0 .db 86,"Avenue",0 .db 90,"Park",0 .db 88,"Place",0 .db 88,"Board",0 .db 89,"Walk",0 .db 85,"Reading",0 .db 83,"Railroad",0 .db 76,"Pennsylvania",0 .db 83,"Railroad",0 .db 88,"B. & O.",0 .db 83,"Railroad",0 .db 88,"Short",0 .db 91,"Line",0 .db 84,"Electric",0 .db 83,"Company",0 .db 87,"Water",0 .db 87,"Works",0 .db 76,"Collect $200",0 .db 80,"as you pass",0 .db 79,"Community",0 .db 89,"Chest",0 .db 79,"Income Tax",0 .db 78,"10% or $200",0 .db 86,"Chance",0 .db 82,"========",0 .db 78,"Just Visiting",0 .db 85,"the Jail",0 .db 90,"Free",0 .db 85,"Parking",0 .db 89,"Go To",0 .db 91,"Jail",0 .db 79,"Luxury Tax",0 .db 84,"Pay $75",0 .db 88,"In Jail",0 .db 84,"=======",0 _asapvar = $ - 1 .db 8,"MONOSAVE" key_to_num_table: .db 3,6,9,0,0,0,0 .db 0,2,5,8,0,0,0,0 .db 0,1,4,7 mono_gfx: #include "gfx.asm" .end