Skip to content

Commit 3afc645

Browse files
committed
Beta 3
1 parent 1bab9f9 commit 3afc645

File tree

97 files changed

+2151
-1627
lines changed

Some content is hidden

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

97 files changed

+2151
-1627
lines changed

3.aut

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
@echo off
22
del autoexec.bat
3-
if exist _PyDexec._PyD rename _PyDexec._PyD autoexec.bat
3+
if exist _autoexec._PyD rename _autoexec._PyD autoexec.bat
44
type menu.txt

3.bat

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
@echo off
2-
if exist autoexec.bat copy/y autoexec.bat _PyDexec._PyD
2+
if exist _autoexec._PyD goto skip
3+
if exist autoexec.bat rename autoexec.bat _autoexec._PyD
4+
:skip
35
copy/y 3.aut autoexec.bat
46
runvm /PyBasic/PyBasic adventure-fast.pgm
57
menu.bat

PyBasic/basicparser.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
pass
2828
try:
2929
from pydos_hw import sndPin as hwsndPin
30-
from pydos_hw import sndGPIO, quietSnd
30+
from pydos_hw import Pydos_hw, quietSnd
3131
sndPin = hwsndPin
3232
except:
3333
sndPin = None
@@ -124,15 +124,19 @@ def __init__(self):
124124
#file handle list
125125
self.__file_handles = {}
126126

127+
self.__pwm = None
127128
if implementation.name.upper() == 'MICROPYTHON':
128129
if sndPin:
129130
try:
130131
self.__pwm = PWM(sndPin,freq=0)
131132
except:
132-
self.__pwm = PWM(sndPin)
133+
try:
134+
self.__pwm = PWM(sndPin)
135+
except:
136+
pass
133137
if 'duty_u16' in dir(self.__pwm):
134138
self.__pwm.duty_u16(0)
135-
else:
139+
elif 'duty' in dir(self.__pwm):
136140
self.__pwm.duty(0)
137141

138142

@@ -893,7 +897,7 @@ def __soundstmt(self):
893897
volume = 800
894898

895899
if implementation.name.upper() == 'MICROPYTHON':
896-
if sndPin:
900+
if sndPin and self.__pwm:
897901
self.__pwm.freq(freq)
898902
if "duty_u16" in dir(self.__pwm):
899903
self.__pwm.duty_u16(volume)
@@ -906,8 +910,8 @@ def __soundstmt(self):
906910
elif implementation.name.upper() == 'CIRCUITPYTHON':
907911
if sndPin:
908912
try:
909-
sndGPIO.deinit() # Workaround for ESP32-S2 GPIO issue
910-
audioPin = PWMOut(sndPin, duty_cycle=volume, frequency=freq, variable_frequency=True)
913+
Pydos_hw.sndGPIO.deinit() # Workaround for ESP32-S2 GPIO issue
914+
audioPin = PWMOut(sndPin, duty_cycle=volume, frequency=freq)
911915
sleep(duration/18.2)
912916
audioPin.deinit()
913917
quietSnd() # Workaround for ESP32-S2 GPIO issue

PyBasic/fractal.bas

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
10 FOR Y = - 12 TO 12
2+
20 FOR X = - 39 TO 30
3+
30 CA = X * 0.0458
4+
40 CB = Y * 0.08333
5+
50 A = CA
6+
60 B = CB
7+
70 FOR I = 0 TO 15
8+
80 T = A * A - B * B + CA
9+
90 B = 2 * A * B + CB
10+
100 A = T
11+
110 IF ( A * A + B * B ) > 5 THEN GOTO 200
12+
120 NEXT I
13+
130 PRINT " " ;
14+
140 GOTO 210
15+
200 IF I > 9 THEN I = I + 7
16+
205 PRINT CHR$ ( 48 + I ) ;
17+
210 NEXT X
18+
220 PRINT
19+
230 NEXT Y

0 commit comments

Comments
 (0)