Skip to content

Commit

Permalink
Merge pull request #10 from RetiredWizard/v1.10
Browse files Browse the repository at this point in the history
V1.10
  • Loading branch information
RetiredWizard authored Sep 13, 2022
2 parents 2883ef9 + 622bd70 commit f09fec5
Show file tree
Hide file tree
Showing 126 changed files with 3,292 additions and 2,140 deletions.
4 changes: 4 additions & 0 deletions 3.aut
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
@echo off
del autoexec.bat
if exist autoexec.sav rename autoexec.sav autoexec.bat
type menu.txt
16 changes: 11 additions & 5 deletions 3.bat
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
@echo off
cd /PyBasic
PyBasic startrek.bas
cd /
menu.bat
@echo off
if not exist /runvm.py goto micropython
if exist autoexec.bat copy autoexec.bat autoexec.sav
copy/y 3.aut autoexec.bat
runvm "PyBasic/PyBasic adventure-fast.pgm"
:micropython
cd /PyBasic
pexec import PyBasic
pexec PyBasic.main("adventure-fast.pgm")
cd /
menu.bat
2 changes: 1 addition & 1 deletion 4.bat
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@echo off
cd /PyBasic
PyBasic eliza.bas
PyBasic startrek.bas
cd /
menu.bat
8 changes: 5 additions & 3 deletions 5.bat
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@dir/w/p
@pause
@menu
@echo off
cd /PyBasic
PyBasic eliza.bas
cd /
menu.bat
3 changes: 2 additions & 1 deletion 6.bat
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
@edit %1
@dir/w/p
@pause
@menu
2 changes: 2 additions & 0 deletions 7.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
@edlin %1
@menu
2 changes: 2 additions & 0 deletions 8.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
@edit %1
@menu
20 changes: 8 additions & 12 deletions PyBasic/PyBasic.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@
from sys import print_exception

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

def main():
def main(passedIn=""):

banner = (
"""
Expand Down Expand Up @@ -117,8 +117,7 @@ def main():
remove('_pybTmp.tmp')
break

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

# Unrecognised input
else:
print("Unrecognized input")
for token in tokenlist:
token.print_lexeme()
print("")

# Trap all exceptions so that interpreter
# keeps running
# Trap all exceptions so that interpreter keeps running
except Exception as e:
if implementation.name.upper() == 'MICROPYTHON':
#### print(e)
print_exception(e)
else:
print(e)

if __name__ != "PyDOS":
passedIn = ""

main()
if __name__ == "PyDOS":
main(passedIn)
else:
print("Enter 'PyBasic.main()' in the REPL to run.")
8 changes: 1 addition & 7 deletions PyBasic/basicparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -281,9 +281,6 @@ def __simplestmt(self,infile,tmpfile,datastmts):
return None

elif self.__token.category == Token.DIM:
#gc.collect()
#if implementation.name.upper() == 'MICROPYTHON':
#gc.threshold(gc.mem_free() // 4 + gc.mem_alloc())
self.__dimstmt()
return None

Expand Down Expand Up @@ -908,11 +905,8 @@ def __soundstmt(self):
elif implementation.name.upper() == 'CIRCUITPYTHON':
try:
Pydos_hw.sndGPIO.deinit() # Workaround for ESP32-S2 GPIO issue
audioPin = PWMOut(sndPin, duty_cycle=0, frequency=440, variable_frequency=True)
audioPin.frequency = freq
audioPin.duty_cycle = volume
audioPin = PWMOut(sndPin, duty_cycle=volume, frequency=freq, variable_frequency=True)
sleep(duration/18.2)
audioPin.duty_cycle = 0
audioPin.deinit()
Pydos_hw.quietSnd() # Workaround for ESP32-S2 GPIO issue
except:
Expand Down
2 changes: 1 addition & 1 deletion PyBasic/eliza.bas
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
180 REM *******USER INPUT SECTION**********
190 REM ***********************************
200 INPUT I$
201 I$ = " " + I$ + " "
201 I$ = " " + UPPER$(I$) + " "
210 REM GET RID OF APOSTROPHES
220 FOR L = 1 TO LEN ( I$ )
230 REM IF MID$(I$,L,1)="'"THEN I$=MID$(I$, 1 ,L-1)+MID$(I$,L+1,LEN(I$)-L):GOTO 230
Expand Down
3 changes: 0 additions & 3 deletions PyBasic/program.py
Original file line number Diff line number Diff line change
Expand Up @@ -300,9 +300,6 @@ def execute(self,infile,tmpfile):
# sequential statement execution. The index
# will be incremented by one, unless modified by
# a jump
#gc.collect()
#if implementation.name.upper() == 'MICROPYTHON':
#gc.threshold(gc.mem_free() // 4 + gc.mem_alloc())
index = 0
self.set_next_line_number(line_numbers[index])

Expand Down
Loading

0 comments on commit f09fec5

Please sign in to comment.