News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests

Main Menu

Fifty Years of BASIC

Started by jj2007, June 13, 2016, 07:49:47 AM

Previous topic - Next topic

jj2007


hutch--


mabdelouahab


avcaballero

Basic was my first programming language, exactly GW-BASIC. My father bought me an exciting pc xt 8088 with one floppy disk of 5"1/4 and 512 Kb ram with a 14" green phosphor screen. My first program was there, with number of lines

10 for i = 0 to 16
20 for j = i to 16
30 print "*";
40 next j
50 print
60 next i


I don't know any other language capable of write down a "hello world" like this:
? "Hello world"

When I tried to learn better basic programming always realized the need of learning assembler. What the f**ck really was those "PEEK/POKE"

My first video game Stardust

Basic never will die :t

jj2007

Quote from: mabdelouahab on June 13, 2016, 04:37:51 PM
And Four Years of MasmBasic   :biggrin:

Thanks for noting - actually, it's more than six years:
MasmBasic
« on: October 06, 2009, 09:24:57 PM »

BTW I didn't like the article so much. It is superficial fishing in old archives. What I lack most is a serious discussion why Basic was pushed aside by C-based languages, including the famous rants of Mr Dijkstra. Given that we live today, decades after, in a World where Adobe informs us after each reboot that they finally solved their security problems in Flash (exploits based on buffer overruns etc), it is hilarious that they still quote Mr Dijkstra for having discovered that GOTOs should be avoided.

There are good reasons why professional programmers hate BASIC:
Quote from: avcaballero on June 13, 2016, 10:14:54 PMI don't know any other language capable of write down a "hello world" like this:
? "Hello world"

And even that one is too complicated; it should be print "Hello world" - we aren't asking questions here, right? Or take this one:
include \masm32\MasmBasic\MasmBasic.inc
  Init
  Let esi="Hello World"
  Let esi=esi+", how are you?"
EndOfCode


To do the same in C, you need professional advice (How to concatenate 2 strings in C?) - and that is why BASIC has always been a threat to the profession 8)

hutch--

 :biggrin:

Well, while I have never tried to be politically correct, I avoid GOTO by using "jmp".  :P

I have seen a lot of clapped out high level language theory in my time and the ancient rant about GOTO was just another attempt to inflict artificial "structure" by means of restriction on some languages. Fantasyland languages come and go (ADA[tm] etc ...) but hardware goes on and on. I have been a fan of the concept of basic for a long time but rarely ever a fan of its implementation as it was often crippled intentionally as a toothless terror with no low level access. Generally Microsoft dialects of basic were very poor, I used a couple of them back in the DOS days, both QB45 and the professional version but they both suffered serious irritations.

The best I found in the early/middle 90s was GFA basic for 16 bit Windows but with the advent of WinNT4/Win95 I found PowerBASIC which has been a good tool for years and the later versions came close to directly porting MASM code so it does most of the HLL tasks I have. I prefer to work directly in MASM for anything serious but PB has been a good tool for years.

avcaballero

? = PRINT in basic

#include <stdio.h>
#include <string.h>

int main (void) {
  char   *msg1 = "Hello JJ. ", *msg2 = "How are you having today?", msg3[80];
  strcpy (msg3, msg1); strcat(msg3, msg2);
  printf(msg3);
  return 0;
}

If qb had any restriction and assembler doesn't. That's it. We can run embedded assembly code or by quick libraries within qb45   :biggrin:.

jj2007

Quote from: hutch-- on June 13, 2016, 11:40:55 PMThe best I found in the early/middle 90s was GFA basic for 16 bit Windows but with the advent of WinNT4/Win95 I found PowerBASIC

I coded a lot in Gfa, first on the Atari ST, then on Windows; the 16-bit version was marvelous, it took the best of Basic and Pascal. But Frank Ostrowski quit before 32-bit Windows became the standard, and those who tried after him to produce a 32-bit version failed miserably. PowerBASIC is indeed a good dialect (and so are FreeBasic, FBSL, O2, ...), but M$ destroyed the scene, maybe not intentionally, with VB - the most successful non-BASIC ever 8)

Quote from: avcaballero on June 14, 2016, 02:25:12 AM
? = PRINT in basic

I know; it's just not intuitive, and Basic should be intuitive.

Your C example works, of course, but you are comparing apples and oranges. What you are showing is a static strings example, and that is much, much closer to hand-made assembler than to Basic. Try this:

include \masm32\MasmBasic\MasmBasic.inc      ; download
  SetGlobals a$="Hello avcaballero", b$=", what's up today?"
  Init
  Let esi=a$+b$+CrLf$+"Here are two little files:"+CrLf$+FileRead$("\Masm32\include\Windows.inc")+CrLf$+FileRead$("\Masm32\include\WinExtra.inc")
  Inkey Left$(esi, 230), CrLf$, "...", CrLf$, Mid$(esi, 977500, 142)
EndOfCode


Output:
Hello avcaballero, what's up today?
Here are two little files:
;;;; head

comment * -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

      WINDOWS.INC for 32 bit MASM (Version 1.6 RELEASE January 2012)

...
comment * ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤

        winextra.inc is the second part of the windows.inc file

avcaballero

Donkey is one of the first (and crappy) qbasic games. Fortunatelly it is easy to make. There are some things to do, but it works :P.

avcaballero

Game almost finished. Each time you avoid the donkey, the car go up a bit in the road, so it will be more difficult to dodge the little animal. If you reach the top, you will increase your score and the game will be restarted. If you run over the donkey, it will have one more point. There is no run over sprites yet.

jj2007

TIOBE Index for July 2016
July Headline: Assembly Language enters the Top 10 again

rrr314159

From the TIOBE page: "Why would anyone write code at such a low level, being far less productive if compared to using any other programming language and being vulnerable to all kinds of programming mistakes?"

The myth will never die! Obviously these people are not assembler programmers
I am NaN ;)

hutch--

He he, we'll turn 'em into men yet.  :biggrin:

TWell

Some reason might be x64 compilers without inline assembly.
To use CPU's new features.
Java folks needs language support for that?

carlos

Why BASIC was pushed aside by C????? for a good reason, C is a production language, from the beginning C was designed to be a language to write good code, (UNIX remember?) while BASIC  was designed to be a LEARNING language, hence it's simplicity,  when basic was chosen to be the pc language, it helped people learn programming without having to go to college to learn, but writing SERIOUS software on BASIC is out of the question, is akin to try to participate in a bicycle race with training wheels.  also, all the bad rap BASIC got from pros in the 70s and 80s stem from the fact that BASIC was a micro-computing phenomenon, it never was strong in the mainframe/minicomputer world, and the pro saw us with disdain, our machines as toys.

Also, that lots of commercial/open source software is bug ridden is not the fault of C is the bad programmers/unrealistic deadlines that that plague the industry these days.