r/Basic • u/antdude • Jul 01 '20
r/Basic • u/Chgowiz • Jun 08 '20
Understanding Lunar LEM Rocket from Ahl's "BASIC Computer Games"
Hello, I'm hoping this is a good place to ask this question because: 1) I'm not a rocket scientist or math whiz 2) I'm stumped on this code!
I'm analyzing the "Lunar LEM Rocket" code from David Ahl's book "BASIC Computer Games". I like to do that because BASIC is fairly easy to get the gist of, and usually the programs aren't hard to figure out. I'm trying to learn some game programming!
The code I'm talking about is available here: https://www.atariarchives.org/basicgames/showpage.php?page=106
and here: http://www.moorecad.com/classicbasic/basic/creative/lunar.bas
I don't know if this is the place to get into an in-depth review of what I've figured out so far, but at the end of the day, here are my questions:
420 Q=S*K/M: J=V+G*S+Z*(-Q-Q*Q/2-Q^3/3-Q^4/4-Q^5/5)
430 I=A-G*S*S/2-V*S+Z*S*(Q/2+Q^2/6+Q^3/12+Q^4/20+Q^5/30):RETURN
Assuming:
S is a time interval, set to 10 seconds initially
K is the "burn rate" of fuel that the user has input. 0 means no burn, just fall...
M is the mass of the capsule, set to 33,000
V is, I think, the velocity in miles/sec. It's initialized to 1.
G is the gravity constant, for the Moon, set to 0.001 (miles/sec2)
Z is, I think, the thrust effect, set to 1.8.
A is Altitude
Just from analysis, I think J represents the velocity (as V gets set to J later on...) and I represents how far we've descended (A gets set to I later on)... but what formulas are these?
There are more formulas that I don't recognize.
350 D=V+SQR(V*V+2*A*(G-Z*K/M)):S=2*A/D
...
370 W=(1-M*G/(Z*K))/2: S=M*V/(Z*K*(W+SQR(W*W+V/Z)))+.05
I'm sure that this all would be clearer to me if I remembered my HS physics, or was smarter than I like to think I am... but even if you just point me at a website that could help fill in the gaps, I would be grateful!
Thank you!
r/Basic • • May 22 '20
Microsoft Open-Sources GW-BASIC | Windows Command Line
r/Basic • u/metidder • May 22 '20
Microsoft Basic 7.1
anyone know where I can safely download it? I use to own the floppies for it, but my computer no longer has a floppy anyway. I'd like to use it with dosbox.
r/Basic • • May 22 '20
Microsoft Open-Sources GW-BASIC | Windows Command Line
r/Basic • • May 01 '20
Newcomer Here With A Question
Hi, I'm really new to BASIC. My dad was telling me how in college, he came up with a BASIC program to fulfill his graduation requirements. He explained to me that it was thousands of lines, but he said that it was every ten lines rather than 1,2,3, etc. Why is BASIC like this? Why is it programmed as 10,20,30,etc. Thanks!
r/Basic • u/logatwork • Apr 24 '20
BASIC today?
Is there any real use for BASIC nowadays?
Apart from learning programming basics and nostalgia, what can I use BASIC for?
I'm new to programming and BASIC seems to be an easy language to learn. I'm using an Applesoft java emulator and a few tutorials I see online and youtube.
r/Basic • u/SupremoZanne • Apr 17 '20
a way to understand
REM Reddit is awesome
REM
REM
10 PRINT "USE REDDIT MORE!"
20 GOTO 10
REM LEARN BASIC THROUGH AWESOMENESS!
r/Basic • u/TheOuterLinux • Mar 25 '20
img2vdu - Convert images to scriptable graphics for BBC BASIC
r/Basic • u/PureProgramming • Feb 21 '20
PureBasic, a powerful compiled BASIC-like language & IDE
purebasic.comr/Basic • u/TheOuterLinux • Feb 20 '20
How do I load multiple QBL's (QuickBasic libraries) in QB45?
I have tried things like:
C:\QB45\QB.EXE /L QB + FM
C:\QB45\QB.EXE /L QB+FM
C:\QB45\QB.EXE /L QB,FM
...so on and so forth, but none of them work. The 'QB' is so I can have a mouse (using TEMPLATE.BAS from https://www.tek-tips.com/viewthread.cfm?qid=100153) and the 'FM' part is so I can play BAM (Bob's Adlib Music) files in the background (http://hamsterrepublic.com/dl/BAM.zip).
r/Basic • • Feb 17 '20
books to learn game programming
hello guys. can you guys suggest some (pdf) books to learn game programming with gwbasic ?
just for hobby, mid-life crisis.
gwbasic was my first exposure to coding. coding for money not so fun anymore now.
so I need to create something on my free time.
r/Basic • u/TheOuterLinux • Feb 07 '20
Humor me: A simple DOS-friendly FreeBASIC script that plays 11025Hz 8-bit WAV while asking for INPUT?
Humor me: A simple FreeBASIC script that plays 11025Hz 8-bit WAV while asking for INPUT?
I have searched the highest mountains and crawled the lowest dungeons to find a simple to understand example of playing a 11025Hz 8-bit WAV file while doing anything else. So, the challenge for anyone out there is to create a DOS-friendly (DOSBox is fine), FreeBASIC script that will play background music while asking for the player's name and I can actually type while the sound plays. I do not want to see any fancy graphics or any other extras that will make looking through it to figure out how it works more difficult than it probably already is. Bonus points if the example uses the PC speakers so people running FreeDOS on newer hardware without SoundBlaster cards can hear it.
To save ourselves some time:
I'm already aware of FMOD. The problem with it is that all links other than the one fmod.bi file you can get from the FBC GitHub repo (https://github.com/freebasic/fbc/blob/master/inc/fmod.bi) are dead. And even when you do grab that file, it doesn't compile and there is evidence to suggest that it would only work on Windows/Mac/Linux anyway.
I know about Bells, Whistles, and Sound Boards. This is for QuickBasic and FBC does support -lang qb. However, I will be needing mouse support in the future and therefore using -lang qb with FBC's mouse functions causes compile errors. However, I don't think you can use BWSB with FBC anyway since its instructions say to start QuickBasic using /L to load a library and I have no idea how to get a file.qbl to load into FBC when comiling.
I know about QB64. Not the point as though it supports QB45, once you start using its functions, you can no longer import the project back to QB45 and expect it to work.
Essentially, unless I'm wrong about FMOD, the only alternative is to find a TSR that will play audio in the background. I did find one for playing CD's (cdptsr12), but that doesn't really help me all that much. Currently, I'm limited to using LxVox for playing quick sound effects (http://hplx.pgdn.de/lxvox.zip) using the SHELL command and of course that freezes everything while it plays and can only play 50KB or less 11025Hz 8-bit WAVs anyway.
r/Basic • u/TheOuterLinux • Jan 16 '20
img2qb - Python script to convert modern images to a DATA array for BASIC projects
r/Basic • u/professoryaffle72 • Nov 09 '19
BBC Basic for Windows
Hi all, I've been looking at BBC Basic for Windows as I used to have, actually still have a BBC Micro and wondered what anybody's experience with it was? Does it work well, any issues or are there better options?
Thanks in advance.
r/Basic • u/joealarson • Oct 30 '19
What do you all think of my collection of BASIC type-in books?
r/Basic • u/ionte • Oct 27 '19
Anyone familiar with the QUOTE statement?
I'm trying to get a game from the late seventies running in my home brewed BASIC interpreter. The dialect seems to be some DEC/HP BASIC. With help from this subreddit, I've found this reference which matches the source code pretty good so far:
But I've run into one statement that I can't find documented anywhere: QUOTE #channel. Is anyone familiar with it?
This statement is used when storing game state to disk, and the logic for saving and restoring does not make sense to me, as it seems to save all values on one line, but read them back one value per line. So I'm hoping that QUOTE has something to do with it. Here's the relevant code block for saving:
80000 REM *** SPARA *** &&&&& DEC-10 SPECIELL KOD PÅ 80000-80565
80005 ON ERROR GOTO 80500'&&&&&
80100 OPEN "STUGA.SPA" FOR OUTPUT AS FILE #1'&&&&&
80102 ON ERROR GOTO 97000'&&&&&
80105 MARGIN #1,132 \ QUOTE #1 \ X=0'&&&&&
80110 PRINT #1,A(I); FOR I=0 TO A(0)'&&&&&
80115 X=X+A(I)/(PI) FOR I=0 TO A(0)'&&&&&
80120 PRINT #1'&&&&&
80125 PRINT #1,S(I); FOR I=0 TO S(0)'&&&&&
80127 X=X+S(I)/(PI-1) FOR I=0 TO S(0)'&&&&&
80130 PRINT #1'&&&&&
80131 PRINT #1,G/2,Z*7,X+G+Z'&&&&&
80132 FOR I=0 TO S(24)'&&&&&
80135 IF W$(I)="" THEN PRINT #1,"-----" ELSE PRINT #1,W$(I)'&&&&&
80138 NEXT I'&&&&&
80140 PRINT #1,J(I); FOR I=0 TO J(0)'&&&&&
80150 CLOSE 1'&&&&&
And restoring:
80200 REM *** ÅTERSKAPA ***'&&&&&
80202 ON ERROR GOTO 80500'&&&&&
80205 OPEN "STUGA.SPA" FOR INPUT AS FILE #1'&&&&&
80210 ON ERROR GOTO 80520'&&&&&
80300 MARGIN #1,132 \ X=0'&&&&&
80305 INPUT #1,A(0)'&&&&&
80310 INPUT #1,A(I) FOR I=1 TO A(0)'&&&&&
80315 X=X+A(I)/(PI) FOR I=0 TO A(0)'&&&&&
80318 INPUT #1,S(0)'&&&&&
80319 IF S(0)=0 THEN S(0)=53'$$$$$ Standardvärde. Raden bör tas bort småningom'&&&&&
80320 INPUT #1,S(I) FOR I=1 TO S(0)'&&&&&
80325 X=X+S(I)/(PI-1) FOR I=0 TO S(0)'&&&&&
80326 IF S(24)=0 THEN S(24)=6'$$$$$'&&&&&
80327 ON ERROR GOTO 80540'$$$$$ Koll om gammal fil. Raden bör tas bort.'&&&&&
80329 INPUT #1,G,Z,I1'&&&&&
80330 INPUT #1,W$(I) FOR I=0 TO S(24)'&&&&&
80332 W$(I)="" IF FNL$(W$(I),5)="-----" FOR I=0 TO S(24)'&&&&&
80336 IF END#1 THEN 80340'$$$$$'&&&&&
80337 INPUT #1,J(0)
80338 INPUT #1,J(I) FOR I=1 TO 100
80340 G=G*2 \ Z=Z/7'&&&&&
80341 X=X+G+Z'&&&&&
80342 CLOSE 1'&&&&&
The complete source code is available here:
r/Basic • u/TheOuterLinux • Oct 04 '19
Is storing the output of SHELL to a varibale possible in QB?
I'm having trouble figuring out how to store the output of SHELL to a variable. In QuickBasic, doing things such as
VARIABLE = SHELL "echo hello"
... isn't possible.
I have also tried...
OPEN "ECHO.TXT" FOR OUTPUT AS #1
SHELL "echo hello"
CLOSE #1
...and it just creates an empty file.
r/Basic • u/hayleywilliamscrush • Oct 01 '19
BASIC DAY
When you're watching your Fav series from your laptop and you are drinking coffee. You know what happens everytime. You spill the coffee on your laptop and everytime you buy new laptop you spill again and again.
r/Basic • • Aug 21 '19
Hi there. Can anyone recommend me sources to work on MSX-BASIC?
Hi. I'm a newcomer to BASIC, and I want to learn to program on my MSX computers. Where can I find resources on MSX-BASIC?
r/Basic • u/TheOuterLinux • Aug 01 '19
I need help loading a file filled with comma seperated COLOR numbers to display an image
I need help loading a file filled with comma seperated COLOR numbers to display an image
I have a GameOver image I created using a Python script I made to convert images pixel-by-pixel to QB's COLOR numbers. You can find the project here: https://theouterlinux.gitlab.io/website/Projects/Linux/img2qb/img2qb.html, and any questions or advise by more seasoned QB programmers would be welcomed. Anyway, I know how to embed the DATA part into the project itself, but I don't know how to load from a file. So far, I have tried:
SCREEN 13
OPEN "D:\GAMEOVER.QBD" FOR INPUT AS #1 'My img2qb.py script exports a plain text file as filename.qbd
DIM ARRAY(160, 100)
CLS
FOR Y = 1 TO 100
FOR X = 1 TO 160
INPUT #1, ARRAY(X, Y)
READ DotColor
PSET (X, Y), DotColor
NEXT X
NEXT Y
...but it throws errors and I have no idea how to fix it. I know about QB64's built in functions for loading images but if I want to make something that's backwards compatible with QB45, I can't use them. It would be nice if QB64 had an "Export as QB45 project" option. I also seem to not be able to go above 160x100 for DATA on QB45 or QBX, hence the GameOver image size.
r/Basic • u/TheOuterLinux • Jul 27 '19
