Skip to content

Commit f09fec5

Browse files
Merge pull request #10 from RetiredWizard/v1.10
V1.10
2 parents 2883ef9 + 622bd70 commit f09fec5

File tree

126 files changed

+3292
-2140
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

126 files changed

+3292
-2140
lines changed

3.aut

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
@echo off
2+
del autoexec.bat
3+
if exist autoexec.sav rename autoexec.sav autoexec.bat
4+
type menu.txt

3.bat

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
1-
@echo off
2-
cd /PyBasic
3-
PyBasic startrek.bas
4-
cd /
5-
menu.bat
1+
@echo off
2+
if not exist /runvm.py goto micropython
3+
if exist autoexec.bat copy autoexec.bat autoexec.sav
4+
copy/y 3.aut autoexec.bat
5+
runvm "PyBasic/PyBasic adventure-fast.pgm"
6+
:micropython
7+
cd /PyBasic
8+
pexec import PyBasic
9+
pexec PyBasic.main("adventure-fast.pgm")
10+
cd /
11+
menu.bat

4.bat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
@echo off
22
cd /PyBasic
3-
PyBasic eliza.bas
3+
PyBasic startrek.bas
44
cd /
55
menu.bat

5.bat

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1-
@dir/w/p
2-
@pause
3-
@menu
1+
@echo off
2+
cd /PyBasic
3+
PyBasic eliza.bas
4+
cd /
5+
menu.bat

6.bat

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1-
@edit %1
1+
@dir/w/p
2+
@pause
23
@menu

7.bat

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
@edlin %1
2+
@menu

8.bat

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
@edit %1
2+
@menu

PyBasic/PyBasic.py

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,10 @@
3838
from sys import print_exception
3939

4040
gc.collect()
41-
if implementation.name.upper() == 'MICROPYTHON':
41+
if 'threshold' in dir(gc):
4242
gc.threshold(gc.mem_free() // 4 + gc.mem_alloc())
4343

44-
def main():
44+
def main(passedIn=""):
4545

4646
banner = (
4747
"""
@@ -117,8 +117,7 @@ def main():
117117
remove('_pybTmp.tmp')
118118
break
119119

120-
# Add a new program statement, beginning
121-
# a line number
120+
# Add a new program statement
122121
elif tokenlist[0].category == Token.UNSIGNEDINT\
123122
and len(tokenlist) > 1:
124123
program.add_stmt(tokenlist,-1,tmpfile)
@@ -246,23 +245,20 @@ def main():
246245
else:
247246
print("Program file not found")
248247

249-
# Unrecognised input
250248
else:
251249
print("Unrecognized input")
252250
for token in tokenlist:
253251
token.print_lexeme()
254252
print("")
255253

256-
# Trap all exceptions so that interpreter
257-
# keeps running
254+
# Trap all exceptions so that interpreter keeps running
258255
except Exception as e:
259256
if implementation.name.upper() == 'MICROPYTHON':
260-
#### print(e)
261257
print_exception(e)
262258
else:
263259
print(e)
264260

265-
if __name__ != "PyDOS":
266-
passedIn = ""
267-
268-
main()
261+
if __name__ == "PyDOS":
262+
main(passedIn)
263+
else:
264+
print("Enter 'PyBasic.main()' in the REPL to run.")

PyBasic/basicparser.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -281,9 +281,6 @@ def __simplestmt(self,infile,tmpfile,datastmts):
281281
return None
282282

283283
elif self.__token.category == Token.DIM:
284-
#gc.collect()
285-
#if implementation.name.upper() == 'MICROPYTHON':
286-
#gc.threshold(gc.mem_free() // 4 + gc.mem_alloc())
287284
self.__dimstmt()
288285
return None
289286

@@ -908,11 +905,8 @@ def __soundstmt(self):
908905
elif implementation.name.upper() == 'CIRCUITPYTHON':
909906
try:
910907
Pydos_hw.sndGPIO.deinit() # Workaround for ESP32-S2 GPIO issue
911-
audioPin = PWMOut(sndPin, duty_cycle=0, frequency=440, variable_frequency=True)
912-
audioPin.frequency = freq
913-
audioPin.duty_cycle = volume
908+
audioPin = PWMOut(sndPin, duty_cycle=volume, frequency=freq, variable_frequency=True)
914909
sleep(duration/18.2)
915-
audioPin.duty_cycle = 0
916910
audioPin.deinit()
917911
Pydos_hw.quietSnd() # Workaround for ESP32-S2 GPIO issue
918912
except:

PyBasic/eliza.bas

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
180 REM *******USER INPUT SECTION**********
3131
190 REM ***********************************
3232
200 INPUT I$
33-
201 I$ = " " + I$ + " "
33+
201 I$ = " " + UPPER$(I$) + " "
3434
210 REM GET RID OF APOSTROPHES
3535
220 FOR L = 1 TO LEN ( I$ )
3636
230 REM IF MID$(I$,L,1)="'"THEN I$=MID$(I$, 1 ,L-1)+MID$(I$,L+1,LEN(I$)-L):GOTO 230

0 commit comments

Comments
 (0)