100 REMark PONTOON version 1 110 REMark copyright Huw Pendry 1986 120 REMark modified for JSU ROM 130 REMark By Bob Schubel CIS# 71320,262 140 : 150 MODE 4 : WINDOW 512,256,0,0 : PAPER 0 : CLS 160 WINDOW 432,240,32,16 170 SCALE 256,0,0 180 DIM money(2),card_tot(2),total(2,2),hand(2,5) 190 DIM suit$(4),numb$(13),str_table(11) 200 set_chars 210 open_pack 220 RESTORE 240 230 FOR i=1 TO 11 : READ str_table(i) 240 DATA 4,7,8,9,5,6,3,2,10,1,11 250 REPeat match_loop 260 PAPER 4 : INK 0 : CLS : BORDER 1,255 270 AT 3,3 280 CSIZE 2,0 290 PRINT "Please enter your name "; 300 STRIP 7 310 POKE 163976,0 320 INPUT name$ 330 POKE 163976,1 340 banker=0 : stake=0 350 FOR j=1 TO 2 360 FOR i=1 TO 5 : hand(j,i)=0 : END FOR i 370 END FOR j 380 money(1)=250 : money(2)=250 390 INK 0 : STRIP 7 : CLS 400 CSIZE 2,0 410 AT 20,17 : PRINT ' '&name$&' ' 420 AT 1,17 : PRINT' '&"Computer"&' ' 430 out_head 440 out_values 450 REPeat game_loop 460 card_tot(1)=0 : card_tot(2)=0 470 stake=0 480 royal_pontoon=0 490 shuffle_pack 500 pointer=1 510 BLOCK 186,53,176,28,4 520 BLOCK 186,53,176,139,4 530 STRIP 4 540 AT 11,10 : PRINT" " 550 AT 9,10 : PRINT" " 560 AT 5,10 : PRINT" " 570 AT 16,10 : PRINT" " 580 AT 5,38 : PRINT" " 590 AT 16,38 : PRINT" " 600 twist 1,1 610 buy 2,1 620 IF banker=1 630 comp_choice 640 IF total(2,1)<=21 AND royal_pontoon=0 : player_choice 650 IF total(1,1)<=21 660 IF total(2,1)<=21 : twist 2,0 : ELSE : out_tot 2 670 END IF 680 ELSE 690 player_choice 700 IF total(1,1)<=21 : comp_bank 710 END IF 720 update_score 730 STRIP 4 : AT 10,25 : PRINT" " 740 IF money(1)=0 OR money(2)=0 : EXIT game_loop 750 END REPeat game_loop 760 AT 10,23 770 IF money(1)=0 780 PRINT"Too Bad, You lose" : ELSE : PRINT"Well done, You Win!!" 790 END IF 800 AT 11,18 : PRINT"Do you want another game (Y/N)?" 810 REPeat yn_loop 820 a$=INKEY$ 830 IF a$="Y" OR a$="N" : EXIT yn_loop 840 END REPeat yn_loop 850 IF a$="N" : EXIT match_loop 860 END REPeat match_loop 870 STOP 880 : 890 DEFine PROCedure left_side (xco,yco) 900 LINE xco-20,yco 910 LINE_R TO -10,0 TO -3,3 TO 0,50 TO 3,3 TO 10,0 920 END DEFine 930 : 940 DEFine PROCedure right_side (xco,yco) 950 LINE xco-20,yco 960 LINE_R TO 20,0 TO 3,3 TO 0,50 TO -3,3 TO -21,0 970 END DEFine 980 : 990 DEFine PROCedure player_choice 1000 INK 7 : STRIP 4,2,3 1010 AT 10,20 1020 IF NOT banker : PRINT"(B)uy , (T)wist" : ELSE : PRINT" (T)wist " 1030 AT 11,20 : PRINT" or (S)tick " 1040 REPeat act_loop 1050 REPeat in_loop 1060 a$=INKEY$(-1) 1070 IF a$='Q' : STOP 1080 IF a$="S" OR a$="B" OR a$="T" : EXIT in_loop 1090 END REPeat in_loop 1100 IF a$="B" AND NOT banker : player_buy 1110 IF a$="T" : twist 1,1 1120 IF NOT banker : check_royal 1 1130 IF (a$="S" AND (total(1,1)>=16 OR total(1,2)>=16)):EXIT act_loop 1140 IF total(1,1)>21 OR card_tot(1)=5:EXIT act_loop 1150 END REPeat act_loop 1160 IF card_tot(1)=5 AND total(1,1)<22 : AT 16,38 : PRINT"FIVE CARD TRICK" 1170 BLOCK 120,20,160,100,4 1180 END DEFine 1190 : 1200 DEFine PROCedure check_royal (wx) 1210 LOCal a 1220 IF total(wx,2)=21 AND card_tot(wx)=2 1230 a=((hand(wx,1)-1) MOD 13)+1 1240 IF a=1 : a=((hand(wx,2)-1) MOD 13)+1 1250 IF a>10 : royal_pontoon=1 : a$="S" 1260 END IF 1270 END DEFine 1280 : 1290 DEFine PROCedure player_buy 1300 LOCal bet 1310 REPeat mon_loop 1320 STRIP 4 : AT 11,10 : PRINT" " 1330 STRIP 7 : INK 0 1340 AT 11,10 : INPUT BET$ : BET$='0'&BET$ : bet=BET$ 1350 IF NOT bet : NEXT mon_loop 1360 IF bet<=money(1) AND bet<=money(2) AND bet<51 : EXIT mon_loop 1370 END REPeat mon_loop 1380 money(1)=money(1)-bet 1390 money(2)=money(2)-bet 1400 stake=stake+2*bet 1410 out_values 1420 twist 1,1 1430 END DEFine 1440 : 1450 DEFine PROCedure comp_bank 1460 IF royal_pontoon=1 : RETurn 1470 twist 2,0 1480 a$="" 1490 REPeat i_loop 1500 IF total(2,2)<>0 1510 IF total(2,2)<16 : comp_twist : ELSE : gamble total(2,2),0 1520 ELSE 1530 IF total(2,1)<16 : comp_twist 2,1 : ELSE : gamble total(2,1),0 1540 END IF 1550 IF a$<>"S" : out_tot 2 1560 IF total(2,1)>21 : EXIT i_loop 1570 INK 0 : STRIP 7 1580 IF card_tot(2)=5 : a$="S" : AT 5,38 : PRINT"FIVE CARD TRICK" 1590 INK 7 : STRIP 2 1600 IF a$="S" : AT 10,25 : PRINT"STICK" : wait : EXIT i_loop 1610 END REPeat i_loop 1620 END DEFine 1630 : 1640 DEFine PROCedure comp_twist 1650 INK 7 : STRIP 2 1660 AT 10,25 : PRINT"TWIST" 1670 twist 2,1 1680 STRIP 4 1690 AT 10,25 : PRINT" " 1700 END DEFine 1710 : 1720 DEFine PROCedure gamble (score,switch) 1730 LOCal r 1740 IF score=21 : a$="S" : RETurn 1750 r=RND(0 TO 21) 1760 IF r>score : comp_twist : RETurn 1770 IF r=score AND switch=1 : comp_buy r*3 : ELSE : a$="S" 1780 END DEFine 1790 : 1800 DEFine PROCedure comp_choice 1810 a$="" 1820 REPeat o_loop 1830 IF total(2,2)<>0 1840 IF total(2,2)<16 1850 comp_buy (RND(1 TO total(2,2)))*3 : ELSE : gamble total(2,2),1 1860 END IF 1870 ELSE 1880 IF total(2,1)<16 : evaluate : ELSE : gamble total(2,1),1 1890 END IF 1900 check_royal 2 1910 IF total(2,1)>21 : EXIT o_loop 1920 INK 0 : STRIP 2 1930 IF card_tot(2)=5 : a$="S" : AT 5,38 : PRINT"FIVE CARD TRICK" 1940 INK 7 : STRIP 2 1950 IF a$="S" : AT 10,25 : PRINT"STICK" : wait : EXIT o_loop 1960 END REPeat o_loop 1970 END DEFine 1980 : 1990 DEFine PROCedure wait 2000 LOCal i 2010 FOR i=1 TO 500 : END FOR i 2020 END DEFine 2030 : 2040 DEFine PROCedure evaluate 2050 LOCal k,strength 2060 IF total(2,1)>11 2070 comp_twist 2080 ELSE 2090 FOR k=1 TO 11 2100 IF str_table(k)=total(2,1) : strength=k 2110 END FOR k 2120 comp_buy RND(1 TO strength)*5 2130 END IF 2140 END DEFine 2150 : 2160 DEFine PROCedure comp_buy (amount) 2170 STRIP 2 : INK 7 2180 AT 10,25 : PRINT" BUY " 2190 IF amount>50 : amount=50 2200 IF amount>money(1) : amount=money(1) 2210 IF amount>money(2) : amount=money(2) 2220 money(1)=money(1)-amount 2230 money(2)=money(2)-amount 2240 stake=stake+2*amount 2250 STRIP 4 2260 AT 9,10 : PRINT" " 2270 STRIP 7 : INK 0 : AT 9,10 : PRINT amount 2280 out_values 2290 buy 2,1 2300 STRIP 4 : AT 10,25 : PRINT" " 2310 END DEFine 2320 : 2330 DEFine PROCedure update_score 2340 LOCal a,b,d,e 2350 IF royal_pontoon=1 2360 banker=NOT(banker) 2370 out_head 2380 CSIZE 2,1 : INK 0 : STRIP 4 2390 AT 5,10 2400 IF banker=1 : PRINT"YOU GET THE BANK!!" : ELSE : PRINT"I GET THE BANK" 2410 IF banker=1 : music 1 : win 3 : ELSE : music 4 : win 4 2420 CSIZE 2,1 : INK 0 : STRIP 4 2430 PAUSE 50 : AT 5,10 : PRINT FILL$(" ",18) 2440 CSIZE 1,0 2450 ELSE 2460 IF total(1,2)<>0 : a=total(1,2) : ELSE : a=total(1,1) 2470 IF a>21 : a=0 2480 IF total(2,2)<>0 : b=total(2,2) : ELSE : b=total(2,1) 2490 IF b>21 : b=0 2500 d=card_tot(1) : e=card_tot(2) 2510 IF d=2 AND a=21 : a=50 2520 IF e=2 AND b=21 : b=50 2530 IF d=5 AND e<>5 AND a<>0 : a=100 2540 IF e=5 AND d<>5 AND b<>0 : b=100 2550 IF a>b OR (a=b AND banker=1) : win 1 : ELSE : win 2 2560 END IF 2570 END DEFine 2580 : 2590 DEFine PROCedure win (z) 2600 IF z=1 : music 2 2610 IF z=2 : music 3 2620 IF z>2 : z=z-2 2630 money(z)=money(z)+stake 2640 IF stake<>0 : stake=0 : out_values 2650 END DEFine 2660 : 2670 DEFine PROCedure music (lin_no) 2680 LOCal no_notes,i,a,b,c 2690 RESTORE 2720+(lin_no*10) 2700 READ no_notes 2710 FOR i=1 TO no_notes : READ a,b,c : BEEP a,b : PAUSE c 2720 BEEP 2730 DATA 4,1000,20,5,1000,20,5,1000,20,5,2000,10,10 2740 DATA 3,0,20,5,0,30,5,0,20,5 2750 DATA 2,3000,100,10,5000,200,15 2760 DATA 3,3000,100,10,3000,150,10,5000,200,15 2770 END DEFine 2780 : 2790 DEFine PROCedure twist (x,no_cards) 2800 LOCal down,ts,i,a,flag 2810 IF x=1 : down=50 : a=143 : ELSE : down=170 : a=31 2820 IF no_cards=0 : flag=1 : no_cards=card_tot(x) : ELSE : flag=0 2830 FOR i=1 TO no_cards 2840 IF flag : card_tot(x)=i-1 2850 print_cards 154+(card_tot(x)*10),down,1 2860 IF NOT flag : deal x : ELSE : tc=hand(x,i) 2870 CSIZE 1,0 2880 ts=((tc-1) DIV 13)+1 2890 IF ts>=3 : INK 2 : ELSE : INK 0 2900 STRIP 7 2910 IF flag : card_tot(x)=i 2920 CURSOR 168+(card_tot(x)*14.7),a 2930 PRINT numb$(((tc-1) MOD 13)+1) 2940 CURSOR 168+(card_tot(x)*14.7),a+9 2950 PRINT suit$(ts) 2960 IF flag : calc_tot x : out_tot x 2970 END FOR i 2980 calc_tot x 2990 END DEFine 3000 : 3010 DEFine PROCedure buy (x,no_cards) 3020 LOCal i,down,b 3030 IF x=1 : down=50 : b=146 : ELSE : down=170 : b=33 3040 FOR i=1 TO no_cards 3050 print_cards 154+(card_tot(x)*10),down,1 3060 deal x 3070 END FOR i 3080 calc_tot x 3090 BLOCK 44,45,169+(card_tot(x)*14.7),b-1,2,7,3 3100 END DEFine 3110 : 3120 DEFine PROCedure deal (wp) 3130 card_tot(wp)=card_tot(wp)+1 3140 tc=pack(pointer) 3150 hand(wp,card_tot(wp))=tc 3160 pointer=pointer+1 3170 END DEFine 3180 : 3190 DEFine PROCedure calc_tot(w) 3200 LOCal ace,f_tot,i,card_val 3210 ace=0 : f_tot=0 3220 FOR i=1 TO card_tot(w) 3230 card_val=((hand(w,i)-1) MOD 13)+1 3240 IF card_val>10 : card_val=10 3250 f_tot=f_tot+card_val 3260 IF card_val=1 : ace=1 3270 END FOR i 3280 total(w,1)=f_tot 3290 IF ace<>0 AND f_tot<=11 : total(w,2)=f_tot+10 : ELSE : total(w,2)=0 3300 IF w=1 : out_tot 1 3310 END DEFine 3320 : 3330 DEFine PROCedure out_tot (wx) 3340 LOCal h 3350 STRIP 4 3360 IF wx=1 : h=16 : ELSE : h=5 3370 AT h,10 : PRINT FILL$(" ",8) 3380 INK 0 : STRIP 7 3390 AT h,10 : PRINT total(wx,1); 3400 IF total(wx,1)>21 : PRINT" BUST" 3410 IF total(wx,2)<>0 : PRINT" or"!total(wx,2) 3420 END DEFine 3430 : 3440 DEFine PROCedure print_cards (across,down,no_cards) 3450 INK 7 3460 FILL 1 3470 draw_cards across,down,no_cards 3480 INK 0 3490 FILL 0 3500 draw_cards across,down,no_cards 3510 END DEFine 3520 : 3530 DEFine PROCedure draw_cards (across,down,no_cards) 3540 LOCal i 3550 FOR i=across TO (no_cards-1)*10+across STEP 10 3560 left_side i,down 3570 END FOR i 3580 right_side i,down 3590 END DEFine 3600 : 3610 DEFine PROCedure out_head 3620 CSIZE 1,0 3630 INK 3 : STRIP 7 3640 AT 2,8 3650 IF banker=0 : PRINT" BANKER " : ELSE : PRINT" PUNTER " 3660 AT 19,8 3670 IF banker=1 : PRINT" BANKER " : ELSE : PRINT" PUNTER " 3680 INK 0 : STRIP 4 3690 AT 4,2 : PRINT"MONEY '" 3700 AT 17,2 : PRINT"MONEY '" 3710 AT 5,2 : PRINT"TOTAL =" 3720 AT 16,2 : PRINT"TOTAL =" 3730 AT 9,2 : PRINT"BET '" 3740 AT 10,2 : PRINT"STAKE '" 3750 AT 11,2 : PRINT"BET '" 3760 END DEFine 3770 : 3780 DEFine PROCedure out_values 3790 INK 0 : STRIP 4 : CSIZE 1,0 3800 AT 4,10 : PRINT" " 3810 AT 17,10 : PRINT" " 3820 AT 10,10 : PRINT" " 3830 STRIP 7 3840 AT 4,10 : PRINT money(2) 3850 AT 17,10 : PRINT money(1) 3860 AT 10,10 : PRINT stake 3870 END DEFine 3880 : 3890 DEFine PROCedure open_pack 3900 LOCal i 3910 DIM pack(52) 3920 FOR i=1 TO 52 : pack(i)=i 3930 END DEFine 3940 : 3950 DEFine PROCedure shuffle_pack 3960 LOCal j,a,b,z 3970 FOR j=1 TO 50 3980 a=RND(1 TO 52) 3990 b=RND(1 TO 52) 4000 z=pack(a) 4010 pack(a)=pack(b) 4020 pack(b)=z 4030 END FOR j 4040 END DEFine 4050 : 4060 DEFine PROCedure set_chars 4070 LOCal i,byte 4080 st_add=RESPR(100) 4090 reg_a0=65537 4100 reg_a2=st_add+6 4110 RESTORE 4240 4120 FOR i=0 TO 61 : READ byte : POKE st_add+i,byte 4130 CALL st_add,0,0,255,37,0,0,0,reg_a0,0,reg_a2 4140 FOR i=1 TO 4 : suit$(i)=CHR$(i+127) 4150 numb$(1)=CHR$(132) 4160 FOR i=2 TO 9 : numb$(i)=i 4170 numb$(10)=CHR$(133) 4180 numb$(11)="J" 4190 numb$(12)="Q" 4200 numb$(13)="K" 4210 END DEFine 4220 : 4230 REMark machine code - 6 bytes 4240 DATA 32,4,78,67,78,117 4250 : 4260 REMark data - 2 bytes 4270 DATA 128,5 4280 : 4290 REMark character patterns - 4300 REMark 9 bytes per char 4310 DATA 8,28,62,127,127,107,8,8,0 4320 DATA 28,28,8,107,127,107,8,8,0 4330 DATA 0,231,255,255,126,60,24,0,0 4340 DATA 8,28,62,127,62,28,8,0,0 4350 DATA 24,24,36,36,126,66,66,0,0 4360 DATA 76,82,82,82,82,82,76,0,0