H P - 4 1 B U F F E R S Just to show I haven't forgotten about the HP-41, here is an article about HP-41 buffers. I mentioned many months ago that such an article should be written, and somehow people got it into their heads that this meant I would write it myself! Early this year Jeremy Smith sent us a list of HP-41 accessories which create buffers, John Bruce said I was just the person to write such an article, and later Frans de Vries gave me the first four issues of the Dutch journal NUTS, with articles on buffers in the first two issues. Then Mark Power submitted a collection of mcode buffer control routines to DATAFILE . This led to an editorial suggesting I would explain buffers soon, and when our esteemed and large editor threatened to sit on me I surrendered. In fact I did so in style and offered more than one article; this is only the first! EARLY DAYS When HP announced the HP-41C in 1979 they provided several articles about it for publication in the PPC Journal. The article in the September 1979 issue (V6N6p20) included a diagram of the HP-41C Data Structure, or memory. The lower part of that diagram looked something like this: | LAST | | PROGRAM | | IN CAT 1 |<---Scratch area |- - - - -| pointer to | | final END | | | EMPTY | | SPACE | |- - - - -| | BUFFER | | AREA | |- - - - -| | KEY | | ASSIGNMENTS | Address 192 |_____________| . . . EMPTY ADDRESS SPACE . . _____________ | | | SCRATCH | |_____________| The description of the "scratch" area was misplaced in the PPC Journal article, it should come directly below this diagram, together with a diagram of the "scratch" area - which we now call the "status registers". The empty address space is now partly used by the first piece of Extended Memory. The buffer area was described like this: "Following the key assignment area is a buffer area. To date this area has not been used and thus always has zero length." Even though there was no use for the buffer area at first, the HP-41 operating system already had instructions to check this area and clear it out if need be. When the PPC ROM was produced, the buffer area was still not used by any product announced by HP, and as a result some PPC ROM programs assume that only key assignments will be found in this area. Soon after, HP announced a range of new products for the HP-41, including the Time module which for the first time used the buffer area, and whose alarms stored in this area could be disrupted by the PPC ROM. (Later on in this set of articles I plan to show what can be done about that problem.) From there on, more and more products which use the buffer area were introduced by HP and later by independent manufacturers. This article is an attempt to sum up the current situation concerning HP-41 buffers. WHY "BUFFERS"? I suppose most computer users have a vague idea that the word "buffer" must be related to buffers on railway stations, but it is interesting to learn more about the word. Originally, to "buff" meant roughly the same as to "puff"; both words sound like blowing, and to buff meant to blow. This still exists in some words, for example South-East England was recently "buffeted" by strong winds. The word then came to mean to hit or strike - we use a similar figure of speech when we say "to strike a blow", in particular it meant to strike a soft inflated body. Next came the saying "to stand buff" which meant to withstand a blow, and so "to buff" came to be used on its own to mean to stand up to being hit, or to absorb a blow. In 1835 a patent was presented for a "buffing apparatus" which would stop a train at a station by absorbing the train's impact. In the same year the word "buffer" was used used in another patent application for equipment which would stop a train - "the shock is harmless when distributed over the interval necessary for the pushing in of the buffer." This use was taken into subjects other than railway engineering. For example in chemistry a buffer solution absorbs an acid or alkali, in politics a buffer state separates two other countries: Poland was a buffer state between Russia and Germany after the First World War and absorbed blows from both countries. In early computers, a "buffer" or a "buffer area" was a storage area between two units used to compensate for the different speeds at which the units could handle data. Thus a print buffer would absorb data which was coming in too fast for a printer to handle. This meaning is still used, but a computer buffer is more generally any area of memory used to store information temporarily, especially during transfers. That is the meaning of the "buffer area" of the HP-41, and this area is often called the "I/O buffer area", though that is not always strictly true. I collected much of this information from dictionaries, and it is fascinating how many other meanings the word has. In early electronic computers it had other meanings too, for example it could mean a diode. Anyway, back to the 41. USES OF THE BUFFER AREA. The Time module does not use the buffer area to transfer information, only as a storage place for temporary information - specifically the alarms. These are temporary because they will eventually become activated and will presumably be cancelled, although I am not sure how "temporary" you would consider an alarm to be if it is not due to go off until December 2199. The alarms are temporary in another way though; if you remove the Time module and turn on the 41 they will be cancelled because if the module is not there then presumably they are of no use. The same is true of other modules - remove the module which owns the buffer and turn the 41 on: its buffer will be deleted. This can be avoided with a bit of SP as I shall describe in another article. After the Time module came some which do use the buffer area for Input/Output, such as the Plotter and the HP-IL Development modules, but others use this area for temporary storage. The buffer area can contain more than one buffer, each buffer begins with a header register at the bottom; this identifies the owner module and gives the buffer's length. The general layout of a buffer header is: nybble: 13 12 11 10 9 8 7 6 5 4 3 2 1 0 contents: I I N N X X X X X X X X X X II is the buffer identifier, NN is its size (the number of HP-41 registers it occupies, including the header register) stored as a hexadecimal number, XXXX can be information used by the module or it can be unused. If you are unsure about registers, nybbles and so on, I suggest you read back numbers of DATAFILE or some other journal, or get my book "Extend Your HP-41." Whenever you turn on the 41 or PACK one of the first things the 41 does is to look through the key assignment area and buffer area. Any register which has Fn in II is taken to be a key assignment register and is deleted if both assignments in it have been cancelled, otherwise it is left alone (n can be any value from 0 to F, but in key assignments created normally it is always a 0). Any other register which has something other than 00 in II has that changed into I0, then the HP-41 uses NN to find the next buffer header. Clearly if NN is 00 then the HP-41 locks up as it keeps checking the same header for ever. When a register with 00 in II is found, the search stops. Then the HP-41 gives each plug-in module a chance to recover its buffers by turning I0 back into II, after this any buffers with a zero still in nybble 12 are deleted. BUFFER IDENTIFIERS. Here is a list of buffer identifiers and the modules which own each one. The modules can be ones made by HP, or modules EPROM sets made by third parties. Clearly anyone with their own mcoding equipment and the necessary knowledge could set up their own buffers too, but I cannot cover all such private buffers. Buffer Module/EPROM Buffer used for: id. 11 David Assem Mcode labels that already exist 22 David Assem Mcode labels referred to but not yet declared 33 RSU-1B ASCII file pointers 44 RSU-1A Data file pointers 55 CCD module random no., matrix info., bin/hex word size 55 Advantage ROM same as CCD module buffer 66 Ext IL (Skwid) accessory id. of currently used device 07 Ext IL (Skwid) print cols. number & width; temp. buffer - id 07 not 77 AA Time module Time module alarms BB Plotter module plotter data and barcode parameters BB Monitor 1A see below, Monitor 1A was an early version of IL Devel CC IL Devel IL buffer and monitoring of IL loop CC CMT-200 I/O buffer for CMT-200 digital data acquisition unit DD CMT-300 status information for CMT-300 programmable multimeter EE Advantage ROM INTEG & SOLVE parameters (see below for special notes) EE Datafile data file pointers Fn HP-41 Key assignments (n is normally 0, but does not have to be). I got a lot of this information from articles by Frans de Vries (where in turn refers to my book "Extend your HP-41", so this is a circular reference) and from Jeremy Smith - many thanks to them both. Please tell me if you know details of any buffers I have missed, such as perhaps the I-code EPROM set or the SKWID barcode ROM both of which I think must use buffers. All these buffers are stored inside the HP-41. Some devices such as printers, have their own buffers built into those devices, not in the 41. Next time I plan to describe what some of the HP-41 buffers do, especially ones that behave unusually, such as the Advantage buffers which lie below the key assignments. Wlodek Mier-Jedrzejowicz