Rick Melick Home

K Basic for VIC 20 and C64

Program listings below of kbasic-vic.prg for the Vic 20 (kbasic-vic.prg). Need the C64 version? You can get it here thanks to the hard work of e5frog at Lemon64. As far as I know it is not available anywhere else online today.
This web page was originally for the VIC-20 version of the driver program for the Cardco Cardkey 1 (CK/1) numeric keypad, but the same information should work for the C64 version as well. It was distributed on cassette from Cardco along with the CK/1. It was called: KBASIC-VIC or KBASIC-C64. It is a BASIC program that places a ML program into memory then removes itself from memory.

To get this working I bought a "new" CK/1 from an old Commodore dealer (not cheap). Even though the cassette had never been used, bit-rot had set in. Nothing would load without a load error. I eventually had to bring the program into my PC as a WAV file from cassette, double the volume, play it back to my VIC-20 through a Cassadapt interface and have the potentiometer set exactly right to trigger whatever signal was too weak on the original cassette. Took me all night of tinkering and about 40 tries. The good people at Cardco only recorded it once on the cassette. (Two copies front and back might have been a nice gesture.) I didn't think it was recoverable. As far as I know it is not available anywhere else online today.

The C64 version is a whole other story. I don't have a C64, so I figured maybe the best thing I can do for my C64 friends is to post a WAV file of the C64 side of the tape (no modifications) and let the experts hack away at it. This was Side One (the VIC stuff was on Side Two). Sound Recorder was set to record at PCM 44.100 kHz, 16 Bit, Stereo, and I was using a first-generation C2N for the playback to Windows. This is the same configuration I used to eventually get kbasic-vic.prg posted online earlier. Tape length is roughly two minutes... WAV.

e5frog picked it up from Lemon64, and worked all night on the repair. He got it!! He found it looks pretty much like the VIC-20 version. "The first row of DATA is the same and then it starts to differ on some bytes," he said. He didn't have a chance to check all of it.

For both versions, if you are using MLX and the driver isn't working, change the following line in MLX from:

101 POKE788,52:REM DISABLE RUN/STOP
to:
101 SYS(the number you found in K Basic): REM ENABLE CK/1

To redefine one of the keys as a comma, list Lines 7010 to 7050 of the K Basic program and change the desired key to a comma.

This same program will drive the Atari CX85 numeric keypad on the VIC-20 as well (not tested on C64), though you will have to re-assign the key mappings using the KBASIC-VIC program GUI. Here is a sequential file containing one such mapping that can be loaded with K Basic: KB_CX85.S00, where NO=*, DELETE=/, YES=RETURN.


The following is a program listing of kbasic-vic.prg for the Vic 20 (kbasic-vic.prg). Need the C64 version? You can get it here thanks to the hard work of e5frog at Lemon64. As far as I know it is not available anywhere else online today.
 LOAD address $1001

 5 GOSUB8000
 10 REM PS=PROG START
 11 DIM A$(16)
 30 PRINT"{CLR}{DOWN}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RVSON} 7{RVSOFF} {RVSON} 8{RVSOFF} {RVSON} 9{RVSOFF} {RVSON}13"
 40 PRINT"{DOWN}{DOWN}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RVSON} 4{RVSOFF} {RVSON} 5{RVSOFF} {RVSON} 6{RVSOFF} {RVSON}12"
 50 PRINT"{DOWN}{DOWN}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RVSON} 1{RVSOFF} {RVSON} 2{RVSOFF} {RVSON} 3{RVSOFF} {RVSON}11"
 60 PRINT"{DOWN}{DOWN}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RVSON}14{RVSOFF} {RVSON} 0{RVSOFF} {RVSON}15{RVSOFF} {RVSON}10{DOWN}{DOWN}"
 61 PRINT"{DOWN}{RIGHT}{RIGHT}{RIGHT}{LARROW} =CHR$(13)"
 62 PRINT"{DOWN}{RIGHT}{RIGHT}{RIGHT}{POUND} =CLEAR SCREEN{DOWN}{DOWN}"
 63 PRINT"SYS"PS"TO ENABLE{DOWN}":GOSUB7000
 65 GOSUB6000:GOSUB5000
 110 PRINT"(E)NABLE & EXIT"
 130 PRINT"(C)REATE NEW VALUES"
 135 PRINT"(L)OAD NEW VALUES"
 140 GETZ$:IFZ$=""THEN140
 150 IFZ$="E"THEN190
 160 IFZ$="L"THEN1500
 170 IFZ$="C"THEN200
 180 GOTO140
 190 SYSPS:PRINT"{CLR}":NEW
 200 REM CREATE
 210 PRINT"{CLR}":GOSUB5000:PRINT" 16=STORE AND EXIT"
 211 PRINT" 17=EXIT":PRINT"ENTER # TO CHANGE";
 220 INPUTZ:IFZ>17ORZ<0THEN200
 221 IFZ=16THENGOSUB6000:GOSUB4000:GOSUB5000:GOTO110
 222 IFZ=17THENGOSUB6000:PRINT"{CLR}":GOSUB5000:GOTO110
 235 PRINTA$(Z);:INPUTA$(Z):GOTO200
 1000 REM LOADER
 1500 PRINT"{CLR}{DOWN}ENTER KEY FILE NAME   TO LOAD"
 1505 INPUT N$:IFN$="@"THENGOSUB5000:GOTO110
 1506 OPEN2,8,2,N$+",S,R"
 1510 FORZ=0TO15:A$(Z)=""
 1520 GET#2,B$
 1521 IFB$=CHR$(13)THEN1525
 1522 A$(Z)=A$(Z)+B$:GOTO1520
 1525 NEXT:CLOSE2
 1530 GOSUB6000:PRINT"{CLR}":GOSUB5000:GOTO110
 4000 REM STORE KEY VALUES
 4010 PRINT"{CLR}{DOWN}ENTER NAME OF KEY FILE"
 4011 INPUT N$:IFN$="@"THENGOSUB5000:GOTO110
 4020 OPEN2,8,2,"@0:"+N$+",S,W"
 4030 FORZ=0TO15
 4040 PRINT#2,A$(Z)
 4050 NEXT:CLOSE2:RETURN
 5000 REM PRINT ARRAY
 5010 FORZ=0TO15:PRINTZ"=";
 5011 IFA$(Z)=CHR$(13)THENPRINT"{LARROW}":GOTO5019
 5012 IFA$(Z)=CHR$(147)THENPRINT"{POUND}":GOTO5019
 5018 PRINTA$(Z)
 5019 NEXT
 5020 PRINT:PRINT:RETURN
 6000 REM PUT ARRAYS TO RAM
 6010 C=0:FORZ=0TO15
 6020 FORQ=1TO8
 6030 R$=(MID$(A$(Z),Q,1))
 6031 IFR$=""THENR=0:GOTO6038
 6032 R=ASC(R$)
 6035 IFR=92THENR=147
 6036 IFR=95THENR=13
 6038 POKE PS+186+C,R
 6040 C=C+1:NEXTQ:NEXTZ
 6050 RETURN
 7000 REM DEFAULT
 7010 A$(0)="0":A$(1)="1":A$(2)="2":A$(3)="3":A$(4)="4"
 7020 A$(5)="5":A$(6)="6":A$(7)="7"
 7030 A$(8)="8":A$(9)="9":A$(10)="+"
 7040 A$(11)="-":A$(12)="/":A$(13)="*"
 7050 A$(14)=".":A$(15)="{LARROW}":RETURN
 8000 REM LOAD DATA
 8010 TM=PEEK(55)+256*(PEEK(56))
 8015 PS=TM-315:HB=INT(PS/256):LB=PS-(HB*256)
 8020 POKE56,HB:POKE55,LB:POKE51,LB:POKE52,HB:POKE53,LB:POKE54,HB
 8030 FORQ=0TO183
 8040 READ XY:POKEQ+PS,XY:NEXT
 8060 RESTORE
 8075 H1=INT((PS+18)/256):L1=(PS+18)-(H1*256)
 8077 POKEPS+2,L1:POKEPS+7,H1
 8078 H1=INT((PS+184)/256):L1=(PS+184)-(H1*256)
 8080 POKEPS+14,L1:POKEPS+15,H1
 8085 POKEPS+38,L1:POKEPS+39,H1
 8090 POKEPS+44,L1:POKEPS+45,H1
 8100 POKEPS+151,L1:POKEPS+152,H1
 8105 H1=INT((PS+185)/256):L1=(PS+185)-(H1*256)
 8110 POKEPS+114,L1:POKEPS+115,H1
 8115 POKEPS+131,L1:POKEPS+132,H1
 8116 POKEPS+141,L1:POKEPS+142,H1
 8117 H1=INT((PS+186)/256):L1=(PS+186)-(H1*256)
 8118 POKEPS+123,L1:POKEPS+124,H1
 8120 RETURN
 8200 DATA 120,169,18,141,20,3,169,192,141,21,3,169,0,141
 8214 DATA 184,192,88,96,173,17,145,205,17,145,208,248,205,17
 8228 DATA 145,208,243,41,32,240,8,169,0,141,184,192,76,191
 8242 DATA 234,173,184,192,208,248,173,17,145,205,17,145,208,248
 8256 DATA 205,17,145,208,243,106,106,41,7,72,173,34,145,72
 8270 DATA 169,127,141,34,145,173,32,145,205,32,145,208,248,205
 8284 DATA 32,145,208,243,106,106,106,106,41,8,133,255,104,141
 8298 DATA 34,145,104,5,255,9,240,73,255,10,10,10,170,169
 8312 DATA 8,141,185,192,164,198,192,10,240,23,189,186,192,240
 8326 DATA 18,153,119,2,206,185,192,232,200,204,137,2,240,5
 8340 DATA 173,185,192,208,233,152,133,198,169,1,141,184,192,173
 8354 DATA 14,144,72,169,0,141,14,144,169,15,141,14,144,162
 8368 DATA 255,202,208,253,169,0,141,14,144,104,141,14,144,76
 8382 DATA 191,234

Converted to HTML using prgread.exe v1.45 by Lee Davison

Cardco was started in 1982 by Ed Lippert and Breck Ricketts out of a garage in Kansas with four employees. Breck designed almost all of the products and Ed was the energetic salesman. The company grew too quickly and lacked necessary maturity. For example, on Tuesday, February 19, 1985, a U.S. federal trademark registration was filed for Cardco by Breck. The USPTO had given the Cardco trademark serial number of 73522548. By November the federal status of this trademark filing was ABANDONED-FAILURE TO RESPOND OR LATE RESPONSE. The business collapsed by 1989. Manufacturing rights were sold off and the founders went on to pursue other business ventures. More information can be found here: http://www.pcmuseum.ca/companyprofile.asp?id=50

In addition to this keypad, I also discuss the Cardco Cardboard/6 interface and Cardco Cardriter Light Pen.