home *** CD-ROM | disk | FTP | other *** search
/ Oakland CPM Archive / oakcpm.iso / cpm / basic / rs2ms.bas < prev    next >
BASIC Source File  |  1984-05-14  |  6KB  |  137 lines

  1. 10 DEFSTR A-D: DEFINT E-Z : Q$=CHR$(34)
  2. 11 REM  MYRS2MB   (v) 1.0    28 May  1983   by   Ed Mahoney
  3. 12 REM *******************************************************************
  4. 13 REM  This program will convert a Radio Shack BASIC program to a 
  5. 14 REM   Microsoft MBASIC 5.1 program.
  6. 15 REM  Instructions are given as the program runs.
  7. 16 REM  INSTALLATION: The conversion process will make certain Radio Shack
  8. 17 REM   statements into printable 'escape codes'.  You must now the two
  9. 18 REM   escape code sequences for your computer (or terminal):                 ***********************************************************
  10. 19 REM    1) clear the screen and home the cursor
  11. 20 CLS$=CHR$(27)+"*" : REM For the MAX-80
  12. 22 REM CLS$=CHR$(27)+"E"   : REM For the Heath
  13. 23 A1="1 CLS$=CHR$(27)+"+Q$+"*"+Q$ : REM For the MAX-80
  14. 24 REM  A1="1 CLS$=CHR$(27)+Q$+"E"+Q$  : REM For the Heath
  15. 25 REM *********************************************************************
  16. 26 REM     2)  print at a screen location  (Row,Column)
  17. 27 DEF FNAT$(R9,C9)=CHR$(27)+"="+CHR$(R9+32)+CHR$(C9+32) : REM For MAX-80
  18. 28 REM DEF FNAT$(R9,C9)=CHR$(27)+"Y"+CHR$(R9+32)+CHR$(C9+32) :REM FOR HEATH
  19. 29 A2="2 DEF FNAT$(AT%)=CHR$(27)+"+Q$+"="+Q$+"+CHR$(INT(AT%/64)+32)+CHR$((AT% MOD 64)+32)" : REM  For the MAX-80
  20. 30 REM A2="2 DEF FNAT$(AT%)=CHR$(27)+"+Q$+"Y"+Q$+"+CHR$(INT(AT%/64)+32)+CHR$((AT% MOD 64)+32)" : REM For the Heath
  21. 31 REM ******************END OF INSTALLATION******************************
  22. 45 GOSUB 60000:PRINT CLS$;"Initializing..............."
  23. 50 SP=0:RP=0
  24. 60 DIM Z(1000),C(130),L(130),D(130),B(9)
  25. 61 READ A: IF A="XXXX" THEN 91
  26. 62 RP=RP+1: C(RP)=A: M=LEN(A):L(RP)=M:B=""
  27. 63 FOR I=1 TO M:V=ASC(MID$(A,I)):IF V>64 THEN B=B+CHR$(V+32) ELSE B=B+CHR$(V)
  28. 64 NEXT I:D(RP)=B
  29. 65 GOTO 61
  30. 70 REM
  31. 71 REM   RESERVED WORDS
  32. 72 REM
  33. 73 DATA ABS,AND,ASC,AS,ATN,AUTO,CDBL,CHR$,CINT,CLEAR,CLOSE,CONT
  34. 74 DATA COS,CSNG,CVD,CVI,CVS,DATA
  35. 75 DATA DEFDBL,DEFINT,DEFSNG,DEFSTR,DEFUSR,DEF,DELETE,DIM
  36. 76 DATA EDIT,ELSE,END,EOF,ERL,ERR,EXP,FIELD,FILES,FOR
  37. 77 DATA FRE,GET,GOSUB,GOTO,HEX$
  38. 78 DATA IF,IMP,INPUT,INP,INSTR,KILL,LEFT$,LEN,LET,LINE
  39. 79 DATA LIST,LLIST,LOAD,LOC,LOF,LOG,LPRINT,LSET,MERGE,MID$,MKD$,MKI$
  40. 80 DATA MKS$,NEW,NEXT,NOT,ON,OPEN,OR,OUT
  41. 81 DATA POS,PRINT,PUT
  42. 82 DATA READ,REM,RESTORE,RESUME,RETURN,RIGHT$,RND,RSET,RUN
  43. 83 DATA SAVE,SGN,SIN,SQR,STEP,STOP,STR$,STRING$
  44. 84 DATA TAB(,TAN,THEN,TO,TROFF,TRON
  45. 85 DATA USING,USR,VAL,VARPTR
  46. 90 DATA XXXX
  47. 91 READ A: IF A="XXXX" THEN 100
  48. 92 QP=QP+1: B(QP)=A:GOTO 91
  49. 95 DATA PEEK,POKE,SET(,RESET,POINT
  50. 96 DATA XXXX
  51. 100 LINE INPUT"WHAT IS RADIO SHACK PROGRAM ...... > ";R$
  52. 110 LINE INPUT"WHAT WILL BE THE MICROSOFT PROGRAM'S NAME > ";M$
  53. 120 OPEN"I",1,R$
  54. 130 OPEN"O",2,M$
  55. 132 A1=A1+" : WIDTH(64)":PRINT A1: PRINT#2,A1
  56. 136 PRINT A2: PRINT#2,A2
  57. 140 IF EOF(1) THEN 20000
  58. 150 LINE INPUT#1, A
  59. 500 PRINT LL$;A;HL$
  60. 1000 REM LOOK FOR THE RANDOM FUNCTION
  61. 1010 P=1
  62. 1020 R=INSTR(P,A,"RND(")
  63. 1030 IF R=0 THEN 2000
  64. 1040 V=VAL(MID$(A,R+4))
  65. 1060 Q=INSTR(R,A,")")
  66. 1065 IF V>0 THEN 1500
  67. 1070 A=LEFT$(A,R-1)+"RND"+MID$(A,Q+1)
  68. 1080 P=R+1:GOTO 1020
  69. 1500 A=LEFT$(A,R-1)+"INT(RND*"+STR$(V)+"+1)"+MID$(A,Q+1):P=P+6:GOTO 1020
  70. 2000 REM CLS TO PRINT CLS$
  71. 2010 P=1
  72. 2020 R=INSTR(P,A,"CLS")
  73. 2030 IF R=0 THEN 3000
  74. 2040 A=LEFT$(A,R-1)+"PRINT CLS$;"+MID$(A,R+3): P=R+9: GOTO 2020
  75. 3000 REM PRINT @###,
  76. 3010 P=1
  77. 3020 R=INSTR(P,A,"PRINT@"): IF R=0 THEN R=INSTR(P,A,"PRINT @")
  78. 3030 IF R=0 THEN 4000
  79. 3040 Q=INSTR(R,A,","):S=INSTR(R,A,"@")
  80. 3050 A=LEFT$(A,S-1)+" FNAT$("+MID$(A,S+1,Q-S-1)+");"+MID$(A,Q+1): GOTO 3020
  81. 4000 REM WARNINGS
  82. 4005 F=0
  83. 4010 FOR I=1 TO QP:IF INSTR(A,B(I)) THEN F=1
  84. 4020 NEXT I
  85. 4030 IF F THEN SP=SP+1: Z(SP)=VAL(A): A=A+":REM WARNING!"
  86. 5000 REM SPACES
  87. 5010 FOR I=1 TO RP
  88. 5020 P=1
  89. 5030 R=INSTR(P,A,C(I)): IF R=0 THEN 5500
  90. 5035 MID$(A,R)=D(I)
  91. 5040 IF MID$(A,R-1,1)<>" " THEN A=LEFT$(A,R-1)+" "+MID$(A,R):R=R+1
  92. 5050 R=R+L(I)
  93. 5060 IF MID$(A,R,1)<>" " THEN A=LEFT$(A,R-1)+" "+MID$(A,R)
  94. 5070 P=R:GOTO 5030
  95. 5500 NEXT I
  96. 10000 PRINT A
  97. 11000 PRINT #2,A
  98. 15000 GOTO 140
  99. 20000 CLOSE
  100. 30000 IF SP=0 THEN END
  101. 40000 PRINT:PRINT:PRINT"WARNING - THE FOLLOWING LINES STILL HAVE EITHER RADIO SHACK GRAPHICS":PRINT"    OR  HAVE EITHER PEEKS AND POKES."
  102. 40100 FOR I=1 TO SP:PRINT Z(I),:NEXT
  103. 49999 END
  104. 50000 I$=INKEY$:IF I$="" THEN 50000 ELSE RETURN
  105. 60000 PRINT CLS;"MYRS2MB          My Radio Shack to Microsoft BASIC conversion utility"
  106. 60010 PRINT"By Ed Mahoney  28 May 83             Version 1.0 "
  107. 60020 PRINT:PRINT"This program will convert a Radio Shack Model I or Model 3 BASIC (or
  108. 60030 PRINT"Disk BASIC) program to a Microsoft BASIC 5.1 program."
  109. 60040 PRINT:PRINT"REQUIREMENTS:":PRINT"1) Your computer that will be running the Microsoft program
  110. 60050 PRINT"   must be able to 'print at' specific locations on your screen."
  111. 60060 PRINT"2) The Radio Shack program that is to be converted, must exist on disk
  112. 60070 PRINT"   and be stored in ASCII format."
  113. 60080 PRINT"    a)  This program must not have line numbers 1 or 2  (the conversion
  114. 60090 PRINT"        process will place statements in these positions)"
  115. 60100 PRINT"    b)  The statements in the Radio Shack program must not be extreemly
  116. 60110 PRINT"        long, say greater than 220 characters long. (The program will
  117. 60120 PRINT"        expand each line.)"
  118. 60130 PRINT"    c)  The Radio Program should not have the following statements:
  119. 60140 PRINT"        PEEK  POKE   SET(x,y)  RESET(x,y)   POINT(x,y)
  120. 60150 PRINT"        (These statements are machine dependent)
  121. 60160 PRINT"    If these 5 statements are present, they will be passed on to the MBASIC"
  122. 60170 PRINT"    with a REM statement appended to the end that warns you that you will
  123. 60180 PRINT"    have to do some additional conversion (good luck!)."
  124. 60190 PRINT"3)  FINAL WARNING: This is only version 1.0.  This utility has not been
  125. 60200 PRINT"      extensivly tested.";
  126. 60250 GOSUB 50000:PRINT CLS$;
  127. 60300 PRINT"WHAT IT DOES:
  128. 60310 PRINT"1)  converts the RND function to MBASIC standards
  129. 60320 PRINT"2)  converts Radio Shack's CLS statement to a print code
  130. 60330 PRINT"3)  converts Radio Shack's PRINT @ ##, to a printable code
  131. 60340 PRINT"4)  'pads' all statements with spaces which MBASIC requires (and Radio
  132. 60350 PRINT"     Shack does not).
  133. 60360 PRINT"5)   Identifies statements that are machine dependent (ex.  PEEK or SET
  134. 60370 PRINT"     with a warning at the end of the statement and provides a table of
  135. 60380 PRINT"     the bad statements oa the end of execution.
  136. 60430 GOSUB 50000:RETURN
  137.