Installing and running BP1

‘BP1’ is the ear­li­est ver­sion of Bol Processor imple­ment­ed in 1981 on Apple II com­put­ers… The name ‘Bol proces­sor’ is anal­o­gous to ‘word proces­sor.’ Its devel­op­ment was trig­gered by Jim Kippen’s wish to type rapid­ly and accu­rate­ly tran­scrip­tions of the North Indian tabla drum’s themes and their sets of vari­a­tions, which are typ­i­cal­ly expressed in syl­la­bles: bols. The solu­tion lay in the cus­tomiza­tion of the computer’s key­board, assign­ing a sin­gle key to every bol.

Bols are ono­matopoe­ic rep­re­sen­ta­tions of strokes on the drum, or move­ments of Kathak dancers. For instance, ‘dha’ would be assigned to the ‘Q’ key instead of typ­ing ‘d’, ‘h’, ‘a’. With this device, it became pos­si­ble to type vari­a­tions of tabla com­po­si­tions near the speed they were played or recit­ed. This also elim­i­nat­ed the mis­spelling of sym­bols and ren­dered a for­mal analy­sis fea­si­ble. The next stage of devel­op­ment was trig­gered by the need for a “search and replace” fea­ture in the Bol Processor. We soon dis­cov­ered that mod­el­ling the theme-and-variations con­struc­tion involved more than replac­ing vari­ables with chunks of bols. This con­struc­tion (qai­da in Urdu) was based on implic­it rules that could be ren­dered explic­it using for­mal gram­mars. Thus, Bol Processor became an expert sys­tem able to mod­el the pro­duc­tion (modus ponens) of strings of sym­bols as well as the analy­sis (modus tol­lens) of vari­a­tions cre­at­ed by musi­cians to assess their com­pli­ance with the for­mal gram­mar. Furthermore, the repet­i­tive nature of musi­cal struc­tures led to the imple­men­ta­tion of pat­tern gram­mars. This approach has been described in Kippen and Bel’s Modelling music with gram­mars: for­mal lan­guage rep­re­sen­ta­tion in the Bol Processor.

It appeared that key­board map­ping was not pos­si­ble in 1981 using the then Apple Writer II word proces­sor. Moreover, in a way it was very for­tu­nate because it prompt­ed us to design a tool which for 40 years has gone way beyond the objec­tive of a cus­tomized key­board. We planned to cre­ate a bicy­cle but in the end it turned out to be a spaceship!

Recently we dis­cov­ered with delight that BP1’s pro­gram, source code, com­pil­er and data flop­py disks used for this project had been safe­ly stored. After more than 37 years these diskettes were eas­i­ly copied and trans­ferred to a hard disk in the DSK for­mat with the kind sup­port of Philippe M., a col­lec­tor of old com­put­ers and soft­ware in Marseille. This means that BP1 can be run on any Apple II emu­la­tor run­ning on MacOS, Linux, and Windows machines.

The source code could even be recom­piled to run under bet­ter con­di­tions, notably exploit­ing mem­o­ry space beyond the orig­i­nal 64 kilo­bytes – indeed, kilo­bytes! Currently, even set­ting the RAM of the vir­tu­al machine at 1Mb does not increase the mem­o­ry space for BP1.

This first arti­cle is about installing an emu­la­tor and edit­ing grammars/data in BP1. The next one explains the full usage of this pro­gram in its orig­i­nal musi­cal context.

For those unfa­mil­iar with the project, Bol Processor (BP2) also exists as a Mac appli­ca­tion for sys­tem ver­sions up to MacOS 10.14 (Mojave) — read the home page of this site. We are cur­rent­ly devel­op­ing a new ver­sion com­pli­ant with MacOS, Linux, and Windows with both 32-bit and 64-bit Intel processors.

Choosing an emulator

So far we have run BP1 on the fol­low­ing emulators:

Given that all these emu­la­tors proved sat­is­fac­to­ry, we assume that any emu­la­tor cre­at­ing an Apple IIe or Apple IIc vir­tu­al machine will do the job. You may there­fore install as well:

The set­up of any Apple II emu­la­tor is rough­ly the same pro­ce­dure. In this arti­cle we describe it for VIRTUALII with a “lim­it­ed license” (cost­ing less than 20 USD). Other emu­la­tors list­ed above are free of charge.

Installing a ROM

In Apple II com­put­ers, the core sys­tem was stored in a sol­id device (Read-Only Memory) which made it almost impos­si­ble to clone these machines. On the vir­tu­al Apple II cre­at­ed by an emu­la­tor, the ROM is a piece of soft­ware which (for com­mer­cial rea­sons) can­not be sup­plied along with the emu­la­tor. You need to down­load it from an autho­rized site. The good news is that this is free of charge.

We down­loaded ROMS from this site:

https://mirrors.apple2.org.za/ftp.apple.asimov.net/emulators/rom_images/

Download and unzip “apple2_roms.zip”. In the “apple2_roms” fold­er, “apple_iie_rom.zip” and “apple_iic_rom.zip” need to be unzipped to pro­duce APPLE2E.ROM and APPLE2C.ROM. Both are suit­able to BP1. No need to cre­ate an old­er Apple II because you would miss 80-column dis­play and upper/lower cases!

Starting VIRTUALII on MacOS makes it clear that a ROM file is missing:

The ROM file(s) you down­loaded shall be placed in a spe­cif­ic fold­er. Select “Show ROM fold­er” in the “File” menu to open it, then drag APPLE2E.ROM into this fold­er and restart the emu­la­tor. Include APPLE2C.ROM if you plan to emu­late an Apple IIc.

You may need to select “Create a New Machine” in the “File” menu until you get the true Apple IIe start­up screen:

Starting an Apple IIe on VIRTUALII
CATAKIG’s blank screen

The same pro­ce­dure applies to CATAKIG emu­la­tor on MacOS. An amus­ing (or irri­tat­ing) fea­ture, how­ev­er, is the dis­play of a blank TV screen with white noise. Those born in the age of cathod­ic tele­vi­sion will guess that this indi­cates the com­put­er has not yet been switched on… No hope find­ing the switch. 😣 Young geeks will dive into the doc­u­men­ta­tion to find out that it is switched on by hit­ting the space bar! 😀

Again you will be told that a ROM file is miss­ing. The “ROMs” fold­er lies near the appli­ca­tion “Catakig.app”. Drag APPLE2E.ROM and restart CATAKIG. You still need to hit the space bar and select “New Apple II” in the “File” menu, Choose “Apple IIe”… and once again hit the space bar!

At last, the old good Apple IIe start­up screen is displayed:

CATAKIG’s Apple IIe start­up screen. I pre­fer the ver­sion of VIRTUALII repro­duc­ing the green col­or of mon­i­tors in the 1980s. 😉

Setup pro­ce­dures are prob­a­bly iden­ti­cal when run­ning emu­la­tors on Windows and Linux machines.

All we need now is to “insert a disk”! This is done by select­ing “Insert Diskette Image” in the “Media” menu of VIRTUALII, or “Load Disk Drive 1” in the “Peripherials” menu of CATAKIG .

Available floppy disk images

All BP1 flop­py disks can be down­loaded from this folder:

https://bolprocessor.org/misc/BP1/

  • BP-PRG.DSK is BP1’s pro­gram disk that needs to be insert­ed first.
  • BP-BB.DSK, BP-JULY87.DSK, BP-OCT88.DSK and BELFAST.DSK are grammar/data disks used by the program.
  • BPSOURCES.DSK con­tains the assem­bly 6502 source code which may be recom­piled using BIGMAC.DSK.

Running BP1

Insert BP-PRG.DSK. This will imme­di­ate­ly launch BP1. After “Loading DOS in high mem­o­ry” (which old goats will under­stand) you get the reward­ing message:

Press the CAPS LOCK key because most com­mands require upper­case hits.

You are told to “wait”… It real­ly takes time because the emu­la­tor is run­ning at the speed of a real Apple II. On VIRTUALII you even hear sounds of flop­py disks! Fortunately, all emu­la­tors offer the option of run­ning appli­ca­tions at high speed. This is most con­ve­nient for BP1 unless you are nos­tal­gic for the squeaks of diskette drives!

Once the disk has stopped spin­ning you will see:

BP1 ran on a sin­gle disk dri­ve — the in-built dri­ve of the Apple IIc we used in field research. This means that the entire pro­gram stays in mem­o­ry. So, you can remove the start­up disk and insert a data disk. On VIRTUALII you first need to select “Eject Disk” in the “Media” menu to make the first dri­ve avail­able. Once this is done, select “Insert Diskette Image” in the “Media” menu and take for instance “BELFAST.DSK”. Then hit <return>… BP1’s main menu is displayed:

All com­mands are acti­vat­ed with upper­case keys. The “Slot num­ber” option should remain “1” since we are using a unique disk drive.

We will now vis­it basic edit­ing com­mands in BP1. A detailed expla­na­tion of its oper­a­tion as an “expert sys­tem” will be post­ed shortly.

Since a grammar/data disk has been loaded you can hit the “L” key, yield­ing again Load/Save/Quit options, then dis­play­ing the con­tent of the BELFAST disk:

Content of ‘BELFAST.DSK’

Hit up/down arrows then <return> to select, for instance, “Q.2.4” (gram­mars). Unless you opt­ed for high speed, it will take some time to read the files… You will be offered the option of load­ing data. Say “No”.

Now the menu is more detailed:

Menu for gram­mar Q.2.4 of ‘BELFAST.DSK’

At this stage we will only check how to edit a gram­mar. Hit the “G” key, then the “down” arrow until “SUBGRAMMAR #3” appears at the top of the menu:

Menu for edit­ing sub-grammar #3 of gram­mar Q.2.4

Technical detail: until now we have been run­ning a frame­work of BP1 writ­ten in AppleSoft BASIC lan­guage. We will next enter pure 6502 code after hit­ting the “E” key:

Entering BP1’s edi­tor (in pure 6502 code)

The edi­tor dis­plays one rule at a time. At the top we find the “RND” instruc­tion telling the infer­ence engine that the fol­low­ing rules should be picked up ran­dom­ly. Hit the “down” arrow to reach rule #14:

Commands [B]eginning, [E]nd etc. are accessed via the “con­trol” key — left­most down a Mac key­board. When using VIRTUALII, all “Print” com­mands pro­duce a PDF file that can be dis­played and export­ed: click the ImageWriter print­er on the right side of the screen.

Left and right arrows move the cur­sor to insert or delete sym­bols. Note that the cur­sor jumps over reserved words and ter­mi­nal sym­bols such as “dha”, “tira”, “kita” etc., which was the ini­tial rai­son d’être of a Bol Processor:

Cursor move­ment in BP1’s editor

In this exam­ple, “A3” is a vari­able. Variables appear in invert­ed con­trast and are gen­er­al­ly dis­played in upper­case (though this is not com­pul­so­ry) where­as ter­mi­nal sym­bols are dis­played in low­er­case with nor­mal con­trast. To type a vari­able, first hit the <quote> key, then type its name and hit <return> or <quote> once again. There was more flex­i­bil­i­ty in nam­ing vari­ables in BP1 than in BP2 because they were tok­enized… For instance:

Since BP1 was first devel­oped on the Apple II (not Apple IIe), it expects only upper­case key­board input for com­mands. The “caps lock” key will def­i­nite­ly be help­ful to this respect.

Note that typ­ing “Q” in the edi­tor inserts “dha”, “Z” inserts “ghi” etc. To see (and mod­i­fy) the key­board map­ping, first quit the gram­mar edi­tor (typ­ing ctrl-Q) then “Q” again to return to the main menu. Select “Alphabet”, then “Modify”:

Keyboard map­ping in BP1

At the bot­tom of the screen, the “Which key?” mes­sage prompts you to select a key and change its map­ping. Unmapped keys are assigned a peri­od which is a blank sym­bol in BP1 syn­tax. Hitting <return> or the space bar quits the key­board map­ping edi­tor. Mappings can be saved. This makes it pos­si­ble for instance to assign “dha” to “Q” on an English key­board and to “A” on a French key­board. Keyword map­ping has no effect on gram­mars and data. It is only used to facil­i­tate typing.

Now you can try to load “Q.3.2 (data+grammars)” and reply “Y” to “Load data?”. Back to the main menu, select “Data”, then “Edit/compute”. Move down to data #3:

If you are using VIRTUALII, for fun you can check “Speak Text Screen” in the “View” menu. The whole piece will be recit­ed in English pro­nun­ci­a­tion which has lit­tle in com­mon with its ren­der­ing by tabla players!

More seri­ous­ly, note that ter­mi­nal sym­bols are chun­ked and spaced by groups of 6 units reflect­ing the “speed” of this musi­cal piece. How is this set up? The trick is revealed after hit­ting the right arrow:

Now the rhyth­mic and syn­tac­tic struc­ture of this item are explicit:

  • “6” in the begin­ning means that chunks of 6 ter­mi­nal sym­bols should be dis­played. This was called bol den­si­ty.
  • “/4/4/4/4” indi­cates that 4 chunks should be placed on every line, there­by match­ing the rhyth­mic pat­tern called tin­tal in India music.
  • These rhyth­mic con­ven­tions have been revised in BP2. Today we should write “4+4+4+4/6” instead of “6/4/4/4/4”. This is the con­ven­tion fol­lowed in our paper.
Printed exam­ple: pat­tern rule
  • Brackets, dia­mond signs (◆) and return (↵) signs denote the syn­tac­tic struc­ture of the piece. A dia­mond sign is the mark­er of a “mas­ter” string and a return sign a mark­er of its “slave” copy. Their asso­ci­a­tion is called a pat­tern. In print­ed ver­sions of gram­mars and in Mac ver­sions of Bol Processor, these signs have been replaced with “=” and “:” respectively.
  • The aster­isk sign (*) tells that the con­tent of the fol­low­ing brack­et is a homo­mor­phic tran­scrip­tion of its mas­ter. For instance, the voiced “dhin--dhagena” is repro­duced as the unvoiced “tin--takena”. Tabla drum­mers name this trans­for­ma­tion khuli/band which means “open” and “closed”, refer­ring to the res­o­nance that makes a phoneme “voiced”. In BP2, sev­er­al homo­mor­phisms can be defined on the same alphabet.
  • Moving the cur­sor over the struc­tured piece high­lights the ref­er­ence (“mas­ter”) string rul­ing every “slave” copy as shown on the pic­ture below. Changing a “slave” string is impos­si­ble as it would break the pat­tern. There is actu­al­ly no space in mem­o­ry for “tin--takena ta--…”:
When the cur­sor reach­es the mark­er of a “slave” string, its “mas­ter” ref­er­ence is highlighted…

Editing patterns

As shown in the pre­ced­ing image, strings delim­it­ed by brack­ets can be copied or “mir­rored” auto­mat­i­cal­ly using “mas­ter” and “slave” mark­ers. A string start­ing with a dia­mond sign (◆) is a “ref­er­ence”. This sign is pro­duced by default when typ­ing an open­ing brack­et. To cre­ate a mir­ror of this expres­sion, open a brack­et and hit the “<” and “>” keys until the desired ref­er­ence is highlighted.

The ref­er­ence can be any­where on the left of the “slave”, and it may in turn be a pat­tern con­tain­ing oth­er ref­er­ences. In the fol­low­ing exam­ple, choice is giv­en to copy­ing “dha--”, “dha­ge­na”, “dhin--” as well as “dha­ge­na dha--”:

If the mir­ror is a homo­mor­phic tran­scrip­tion of its ref­er­ence, type “*” before the open­ing bracket.

Once a pat­tern has been defined, any mod­i­fi­ca­tion of a ref­er­ence expres­sion (“mas­ter”) is imme­di­ate­ly mir­rored in its copies (“slave”).

Patterns are defined in sub­gram­mars gen­er­al­ly at a high lev­el of the struc­ture. For this rea­son, Bol Processor gram­mars are a class of pat­tern gram­mars.

Pattern edit­ing was a great achieve­ment of BP1’s inter­face. Entirely designed in 6502 machine lan­guage, its imple­men­ta­tion took more than 3 months full-time, asso­ci­at­ed with instant mem­o­ry defrag­men­ta­tion… Memory was a crit­i­cal lim­i­ta­tion: type ctrl-F in the edi­tor to check the few “bytes left”!

Keyboard shortcuts

Keyboard short­cuts depend on the com­put­er set­tings. The fol­low­ing have been checked on a Mac French (AZERTY) keyboard:

  • ORD is entered as alt+/ or “ORD”
  • RND is entered as ¨RND”
  • LIN is entered as alt+j or “LIN”
  • <-> is entered as alt+,
  • <-- is entered as alt+c
  • --> is entered as alt+b
  • S is entered as alt+i or “S”
  • TEM is entered as alt+h or “TEM”

More fun?

Explaining the intri­ca­cies of rhyth­mic and syn­tac­tic pat­terns of tabla com­po­si­tions is beyond the scope of this arti­cle. Read for instance Kippen and Bel’s paper for a detailed pre­sen­ta­tion of Bol Processor refer­ring to the musi­cal con­text of drum play­ers. We hope that this intro­duc­tion will be suf­fi­cient for mas­ter­ing the edit­ing pro­ce­dures of BP1.

DOS 3.3 com­mands are doc­u­ment­ed on this page. After quit­ting BP1 you may for instance restart it with the com­mand “RUN BOL PROCESSOR”, or type “CATALOG” to list the con­tent of the disk.

Type “LOAD BOL PROCESSOR” then “LIST” to dis­play the BASIC frame­work of BP1. For instance:

Part of the AppleSoft BASIC code of BP1’s frame­work, after typ­ing LIST 100-1000.

Contributors to this arti­cle: Bernard Bel

Leave a Reply

Your email address will not be published. Required fields are marked *