Sunteți pe pagina 1din 2

Basic programming

Ken Holmes
Starting its life way back then as Beginners' All-purpose Symbolic Instruction Code, it is aptly named. It is probably the first language for most who have ventured, permanently or temporarily, into the world of programming. Early versions such as IBM A-Basic, Microsoft GWBasic (Gee Whiz!) and a myriad of variations usually came bundled with Operating Systems and the many individual computer designs which preceded today's relatively few popular standards. They were characterised by the numbered lines system with strictly one instruction per line, as with Assembler, reflecting the programmers' view of the code as being a linear sequence of instructions at consecutive addresses in memory. Since it is inevitably necessary to insert extra code as a program is written it was usual to number lines in tens so that several new ones could be inserted between consecutive lines. Periodically, automatic renumbering could be invoked to restore the even (10) gaps throughout the program. Early Basics came on audio tapes, coded into the operating system or on 180 or 360 kB floppies. My copies are on 360s but I no longer have access to a 360 floppy drive. I'm not alone. The general thrust of instruction words was usually obvious, at least to English speakers, but the manual (remember those?) was an invaluable companion for revealing the subtleties of usage. The now-despised "GOTO linenumber" was the way to obtain looping code, with "IF ... THEN GOTO ..." as the escape route. Subroutines were usually placed at the end of the code and reached by "GOSUB linenumber" and exited with "RETURN linenumber". When linenumber happened to be 19480, it was difficult to maintain an overall view of your own program, let alone someone else's. Automatic renumbering had to cater for the jumps so that the operating sequence was maintained. When line numbering faded, individual line labels were used as necessary to facilitate the grasshopping, and "structured programming", as with Microsoft QuickBasic or Borland PowerBasic, introduced the named SUB procedure. The SUB was looked after by the program and could be called up by name, from "somewhere else" in memory, of little concern to the programmer. One SUB may be called for inside another, as many layers as required, and a SUB may call up (a copy of) itself to provide the useful device, recursion. A recognisable program can fit on a few screens and the details of the SUBs may be referred to separately only as and when needed. Early Basics were interpreters with the individual code operable only within the Basic environment. Later, for example with QuickBasic, an EXE file could be made to operate independently. This could exist in two forms - firstly, a stand-alone version including the libraries which provide the machine code for each of the instruction words used in the program, and secondly, a version needing a second file, a run-time library called "BRUN??.LIB. A virtue of the second approach is that you may have many (shorter) programs with only one copy of the run-time library. Indeed this line is taken by Visual Basic with its VBRUN???.DLL files made available in Windows. For those wishing to do a bit of simple, honest Basic programming, free of the GUI wrappings, the most readily available program is QBasic.exe and QBasic.hlp which came with later versions of DOS and also on Windows 95 and 98 CDs in the \tools\oldmsdos directory. It is only an interpreter and unable to make EXE files. QuickBasic was sold separately and is not now available, unless secondhand. QBasic 4.5 and QBasic 7.1 are available on the Web and able to create EXEs; also there are QBasic groups where .BAS programs are presented and discussed.

Basic has, of course, made a resurgence in Visual Basic but it provides much ready written code for common tasks and is not likely to encourage a beginner to get to grips with coding. If he/she wishes to achieve something out of the ordinary, he/she is unlikely to get the skills to do so. However, time moves on and the common requirement is programs which will operate in Windows and which need to perform functions which have been done before. These allow users to customise programs to individual requirements most of the time but there is an ongoing need for core programmers to develop the fundamentals to exploit future developments akin to extended memory, 64 bit, multiple processors or whatever.

S-ar putea să vă placă și