|
A Tiny 80(C)32 BASIC Board, A tiny but powerful stand alone BASIC computer, not larger than the size of a package of cigarettes built entirely from salvaged components, just for fun! |
|
In 1977 when I was about sixteen a (micro-)computer was, at least to me, still a fantastic allmost sience fiction sort of machine. By then, reading everything I could find on the topic, I had pretty much figured out how computers worked. I had even build a machine language programmable microcomputer based on the SC/MP processor from National Semiconductors[1]. Nevertheless, the idea that using a computer language like BASIC you could program a computer so that it would solve something like the ABC formula was allmost beyond comprehension. By then I had learned BASIC through a Radio Shack text book, but I had never really entered those mysterious commands on a real computer.
Then came the moment that our local electronic component shop had a Commodor PET computer on display. The shop owner who knew me was so kind as to let me try the machine, and I will never forget how glorious it was to enter and excecute a real BASIC program. How distant these recollections seem in a area where computers are so common.
A machine like the PET or the TRS80 (from Radio Shack) were for beyond the financial means of my parents. It is therfore not difficult to understand my excitement when the electronic magazine Elektuur (Elektor) in 1979 published a Tiny-BASIC interpreter for my SC/MP called NIBL. Around the same period they started a series of monthly tutorials on the BASIC language. The cartoons on this page have been taken from these tutorials. The next few years were spend building a system that would run the NIBL interpreter. It became so to speak the end goal of all my hobby efforts. Remember that I was sixteen with allmost no budget and that it was 1979. I finally succeeded but it never worked very well and by the time I had it working it already had become easier to get access to real computers so I kind of lost interest in the NIBL interpreter.
The SC/MP processor however remained my favourite processer until the mid eightees. When National Semiconductor announced that they would stop production of the SC/MP, I was able to buy a tube full of them for a friendly price so that I would have an "all time stock". Soon afterwards I was introduced to the 8031 family of processors and the SC/MP moved to the background.
Two years ago during a move I again found the tube with the SC/MP processors.
I thought that it would be nice to finally realize my childhood dream and to
make a "powerfull" small SC/MP system with the NIBL Tiny-BASIC interpreter!
If I think back how scarce memory was in those days! Now a single
chip can fill the complete 64k byte memory space. So here it is: A tiny
SC/MP system complete with NIBL just for old-time sake. If you hapen to
have an old SC/MP processor lying around, why not relive your early steps
in microcomputing?
NIBL is a Tiny-Basic interpreter for the SC/MP microprocessor.
The Complete documentation and even the annotated source code may be
found in the Nov./Dec issue of Dr. Dobbs Journal 1976 (Volume 1!) [2].
In the paper, the author Mark Alexander gives us some interesting information
on the origin of the NIBL interpreter. It is interesting to read some
excerpts since they give us a good impression of the state of afairs in the
early microprocessor years, when all the things we are now used to were
very new:
Mark Alexander, National Semiconductor Corp. Nov. 29, 1976
NIBL (National Industrial Basic Language) is a machine oriented programming
language for the SC/MP. It is a language similar to Tiny BASIC, but it also
has some unique features. Many of these features, such as a genuinely useful
control structure (the PASCAL-influenced DO/UNTIL) and the indirect
operator ("@") have been added to the language to allow NIBL to be nearly
as flexible as machine language in such applications as medium speed
process control.
By using NIBL, one trades the high execution speed and low memory consumption
of machine language for some very tangible advantages: Program readebility,
modifiability, and reliability, which are truly difficult to achieve in
machine language programs.
NIBL programs are interpreted by a large (4k byte) SC/MP program that resides
in ROM. The interpreter is broken into two blocks: a program written in an
Intermediate (or Interpretive) Language - I.L. for short - which does the
actual interpretation; and a collection of SC/MP machine language subroutines
invoked by the I.L. program. The I.L. approach is well-documented in
Vol. 1, No. 1 of Dr. Dobb's Journal of Computer Calisthenics and
Orthodontia, and readers should refer to that issue for a more detailed
description of the interpretation process..........
....... NIBL came into this world as an interpreter for Tiny BASIC,
as originally describel in the first issue of Dr. Dobb's Journal. That Program
was written by Steve Leininger, who subsequently left before the program was
ever assembled or executed. The current version of NIBL is an almost complete
re-write of the original interpreter, whith changes and additions being made
to improve the modularity of the program, to greatly increase execution
speed, and to extend the capabilities of the languagee itself.
The program was developed on the PACE Disk Operating System, and was
assembled by a PACE resident cross-assembler for the SC/MP.
The original NIBL program was available in a ROM with type number INS8295. The INS8295 is a programmed version of the INS8332. The datasheet of the INS8295 contains a very usefull summary of NIBL statements and commands which I have reproduced here.
Dana Knight was so kind as to contribute the National Semiconductor Tiny Basic Users Manual to this page.
The SC/MP architecture forces memory to be split into pages of 4K bytes each. The NIBL interpreter resides in the lowest page 0 (#0000-#0FFF). The interpreter requires at least 2K bytes of RAM starting at address #1000 (page 1), of which the interpreter uses nearly 300 bytes for variables, stacks etc., leaving. The rest for the user's program. NIBL uses only 26 integer variables (a severe limitation). The varables are stored as 2 byte two's complements starting at address #101C. So variable A is stored at #101C (high order byte) and #101D (lower order byte), B at #101E (high) and #101F (Low) etc. It is important to know this when interfacing NIBL with machine language routines. NIBL can in total address 7 pages (1-7) of program memory. The first page as we have seen must be in RAM since the interpreter uses part of it for temporary storage. The part used to store the user program starts at location #111E. The other 6 pages can be either ROM or RAM. Page 2 is a special page. On power-up NIBL checks if PAGE 2 contains a valid BASIC program. If so the program is executed immediately. Each of the 7 pages may contain a different program. Editting a program in one page will not effect the programs in the other pages. To switch editing of one page to the other is done by simply typing the PAGE=n command in edit mode. Programs may also be linked to other pages by this command.
The NIBL program was designed to interface with a teletype with paper tape reader and punch for program storage. Since the IO interface is not based on a UART but rely on software to serialize the data, the baudrate can only be changed by modifying the timed delays in NIBL's I/O routines. The baud rate in the standard NIBL program is fixed at 110 baud. Oh and before I forget: NIBL only works with CAPITALS, so put Caps Lock on and save yourself a lot of trouble trying to find out what the devil is going on.
In the May issue of the Dutch version of Elektor (Elektuur) a stand alone NIBL Basic system was presented [3]. It featured a newly designed SC/MP processor card which additionally contained the NIBL interpreter in ROM (INS8295). The card could be used with the 4K byte RAM card from the "standard" Elektor SC/MP system published in 1977.
Although I have the complete assebler listing and a hex dump of the
original NIBL I never took the effort to copy it into EPROM.
Instead I have always used the NIBL-E version.
Unfortunately it was not directly possible to use the NIBL interpreter with the Elektor SC/MP system dating from 1977. The reason was the page 0 was already used by the ELBUG monitor and the HEX I/O addresses. Therefore Elektor in cooperation with D. Hendriksen addepted NIBL so that it would run in page 1. This version of NIBL was called NIBL-E and it was published in the same number as the stand alone BASIC system [4]. Normally the page structure of the SC/MP address structure would have made such a shift of the program faily easy since only instructions concerning pointer manipulations would need modification. However the Intermediate Language (I.L.) approach used in NIBL made things a little bit more complex so that in total, according to the article, some three hundred modifications in the program were required.
Placement of NIBL-E in page 1 meant that one program page was saccrificed. Shifting of the NIBL-E program also meant that the RAM scratch used by NIBL-E is now also shifted from page 1 (#1000-#1FFF) to page 2 (#2000-#2FFF). The "auto-start page" is now shifted to page 3.
Fortunately for me Elektor printed in the NIBL-E article the complete
NIBLE-E hex dump.
I remember how as a boy, with the help of my
mother, I entered all 4096 bytes in my own SC/MP system.
I first made three
photo-copies of the hex dump. My mother after reading a byte to me
would cross-out the byte on paper so as not to make any mistakes. It took
several evenings to enter the complete program! After the whole program had
been entered, I checked the code two times again crossing out the bytes
on the other two photo-copies. Since EPROM's were expensive in those
days I had to save the program on cassette tape which took several minutes.
Also the chance on an error using cassette tapes was quite large so that
I had several tapes as backup. When after a few years 2732 EPROMs became
into my reach, I saved the program in EPROM. Years later when I built the
LAPTOP style SC/MP system I used this EPROM and changed the I/O routines
so that the LED display could be used. There is stayed for about twenty
years. A year ago I checked the SC/MP LAPTOP, and it still worked, but
for how long ? I got a little bit nervous that I would loose the once
so precious NIBL interpreter forever. Fortunately the EPROM programmer
in the SC/MP LAPTOP also still worked so I copied the modified NIBL program
again into a new EPROM. With my current EPROM programmer I was finally
able to save the program forever on my PC. With the aid of the original
Elektor hex listings I restored the original I/O routines. It is this
version that you can download on this page.
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
NIBL was designed to operate with a paper tape reader/puncher for
program storage.
I use the file capture/transmit option of my terminal
emulator for program storage. The terminal emulator I use is SmartTerm
ST240, an somewhat old fashioned program running under DOS.
NIBL tokenizes the commands before storing them in the program memory.
Since the SC/MP is not so fast this takes some time. It is therefore
necessary to add some delay after transmission of each character and
especially after a carriage return. ST240 allows these delays to be set
in the file transmit options menu. Here is a step-by-step recipy
for program storage/loading:
Program Storage:
The existence of a floating point BASIC interpreter for the SC/MP is not widely known. The interpreter was writtend end seventies by Erich Kuster from Krefeld (Germany). The interpreter is about 12 k bytes long and is located in memory locations #D000 to #FEFF. In the SC/MP system described on this webpage I have reserved the upper 16K byte for the floating point interpreter (#C000-#FFFF). The start addres for the interpreter is #DFC1 (execute in NIBL: LINK #DFC1). The scratch pad and the stacks are placed in the upperpart of the 32K byte RAM space (#7C00-#7FFF). This area may be relocated by changing memory location #D006 from #7C into nC in which n represents the new page number. On start-up by default page 1 is chosen as the current program page (PRINT PAGE > 1). Since this page already contains the NIBL interpreter the PAGE number has to be changed to 2-7 before a program can be entered (PAGE = 2). The command set of the floating point interpreter is essentially the same as that of the popular PET Commodore computer without obviously the graphic instructions, and is repeated here.
In May 2023 Erich Küster, who is now retired, found the time to dive into his old notes, and update the FBASIC assembler source code to the latest version 7.9! You can find this latest version on his Github page. On the same Github page you can find the OCR scanned and checked assembler codes for NIBL and NIBLE. Unfortunately, due to lack of time, I didn’t have time to burn the new code in an EPROM and check it, but for sure it is on my list of things to do after my retirement end of this year!
The circuit diagram of the SC/MP microcomputer is rather conventional.
Figure 1 is only meant to give an overview of the circuit. By clicking
in the diagram a detailed diagram in pdf format can be downloaded.
Figure 1 Circuit diagram of the SC/MP microcomputer.
(click on the image to download a detailed pdf file)
A single TC55257 (or pin compatible equivalent) is used to fill the memory
space from #2000-#7FFF. Either a 2716 or an 27512 EPROM may be used by
changing two jumpers. If only the NIBL interpreter is used a 2716 is
sufficient. In case also the floating point interpreter is used a 27512 is
needed. Obviously only parts of the EPROM are used in this case. The good old
8255 is used to provide three 8 bit I/O ports. The SC/MP multiplexes the
highest 4 bits of the address over the databus. They are available when
NADS (Negative ADdress Strobe) is low. A 74HC573 latch is used to store
these 4 bits. The highest 3 address bits are fed into a 74HCT138 3-to-8
line decoder. In this way the total 64K byte memory space is devided into
8K byte blocks (Not to be confused with the 4K byte pages used by the BASIC
interpreters). By ANDing outputs of the 74HCT138 in a four input AND gate
the total address space is assigned to the RAM/EPROM/IO. Table 2a summarizes
the memory mapping used. I only use the 8255 in its simplest mode. Table 2b
summarizes the programming of the control byte for different I/O
configurations.
Figure 2 a. Memory map of the SC/MP Microcomputer, b. programming of the 8255 control register.
The EPROM programmer that I once built, is only suitable for 27(C)16
EPROMs. In order to be able to program also larger EPROMS, I made a small
adapter so that also 27(C)256 and 27(C)4001 EPROMS could be
programmed. Both EPROMS use same programming protocol as the 2716.
The consequence is that I can only program 8K byte blocks at a time
and that for every block the dip-switches have to be set. As a result
the 16K byte floating point interpreter is split over two HEX files:
FBASLO.HEX and FBASHI.HEX. I use a simple converter so that a
27C4001 can be used instead of a 27512.
Figure 3 SC/MP microcomputer on a piece of breadboard.
Although the SC/MP is equiped with a serial
input and output they are not used by the interpreters so that they
can be used by a user application. Instead Flag 0 is used as output and
SENSEB is used as serial input. A standard circuit around the well known
MAX232 is used to bring these signals to RS232 level.
I use the ST240 terminal emulator from SMARTERM running under DOS.
The settings are 1200 baud, 8 bits, no parity. Remember both interpreters
only accept capitals.
The zip file that you can download here contains the following files:
Roger Marin took the effort to extract the original NIBL assembly code
from the original hardcopy listing via OCR and text editor!
The assembly-code was checked by assembling the code using the free-tool
macro assembler "AS" by Alfred Arnold [8],
and comparing the resulting
hex code against the ROM code.
Great job Roger!
download the compressed file here.
Helmut Veit has kindly provided me with a copy of the original ELBUG monitor from Elector!
He also reverse engineered the code and added comments to the listing.
The zip file available for download here contains the following files:
Roger also found a very interesting link for everybody who does not have a SC/MP processor lying around anomore. On "Karen's Microprocessor Projects" [9] site, you will find projects that emulate the MK14 kit as wel as the complete NIBL interpreter on a PIC16F877 processor!. Great site !!
Recently I received the sad news that Karen passed away. Several people have posted nice YouTube videos as a tribute to her work!
The SC/MP and NIBL keeps people facinated, probably for sentimental reasons!
Very recently (june 2015) Mark Owen made a SC/MP emulator on an LPC811 ARM processor
from NXP. He calls it the Pound Shop Basic.
The total circuit consists of one single component, the processor which comes in a tiny 16 pin
TSSOP package. There are three levels of interpretation: The ARM processor interpreting
the SC/MP instructions, the SC/MP interpreting the IL code and NIBL interpreting BASIC.
And still it is faster than the original! Nice project for a rainy sunday afternoon!
Jim from England programmed a complete MK14 emulator in Excel VBA! It comes complete with help instructions and a number of games. If you owned an MK14 once, and would like to re-live that feeling of playing your first computer game you should check it out! You can download the Excel file here, or click on the screen capture below.
Impression of Jim’s MK14 emulator in Excel (download here)
For 2022 Jim also implemented Elektor’s ELBUG and the NIBL and Floating Point BASIC interpreters in his EXCEL SC/MP emulator! You can download the Excel file here.
This is how you start NIBL:
[1] | http://www.bitsavers.org/pdf/national/_dataSheets/SCMP_dataSheet.pdf |
[2] | Alexander, Mark, "NIBL --Tiny Basic for NAtional's SC/MP Kit - complete documentation and annotated source code", Dr. Dobb's Journal of Computer Calisthenics and Orthodontia, Vol. 1 Nov./Dec. 1976, pp. 331-347 |
[3] | "BASIC microcomputer - een SC/MP-microcomputer met BASIC-interpreter", Elektuur, no. 187, mei 1979, pp. 5.54-5.62 |
[4] | "NIBL-E - een BASIC-interpreter voor het Elektuur SC/MP-systeem in samenwerking met D. Hendriksen", Elektuur, no. 187, mei 1979, pp. 5.63-5.66 |
[5] | Taphoorn, W.H. "NIBL 1200 GT - via Geheugen-Transplantatie naar 1200 baud", Elektuur, no. 219, januari 1982, pp. 1.64-1.65 |
[6] | Langenberg, A. "BASIC kalender", Elektuur, no. 207, januari 1981, pp. 1.63 |
[7] | http://mymk14.co.uk/ |
[8] | http://john.ccac.rwth-aachen.de:8000/as |
[9] | http://techlib.com/area_50/Readers/Karen/micro.htm#PICL |
[10] | The SCMP Technical Description; contributed by Dana Knight. |
[11] | The National Semiconductor Tiny Basic Users Manual; contributed by Dana Knight. |
[12] | Microcomputer Digest Sept. 1975; contributed by Dana Knight. |
[13] | Microcomputer Digest Jan. 1977; contributed by Dana Knight. |
[14] | Implementation of a Hardware-Optimized MPI Library for the SCMP Multiprocessor, a master thesis by Jeffrey Hyatt Poole; contributed by Dana Knight. |
[15] | Erich Küster’s Github page containing the assembler and hex code for the latest fbasic version 7.9, as well as the assembler and hex codes for NIBL and NIBLE. |