Yes, it reads right. I have sketched this recipe for compiling in Windows: https://github.com/udhos/basgo/blob/master/README-windows.md If you face difficulties with the recipe, you can reach me at: everton.marques(at)gmail.com Everton
This is the output from compiled code: Statistical distribution of random natural events (SI=0 TO 4) ongoing... SI 0 1 2 3 4 0% 5 6 11 12 17 10% 74698 146235 226351 310990 399003 20% 148396 247962 341132 368015 345788 30% 169462 260515 216470 160447 126812 40% 178459 167264 100198 72203 56242 50% 183660 78272 46347 33751 26450 60% 111137 31370 19722 14612 11933 70% 40257 15285 10293 7983 6535 80% 20289 9289 6577 5206 4222 90% 12719 6369 4604 3660 3150 100% 8946 4710 3402 2757 2381 Execution time...
Hi, Due to limitations in the compiler, I had to tweak the code in order to compile it. This is the final code I compiled. However I am afraid I broke the math in line 10 when inserting parenthesis for RND(). The compiler is unable to parse RNDnumber, it requires RND(number). I think I might have mistranslated RNDG/2, RNDEV250, and PERC=RA100/(G+0.1). Can you help me to fix properly line 10? 1 screen 0 5 RANDOMIZE TIMER:CLS:?"Statistical distribution of random natural events (SI=0 TO 4) ongoing...":'ON...
I experimented with compiling your bechmark code to native code with my toy compiler for basic: https://github.com/udhos/basgo Not filling the screen, your code took Average= 0.00011061930126743391 Filling the screen, it took: Average= 0.1786323386011645 Compiled to native executable, under Linux, x86_64, i7-8750H CPU @ 2.20GHz
You could try: chdir "esi" run "esi.bas" Everton Em dom, 13 de jun de 2021 12:56, David Wright djmwright@users.sourceforge.net escreveu: OK. I have put the esi folder into my documents. I have loaded it using Load"esi\esi.bas". Message says OK. Then I enter Run. The PC bleeps and PC-Basic closes. I think that the program has to access other files (e.g. .dat) in the esi folder. Could that be a reason why it isn't working?David From: Rob Hagemans robhagemans@users.sourceforge.net Sent: 13 June 2021...
Can you share the code?
Hi Tommy, Which PCBASIC version are you running? I am using 2.0.2. That could account for differences where files are located. I think I see the source of your confusion when editing programs in PCBASIC. PCBASIC closely emulates the GWBASIC editing features that are at odds with what one would expect nowdays. That's why I recommended Notepad++. However the trick is, PCBASIC editor only actually updates one FULL line of the program when you position the cursor over that line and hits RETURN. Just...
Hey Tommy, Sorry that Notepad++ didn't work in your system. It is an awesome tool. Did you try the 32-bit version or the 64-bit one? The benefit in finding the location of the drive letter Z: is you can load/save files using other code editors than the one included in PC-BASIC (that is cumbersome to work with any longer code). PC-BASIC documentation about the driver letter Z: states this: "If PC-BASIC is started from the start menu shortcut, the current device will be your Documents folder (or My...
Hey Tommy, Sorry that Notepad++ didn't work in your system. It is an awesome tool. Did you try the 32-bit version or the 64-bit one? The benefit in finding the location of the drive letter Z: is you can load/save files using other code editors than the one included in PC-BASIC (that is cumbersome to work with any longer code). PC-BASIC documentation about the driver letter Z: states this: "If PC-BASIC is started from the start menu shortcut, the current device will be your Documents folder (or My...
Hey Tommy, Sorry that Notepad++ didn't work in your system. It is an awesome tool. Did you try the 32-bit version or the 64-bit one? The benefit in finding the location of the drive letter Z: is you can load/save files using other code editors than the one included in PC-BASIC (that is cumbersome to work with any longer code). PC-BASIC documentation about the driver letter Z: states this: "If PC-BASIC is started from the start menu shortcut, the current device will be your Documents folder (or My...
Tommy, Try this script: 1) Install a source code editor like notepad++: https://notepad-plus-plus.org/ 2) Open PC-BASIC and enter the command FILES to find what its current folder is. On my system the folder is: C:\Users\evert\OneDrive\Documents 3) Write this little program below into notepad++ and save it as "hello.bas" in the folder you found out on step 2. 10 print "hi" 20 print "hit any key to loop or Ctrl-C to quit" 30 x$=input$(1) 40 goto 20 On my system, I saved that BASIC code as C:\Users\evert\OneDrive\Documents\hello.bas....
Tommy, I think you might enjoy this GW-BASIC tutorial: http://www.o-bizz.de/qbtuts/gw-train/index.htm If you need any help, please feel free to reach me by email. Everton
Is it required to download Go before downloading basgo-build_windows.amd64 version? I see Go is a large file (115mb) and I'm using windows 8.1 64-bit as an operating system. No, Go is not required for basgo-build, but Go is going to be required to build the final EXE. The process goes like this: basgo-build: compiles from .BAS to .go go: compiles from .go to .EXE If you need further help, you can open issues at https://github.com/udhos/basgo/issues or email me directly. I guess we should avoid cluttering...
And could you compile a program as an execute file from .BAS to .EXE? Cedric, You could try this compiler to translate from .bas to .exe: https://github.com/udhos/basgo If you need help, let me know. Cheers, Everton
You could create a batch script in order to automatically run "GWBASIC PROGRAM"for you. See: https://www.howtogeek.com/263177/how-to-write-a-batch-script-on-windows/
Can you paste the program code into a text editor like notepad++ and save it as "program.bas" in a folder that Basic can read? Then you could just load it with LOAD"program.bas".
Hi! Is it possible for the BASIC program to read the full command-line arguments passed to GW-BASIC? Thanks for any directions! Everton
I have just tested it on PC-BASIC 2.0.1 and it reported "Overflow". You should report issues here: https://github.com/robhagemans/pcbasic/issues
It might be hard to iterate over files in a directory. See this thread: https://sourceforge.net/p/pcbasic/discussion/programs/thread/a56a1a7cd2/ You can open every file, load its lines to memory and then search every line for the string. If it is simple if you have text files, but it might get quite challenging if you need to handle other formats such as pdf.
Ralph, You may want to notice there is a trick in that PC-BASIC driver letters are distinct from Windows drive letters. Try this recipe: Suppose that: a) You copied your programs to the location C:\Basic in your new computer. b) You want to mount your C:\Basic directory as drive A: for PC-BASIC. Locate the file PCBASIC.INI file in your new Windows computer. PC-BASIC documentation says that file should be located at %AppData%\pcbasic-1.2\PCBASIC.INI Point is, you need to locate that PCBASIC.INI file,...
Save your program by typing save"prog.bas",a then paste the full contents of prog.bas here in the discussion so we can look at it.
Suppose you want to mount your C:\Basic directory as drive A: for PC-BASIC. You have two options: 1) Either run PC-BASIC from command prompt like this: pcbasic --mount=A:C:\Basic 2) Or, before running PC-BASIC, edit the file PCBASIC.INI and add the following line: mount=A:C:\Basic You would find PCBASIC.INI in your %AppData% path: %AppData%\pcbasic-1.2\PCBASIC.INI
No, not from within the PC-BASIC interpreter. Suppose you want to mount your C:\Basic directory as drive D: for PC-BASIC. You have two options: 1) Either run PC-BASIC like this: pcbasic --mount=D:C:\Basic 2) Or, before running PC-BASIC, edit the file PCBASIC.INI and add the following line: mount=D:C:\Basic You would find PCBASIC.INI in your %AppData% path: %AppData%\pcbasic-1.2\PCBASIC.INI
Brian, See the 'mount' option from documentation: You can map drives and other file system locations as PC-BASIC devices by using the mount option in the configuration file or on the command prompt. For example, on Windows, the option mount=A:C:\Users\Me\BasicFloppy will make the folder C:\Users\Me\BasicFloppy available as PC-BASIC's A: http://robhagemans.github.io/pcbasic/doc/1.2/
I'm aware one can use FILES to list directory contents to screen. However I can't see a way to programmaticaly iterate over files in a directory. I can't believe that GW-BASIC didn't provide a straightforward mechanism for scanning files from a directory. Has anyone ever tackled that problem?
Ralph, If USB floppy drives were able to read your old disks, you could copy them to another filesystem location on your new computer. Then PC-BASIC would surely be able to handle them. However, I find it unlikely that the data on your old floppy disks would have lasted so long, unfortunately. Everton
Hey, noticed a funny detail here. Looking at the gist I see: source code for BOOGERS by Mitch Teich 1982 However the source code says: 5 REM DATNOIDS Copyright (c) 1982 By Casey Roche I suppose this is source code for Datanoids saved as BOOGERS??
Rob, I've added your _GOFUNC suggestion. It looks like this now: everton@homeubu:~/basgo$ more gofunc/rad.bas 110 rem Using _GOIMPORT and _GODECL to embed Go code within BASIC code 120 rem 130 _goimport("math") 140 _godecl("func degToRad(d float64) float64 {") 150 _godecl(" return d*math.Pi/180") 160 _godecl("}") 170 rem 180 rem Now using _GOFUNC to call that Go function from BASIC code 190 rem 200 d = 180 210 r = _gofunc("degToRad", d) 220 print d;"degrees in radians is";r everton@homeubu:~/basgo$...
Thanks for the _GOFUNC hint. I filed an issue to fix it asap: https://github.com/udhos/basgo/issues/3
Try this: 10 dim t(16) 20 for i=1 to 16 30 t(i)=i 40 next 50 n=16 60 while n>1 70 i=int(rnd * n) + 1 80 print t(i) 90 t(i)=t(n) 100 n=n-1 110 wend 120 end
How about this? 10 read n$, birth$ 20 gosub 100 30 print string$(20, "-"); " "; string$(20, "-") 40 for i=1 to 3 50 read n$, birth$ 60 gosub 100 70 next 80 end 100 print n$; space$(20-len(n$)); " "; birth$ 110 return 1000 data "NAME", "BIRTHDAY" 1010 data "smith, john", "January 27, 2019" 1020 data "denvers, carol", "February 10, 2018" 1030 data "wayne, bruce", "March 30, 2017" Output: NAME BIRTHDAY -------------------- -------------------- smith, john January 27, 2019 denvers, carol February 10,...
How about this? 10 read name$, birth$ 20 gosub 100 30 print string$(20, "-"); " "; string$(20, "-") 40 for i=1 to 3 50 read name$, birth$ 60 gosub 100 70 next 80 end 100 print name$; space$(20-len(name$)); " "; birth$ 110 return 1000 data "NAME", "BIRTHDAY" 1010 data "smith, john", "January 27, 2019" 1020 data "denvers, carol", "February 10, 2018" 1030 data "wayne, bruce", "March 30, 2017" Output: NAME BIRTHDAY -------------------- -------------------- smith, john January 27, 2019 denvers, carol...
Hi guys, First of all, thanks to Rob for PC-BASIC. It is amazing. It brings sweet old memories of fun with BASIC. Currently I am sketching a toy compiler to translate BASIC programs to Go. Then the Go code can be compiled to native binary. It works like this: basgo-build < program.bas > program.go ;# translates to Go go build program.go ;# compiles to executable ./program ;# executes the binary program Right now, it can handle only simple BASIC programs. I use the awesome PC-BASIC as authoritative...