Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Hex dump

The Hex dump program below was originally published to the EPROM User group. It is of note as it provides a worked example of the in-line assembler abilities of the BBC Basic application.

Code Block
   10 REM **********************************
   20 REM Hexdump (C) Danny Langton        *
   30 REM Aware Technology, DECEMBER 1988  *
   40 REM TO BE TREATED AS PUBLIC DOMAIN   *
   50 REM I.E. COPY AND USE BUT DON'T SELL *
   60 REM **********************************
   70 PROCassemble
   80 REPEAT
   90   CLS:REPEATINPUT''"Name of file to dump : "'"(Use [ESCAPE] to quit)"SPC10""D$:UNTILLEND$
  100   X=OPENIN D$:IFX=0PRINT'"That file does not exist":GOTO90
  110   PRINT"Use UP and DOWN cursor keys to move through file"'"a line at a time,"'"[SHIFT] and cursor keys for a page at a time"'"and [DEL] to quit":TIME=0:REPEATUNTILTIME>300
  120   L%=0
  130   CLS
  140   REPEAT
  150     PROCdump(L%)
  160     CALL flush
  170     G%=GET:IFG%=0 G%=GET
  180     L%=L%+(G%=255)*16+(G%=251)*112-(G%=254)*16-(G%=250)*112
  190     IF G%=246 L%=EXT#X-96-(EXT#X)MOD16
  200     IF L%<0 OR L%>EXT#X OR G%=247L%=0
  210   UNTILG%=127
  220 UNTIL0
  230 :
  240 DEFPROCdump(L%)
  250 CLS
  260 PTR#X=L%
  270 IFEXT#X-L%<112 F%=EXT#X-L% ELSE F%=112
  280 R%=0:C%=0
  290 PRINTTAB(0,0)STRING$(8-LENSTR$~L%,"0")STR$~L%
  300 FOR M%=L% TO L%+F%-1
  310   IFR%=7GOTO360
  320   N%=BGET#X:N$=STR$~N%:IF LEN N$=1 N$="0"+N$
  330   PRINTTAB(12+C%*3,R%)N$TAB(64+C%,R%);
  340   IFN%>31 AND N%<127 PRINTCHR$N%; ELSE PRINT".";
  350   C%=C%+1:IFC%=16 C%=0:R%=R%+1:IFR%<7PRINTTAB(0,R%)STRING$(8-LENSTR$~(L%+R%*16),"0")+STR$~(L%+R%*16)
  360 NEXT
  370 ENDPROC
  380 :
  390 DEFPROCassemble
  400 DIMflush 50
  410 FORpass=0TO2STEP2
  420   P%=flush
  430   [OPT pass
  440   LD HL,0:ADD HL,SP:LD SP,(&1FFE):PUSH HL:CALL main:POP HL:LD SP,HL:RET
  450   .main
  460   RST &20
  470   DEFB &33
  480   RET
  490   ]
  500 NEXT
  510 ENDPROC
  520 :

Music Program for the Z88

Written by J. Mark Stevenson in 1989 - note the warnings in the REM statements.

Code Block
   10 REM J.MARK STEVENSON 12 FEB 89
   20 REM JUST TO PROVE THE Z88 CAN MAKE MUSIC!
   30 REM YOU ARE INVITED TO EXPERIMENT WITH THIS PROGRAM
   40 REM BUT BEWARE - THIS MAY CAUSE THE MACHINE TO HANG
   50 DIM Z% 200
   60 FOR Y% = 0 TO 2 STEP 2
   70   P%=Z%
   80   [ OPT Y%
   90   .cnt DEFW 0 :DEFW 0
  100   .del1 DEFW 0 :DEFW 0
  110   .del2 DEFW 0 :DEFW 0
  120   .flag DEFW 0
  130   .code
  140   LD HL,(cnt)
  150   .cnt_loop
  160   LD A,(flag) :OR A :CALL Z,inc :DEC A :CALL Z,dec
  170   LD BC,(del1) :CALL del_loop
  180   LD A,(&4B0) :PUSH AF :OR &40 :OUT (&B0),A
  190   LD BC,(del2) :CALL del_loop
  200   POP AF :OUT (&B0),A
  210   DEC HL :LD A,H :OR L :JR NZ,cnt_loop
  220   RET
  230   \
  240   .del_loop DEC BC :LD A,B :OR C :JR NZ,del_loop :RET
  250   \
  260   .inc
  270   LD DE,(del1) :INC DE :INC DE :LD (del1),DE 
  280   LD DE,(del2) :INC DE :INC DE :LD (del2),DE
  290   RET
  300   \
  310   .dec
  320   LD DE,(del1) :DEC DE :DEC DE :LD (del1),DE 
  330   LD DE,(del2) :DEC DE :DEC DE :LD (del2),DE
  340   RET
  350   ]
  360 NEXT
  370 :
  380 FOR T%=0 TO 2
  390   ?flag=T%
  400   FOR R%= 90 TO 41 STEP -3
  410     !cnt=3000/R% :!del1=R%*4 :!del2=R%*4
  420     Q%=USR(code)
  430   NEXT
  440 NEXT

Z88 Easter Eggs / ROM 2

There is a hidden message immediately before the internal ROM application front DOR in bank 7 at offset 3F57. Enter the command: .MV 3F57 07 in Gunther Strube's Intuition on the Assembler Workbench ROM.

Or use Thierry Peycru's Zmonitor on the Z88 Forever Compilation ROM. Or use ROMDMPx.BAS or similar program.

Or enter and run this BASIC / machine code program at your own risk. One small mistake in typing it in could corrupts memory in your Z88 and cause a FAIL or HARD RESET immediately or months later loosing all your files.

Code Block
   10 DIM code 29
   20 DIM buff 104
   30 P%=code
   40 [
   50 OPT 2
   60 LD A,(&4D3)
   70 PUSH AF
   80 LD A,7
   90 LD (&4D3),A
  100 OUT (&D3),A
  110 LD HL,&FF57
  120 LD DE,buff
  130 LD BC,104
  140 LDIR
  150 POP AF
  160 LD (&4D3),A
  170 OUT (&D3),A
  180 RET
  190 ]
  200 CALL code
  210 PRINT $buff

Yahtzee

The popular dice game.

Code Block
   10 *NAME YAHTZEE V4.5
   20 REM BY I D HUNNABLE (1850)
   30 ON ERROR GOTO2270
   40 PROCinit:CLS:VDU1,ASC"B":PRINTTAB(39,1)"YAHTZEE":VDU1,ASC"B":PRINTTAB(30,3)"HOW MANY PLAYERS? 1 OR 2":PRINTTAB(42,5);:REPEAT:A%=INKEY(0):UNTILA%=49ORA%=50
   50 IFA%=49PROCpatience:ELSE PROCgame
   60 CLS:PRINTCHR$1+"2+C":END
   70 DEFPROCgame
   80 REPEAT:CLS:VDU1,ASC"B":PRINTTAB(39,1)"YAHTZEE":VDU1,ASC"B":PRINTTAB(39,3)"NAMES?":INPUTTAB(39,5)P$(1):INPUTTAB(39,6)P$(2):UNTILLEN(P$(1))<6ANDLEN(P$(2))<6
   90 PRINTCHR$1,"2-C"
  100 GC%=1:PROCscreen:REPEAT:FORPLR%=1TO2:PROCgo(PLR%):NEXT:GC%=GC%+1:UNTILGC%=14:PROCendgame:IFAA$="Y"ORAA$="y" PROCclear:GOTO100
  110 ENDPROC
  120 DEFPROCpatience
  130 PRINTTAB(30,3)SPC(35):PRINTTAB(39,3)"YOUR NAME ";:INPUTP$(1)
  140 PRINTCHR$1+"2-C"
  150 GC%=1:PROCscreen:FORGC%=1TO13:PROCgo(1):NEXT
  160 FORX%=2TO4:PRINTTAB(36,X%);SPC(20):NEXT
  170 PRINTTAB(41,3)CHR$1+"2+B"+"GO AGAIN?"+CHR$1+"2-B":PROCans("Y","y","N","n"):IFAA$="Y"THENPROCclear:GOTO150
  180 ENDPROC
  190 DEFPROCinit
  200 DIMD$(6),T%(5,1),SC%(17,4),SB$(14),P$(2),HOLD$(2):t1$=CHR$1+"2+T":t2$=CHR$1+"2-T":TH%=1:@%=&00000904
  210 SB$(1)=t1$+"ONES"+t2$:SB$(2)=t1$+"TWOS"+t2$:SB$(3)=t1$+"THREES"+t2$:SB$(4)=t1$+"FOURS"+t2$:SB$(5)=t1$+"FIVES"+t2$:SB$(6)=t1$+"SIXES"+t2$:SB$(7)=t1$+"BONUS"+t2$
  220 SB$(8)=t1$+"3 OF A KIND"+t2$:SB$(9)=t1$+"4 OF A KIND"+t2$:SB$(10)=t1$+"FULL HOUSE"+t2$:SB$(11)=t1$+"LOW STRAIGHT"+t2$:SB$(12)=t1$+"HIGH STRAIGHT"+t2$:SB$(13)=t1$+"YAHTZEE"+t2$:SB$(14)=t1$+"CHANCE"+t2$
  230 TAG1=0:TAG2=0:TAG3=0
  240 L$=CHR$1+CHR$244:R$=CHR$1+CHR$245:D$=CHR$1+CHR$246:U$=CHR$1+CHR$247
  250 HOLD$(2)=CHR$1+CHR$243:HOLD$(1)="  "
  260 VDU1,138,61,65,128,128,159,160,160,173,173,160
  270 VDU1,138,61,66,128,128,190,129,129,173,173,129
  280 VDU1,138,61,67,160,173,173,160,160,159,128,128
  290 VDU1,138,61,68,129,173,173,129,129,190,128,128
  300 VDU1,138,61,69,128,128,159,160,160,172,172,161
  310 VDU1,138,61,70,128,128,190,129,129,141,141,161
  320 VDU1,138,61,71,161,172,172,160,160,159,128,128
  330 VDU1,138,61,72,161,141,141,129,129,190,128,128
  340 VDU1,138,61,73,128,128,159,160,160,166,166,160
  350 VDU1,138,61,74,128,128,190,129,129,153,153,129
  360 VDU1,138,61,75,160,166,166,160,160,159,128,128
  370 VDU1,138,61,76,129,153,153,129,129,190,128,128
  380 VDU1,138,61,77,128,128,159,160,160,160,160,161
  390 VDU1,138,61,78,128,128,190,129,141,141,129,161
  400 VDU1,138,61,79,161,160,172,172,160,159,128,128
  410 VDU1,138,61,80,161,129,129,129,129,190,128,128
  420 VDU1,138,61,81,128,128,159,160,160,166,166,160
  430 VDU1,138,61,82,128,128,190,129,129,129,129,129
  440 VDU1,138,61,83,160,160,160,160,160,159,128,128
  450 VDU1,138,61,84,129,153,153,129,129,190,128,128
  460 VDU1,138,61,85,128,128,159,160,160,160,160,161
  470 VDU1,138,61,86,128,128,190,129,129,129,129,161
  480 VDU1,138,61,87,161,129,129,129,129,190,128,128
  490 VDU1,138,61,88,161,160,160,160,160,159,128,128
  500 VDU1,138,61,89,129,129,130,130,132,148,136,128
  510 VDU1,138,61,90,191,160,175,168,168,168,168,168
  520 VDU1,138,61,91,191,128,191,128,128,128,128,128
  530 VDU1,138,61,92,191,129,189,133,133,133,133,133
  540 VDU1,138,61,93,133,133,133,133,133,133,133,133
  550 VDU1,138,61,94,168,168,168,168,168,175,160,191
  560 VDU1,138,61,95,128,128,128,128,128,191,128,191
  570 VDU1,138,61,96,133,133,133,133,133,189,129,191
  580 VDU1,138,61,97,168,168,168,168,168,168,168,168
  590 CH$=CHR$1+CHR$130+"?":TL$=CH$+CHR$90:TR$=CH$+CHR$92:RS$=CH$+CHR$93:BL$=CH$+CHR$94:B$=CH$+CHR$95:BR$=CH$+CHR$96:LS$=CH$+CHR$97:Top$=CH$+CHR$91:BSD$=CHR$8+CHR$10:BS$=CHR$8:CU$=CHR$8+CHR$11
  600 TROW$=TL$+STRING$(20,Top$)+TR$:RU$=RS$+BSD$+RS$+BSD$+RS$+BSD$+RS$:BROW$=BL$+STRING$(20,B$)+BR$:LU$=LS$+BSD$+LS$+BSD$+LS$+BSD$+LS$
  610 CH$=CHR$1+CHR$130+"?":BS2$=CHR$8+CHR$8+CHR$10
  620 D$(6)=CH$+"A"+CH$+"B"+BS2$+CH$+"C"+CH$+"D"
  630 D$(5)=CH$+"E"+CH$+"F"+BS2$+CH$+"G"+CH$+"H"
  640 D$(4)=CH$+"I"+CH$+"J"+BS2$+CH$+"K"+CH$+"L"
  650 D$(3)=CH$+"M"+CH$+"N"+BS2$+CH$+"O"+CH$+"P"
  660 D$(2)=CH$+"Q"+CH$+"R"+BS2$+CH$+"S"+CH$+"T"
  670 D$(1)=CH$+"U"+CH$+"V"+BS2$+CH$+"X"+CH$+"W"
  680 TICK$=CH$+"Y"
  690 PROCclear
  700 ENDPROC
  710 DEFPROCgo(P%)
  720 FORN=1TO5:T%(N,0)=0:NEXT
  730 PRINTTAB(40,4)SPC(15);TAB(54,0)"1 "
  740 PRINTTAB(44,0);GC%;TAB(55+(19*(P%=2)),3)" ";TAB(55+(19*(P%=1)),3);CHR$1+CHR$(245+(P%=1));:PROCflush:REPEAT:Z$=GET$:UNTILZ$=" "
  750 TH%=0:REPEAT:TH%=TH%+1:PRINTTAB(54,0);TH%;" ";
  760   TIME=0:REPEAT:WD%=RND(5):IFT%(WD%,0)<>1T%(WD%,1)=RND(6):PRINTTAB(36+(3*WD%),2)D$(T%(WD%,1))
  770   UNTILTIME>=500:VDU7:PRINTTAB(55,0)TICK$;:IFTH%=3THEN820
  780   PROCflush
  790   REPEAT:REPEAT:H%=GET-48:UNTIL(H%>0ANDH%<6)ORH%+48=32ORH%+48=83:IFH%+48<>32ANDH%+48<>83T%(H%,0)=ABS(T%(H%,0)=0):PRINTTAB(36+(H%*3),4)HOLD$(2+(T%(H%,0)=0));
  800   UNTILH%+48=32ORH%+48=83
  810   IFH%+48=83TH%=3:VDU7
  820 UNTILTH%=3
  830 PROCscore(P%):PROCtotal(P%):PROCshowscore(P%):IFP%=1PROCmover:ELSE IFGC%<>13PROCmovel
  840 ENDPROC
  850 DEFPROCscore(P%)
  860 AS%=0:ST%=0:TS%=0:VDU1,ASC"R":VDU1,ASC"T":PRINTTAB(36,4)"SCORE AGAINST WHAT ?":VDU1,ASC"T":VDU1,ASC"R"
  870 PROCflush
  880 REPEAT:A$=GET$:UNTILA$="1"ORA$="2"ORA$="3"ORA$="4"ORA$="5"ORA$="6"ORA$="T"ORA$="F"ORA$="H"ORA$="L"ORA$="S"ORA$="Y"ORA$="C"
  890 IFA$="1"ORA$="2"ORA$="3"ORA$="4"ORA$="5"ORA$="6"PROCcalcN(P%,VAL(A$))
  900 IFA$="T"PROCcalcK(P%,9)
  910 IFA$="F"PROCcalcK(P%,10)
  920 IFA$="H"PROCcalcF(P%)
  930 IFA$="L"PROCcalcL(P%)
  940 IFA$="S"PROCcalcH(P%)
  950 IFA$="Y"PROCcalcY(P%)
  960 IFA$="C"PROCcalcC(P%)
  970 IFAS%=1ORST%=0VDU7:GOTO860
  980 PRINTTAB(36,4)SPC(20)
  990 ENDPROC
 1000 DEFPROCcalcN(P%,N%):IFSC%(N%,P%+2)=127AS%=1
 1010 FORX%=1TO5:IFT%(X%,1)=N%TS%=TS%+N%
 1020 NEXT
 1030 PROCoke(P%,SB$(N%),60+(60*(P%=1)),N%-1):IFST%=1:SC%(N%,P%)=TS%:SC%(N%,P%+2)=127
 1040 IFSC%(1,P%+2)=127ANDSC%(2,P%+2)=127ANDSC%(3,P%+2)=127ANDSC%(4,P%+2)=127ANDSC%(5,P%+2)=127ANDSC%(6,P%+2)=127SC%(7,P%+2)=127
 1050 PROCchb(P%)
 1060 ENDPROC
 1070 DEFPROCcalcK(P%,N%):IFSC%(N%,P%+2)=127AS%=1
 1080 A%=0:B%=0:C%=0:D%=0:E%=0:F%=0:G%=0:IFN%=9K%=3 ELSE K%=4
 1090 FORX%=1TO5
 1100   IFT%(X%,1)=1A%=A%+1:IFA%=K%F%=1
 1110   IFT%(X%,1)=2B%=B%+1:IFB%=K%F%=1
 1120   IFT%(X%,1)=3C%=C%+1:IFC%=K%F%=1
 1130   IFT%(X%,1)=4D%=D%+1:IFD%=K%F%=1
 1140   IFT%(X%,1)=5 E%=E%+1:IFE%=K%F%=1
 1150   IFT%(X%,1)=6G%=G%+1:IFG%=K%F%=1
 1160 NEXT
 1170 IFF%=1FORX%=1TO5:TS%=TS%+T%(X%,1):NEXT:ELSE TS%=0
 1180 PROCoke(P%,SB$(5+K%),75+(60*(P%=1)),K%-3):IFST%=1SC%(N%,P%)=TS%:SC%(N%,P%+2)=127
 1190 ENDPROC
 1200 DEFPROCcalcF(P%):IFSC%(11,P%+2)=127AS%=1
 1210 A%=0:B%=0:C%=0:D%=0:E%=0:F%=0:FORX%=1TO5
 1220   IFT%(X%,1)=1A%=A%+1
 1230   IFT%(X%,1)=2B%=B%+1
 1240   IFT%(X%,1)=3C%=C%+1
 1250   IFT%(X%,1)=4D%=D%+1
 1260   IFT%(X%,1)=5 E%=E%+1
 1270   IFT%(X%,1)=6 F%=F%+1
 1280 NEXT
 1290 FORX%=1TO5:TWO=0:THR=0
 1300   IFA%=3THR=1:ELSE IFA%=2TWO=1
 1310   IFB%=3THR=1:ELSE IFB%=2TWO=1
 1320   IFC%=3THR=1:ELSE IFC%=2TWO=1
 1330   IFD%=3THR=1:ELSE IFD%=2TWO=1
 1340   IFE%=3THR=1:ELSE IFE%=2TWO=1
 1350   IFF%=3THR=1:ELSE IFF%=2TWO=1
 1360 NEXT
 1370 IFTHR=1ANDTWO=1TS%=25:ELSE TS%=0
 1380 PROCoke(P%,SB$(10),75+(60*(P%=1)),2):IFST%=1SC%(11,P%)=TS%:SC%(11,P%+2)=127
 1390 ENDPROC
 1400 DEFPROCcalcL(P%):PASS%=0:IFSC%(12,P%+2)=127AS%=1
 1410 F%=0:PROCsort:S$=STR$(T%(1,1))+STR$(T%(2,1))+STR$(T%(3,1))+STR$(T%(4,1))+STR$(T%(5,1))
 1420 IFMID$(S$,1,4)="1234"ORMID$(S$,1,4)="2345"ORMID$(S$,1,4)="3456"ORMID$(S$,2,4)="1234"ORMID$(S$,2,4)="2345"ORMID$(S$,2,4)="3456"F%=1
 1430 IFF%=1ORPASS%=1GOTO1480
 1440 PASS%=1:FORX%=2TO3
 1450   IFT%(X%,1)=T%(X%+1,1) T%(X%+1,1)=0:X%=3
 1460 NEXT
 1470 GOTO1410
 1480 IFF%=1TS%=30:ELSE TS%=0
 1490 PROCoke(P%,SB$(11),75+(60*(P%=1)),3):IFST%=1SC%(12,P%)=TS%:SC%(12,P%+2)=127
 1500 ENDPROC
 1510 DEFPROCcalcH(P%):IFSC%(13,P%+2)=127AS%=1
 1520 PROCsort:S$=STR$(T%(1,1))+STR$(T%(2,1))+STR$(T%(3,1))+STR$(T%(4,1))+STR$(T%(5,1))
 1530 IFMID$(S$,1,5)="12345"ORMID$(S$,1,5)="23456"ORMID$(S$,2,5)="12345"ORMID$(S$,2,5)="23456"TS%=40:ELSE TS%=0
 1540 PROCoke(P%,SB$(12),75+(60*(P%=1)),4):IFST%=1SC%(13,P%)=TS%:SC%(13,P%+2)=127
 1550 ENDPROC
 1560 DEFPROCcalcY(P%):Types=1:IFSC%(14,P%+2)=127AS%=1
 1570 IFT%(2,1)<>T%(1,1)Types=Types+1
 1580 IFT%(3,1)<>T%(1,1)Types=Types+1
 1590 IFT%(4,1)<>T%(1,1)Types=Types+1
 1600 IFT%(5,1)<>T%(1,1)Types=Types+1
 1610 IFTypes=1TS%=50:ELSE TS%=0
 1620 PROCoke(P%,SB$(13),75+(60*(P%=1)),5):IFST%=1SC%(14,P%)=TS%:SC%(14,P%+2)=127
 1630 ENDPROC
 1640 DEFPROCcalcC(P%):IFSC%(15,P%+2)=127AS%=1
 1650 FORX%=1TO5:TS%=TS%+T%(X%,1):NEXT:PROCoke(P%,SB$(14),75+(60*(P%=1)),6):IFST%=1SC%(15,P%)=TS%:SC%(15,P%+2)=127
 1660 ENDPROC
 1670 DEFPROCtotal(P%):SC%(8,P%)=0:SC%(16,P%)=0
 1680 FORX%=1TO6:SC%(8,P%)=SC%(8,P%)+SC%(X%,P%):NEXT
 1690 IFSC%(8,P%)>=63SC%(7,P%)=35:SC%(7,P%+2)=127
 1700 SC%(8,P%)=SC%(8,P%)+SC%(7,P%)
 1710 FORX%=9TO15:SC%(16,P%)=SC%(16,P%)+SC%(X%,P%):NEXT
 1720 SC%(17,P%)=SC%(8,P%)+SC%(16,P%)
 1730 ENDPROC
 1740 DEFPROCshowscore(P%):X1%=68+(60*(P%=1)):X2%=88+(60*(P%=1))
 1750 PRINTTAB(X1%,0),SC%(1,P%);TAB(X1%,1),SC%(2,P%);TAB(X1%,2),SC%(3,P%);TAB(X1%,3),SC%(4,P%);
 1760 PRINTTAB(X1%,4),SC%(5,P%);TAB(X1%,5),SC%(6,P%);TAB(X1%,6),SC%(7,P%);TAB(X1%,7),SC%(8,P%);
 1770 PRINTTAB(X2%,0),SC%(9,P%);TAB(X2%,1),SC%(10,P%);TAB(X2%,2),SC%(11,P%);TAB(X2%,3),SC%(12,P%);
 1780 PRINTTAB(X2%,4),SC%(13,P%);TAB(X2%,5),SC%(14,P%);TAB(X2%,6),SC%(15,P%);TAB(X2%,7),SC%(16,P%);TAB(40,7),SC%(17,1);TAB(54,7),SC%(17,2);
 1790 FORX%=0TO6:PRINTTAB(12,X%);CHR$(SC%(X%+1,3));TAB(72,X%);CHR$(SC%(X%+1,4));:NEXT:FORX%=9TO15:PRINTTAB(32,X%-9);CHR$(SC%(X%,3));TAB(92,X%-9);CHR$(SC%(X%,4));:NEXT
 1800 ENDPROC
 1810 DEFPROCscreen
 1820 CLS:FORPSC%=1TO7:PRINTTAB(0,PSC%-1)SB$(PSC%);TAB(60,PSC%-1)SB$(PSC%);:NEXT
 1830 PRINTCHR$1+"2+T";TAB(0,7);"TOTAL";TAB(60,7)"TOTAL";CHR$1+"2-T";:FORPSC%=8TO14:PRINTTAB(15,PSC%-8)SB$(PSC%);TAB(75,PSC%-8)SB$(PSC%);:NEXT 
 1840 PRINTCHR$1+"2+T";TAB(15,7);"TOTAL";TAB(75,7)"TOTAL";CHR$1+"2-T";
 1850 PROCshowscore(1):PRINTTAB(0,0):PROCshowscore(2)
 1860 PRINTTAB(36,0)"ELEMENT 1   THROW 1";TAB(34,7);P$(1);TAB(48,7)P$(2);
 1870 C=0:FORN=39TO51STEP3:C=C+1:D%=RND(6):PRINTTAB(N,2)D$(D%):T%(C,0)=0:NEXT
 1880 PRINTTAB(35,1)TROW$;TAB(35,2)LU$;TAB(56,2)RU$;TAB(35,5)BROW$;
 1890 ENDPROC
 1900 DEFPROCclear:FORX%=1TO17:FORY%=1TO2:SC%(X%,Y%)=0:NEXT:NEXT:FORX%=1TO7:SC%(X%,3)=32:SC%(X%,4)=32:NEXT:FORX%=9TO15:SC%(X%,3)=32:SC%(X%,4)=32:NEXT:ENDPROC
 1910 DEFPROCsort
 1920 FORI%=1TO4:FORJ%=I%+1TO5:IFT%(J%,1)<T%(I%,1)T%(0,1)=T%(J%,1):T%(J%,1)=T%(I%,1):T%(I%,1)=T%(0,1)
 1930   NEXT:NEXT
 1940 ENDPROC
 1950 DEFPROCmovel
 1960 LOCAL I%:I%=15
 1970 PRINTTAB(55,3)R$:PROCw(150)
 1980 PRINTTAB(55,3)D$:PROCw(I%):PRINTTAB(55,3)" ":PRINTTAB(55,4)D$
 1990 PROCw(I%):PRINTTAB(55,4)" ":FORMAL%=53TO37 STEP -2:PRINTTAB(MAL%,4)L$:PROCw(I%):PRINTTAB(MAL%,4)" ":NEXT:PRINTTAB(36,3)U$:PROCw(I%)
 2000 ENDPROC
 2010 DEFPROCmover
 2020 LOCAL I%:I%=15
 2030 PROCw(150)
 2040 PRINTTAB(36,3)D$:PROCw(I%):PRINTTAB(36,3)" ":PRINTTAB(36,4)D$
 2050 PROCw(I%):PRINTTAB(36,4)" ":FORMAR%=38 TO 54 STEP 2:PRINTTAB(MAR%,4)R$:PROCw(I%):PRINTTAB(MAR%,4)" ":NEXT:PRINTTAB(55,3)U$
 2060 ENDPROC
 2070 DEFPROCchb(P%)
 2080 SSF%=0:HSP%=0:FORN=1TO6:IFSC%(N,P%+2)<>127 HSP%=HSP%+(N*5)
 2090   IFSC%(N,P%+2)=127SSF%=SSF%+SC%(N,P%)
 2100 NEXT
 2110 IFHSP%+SSF%<63SC%(7,P%+2)=127
 2120 ENDPROC
 2130 DEFPROCendgame:FORX%=2TO4:PRINTTAB(36,X%);SPC(20):NEXT
 2140 IFSC%(17,1)>SC%(17,2)VDU1,ASC"B":PRINTTAB(41,2)P$(1);" WINS":VDU1,ASC"B":ELSE IF SC%(17,2)>SC%(17,1)VDU1,ASC"B":PRINTTAB(41,2)P$(2);" WINS":VDU1,ASC"B":ELSE IF SC%(17,1)=SC%(17,2)VDU1,ASC"B":PRINTTAB(42,2)"GAME DRAWN":VDU1,ASC"B"
 2150 VDU1,ASC"B":PRINTTAB(37,4)"ANOTHER GAME? Y/N":VDU1,ASC"B":PROCans("Y","y","N","n")
 2160 ENDPROC
 2170 DEFPROCoke(P%,E$,Q%,R%):PRINTCHR$1+"2+R":PRINTTAB(Q%,R%)E$;:PRINTCHR$1+"2-R";
 2180 IFAS%=1PROCmes:GOTO2210
 2190 PRINTCHR$1+"4+T+R":PRINTTAB(36,4)SPC(20);TAB(38,4)"SCORES ";TS%;" OK? Y/N";:PRINTCHR$1+"4-T-R":PROCans("Y","y","N","n")
 2200 IFAA$="Y"ORAA$="y"ST%=1
 2210 PRINTTAB(Q%,R%)E$;
 2220 ENDPROC
 2230 DEFPROCans(Q$,R$,S$,T$):REPEAT:AA$=GET$:UNTILAA$=Q$ORAA$=R$ORAA$=S$ORAA$=T$:ENDPROC
 2240 DEFPROCflush:REPEAT:FL%=INKEY(0):UNTILFL%=-1:ENDPROC
 2250 DEFPROCw(TT%):TIME=0:REPEAT:UNTILTIME>=TT%:ENDPROC
 2260 DEFPROCmes:VDU1,ASC"T":VDU1,ASC"R":PRINTTAB(36,4)" YOU'VE SCORED THAT ":VDU1,ASC"R":VDU1,ASC"T":PROCw(250):ENDPROC
 2270 REPORT:PRINT" at line ";ERL:PRINTCHR$1+"2+C"