1 REMark jsformat (c) Timo Salmi
2 REMark Sat 1987 Sep 05 08:23:38
3 REMark version 2.3
4 :
100 CLEAR:kokoaika=DATE:vr$=VER$
110 DIM ohj$(8),tpvm$(8),vrs$(4)
120 p_tsotsake("JSFORMAT"),("05.09.87"),("2.3")
130 :
140 REPeat runko
150 :
160 p_ikkunat
170 :
180 IF vr$=="jm" OR vr$=="ah":vanha=1:ELSE :vanha=0:END IF 
190 IF vanha THEN 
200  PRINT"IMPLEMENTED WITHOUT ERROR RECOVERY ON"!"QL VERSION"!vr$
210  PRINT"In case of format failed write RETRY":PRINT
220 END IF 
230 :
240 virhe%=0:maxyr%=5
250 IF NOT vanha THEN 
260  WHEN ERRor 
270   IF ERR_FF THEN 
280    virhe%=virhe%+1
290    IF virhe%<=maxyr% THEN 
300     PRINT"FAILED, I SHALL RETRY"
310     FOR il=1 TO 200:END FOR il
320     RETRY
330    ELSE 
340     PRINT"FAILED TOO MANY TIMES"
350     PRINT"I GIVE UP"
360     IF f_vielako:NEXT runko:ELSE :EXIT runko:END IF 
370    END IF 
380   ELSE 
390    REPORT:STOP
400   END IF 
410  END WHEN 
420 END IF 
430 :
440 DIM dr$(5),nimi$(15),kertaa$(3),maxyr$(3),v$(3)
450 :
460 REPeat kysy_asema
470  clb=KEYROW(0)
480  INPUT"CHOOSE MICRODRIVE (1/2)?"!dr$
490  IF dr$="1" THEN EXIT kysy_asema
500  IF dr$="2" THEN EXIT kysy_asema
510 END REPeat kysy_asema
520 dr$="mdv"&dr$&"_"
530 :
540 REPeat kysy_nimi
550  clb=KEYROW(0)
560  INPUT"NAME FOR THE CARTRIDE?"!nimi$
570  IF LEN(nimi$)<=10 THEN EXIT kysy_nimi
580  PRINT"NAME TOO LONG"
590 END REPeat kysy_nimi
600 :
610 REPeat kysy_kerrat
620  clb=KEYROW(0)
630  INPUT"FORMAT HOW MANY TIMES?"!kertaa$
640  IF LEN(kertaa$)=1 AND kertaa$>"0" AND kertaa$<="9" THEN EXIT kysy_kerrat
650  PRINT"MUST BE ONE TO NINE"
660 END REPeat kysy_kerrat
670 :
680 IF NOT vanha THEN 
690  REPeat kysy_retryt
700   clb=KEYROW(0)
710   INPUT"MAXIMUM NUMBER OF RETRYS?"!maxyr$
720   IF LEN(maxyr$)=1 AND maxyr$>="0" AND maxyr$<="9" THEN EXIT kysy_retryt
730   PRINT"MUST BE ZERO TO NINE"
740  END REPeat kysy_retryt
750  maxyr%=maxyr$
760 END IF 
770 :
780 PRINT:FLASH 1:PRINT"WARNING"!;:FLASH 0
790 PRINT"ALL DATA ON"!dr$!"WILL BE DESTROYED"
800 clb=KEYROW(0)
810 INPUT"TO CONTINUE PRESS ENTER"!v$:PRINT
820 :
830 FOR i=1 TO kertaa$
840  FORMAT dr$&nimi$
850  virhe%=0:PAUSE 100
860 END FOR i
870 PRINT:PRINT"FORMAT SUCCESSFUL"
880 :
890 IF f_vielako:NEXT runko:ELSE :EXIT runko:END IF 
900 :
910 END REPeat runko
920 :
930 PRINT:p_valmis(1):PRINT:CSIZE 3,1
940 IF vanha:PRINT TO 6;:ELSE :PRINT TO 9;:END IF 
950 STRIP 0
960 IF vanha THEN 
970  PRINT"Write RUN 1040":CSIZE 2,0:PAPER 2
980 ELSE 
990  PRINT"RESET QL":CSIZE 2,0:PAPER 2
1000  PRINT:PRINT"    before using other programs"
1010 END IF 
1020 STOP
1030 :
1040 reset(8):NEW
1050 :
17000 DEFine PROCedure p_ikkunat
17010  WINDOW#1,levg%,190,alkug%, 38
17020  WINDOW#0,levg%, 28,alkug%,228
17030  PAPER#1,2:BORDER#1,0,0:CSIZE#1,2,0:INK#1,7:CLS#1
17040  PAPER#0,0:CSIZE#0,2,0:INK#0,7:CLS#0
17050 END DEFine p_ikkunat
17060 :
20000 DEFine PROCedure p_tsotsake(ohj$,tpvm$,vrs$)
20010  LOCal il1%,il2%,il%,i:MODE 8:il%=3
20020  levg%=448:alkug%=INT((512-levg%)/2)
20030  WINDOW 512,256,0,0:PAPER 0:CLS
20040  OPEN#3,con_:WINDOW#3,levg%,22,alkug%,16
20050  PAPER#3,0:CLS#3:BORDER#3,1,7:CSIZE#3,il%,1
20060  CURSOR#3,5,0:INK#3,6:PRINT#3,ohj$;
20070  il2%=levg%-12*LEN(tpvm$)-9
20080  il1%=(il2%+(4+4*il%)*LEN(ohj$)-35-40*il%)/2
20090  INK#3,4:CURSOR#3,il1%,0:PRINT#3,"Timo Salmi";
20100  INK#3,2:CSIZE#3,2,0
20110  CURSOR#3,il2%,0:PRINT#3,"Ver."!vrs$;
20120  CURSOR#3,il2%,10:PRINT#3,tpvm$;:CLOSE#3
20130 END DEFine p_tsotsake
20140 :
30000 DEFine PROCedure p_valmis(ch%)
30010  LOCal tl,ml,sl
30020  PRINT#ch%,"READY, elapsed";
30030  sl=DATE-kokoaika
30040  tl=INT(sl/3600):sl=sl-tl*3600
30050  ml=INT(sl/60):sl=sl-60*ml
30060  IF tl>0 THEN PRINT#ch%,!tl!"h";
30070  IF ml>0 OR tl>0 THEN PRINT#ch%,!ml!"min";
30080  PRINT#ch%,!sl!"sec"
30090 END DEFine p_valmis
30100 :
30500 DEFine FuNction f_vielako
30510  LOCal key%,cl%,loop
30520  cl%=0:PAPER#cl%,0:CLS#cl%:INK#cl%,6
30530  PRINT#cl%,"AGAIN: F3, QUIT: ESC";
30540  clb=KEYROW(0)
30550  REPeat loop
30560   key%=CODE(INKEY$(-1))
30570   IF key%=240 THEN EXIT loop
30580   IF key%= 27 THEN EXIT loop
30590  END REPeat loop
30600  CLS#cl%:INK#cl%,7:RETurn key%=240
30610 END DEFine f_vielako
30620 :
31000 DEFine PROCedure reset(i)
31010  LOCal il:MODE i
31020  FOR il=1,2:OPEN#il,con_:END FOR il
31030  WINDOW 512,256,0,0:PAPER 0:CLS
31040  WINDOW#0,448,40-(i=4),32,216+(i=4)
31050  WINDOW#2,448,200,32,16:PAPER#2,1:INK#2,7
31060  WINDOW 448+8*(i=4),200+2*(i=4),32-4*(i=4),16-(i=4)
31070  PAPER 2*(i=8):BORDER (i=4),4*(i=4)
31080  FOR il=0,1,2:CSIZE#il,(i=4)+2*(i=8),0:END FOR il
31090  PAPER#0,0:INK#0,7-3*(i=0):INK 7:CLS
31100  SCALE 100,0,0:FILL 0
31110 END DEFine reset
31120 :
31990 STOP
32000 vsave 1:STOP
32010 vsave 2:STOP
32020 vsave 3:STOP
32030 vsave 4:STOP
32040 vsave 5:STOP
32050 vsave 6:STOP
32060 DEFine PROCedure vsave(dr)
32070  LOCal a$,b$,d$(6,5):a$="jsformat"
32080  b$=DATE$:b$=b$(1 TO 4)
32090  IF b$<>1987 THEN
32100   PRINT#0,DAY$!DATE$!"Not saved, set SDATE"
32110   BEEP 4000,12:STOP:END IF 
32120  ver1%=2:ver2%=3
32130  d$(1)="mdv1_":d$(2)="mdv2_"
32140  d$(3)="fdk1_":d$(4)="fdk2_"
32150  d$(5)="ram1_":d$(6)="ram2_"
32160  b$=d$(dr)&a$
32170  DELETE b$:OPEN_NEW#3,b$:ver%=ver2%+1
32180  PRINT#3,"1 REMark ";a$!"(c) Timo Salmi"
32190  PRINT#3,"2 REMark ";DAY$!DATE$
32200  PRINT#3,"3 REMark version"!ver1%;".";ver%
32210  PRINT#3,"4 :"
32220  LIST#3,100 TO 32110
32230  PRINT#3,"32120  ver1%=";ver1%;":ver2%=";ver%
32240  LIST#3,32130 TO:CLOSE#3
32250  PRINT#0,"Saved"!b$!"version"!ver1%;".";ver%
32260 END DEFine vsave
