Now, now... for 'we bears of very little brain'* basic is a fine
language.
I've got several little programs that help me on my way.
All in good fun :^)
Hey there's this white fluffy stuff falling outside my window.
What's that?
And here's wishing all the SEBers a wonderful Holiday season!
I'm cutting out early to go decorate Xmas cookies at granma's with the
kids.
SUB nitpick
basic doesn't need line numbers anymore
the commands are still in caps, but I use lower case for variables
which makes it easier to read.
Robbie the Robot (a nice Asimov story.) was not on the screen with
Will Robinson. (Undoubtedly the worst Sci-fi series ever!)
RETURN
*no insult intended for other basic users.
---
Power BASIC's Console Compiler commands are all lower case and the
source code is gorgeous.
Here's an example, the application being a 2 resistor voltage divider
solver, with the executable at abse:
function pbmain() as long
color 0,15
cursor on,10
e1sw:
gosub loopa
print "Solve for E1? <y/n>"
locate 13,20
e1yorn:
i$ = waitkey$
if i$ = "y" or i$ = "Y" or i$ = chr$(13) then goto e1out
if i$ = "n" or i$ = "N" then goto r1sw
goto e1yorn
r1sw:
print""
print "Solve for R1? <y/n>"
locate 14,20
r1yorn:
i$ = waitkey$
if i$ = "y" or i$ = "Y" or i$ = chr$(13) then goto r1out
if i$ = "n" or i$ = "N" then goto e2sw
goto r1yorn
e2sw:
print""
print "Solve for E2? <y/n>"
locate 15,20
e2yorn:
i$ = waitkey$
if i$ = "y" or i$ = "Y" or i$ = chr$(13) then goto e2out
if i$ = "n" or i$ = "N" then goto r2sw
goto e2yorn
r2sw:
print""
print "Solve for R2? <y/n>"
locate 16,20
r2yorn:
i$ = waitkey$
if i$ = "y" or i$ = "Y" or i$ = chr$(13) then goto r2out
if i$ = "n" or i$ = "N" then goto endsw
goto r2yorn
endsw:
print ""
print "End? <y/n> "
locate 17,11
endyorn:
i$ = waitkey$
if i$ = "y" or i$ = "Y" or i$ = chr$(13) then end
if i$ = "n" or i$ = "N" then goto more
goto endyorn
more:
print""
print "Another try? <y/n> "
locate 18,19
moreyn:
i$ = waitkey$
if i$ = "y" or i$ = "Y" or i$ = chr$(13) then goto e1sw
if i$ = "n" or t$ = "N" then end
goto moreyn
e1out:
print""
input "Enter resistance of R1 in ohms: " ,r1!
input "Enter voltage of E2 in volts " ,e2!
input "Enter resistance of R2 in ohms: " ,r2!
e1!=(e2!)*(r1!+r2!)/r2!
print""
print "E1 = "e1!" volts."
print "another run? <y/n> "
i$ = waitkey$
if i$ = "y" then gosub loopa else end
goto e1out
r1out:
print""
input "Enter voltage of E1 in volts: " ,e1!
input "Enter voltage of E2 in volts " ,e2!
input "Enter resistance of R2 in ohms: " ,r2!
r1!=(r2!)*(e1!-e2!)/e2!
print""
print "R1 = "r1!" ohms."
print "another run? <y/n> "
i$ = waitkey$
if i$ = "y" then gosub loopa else end
goto r1out
e2out:
print""
input "Enter voltage of E1 in volts: " ,e1!
input "Enter resistance of R1 in ohms: " ,r1!
input "Enter resistance of R2 in ohms: " ,r2!
e2!=(e1!*r2!)/(r1!+r2!)
print""
print "E2 = "e2!" volts."
print "another run? <y/n> "
i$ = waitkey$
if i$ = "y" then gosub loopa else end
goto e2out
r2out:
print""
input "Enter voltage of E1 in volts: " ,e1!
input "Enter resistance of R1 in ohms: " ,r1!
input "Enter voltage of E2 in volts " ,e2!
r2!=(e2!*r1!)/(e1!-e2!)
print""
print "R2 = "r2!" ohms."
print""
print "another run? <y/n> "
i$ = waitkey$
if i$ = "y" then gosub loopa else end
goto r2out
loopa:
cls
print""
print " E1"
print " |"
print " [R1]"
print " |"
print " +---E2"
print " |"
print " [R2]"
print " |"
print " GND
print""
print""
return
end function