retro-basic

General discussion for topics related to the FreeBASIC project or its community.
Post Reply
srvaldez
Posts: 3383
Joined: Sep 25, 2005 21:54

retro-basic

Post by srvaldez »

some time I came across PC-BASIC a cross-platform gwbasic interpreter, I also came across some old basic code repositories https://github.com/robhagemans/hoard-of-gwbasic and https://github.com/robhagemans/basicode
however, it's pure torture for me to look at the codes
today I found that the Microsoft Store has a QuickBasic for Windows 7 and 10 https://www.microsoft.com/en-us/p/qbasi ... verviewtab
I wonder if it uses DOSbox, nevertheless it has a nice IDE and you can run your old qb code, speaking about qb, here's some nice qb code https://github.com/geneb/QuickPakScientific
angros47
Posts: 2329
Joined: Jun 21, 2005 19:04

Re: retro-basic

Post by angros47 »

srvaldez wrote:today I found that the Microsoft Store has a QuickBasic for Windows 7 and 10 https://www.microsoft.com/en-us/p/qbasi ... verviewtab
I haven't tested it.. but from the screen shots, it reminds me of this: http://stevehanov.ca/blog/?id=92
srvaldez
Posts: 3383
Joined: Sep 25, 2005 21:54

Re: retro-basic

Post by srvaldez »

thank you angros47 :-)
that was an intersting read.
badidea
Posts: 2594
Joined: May 24, 2007 22:10
Location: The Netherlands

Re: retro-basic

Post by badidea »

https://www.microsoft.com/en-us/p/qbasic/9ntmcqwn2sqm wrote:OS: Windows 10 version 15063.0 or higher, Xbox One
I hope that the Xbox One supports a keyboard. Writing code with a game-pad does not sound like fun :-)
jj2007
Posts: 2326
Joined: Oct 23, 2016 15:28
Location: Roma, Italia
Contact:

Re: retro-basic

Post by jj2007 »

srvaldez wrote:however, it's pure torture for me to look at the codes
Agreed!

Code: Select all

1000 A=500:GOTO 20:REM FRAGE & ANTWORT
1010 DIM F$(50,3),A$(50,3),NR(50)
1020 Z1$="#################################"
1030 Z2$="#                               #"
1040 Z3$="#    #    #                     #"
1050 Z4$="                              "
1060 PRINT Z1$:FOR Z=1 TO 5:PRINT Z2$:NEXT Z:PRINT Z1$
1070 VE=8:HO=0:GOSUB 110:PRINT Z1$:VE=VE+1:GOSUB 110
1080 FOR Z=1 TO 5:PRINT Z2$:VE=VE+1:GOSUB 110:NEXT Z:PRINT Z1$
1090 VE=16:HO=0:GOSUB 110:PRINT Z1$:VE=VE+1:GOSUB 110
1100 FOR Z=1 TO 5:PRINT Z3$:VE=VE+1:GOSUB 110:NEXT Z:PRINT Z1$
1110 VE=3:HO=7:GOSUB 110:PRINT "EINEN MOMENT BITTE !"
1120 SR$="    FRAGE  &  ANTWORT      "
1130 VE=23:HO=0:GOSUB 110:GOSUB 150
1140 VE=11:HO=9:GOSUB 110:PRINT "Ich sortiere !"
1400 REM ===============================
1410 FOR I1=1 TO 50
1420 READ NR(I1)
1430 FOR I2=1 TO 3
1440 READ A$(I1,I2)
1450 NEXT I2
1460 NEXT I1
1470 FOR I3=1 TO 50
1480 READ NR(I3)
1490 FOR I4=1 TO 3
1500 READ F$(I3,I4)
1510 NEXT I4
However, the same applies to some recent FB examples that resemble more C++ than Basic ;-)
D.J.Peters
Posts: 8586
Joined: May 28, 2005 3:28
Contact:

Re: retro-basic

Post by D.J.Peters »

In the early 90th if I saw an idle PC with QBASIC, in any shopping mall
I typed and execute one simple line of BASIC It was fun to see how some peoples react.

Joshy

Code: Select all

SCREEN 13: SCR% = &HA000: FOR Y% = 0 TO 199: DEF SEG = SCR%: FOR x% = 0 TO 319: POKE x%, x% AND 127 * Y% AND 127: NEXT: SCR% = SCR% + &H14: NEXT
RockTheSchock
Posts: 252
Joined: Mar 12, 2006 16:25

Re: retro-basic

Post by RockTheSchock »

This code does the same as Joshy's but can be run from both QB and FB. So with QB you could actually write readable code.

Code: Select all

SCREEN 13
DIM x AS INTEGER
DIM y AS INTEGER
FOR Y = 0 TO 199
	FOR x = 0 TO 319
		PSET (x,y), x AND 127 * Y AND 127 
	NEXT
NEXT
SLEEP
D.J.Peters
Posts: 8586
Joined: May 28, 2005 3:28
Contact:

Re: retro-basic

Post by D.J.Peters »

In scope of "RETRO" BASIC the "free" QBASIC version shipped with DOS was an slow BASIC interpreter.
On a 80386SL 20 MHz PSET() was one of the slowest command at all.
The trick was to use DEF SEG instead of the missing pointer arithmetic.

SCR% = SCR% + 20 moved the "pixel pointer" 200 pixels one complete row forward in screen memory.

Another point are x% * y% would produce an overflow (integer '%' was signed 16 bit not 32 bit)
an "AND 127" fixed the overflow problem and result was the nice looking pattern.

Using integer x%,y% as loop counters was two times faster than x,y
and "poking" directly in screen memory was 3 times faster a PSET() !

With other words the point wasn't to write strange looking code the point was get speed for free :-)

I loved the simple syntax of QBASIC and wrote simple rotating 3D cubes
more complex raytracer's and neuronal network's with it.

Getting a mirrored sphere with shadow on a black and white chess board
was totally slow but a kind of (math) adventure for me.

Joshy
angros47
Posts: 2329
Joined: Jun 21, 2005 19:04

Re: retro-basic

Post by angros47 »

Of course, that applied only in mode 13, since every memory location mapped to a single pixel.

In modes 7,8,9 and 12, every memory location affected only one color bit, related to 8 pixels, and to plot a single pixel one had to poke values in 4 bytes (one for red, one for green, one for blue, one for luminosity).

This allowed to save memory, but, most important, allowed to use memory chips that otherwise wouldn't have been fast enough: the VGA mode had a refresh rate of 60Hz, and that means that a screen of 640*480 had to be streamed 60 times in a second.. about 18 millions of pixels to be read in a second. At the time, no memory chip could be read that fast. In black and white mode, that could be fixed by using single bits to represent pixels, so every byte represented 8 pixels, and that was doable with the memory chips available at the time.
For color modes, the VGA used not one, but 4 memory chips, each one provided the data for a single bit plane, for 8 pixels. By reading the 4 chips in parallel, an acceptable bitrate was achieved.

In mode 13, actually, still 4 memory chips were used: each chip streamed color data on one pixel each 4. As result, the image was actually stored in 4 banks, and pixels were not stored in sequence. But a controller hide that from the software, and remapped the memory so it looked sequential.

If the controller was bypassed, and memory was accessed directly, writing on the video memory was more difficult, but it was possible to achieve more speed, and other advantages (that technique was called "Mode X")
angros47
Posts: 2329
Joined: Jun 21, 2005 19:04

Re: retro-basic

Post by angros47 »

Looks like this retro-basic is open source:

https://github.com/IshikawaMasashi/QBasic

And being written in javascript (with some WASM and TypeScript) it works in browser, under any operating system. You can try it even if you don't have windows. At least now I can answer srvaldez's question: it surely doesn't use DosBox.
Post Reply