Showing posts with label liberty basic. Show all posts
Showing posts with label liberty basic. Show all posts

Thursday, September 19, 2019

Kronos - The beginning

After my stint working as a contractor on the IBM + Raytheon project, a friend of mine I knew from church who happened to know I specialized in Smalltalk reached out to me and got me an interview at Kronos, Inc. where they made time and attendance products.  They hired me as a contractor.

Kronos was the market leader in this space and their breakthrough product was the combination of digital punch clocks with a magnetic card strip reader and an application developed in C to process all the data of employees coming and going.

Before I went there they had created a new version of their system called TimeKeeper C/S which was developed in Smalltalk.  The C/S part stood for Client/Server, so Smalltalk application used a SQL Server database as its backend.

My task on this contracting job was to develop an extension to their TimeKeeper C/S application.  Because they didn't have a database resource to work with me, I developed a dynamic object persistence system that was file based, and I also created a dynamic user interface mechanism to present application windows based on metadata.

It was an interesting project and the work paid well.  Later on the contacts I made would help me again and again.

After the contract period was finished I went back to working on Liberty BASIC again.

Fractals in one page of code - Redux

Some time back I blogged about how someone wrote a one page program in Just BASIC that draws a colorful fractal image.

And I quote (myself):

"What's great about BASIC and languages like it is that you don't have a write a lot of code that has nothing to do with what you're trying to create (like Java for example). It should be really easy to throw together a little code and play with graphics. Programming should be fun, not a burden.

Here is a thread that shows how to draw fractals in less than a page of BASIC."

But the link is now broken because the forum site shut down and we lost a lot of good stuff.

Here's where we make it right.  A few months ago I found a fractal example for the Apple II written in Applesoft BASIC.  I thought it was pretty cool, so I adapted it for Liberty BASIC.

startMS = time$("ms")
WindowHeight = 230
open "mandelbrot set" for graphics as #gr
#gr down()
#gr fill("black")
color$ = "red orange yellow green blue red orange yellow green black"
for x = 0 to 279
for y = 0 to 95
  x1 = x / 280 * 3 - 2 : y1 = y / 191 * 2 - 1
  i = 0:s = x1:t = y1
    while i < 20 AND s * s + t * t < 4
      s1 = s * s - t * t + x1
      t = 2 * s * t + y1:s = s1: i = i + 1
    wend
  c = i/2
  #gr color(word$(color$, c + 1))
  if c <> 0 then #gr set(x, y) : #gr set(x, 191-y)
next y
next x
print "done in "; time$("ms")-startMS; " milliseconds"

Note: This is written to run on Liberty BASIC v5 to be one of the example programs.  LB5 is as of the time of this writing is in alpha test.  Click to visit the Liberty BASIC v5 board in our forum.

Saturday, October 27, 2018

Jobs vs Woz - The Closed vs Open Hand

Most people know who Steve Jobs was.  He was the charismatic and visionary frontman for Apple for many years.  He even managed a friendly coup at Apple when he took back the company he was ousted from.  He was a controversial person.  He had his fans and his detractors.  I think he certainly had his good points, but I am really more of a fan of the other less well known Steve of Apple, Steve Wozniak affectionately known as Woz.

Woz was the designer of the original line of Apple II computers.  He had a vision of computers as computers, for everyone.  A hippy vision of computing?  ;-)

What appeals to me more about Woz is that he was generous and wanted to give people something great.  His ambition lay more in personal accomplishment and also in sharing his knowledge with others.  When he created the Apple II computer he wanted it to be open.  He provided a schematic so that users could understand the computer, and so that they could modify it.  People even wrote books about how to do this.  Another example of this is that Woz included expansion slots so that people could extent the computer in this way.

When you turn on an Apple II you can program it right away.  There is a built in machine language monitor.  Depending on the model you can either use Woz's Integer BASIC or you can run Applesoft BASIC.

This version of an Apple computer is a real computer, for computing, by programming.  A computer is a device for a computer user.

Enter the computer as appliance.  :-/

Steve Jobs had a vision of computer as appliance.  This is purely a business perspective.  Sell more computers by marketing to the fat middle of the bell curve.

Of course he is not the only one to think this way.  Somehow progress in computing tends towards reducing it down to a touchscreen and away from programming and true computer literacy.  The Macintosh was a step in this direction.  This has a certain irony because the form of the Mac user interface was inspired directly by the Smalltalk windowing user interface, a programming system.  In addition to the appliance-like format of the Mac software, the computer itself was meant to be closed unit.  You need a special screwdriver to open it, and there are no expansion slots.

So the Mac was a closed machine, and it pointed other systems in this direction (i.e. Microsoft Windows).  You could purchase programming software for the Mac, but unlike other computers on the market there was no direct path to programming when you turned on the machine.  Why was there no easy programming option on the desktop when you started the Mac OS?  For more on this issue see Why Johnny Can't Code which is a popularly referenced article on this topic.

HyperCard eventually was made available on the Mac as an easy and fun programming tool and it was included free of charge for some years, but now it is gone.

Microsoft followed suit with Windows and they too also did not include even a version of their famous BASIC as an icon on the desktop of their new system.  I wrote Liberty BASIC back in the early 1990s as a response to this.  Microsoft eventually provided Visual Basic, but I strongly suggest the this should have been included, for free, and an icon to start Visual Basic should have appeared on the Windows desktop on startup.

I'm not going to suggest that there is some sort of conspiracy to dumb down the computer.  What I will say is that this amounts to a stupid and harmful mistake.  The computer is so powerful and wonderful as a creative too.  These new computers as appliances are depriving people of so much by simply omitting an easy and friendly programming tool.  A desktop icon to entice the curious to try something simple enough for children and powerful enough for casual applications programming.

So, what is really better?  How do you define progress?  What of the early 6502 and Z80 computers when compared to what we have today?  The new computers dwarf these charming old timers, but they are less powerful in terms of the concepts they omit from the user.

Sunday, September 16, 2018

Python - The Emperor's New Clothes

I recently posted a couple of examples of a starfield simulation written in BASIC.  One of these was written in Commodore BASIC for the VIC-20.  The other was written in Liberty BASIC for Windows.

BASIC gets a lot of flack from people with a certain kind of snob factor (yes, you know who you are).  And there is the infamous comment by Edsger Dijkstra, and BASIC has never lived it down.  Nowadays when you see people discussing what is the best first language I probably see Python mentioned most.  In these forum discussions someone always seems to snidely denounce BASIC as that old thing with the GOTO and the unreadable spaghetti code.  They don't seem to have a good reason to recommend Python, except that it isn't BASIC.

People also recommend C and it's derivatives such as C++ which also has GOTO.  So go figure.

Wait, here is something scandalous!  On the Python Software Foundation website, in their design and history FAQ page, they actually answer the question about why there is no GOTO in Python by encouraging people to use exception handling as a hack to simulate something like GOTO!  Ummmm.   See for yourself.  https://docs.python.org/3/faq/design.html#why-is-there-no-goto

Okay, getting back to the starfield simulation example.  If you look at the version of the starfield simulation written in Liberty BASIC, it addresses some of the things that BASIC is frowned on about.
  • GOTO - Uh oh, not really.  There is one GOTO, but in this case I'm not sure a WHILE/WEND forever loop is really better, so...  The Commodore BASIC version has three GOTOs.
  • Structure - The Liberty BASIC version uses control structures properly the way modern languages do.
  • Line numbers - Liberty BASIC programs do not require numbers.  You can give your routines meaningful names instead of numbers.
Okay, let's be frank.  Liberty BASIC was not the first version of BASIC to solve these problems.  There are many BASICs with modern features, and so it isn't fair to criticize BASIC as being a bad language for beginners.  BASIC has been a proper language for teaching good programming practices for a very long time now.

What do you think?  Comments welcome.  :-)


Saturday, August 25, 2018

Starfield Simulation in Liberty BASIC

Here is the starfield simulation that for the VIC-20 that I posted a few days ago, but ported as simply as possible to Windows using the Liberty BASIC language (http://www.libertybasic.com).  If you compare them side by side you can see that a lot of the original code is preserved across the translation.

Enjoy!

 dim st(9,1)  
 gosub [setup]  
 timer 20, [cycle]  
 [cycle]  
   for c=0 to n  
     xold=st(c,0)  
     yold=st(c,1)  
     st(c,0)=xold*1.23  
     st(c,1)=yold*1.23  
     x=int(st(c,0))  
     y=int(st(c,1))  
     if abs(x)<15 and abs(y)<15 then  
       gosub [clearStar]  
      else  
       if abs(x)>200 or abs(y)>200 then  
         st(c,0)=(rnd(1)-0.5)*3  
         st(c,1)=(rnd(1)-0.5)*3  
        else  
         gosub [drawStar]  
       end if  
     end if  
   next c  
   wait  
   goto [cycle]  
 [clearStar]  
   #starfield "color black ; place "; xCenter + xold; " "; yCenter + yold  
   #starfield "\."  
   return  
 [drawStar]  
   gosub [clearStar]  
   #starfield "color white ; place "; xCenter + x; " "; yCenter + y  
   #starfield "\."  
   return  
 [setup]  
   input"# stars (1-10)";n  
   n=n-1  
   for x=0 to n  
     st(x,0)=(rnd(1)-0.5)*200  
     st(x,1)=(rnd(1)-0.5)*200  
   next x  
   open "starfield" for graphics as #starfield  
   #starfield "home ; posxy xCenter yCenter"  
   #starfield "down ; fill black ; backcolor black"  
   #starfield "trapclose [quit]"  
   return  
 [quit]  
   close #starfield  
   end  

Monday, August 20, 2018

Back to BASICs

Some time ago I began to assemble a small collection of vintage home computers in order to begin blogging about what makes these machines so appealing.  In particular, programming these computers in BASIC in my early years made a huge impression on me and my creation of Liberty BASIC was inspired by my love for BASIC.

I have obtained the following machines in working condition.

Apple //c
Commodore 128 (a Commodore 64 compatible machine which also has a Z80 processor)
Commodore VIC-20
Atari 800XL
TRS-80 Color Computer 2 (not sure I will actually use this one)
And a few less popular computers that might make guest appearances.

To begin with, I am focusing on the Commodore VIC-20.  I have some ideas about very simple and fun projects in BASIC, and some Forth.  Since most of these machine also have a 6502 processor, perhaps there will also be some posts about that.


Wednesday, July 13, 2016

Ziff Davis Interactive, Liberty BASIC, and Bill Gates

Robert Gerami, a close friend of mine worked for Ziff Davis (the owner of PC Magazine) in Cambridge, Massachusetts.  He was in charge of their free downloadable utilities.  They were particularly well known for their whimsical screensavers, including one where a cartoon of Bill Gates would smash your Windows 3 desktop to reveal a shiny new Windows 95 desktop which would then be eaten by bugs before your eyes.

Robert liked what he saw in Liberty BASIC and decided to offer me a chance to have it featured on their web site as a special edition.  But, before he was willing to do this he want it to support making API calls.

The best part of this arrangement was that Ziff Davis would pay me to do the development, and that the resulting work would still be owned by me.

This is one of the important features of what became Liberty BASIC v2.0.  This was promoted by Ziff Davis Interactive on their website for several years.

Thursday, January 21, 2016

DOOM and the raiders of the lost hours

My first PC compatible computer ran DOS and Windows, and OS/2 and... DOOM.

In between rounds of development work on Liberty BASIC I would take breaks playing DOOM.  By today's standards this is a crude looking game, but back then it was really groundbreaking.  Playing it in a dark room was a good way to scare yourself half to death.  Today I would surely consider it rather tame.  The only thing that really compared to it was a game called Ultima Underworld which was actually a smoother and more detailed real-time 3D game.

In the world of PC gaming it really was all DOS.  Running Windows or OS/2 sucked up too many resources from what was typically a 33MHz 80486 computer.  The game would not play well.  Even when running DOS you needed to use HIMEM and play all the tricks in the book for there to be enough memory.

Other games that wasted my time included Falcon 3.0 which is probably the perfect air combat simulator and a cool game called Theatre of War which was sort of a real time version of Chess, kinda.

Thursday, January 14, 2016

Murphy's Law of book publishing

Once the book was all proofed and the camera ready art produced, and once I had the color separation for the cover all produced I was ready to order the first run of books which was approximately 1000 copies.

NRI Schools sent me a check in advance for these books.  How can you beat that?  So I sent everything off to Whitehall Publishing and waited nervously.

A couple of weeks later several heavy boxes arrived.  So exciting!

I cracked open one of the boxes and grabbed one of the fresh books.  What a neat thing to hold the result of so much work in my hands.  This really looked just like a book that you would buy at the store.

And then... I opened the book to the first page and my heart sank.  The very page had a spelling mistake.  I misspelled the word congratulations.  :-/

It read Congradulations.   What?  How could I miss that?

Ah well, it was still a great day!  :-)

Sunday, January 10, 2016

Liberty BASIC book preproduction

In addition to actually writing the Liberty BASIC book which involved developing the tutorial examples and explaining them, creating a quiz for each chapter, developing and proofreading each chapter, etc. There was the matter of producing camera ready pages.  They needed to be a certain size and they wanted crop marks on the pages.

NRI Schools also wanted a full color color, which I really didn't know how to create.  A friend of mine named Robert Gerami actually helped me with the graphic, and he even added a funny cartoon to the back of the book.  The cartoon was of a building with a sign saying "Programming School" and there was a hot dog stand outside the building.  A character with a fishing rod up on the second floor was trying to snatch a hot dog from the vendor's stand with his fish hook!  It was a humorous way to polish off the book's cover design.

There was a local company that created the acetate color separations for the cover, and all this went off to a company called Whitehall Publishing.  They charged me approximately $6 for each copy of the book when ordered in 1,000 or more.

All I needed to do now was write the check and wait...

Friday, January 8, 2016

Writing a book was more than I bargained for

I really had no idea how much work this was going to be.  I had good starting material with the Liberty BASIC tutorial, which had actually been fashioned into a spiral bound book which I produced at the local Staples store, but this had to be more polished.

I had no serious word processing software.  This meant that I needed to use the Write application that came with Microsoft Windows.  The only strengths that this provided was that it was essentially free, it was easy to understand and didn't burden me with any strange gotchas that full blown word processors often do, and it allowed page footers.

This was hard work.  The process was to produce a draft of a chapter, print it out and then I would lay down on the carpet with a pencil and read it, marking it up as I went.  Then I would go back and enter in all my changes and repeat the process several times until that chapter seemed good enough for the book.

This took weeks.  By the time I was done, I was determined to never, ever do it again.  Of course this didn't end up being my last book.  :-/

Thursday, January 7, 2016

NRI Schools and my first book

About this time I received a phone call from someone at NRI Schools, McGraw-Hill Continuing Education Center which was a popular adult education company.  They told me that they were developing a new computer programming course and they wanted to base it on Liberty BASIC.  Wow!

Here's what they wanted to do.  They would write their own course, which would be a staple bound series of books that they would distribute to their students.  They also wanted an actual official Liberty BASIC manual from me for which they would prepay me.

This was to be a perfect bound book with a full color cover.  I had never done such a thing before, so I had a lot to learn.  It was very helpful that they were willing to prepay for the first 1000 copies of the book because otherwise I was not going to be able to bankroll this project.

I decided that the book would be based on the tutorial that came with Liberty BASIC.

This was going to be a lot of work, but it was very exciting!

Thursday, December 31, 2015

Liberty BASIC at IBM!

While working on our prototype for the Defense Nuclear Agency I discovered that we needed to reset some files repeatedly whenever we tested and demonstrated the functionality of our system.

I was eager to put Liberty BASIC to good use, and since we were running on OS/2 this gave me an opportunity to create a utility that would make things easy.  Liberty BASIC to the rescue!

It was actually easier to create this utility in BASIC than it would have been in Smalltalk.  Smalltalk is very powerful and really is one of the best languages, but BASIC is stronger for banging out small and simple programs.

I took great pride that when were were demonstrating our system to the customer that they also got a demo of Liberty BASIC in action!

Tuesday, December 29, 2015

Onward and upward!

In my time at CFC Incorporated I had several interviews for work in Smalltalk.  One of them was in Cambridge, Massachusetts.  They focused a lot on Unix in the interview, or at least that's the way I remember it.  I never got a call back from them.

Another interview was with a company in Waltham called Marble Associates where my friend Laird Popkin worked.  This job seemed fantastic, and the interview was going great.  But when they told me that it was a traveling job which required that I fly to the client every Monday through Thursday I regretfully declined because I was unwilling to be away from my wife and children and also my church community in that fashion.

One day in 1995 I was contacted by one Peter Statterman, and he told me that his company GEM Consulting was looking for an experienced Smalltalk developer for a joint IBM and Raytheon project for the Defense Nuclear Agency of the US military.

We met at a coffee shop in Natick, Massachusetts and he interviewed me.  I must have said something right because he hired me!  It was exciting to be working on a project for IBM on the OS/2 operating system platform.  I was already working on Liberty BASIC for OS/2 and so this gave me the experience I needed to jump right into the project.

GEM Consulting hired me as a subcontractor.  The money was really good, but it was only a three month contract to create a prototype.  If that went well they would extend that to another six month phase.

My intention was to focus on Liberty BASIC when the contract ended and try to launch a full time business.

This was the start of a new chapter in my software development career!

Thursday, February 25, 2010

The SBASIC Preprocessor

I had become familiar with structured programming ideas from my casual experimentation with Forth. I wanted to do something to improve the quality of my Microsoft BASIC programming. I realized that I could write a program that would take BASIC source code without line numbers, and adding in named labels for the GOTO and GOSUB targets and output line numbered BASIC. Then I could run this code in an interpreter or compile it. This was a cool idea for me. After having done the CNC simulator this lit up a part of my brain that brought me closer to realizing that a compiler is just another kind computer program that treats source code as data.

I wasn't familiar with QuickBASIC at that time, so I didn't use Microsoft's syntax for this. Instead I used square brackets for branch labels like so:

[loopHere]
a = a + 1
print a
if a = 10 then [quit]
goto [loopHere]

[quit]
print "done."
end

Liberty BASIC programmers will recognize this syntax. I called this preprocessor SBASIC for Structured BASIC.

Here's what it looks like in QuickBASIC:

loopHere:
a = a + 1
print a
if a = 10 then quit
goto loopHere

quit:
print "done."
end

I think that my syntax is better. It certainly is more consistent because in QuickBASIC the branch label will either be quit or quit: but in SBASIC it is always [quit].

So here we see a direct precursor to Liberty BASIC. At this time I did not have plans to create my own BASIC. That wouldn't come for four more years.

Wednesday, January 27, 2010

Rumblings of the Future

One formative project I started but never finished on my VIC-20 was a programmable calculator program. I got my start programming the HP-67 calculator, and I've always been fond of these little pocket sized computers so this was my inspiration for this project. This was going to be the simplest interpreter you could write in BASIC. I didn't bother to sit down and design it on paper first. I just starting coding it. Really, I can't remember much about it except that I was motivated to give it a try. I didn't get very far.

Another idea I've always been very interested in pursuing is to create a robot battle programming system like Robot Wars on the Apple II. This is similar to CRobots for the PC. It's a very simple real-time simulation of two or more robots duking it out in an arena. The robots search and destroy each other by executing battle programs written by a human user.

I never finished my programmable calculator. Years later on I would go on to write different kinds of interpreters and some similar things in connection with paid work, and ultimately Liberty BASIC and Run BASIC.

Programming languages have always fascinated me, and I enjoy reading books and articles by other programming language implementors to improve my understanding of the field.