10 CLS:PRINT "TLC.EXE - Ver. 1.20 (SM-10/92)":PRINT 20 REM ** Lecture et ‚criture de T‚l‚carte 256 bits 30 REM ** d'aprŠs Le Haut-Parleur num‚ro 1805 page 148 - 10/92 40 REM ================= PROGRAMME PRINCIPAL ========================= 50 REM ***************** S‚lection de fonction *********************** 60 PRINT "This programm reads data from France Telecom telecarte to an Ascii file," 70 PRINT "or writes data from an Ascii file to a telecarte. Dedicated interface is" 80 PRINT "required (see TLC.DOC)." 85 PRINT 90 REM ** "WARNING: some program parameters may need computer matching." 110 REM ** adresses de ports, … confirmer sur machine 120 REM ** E: Busy = bit 7, ACK barre = bit 6 130 E = &H379 140 REM ** S: A = bit 2, B = bit 1, ST = bit 0 150 S = &H378 152 Print "Input port: 379h - Output port: 378h":print 160 REM ** tableau pour stocker fichier … ‚crire 170 DIM T(256) 180 PRINT "> hit to read, to write, or to quit " 200 OUT S, 0 210 R$=INKEY$ 220 IF R$ ="R" OR R$ ="r" THEN GOTO 260 230 IF R$="W" OR R$="w" THEN GOTO 650 240 IF R$="Q" OR R$="q" THEN GOTO 1260 250 GOTO 210 260 REM ***************** programme de lecture ************************ 270 PRINT "Selection: Read data from card to file." 290 REM ** vers routine carte ins‚r‚e 300 GOSUB 1310 310 REM ** on a eu plus de 3 tentatives carte non ins‚r‚e 320 IF I > 3 THEN GOTO 180 330 INPUT "> enter file name to store data in : ",F$ 350 IF F$="" THEN GOTO 390 360 PRINT "Data will be stored in "; F$ 380 OPEN F$ FOR OUTPUT AS #1 390 PRINT "Reading data from memory card ":PRINT 410 REM ** un coup de ST, A et B … 0 420 OUT S, &HF9 430 OUT S, &HF8 432 Rem ** initialisation des variables de comptage 434 Utotal$="" 436 Uconsom%=0 438 Rem ** I = # ligne de 16 bits, j = # colonne droite (1) ou gauche (2) 439 Rem ** K = # bits dans une colonne, L = le bit (0 ou 1) 440 FOR I=1 TO 16 450 FOR J=1 TO 2 460 FOR K=1 TO 8 470 OUT S, &HFA 480 REM ** ST … 0, B … 1, A … 0 ---> +1 compteur d'adresses 490 L = INP(E) 500 REM ** lecture ACK, on suppose un ACK barre = bit 6 de 379 510 L = (L AND &H40) 520 IF L = &H40 THEN PRINT "1";:if f$<>"" then PRINT #1, "1 "; 530 IF L <> &H40 THEN PRINT "0";: if f$<>"" then PRINT #1, "0 "; 532 if i=6 and j=2 then if l=&h40 then Utotal$=Utotal$+"1" else Utotal$=Utotal$+"0" 534 if i>6 and i<16 then if l=&h40 then Uconsom%=Uconsom%+1 540 REM ** ST … 1, A et B inchang‚s 550 OUT S, &HFB 560 NEXT K 570 PRINT " ";:if f$<>"" then PRINT #1, ""; 580 NEXT J 590 PRINT : if f$<>"" then PRINT #1, 600 NEXT I 610 PRINT 620 if f$<>"" then CLOSE #1 621 U%=0 622 For i=1 to 4 623 u%=u%+2^(4-i)*val(mid$(Utotal$,i,1)) 624 next i 625 u%=u%*10 626 for i=5 to 8 627 u%=u%+2^(8-i)*val(mid$(Utotal$,i,1)) 628 next i 629 u%=u%*10 630 if u% <360 then Print "Full:";u%-10;"U - Remaining:";U%-Uconsom%;"U" else PRINT "Done with reading " 636 PRINT 638 OUT S,0 640 GOTO 180 650 REM **************** programme d'ecriture ************************* 660 PRINT "Selection: write data to card from file." 680 REM ** vers routine carte ins‚r‚e 690 GOSUB 1310 700 REM ** on a eu 3 tentatives carte non ins‚r‚e 710 IF I > 3 THEN GOTO 180 720 INPUT "> enter file name to write data from : ",F$ 740 IF F$="" THEN GOTO 180 750 PRINT "Data will be written from "; F$ 770 OPEN F$ FOR INPUT AS #1 780 REM ** chargement tableau de 256 bits … ‚crire 790 FOR N=1 TO 256 800 INPUT #1,A 810 T(N)=A 820 NEXT N 830 CLOSE #1 840 INPUT "> set Vpp switch to ON, then ",R$ 860 PRINT "Writing data to memory card ":PRINT 880 REM ** un coup de ST, A et B … 0 890 OUT S, &HF9 900 OUT S, &HF8 910 N=1 920 FOR I=1 TO 16 930 FOR J=1 TO 2 940 FOR K=1 TO 8 950 REM ** tout … 0 960 OUT S, &HFA 970 B=T(N) 980 REM ** on n'‚crit que les bits … 1, les bits ‚tant … 0 par d‚faut... 990 IF B=1 THEN GOSUB 1150 1000 REM ** compteur d'adresse +1 1010 OUT S, &HFB 1020 PRINT RIGHT$(STR$(B),1); 1030 N=N+1 1040 NEXT K 1050 PRINT " "; 1060 NEXT J 1070 PRINT 1080 NEXT I 1090 PRINT 1095 PRINT "Done with writing " 1100 OUT S,0 1110 INPUT "> set Vpp switch to OFF, then ",R$:print 1130 GOTO 180 1140 REM ================ SUBROUTINES ================================== 1150 REM **************** Ecriture des bits … 1 ************************ 1160 REM ** un coup de Strobe, A et B … 1 1170 OUT S, &HFE 1180 OUT S, &HFF 1190 REM ** ajuster p pour ST = 50ms +/-5ms au scope 1200 FOR P=1 TO 140 1210 NEXT P 1220 OUT S, &HFE 1230 REM ** compteur d'adresses +1 1240 OUT S, &HFA 1250 RETURN 1260 REM **************** Fin du programme ***************************** 1280 PRINT: Print "Bye! ":PRINT 1290 REM retour au DOS 1300 SYSTEM 1310 REM **************** Test Switch carte ins‚r‚e ******************** 1320 I=1 1330 REM ** si carte pas ins‚r‚e aprŠs 3 demandes, on sort 1340 IF I > 3 THEN GOTO 1420 1350 INPUT "> plug memory card, then ",R$ 1370 REM ** on test Busy, bit 8 de 379 1380 L= INP(E) 1390 L=(L AND &H80) 1400 I = I +1 1410 IF L = 0 GOTO 1340 1420 RETURN