By the way: Not all those lines need to be changed; don't change lines 3, 6, 7, 9, 10 and 18.
15 and 16 can be tricky ;-) If MID$ is at the beginning of a line or immediately after a ":" or a "THEN" then it needs to be changed; otherwise it's OK as it is. It's handy, but in my opinion the fact that in the M100 it can have two different meanings actually makes it more confusing than the straightforward NEC version. As to your comment, "Such a shame, really a hard life for guys that want to program on NEC," you'd say the same thing about the M100 if you were converting a NEC program to the M100... ;-) m ----- Original Message ----- From: "NEC" <[email protected]> To: <[email protected]> Sent: Wednesday, June 14, 2017 3:53 PM Subject: [M100] Translating BASIC code from 100 to NEC. > Hi folks. > My first post as new member here in the list. > I'm trying to translate a BASIC program from TRS 80/100 to NEC 8201A. > In order to do it more easily I'm using the BASCON v2.0 conversion utility by > Gary Weber. > After running that utility I get a converted BASIC code together with a .RPT > file where the outcome of the conversion is written. > In the report it's written that some program's lines have to be investigated > due occurrences of MID$ that should be better to check for their usage as an > assignment. > The actual message is this: > > BASCON v2.0 - Conversion of 100.BA to NEC.BA > Date/Time: 06-12-2017 12:41:58 > > *** Lines to investigate: > > Line XXX -- Occurrence(s) of MID$ (check for usage as an assignment) > > The lines involved are these: > > 1 MID$(PB$(1),4,5)=LEFT$(D$,5) > > 2 MID$(PB$(1),10,4)="19"+RIGHT$(D$,2):MID$(PB$(2),4,8)=T$:CLS > > 3 J=ASC(MID$(PA$(Y%),X%,1))-48:IF J<1OR J>5THEN340 > > 4 MID$(PB$(Y%),X%,1)=K$:PRINT K$; > > 5 IF X%=4AND Y%=6THEN MID$(PB$(Y%),X%+1,11)=SPACE$(11):GOSUB1970 > > 6 A2=(M/60+D)/360*P2:IF MID$(PB$(3),13,1)="S"THEN A2=-A2 > > 7 IF MID$(PB$(4),13,1)="W"THEN O2=-O2 > > 8 R=5:C=4:N=3:GOSUB1960:F2=V*P2/360:IF V<1THEN MID$(PB$(5),5,1)="9":GOTO280 > > 9 FOR I=1 TO NB%:IF MID$(PB$(6),4,LEN(BN$(I)))=BN$(I) THEN680 > > 10 L2=(D+M/60)/360*P2:IF MID$(PB$(8),4,1)="-" THEN L2=-L2 > > 11 MID$(PB$(6),4,12)=SPACE$(12):GOSUB1970 > > 12 > MID$(PB$(6),4,12)=BN$(I)+SPACE$(9):T0!=BC!(I,0):T1!=BC!(I,1):T2!=BC!(I,2):GOTO1720 > > 13 T2!=SQR(ABS(1-T0!*T0!-T1!*T1!)):MID$(PB$(6),4,12)=SPACE$(12) > > 14 MID$(PB$(8),4,1)=D$:A=ABS(M3*10):GOSUB1980:T$=" ":IF M3<0 THEN T$="-" > > 15 MID$(PB$(5),12,4)=T$+MID$(D$,5,1)+"."+MID$(D$,6,1):GOSUB1970:RETURN > > 16 MID$(PB$(B),4,3)=MID$(D$,1,3):MID$(PB$(B),8,2)=MID$(D$,4,2) > > 17 MID$(PB$(B),11,1)=MID$(D$,6,1):RETURN > > 18 V=VAL(MID$(PB$(R),C,N)):RETURN > > --- > > Line 1 is the only one that BASCON rewrites differently from the original: > > ORIGINAL LINE: 1 MID$(PB$(1),4,5)=LEFT$(D$,5) > > Same line as converted by BASCON: 1 > PB$(1)=LEFT$(D$,5)+RIGHT$(PB$(1),LENPB$(1)-4)++RIGHT$(PB$(1),LENPB$(1)-5) > > I guess the double "+" just before RIGHT$(PB$(1),LENPB$(1)-5) it's a spurious > typo from BASCON. > Anyway, single "+" or double "+", it doesn't work. > > On http://bitchin100.com/wiki/index.php?title=Synchronize_Time_with_your_NADS > and especially In "Designing cross-compatible programs for Model 100 to NEC > 8201A/8300" on http://www.web8201.net/ there are some explanations about how > simulate the function of a MID$ assignment with a routine like this: > > 30000 ZO=LEN(OX$):TX$=OX$:OX$=LEFT$(TX$,NX-1)+NX$ > 30010 IFZO-LEN(OX$)>0THENOX$=OX$+RIGHT$(TX$,ZO-LEN(OX$)) > 30020 OX$=LEFT$(OX$,ZO):RETURN > 30030 ' MID$ by Gary Weber > 30040 ' Entry: OX$=String to modify, NX=Target position, NX$=Target text > 30050 ' Exit: OX$ contains modified string > > but honestly I understood little and nothing. > Is there somebody who can explain me better or pointing to me any inherent > document so that I can translate all the 18 lines in the right way for the > NEC 8201A? > > Thanks in advance, > > Peppino
