minid—a basic program to assist in the optical identification of minerals in thin section

13
Computers & Geo.wlences Vol. 15. No, I. pp. 121-133. 1989 00q8-3004 80 $3 00 -,-- 0.00 Pnnted m Great Britain. All rights reserved Copyright ( 1989 Pergamon Press pie MINID A BASIC PROGRAM TO ASSIST IN THE OPTICAL IDENTIFICATION OF MINERALS IN THIN SECTION MALCOLM REEVES Department of Geological Engineering. University of Saskatchewan. Saskatoon. Saskatchewan. Canada S7N 0WO (Received 5 December 1987; revised 22 June 1988) Abstract--MINID is an interactive BASIC program, with various 808688 assembler code routines, it is designed to assist in the optical identification of minerals in thin section. The user is prompted for observations and all minerals which cannot display the property observed are eliminated from a list of possibilities. Eventually MINID identifies a single mineral or generates a limited list of remaining possibili- ties. The MINID database is compact and all comparisons are performed as logical rather than arithmetic operations. MINID has extremely fast interactive response and can store properties for up to 255 minerals. The program runs on a variety of IBM PC compatible microcomputers using a number of readily available BASIC interpreters and compilers. Kc.v tl'ord~: Mineral identification. Optical mineralogy. Compact database, IBM PC. INTRODUCTION The optical idcntilication of minerals in thin section is a routine skill to be acquired by all students of geol- ogy. Traditionally, in the early stages of learning, frequent reference must be made to classic texts con- raining tables or lists of optical properties (e.g. Rogers and Kerr, 1933; Zoltai and Stout, 1984). These methods have undergone little cha, nge in principle through a period of several decades. With the advent of cheap desktop microcomputers, much of this early routine reference work can be speeded up by use of an on-line, interactive database. MIND is a program that originally was written for a Z-80 based S-100 system in 1979 (Reeves and Lucas, 1980) and has been ported recently to the 8086/88 based IBM PC com- puter and compatibles. MINID FILE DESCRIPTIONS MINID is a menu or command-line driven, inter- active, modular program, written in BASIC which manipulates a mineral property database. The data- base is loaded as two files: SMINS.DAT contains ASCII text mineral names separated by commas. The order of these names is significant. A mineral name list is given as Appendix I. SPROPS.DAT contains the property data for the minerals in a compact binary form which will be explained later. The MINID package comprises a series of pro- gram files and support files which have been compac- ted into an archive for distribution to users. An arch- ive, in this context is a specially compressed file which can be expanded readily. Several different program files are provided in the MINID distribution archive. MINII).BAS is an MS-BASICA version of MINID stored in "tokenized'" form. (When storage was limited on PCs, many of the early BASIC inter- pretcrs stored keywords as single "extended" ASCII codes or "*tokens" rather than as ASCII text, to save space.) MINID.ASC is a raw ASCII version of MINII).BAS which can be viewed or edited with a any standard ASCII text formatter or editor. MINID.TBO is an ASCII version of MINID.BAS modilied to compile in Turbo BASIC. The differences between the two versions is minimal and all differences are "flagged" clearly in the file. MINID.EXE is the Turbo BASIC compiled exe- cutable. This is the largest file in the archive and is t:aster than running MINID through an interpreter. (This added speed is not necessary even for interactive use. ) MINID.DOC is a documentation file explaining the operation and installation of MINID. MINID.ASM is the source listing for the assemb- ler code routines. Within MINID.BAS (and other versions of the main program) a series of 8086/88 assembler code routines are stored in DATA state- ments. The BASICA source code is listed in Appendix 2. The assembly code routines are listed in Appendix 3. MINID EXECUTION SEQUENCE When MINID is executed by a BASIC interpreter or compiler, it loads a number of assembler code rou- tines into memory (starting at code segment offset $F000). The assembler code routines which are used to manipulate the property database and comprise: BAND--a routine to AND data with a buffer. 121

Upload: malcolm-reeves

Post on 25-Aug-2016

215 views

Category:

Documents


3 download

TRANSCRIPT

Computers & Geo.wlences Vol. 15. No, I. pp. 121-133. 1989 00q8-3004 80 $3 00 -,-- 0.00 Pnnted m Great Britain. All rights reserved Copyright ( 1989 Pergamon Press pie

MINID A BASIC PROGRAM TO ASSIST IN THE OPTICAL IDENTIFICATION OF MINERALS IN THIN SECTION

MALCOLM REEVES Department of Geological Engineering. University of Saskatchewan. Saskatoon. Saskatchewan.

Canada S7N 0WO

(Received 5 December 1987; revised 22 June 1988)

Abstract--MINID is an interactive BASIC program, with various 808688 assembler code routines, it is designed to assist in the optical identification of minerals in thin section. The user is prompted for observations and all minerals which cannot display the property observed are eliminated from a list of possibilities. Eventually MINID identifies a single mineral or generates a limited list of remaining possibili- ties. The MINID database is compact and all comparisons are performed as logical rather than arithmetic operations. MINID has extremely fast interactive response and can store properties for up to 255 minerals. The program runs on a variety of IBM PC compatible microcomputers using a number of readily available BASIC interpreters and compilers.

Kc.v tl'ord~: Mineral identification. Optical mineralogy. Compact database, IBM PC.

INTRODUCTION

The optical idcntilication of minerals in thin section is a routine skill to be acquired by all students of geol- ogy. Traditionally, in the early stages of learning, frequent reference must be made to classic texts con- raining tables or lists of optical properties (e.g. Rogers and Kerr, 1933; Zoltai and Stout, 1984). These methods have undergone little cha, nge in principle through a period of several decades. With the advent of cheap desktop microcomputers, much of this early routine reference work can be speeded up by use of an on-line, interactive database. M I N D is a program that originally was written for a Z-80 based S-100 system in 1979 (Reeves and Lucas, 1980) and has been ported recently to the 8086/88 based IBM PC com- puter and compatibles.

MINID FILE DESCRIPTIONS

MINID is a menu or command-l ine driven, inter- active, modular program, written in BASIC which manipulates a mineral property database. The data- base is loaded as two files:

SMINS.DAT contains ASCII text mineral names separated by commas. The order of these names is significant. A mineral name list is given as Appendix I.

SPROPS.DAT contains the property data for the minerals in a compact binary form which will be explained later.

The M I N I D package comprises a series of pro- gram files and support files which have been compac- ted into an archive for distribution to users. An arch- ive, in this context is a specially compressed file which can be expanded readily. Several different program files are provided in the M I N I D distribution archive.

MINII) .BAS is an MS-BASICA version of M INID stored in "tokenized'" form. (When storage was limited on PCs, many of the early BASIC inter- pretcrs stored keywords as single "extended" ASCII codes or "*tokens" rather than as ASCII text, to save space.)

MINID.ASC is a raw ASCII version of MINII) .BAS which can be viewed or edited with a any standard ASCII text formatter or editor.

MINID.TBO is an ASCII version of MINID.BAS modilied to compile in Turbo BASIC. The differences between the two versions is minimal and all differences are "flagged" clearly in the file.

MINID.EXE is the Turbo BASIC compiled exe- cutable. This is the largest file in the archive and is t:aster than running M I N I D through an interpreter. (This added speed is not necessary even for interactive use . )

M I N I D . D O C is a documentat ion file explaining the operation and installation of MINID.

MINID.ASM is the source listing for the assemb- ler code routines. Within MINID.BAS (and other versions of the main program) a series of 8086/88 assembler code routines are stored in DATA state- ments.

The BASICA source code is listed in Appendix 2. The assembly code routines are listed in Appendix 3.

MINID EXECUTION SEQUENCE

When M I N I D is executed by a BASIC interpreter or compiler, it loads a number of assembler code rou- tines into memory (starting at code segment offset $F000). The assembler code routines which are used to manipulate the property database and comprise:

B A N D - - a routine to A N D data with a buffer.

121

122 M.R.~F,'Es

Table 1. MINID startup and help screen

i MINID - mineral identification in thin sectian i

i

MODE cemmands allow : r

!II - IDENTIFICATI[IN [ liE - ENTRY/EXAMINATION

i PROFEI~TY cc~mands allow user data entry in any order

, i/CO - colour I/SH - shade /RE - relief I/IN - blrefringence JDI - dispersion I/2V - 2v angle i i/OP - optic sign I/CL cleavage '/EX - extinction angle /~J twinning i JUN - uniaxial/biaxial l~u pleochroism I i/CR - orientation /FO form i

UTILITY ccnTnands allow he user flexibility to recover errors

!/Q - save and quit /~R- save and restart possible minerals J I/P [ZH display help screen

DATA ~FfRY requires ursor return on t~ appropriate line

[ Any key to continue :

DBOR a routine to OR data with a buffer. B A N D I T - - a routine to initialize the A N D buffer.

B O R I T - - a routine to initialize the OR buffer. C O U N T . - a routine to count mineral possibili-

ties. M E M C L . - a routine to clear a specilic ;trc:t of

memory.

After the assembler code routines are loaded, M I N I D uses M E M C L to clear storage space for the property database and proceeds to read the M I N I D

names file (M ! N I D. DAT) and M I N I D properties file (SPROPS.DAT) into memory.

Next. M I N I D displays the help screen shown in Table I. When the user enters a carriage return, M I N I D enters the default mineral I D E N T I F I C A - T I O N mode displaying the screen in Table 2.

The user may take over control by entering a command prefaced by " / " or select one of the menu options. The command line override is available at all times. The alternative to mineral identitication made (/I) is mineral entry/examination mode (/E).

Table 2. MINID identitication mode screen

r MINID - mineral identification in thin section I J

',CURRENt ACTIVE MODE CI/RRDrP FROPE~TY :C~JRRENT MINE~ALCS )

: IDENTIFICATION : CO[/~JR : 144

Colaurless Blue Purple Red Brown Green 3range Yellow Pink Gray Not observed

0 1 "2

3 4

5 6 7 8

9 w

<<<

'MODE (I3MMANDS : /I /E MTILITY COMMANDS : /O /P /R /H PROPERTY C[]MMANDS : /CO ISH /RE /IN /DI 12V IOS

/CL /EX /'I"%; /UN /PL /CR /PO i

Optical identification of minerals 123

IDENTIFICATION MODE

In 'I mode the user is guided through a series of PROPERTY menus. For each property a list of ATTRIBUTES are displayed. The user is required to use the cursor keys and enter a carriage return where the attribute has been observed.

For example, Table 2 shows that for the PROPERTY:COLOUR, the cursor pointer is op- posite the ATTRIBUTE:GREEN. Some property attributes are almost mutually exclusive, for example, few minerals in the same thin section will have both POSITIVE and NEGATIVE attributes for the property OPTIC SIGN. Where more than one attri- bute is appropriate the property menu can be reselec- ted with a command. For example, the/FO command reselects the menu for the PROPERTY:FORM and the ATTRIBUTE:EQUANT GRAINS and ATTRI- BUTE: INTERSTITIAL could be selected.

A list of MINID properties together with com- mand line abbreviations are shown in Table I. There are a total of fourteen property options with as many as twelve attributes in some situations.

Every time an observed property attribute is en- tered, MINI D attempts to eliminate mineral possibili- ties.

[:or example, if the attribute BLUE is entered for the property COI.OUR, all those minerals for which the attribute BI.UE is not set in the database are eliminated from the possible mineral buffer.

For every property the user can select to enter no information in which instance no eliminations are made. MINID only eliminates minerals if an impos- sible attribute is specified thus the program forgives incomplete observations but not inaccurate ones.

Eventually the observational evidence allows MINID to reduce the list of possible minerals to manageable proportions (say 10 possibilities). At this stage (or any other) the user may use the/P command to list names of possibilities. In many situations experience may be used to complete the identification but if ambiguity remains, additional observations can be made to re- duce the number of mineral possibilities further.

Table 3 shows a list of all those minerals for which the attribute COLOUR:BLUE is set in the database, that is. all the minerals which may possibly appear blue in thin section. The list was generated using the /P command.

EXAMINATION MODE

In E mode the screen is similar to that for /I (identification) mode. First the user is prompted for a mineral name for which data are to be entered or examined. MINID does not distinguish between uppercase and lowercase letters but it does insist on correct spelling because the whole word is used to locate the entry in the database. Bccause English and U.S. spellings may differ this can create minor pro- blems. In general MINID uses English spellings but users readily can edit the name file SMINS.DAT to reflect their personal preferences.

When it va, lid mineral namc is entered, MINID responds by displaying the database contents for each of the lburteen properties in turn. Users may edit the property database for the current run of MINID by amending these displays. If a "new" mineral name is entered. MINID responds with the message "ERROR:mineral ***** not found". To force entry of a "'new" mineral, the name must bc preceded by a

Table 3. MINID remaining minerals list

1

16 POSSIBLE MINERALS j ..... J

hauyne r iebeck ite cordie r i te chalcedony corundun axlnite durcrtlerite glaucophane spcch~rene elbalte kyanlte schorllte lam~l ire d iaspore zl rcon piedmont ite

Any key to continue

12a M. KEE~,ES

* so that .Fuchsite will enable the chrome mica to be added to the database. The mineral then can be re- ferenced without the • prefix.

When the user exits from MINID. after making use of ENTRY and EXAMINATION mode, an op- tion is offered to save the current mineral list and database. NEVER select this option unless a backup copy of the original files has been made because the existing files are overwritten. For added security two files MINS.SAV and PROPS.SAV are provided. MINSSAV is an ASCII copy of SMINS.DAT. PROPS.SAV is a printable ASCII version of the origi- nal SPROPS.DAT which can be "'poked" into mem- ory. The PROPS file is not the same as the original binary format. It is an emergency backup to enable recovery from loss of all copies of SPROPS.DAT. The recovery process is long and tedious.

The display screen shown in Table 4 indicates that, for the mineral quartz, the PROPERTY:INTER- FERENCE COLOUR may have more than one valid attribute: in this situation both the ATTRIBUTE: GRAY and the ATTRIBUTE:YELI+OW are poss- ible. The program has the flexibility to handle these multiple possibilities during data ENTRY and EXAMINATION mode, in IDENTIFICATION mode, it is assumed that only a single observation can bc entered for each screen but screens can be recalled to allow multiple ATTRIBUTE entries for any PROPERTY as cxpl:fincd carlicr.

AI)I)I ' I ' IONAI+ NIINID CONINIANI)S

On-line help is available for MINID through the /II cornnl:tnd at any time. The help screen was shown in Table I. All commands and their abbreviated forms

are listed on the main help screen. Command ab- breviations also appear at the bottom of the identifi- cation and entry 'examination mode screens.

The :R command is a restart option which clears all buffers and restarts in the default I (identification) mode. This both enables MINID to be left on-line for multiple users and also allows the database and mineral list to be updated and sa~ed without exiting from MINID.

ATYRIBUTE DATABASE

The MINID database contains binary information for property attributes for each mineral. For every property, e~ery attribute is set to either I or 0 for every mineral. A "one" signifies that the mineral may (not must) display the attribute. A "zero" signifies that under no possible circumstances can the attribute be displayed by the mineral in question. This informa- tion is stored as one bit per attribute and thus is compact ( < 5 K for the entire database of potentially 255 minerals). The distribution database supplied with MINID contains 144 minerals but reserves space for 255. In addition to economy in storage, the unique mineral bit-patterns can be compared rapidly using logical AND and OR instructions.

TI IEOR'*' OF OIq'~RATION

When the ident i f icat ion process begins M I N I D sets up a work ing mineral property buffer and fills it wi th zeros using the rout ine f lORIT . A second buffer, the possible minerals butter is l i l led wi th ones, using B A N D I T , for all minerals in the database. In i t ia l ly there are no observat ions and all minerals (counted as

Table 4. M 1NI D entry/examination mode screen

! l~dCID - mLner~l i d e n t i f i c a t i o n in t h i n sec t ion :

! . . . . . . . . -1 i ~ ACTIVE MODE : j E ~ r f R Y / ~ N A T I O N I61~RENT PROPERTY :i ~ o0r~t~ CIA~RENr MINERAL(S) : i quartz

iGray ( 0 i< <( IYellow ( i < < < iOrange ( 2 iRed 3 iBlue ( ( 4 ,Green ( 5 INext property i < < < L

MODE ~ : II IE UTILITY (DDMMANDS : IQ IP IR IH PROPERTY CCMMANDS : /CO /SH /RE /IN IDI /2V /OS i ! ICL liD( ITW IUN IPL ICR IFO

Optical identification of minerals

ones in the possible minerals buffer) are possibilities, When attribute data are entered, they are "'OR"ed

with the working mineral property buffer to set the attribute bit using DBOR. The property data, for every mineral in turn, then is "AND"ed with the working mineral property buffer using DBAND and the result of each operation is placed in the possible minerals buffer. Thus those minerals which cannot have the observed attribute, set a zero in the possible mineral buffer because the AND operation yields a false result. The number of bits set in the possible minerals buffer are counted (COUNT does this!) and displayed by MINID. All these operations occur as MINID moves between property screens.

COMPATIBILITY

MINID is written in a generic BASIC and is com- patible with IBM-BASICA Version 2.xx, Compaq BASICA Version 2.xx, and GW-BASIC Version 2.xx and higher versions. A version of MINID suitable for compilation with the Turbo BASIC compiler also is available. MINID may be adapted readily for com- pilation with the Microsoft QuickBASIC compiler.

The code has been tested on the following micro- computers: IBM PC, IBM XT, Compaq portable, Compaq Dcskpro, Compaq 286 portable, AT&T PC6300. Commodore PC-10. There is no reason to suppose it will not run on most IBM-PC workalikes. None of the assembler code segments make any DOS or BIOS calls so incompatibilities cannot arise in these respects.

Some problems may occur with the placement of the assembler code and databases in memory. MINID was written before many of the assembly code hand- ling enhancements were added to various BASIC in- terpreters and compilers. As a result the assembler code and databases are loaded at absolute addresses which may be user specified. If the program does not function as it should, modifying the offset address (the variable BS in MINID.BAS) usually will produce a working version. It also is necessary to recompile the assembler code routines with the parameter begin set to BS + SE00. This change is fairly easy to do at the machine-code level because all the addresses to be changed have the value $7E in the BASIC DATA statements and must be changed to the high byte of BS + $E00. Complete details are provided in the

"User Guide" (Reeves, program disk.

125

1986) distributed with the

DATABASEINTEGRITY

The MINID database was installed by the author in 1979 using standard mineralogy textbooks (i.e. the ones the author used as an undergraduate). Some user-reported errors have been corrected but the author makes no claims in respect of the mineralogi- cal accuracy of the database. Users are free to edit, correct, amend, or replace the information in both SMINS.DAT and SPROPS.DAT. It is difficult to delete a mineral from either file because the sequence is critical. However it is easy to enter null data for all properties or to replace one mineral with another. through the M I N I D / E option. Any improvements in the database will be included in the MIND archive for distribution.

DOCUMENTATION AND SUPPORT

MINID is available from the author on floppy disk together with a brief operations manual (Reeves, 1986). The manual contains a page-by-page guide to the property menus and the assembly language source code for the assembler code segments. In addition, detailed sections on managing the database are provided (adding, amending, replacing minerals).

MINID is available to students in the Department of Geological Sciences at the University of Sas- katchewan through the department GEM LAB micro- computer network. It also can be downloaded from the Canadian Computer Users Group for Geological Sciences (CCUGGS) Bulletin Board at 306-955-3078. MINID is free user-supported software. Questions about MINID can be left on the BBS and will be answered as quickly as possible.

REFERENCES

Reeves, M. J., and Lucas. J. M., 1980, Microcomputer ap- plications in the geological sciences: Computers in Geol- ogy II, Geol. Soc. London, Misc. Paper 14, p. 155-178.

Reeves, M. J., 1986, MINID users guide and manual GEM- LAB: Tech. Note No. 13, 26p.

Rogers, A. F., and Kerr, P. F., 1933, Optical mineralogy: McGraw-Hill Book Co., New York, 370 p.

Zoltai, T., and Stout, J. T., 1984, Mineralogy: concepts and principles: Burgess Publ. Co., Minneapolis, Minnesota, 505 p.

Appendices overh, af

126 M. Rr~vv.s

APPENDIX 1

Mmeral Names List

o p a l , f l u o r i t e , l e c h a t e l i e r i t e , e o d a l i t e , a n a l c i m e , h a u y n e , h a l i t e , h a l l o y s i t e , an t i g o r i t e , c l i a c h i t e , c o l l o p h a n e , p e r i c l a s e , g r o a s u l a r i t e , p y r o p e , a lmand i r e , s p e s s a r i t e , u v a r o v i t e , andrad i t s , 1 i m o n i t e , s p i n e l , chromite,perovskite, sphalerite,graphite, leuclte,mesolite,pyrite, penninite, prochior its, chabazite, c r istobal ire, apat ire, nephe Iine, trldymite, riebeckite, idocrase,beryl,dahllite,clinochlore,pyrrhotite, kaolinlte,melillte, anorthoclase, cllnozoisite,dickite, stilbite, t homsonit e, zois its, sanid ins, heul and ire, andes ins, ecolect ite, mlc roc I ins, chamosite, labradorite,chalcopyrite,oligoclase, andalusite,cordierite, cancrinite, chalcedony, orthoc I ass, corundum, enstatlte, bytownlt e, celestlte,gypsum,quartz, topaz, alblte, axlnite, staurollte,hypersthene, allanite,scapolite, enorthlte,chrysotile,dumortlerite,barite,mullite, natrol Ite,J adeite,chloritoid,glaucophane, spodumene,wollastonite, monticelllte,epidote, sepiolite, elbaits, kyanite, anthophyllite,hedenberglte,brucite, lawsonlte,polyhal Its, dravite, hornblende, elunite, sillimanite,glauconite, prehnite, montmorillonlte, augite, pigeonite,gibbsite,nephrlte, tremollte, schorlite, palygorsklte, cummingtonlte, I amprobo I its, chond rod Its, d lops ide, aeg i r ins-aug ite, hyd romuscovite, talc, st I Ipnomelane, b l o t Ire, forst er Its, lazul Its, el ivine ,muscovite, aeglrine, iddingsite, fayalite,grunerite, enhydrite, phlogopite, lepldolite, diespore,pyrophylllte,monazite, zlrcon,piedmontlte, sphene, caseiterlte, J arosite, aragonite, calcite,dolomlte,magnesite, siderite, rut ile,

i'iiii!!i'""""!iiiiii : ::::: ::::::::::::: ::::::: :',::::: , J , , ! ,

, e , ,

APPENDIX 2

BASICA Sm~rce Code

lO ' .................. 20 ' MINID Main program 30 ' ..................

40 CLEAR ,&HF000,1024:KEY OFF:CLRI-7:CLR2-0:CLR3-O:CSI$-"<<<" 50 DIM CO$(9),SH$(3),RE$(5),IO$(3),DI$(4),pL$(3),CL$(4),TW$(5) 60 DIM FO$(5),MO$(2),CM$(21),MN$(255),ST(15),N(20) 70 ' ***** Print header message 80 COLOR CLRI,CLR2,CLR3zCLS:TBAS-160 90 PRINT "MINID - Version 2.1 for MS-DOS" I00 PRINT "COPYRIGHT (C) Malcolm Reeve,,1985" l l O ' ***** I n i t i a l i z e base a d d r e s s e s 120 ' Database uses BS to BS+CFFH 130 ' Assembler routines use BS+D00H to BS÷ETFH 140 ' Buffers use BS÷E80H to BS+FFFH 150 BS'&HT000:BP-BS+&HF00:NMIN-BP-I 160 ' ***** Set assembler call addressee 170 DBAND-BS+&HDO0:DBOR-BS÷&HD20:BANDIT-B$+&HDd0:BORIT.BS+&HD60 180 COUNT-BS÷&HDgO:MEMCL-BS÷&HDC0 190 ' ***** Set key traps for <CR> and / 200 KEY 15,CHR$(0)÷CHR$(28) 210 KEY 16tCHR$(0)+CHR$(53) 220 ' ***** Trap h a n d l i n g r o u t i n e s 230 ON KEY(If) GOSUB 2230 240 ON KEY(I&) GOSUB 2250 250 ON KEY(15) GOSUB 2270 260 ON KEY(16) GOSUB l&90

270 ' ***** Read in program data and assembler code 280 GOSUB 2860:PRINT 290 ' ***** Test assembler routines 300 PRINT " DBAND at ";:CALL DBAND :PRINT HEX$(DBAND) 310 PRINT " DBOR at ";:CALL DBOR :PRINT HEX$(DBOR) 320 PRINT " BANDIT at ";:CALL BANDIT:PRINT HEX$(BANDIT) 330 PRINT " BORIT at ";:CALL BORIT zPRINT HEX$(BORIT) 340 PRINT " COUNT at ";:CALL COUNT :PRINT HEX$(COUNT) 350 PRINT " MEMCL at ";:CALL MEMCL :PRINT HEX$(MEMCL) 360 ' ***** Read in database 370 CALL MEMCL:GOSUB 3650

380 390 400 410 A20 430 450 460 470 480 490 500 510 52O 53O 540 550 560 570 58O 590 600 610 620 630 640 650 660 670 680 690 700 7i0 720 730 740 750 760 770 780 790 800 810 820 83O 84O 850 860 870 880 890 900 910 920 930 940 950 960 970 980 990 I000 I010 I020 1030 1040 1050 1060 1070 1080 1090 1100 I I I 0 I120

CAGEO 15:i-!

Opticalidentification of minerals

, ***** Set default mode I I MO$-MOS(1):MS-"I=:LM$-M$:N-I:GOSUB 2660 ' *~*** User mode restart /R LM$-M$:IM-I:Q-0:N-I:M-0:CS$-CSI$ IF MS'"I" THEN CLRI-7:CALL BANDIT:CALL COUNT:POKE NMIN,TMIN-I:GOSUB 2540 IF MS-"E" THEN CLRI-15:GOSUB 2540:GOSUB 2L20:IF C$'"/" THEN GOSUB 1510

***** / trap returns here after processing IF N-0 OR M$<>LM$ THEN GOTO 410

***** Jump table for next property GOSb'~ 1660

***** For /E mode d i s p l a y d a t a IF MS-'E" THEN GOSUB 2050

***** Input from keyboard SCREEN ,,0,0:GOSUB 2190

***** Decode input GOSUB 2360:IF RC-I THEN GOTO 640

***** For /E mode completed IF MS-"E" AND N-16 THEN GOTO 410

***** For /I mode AND data with buffer, count minerals IF MS-"I" THEN CALL DBAND:CALL COUNT:LOCATE 6,36:PRINT PEEK(NMIN);

***** Check for p o s s i b i l i t i e s exhausted IF PEEK(NMIN)-O THEN GOSUB 1850:GOTO 410

***** Indicate remaining poesibilitiee IF PEEK(NMIN)-I OR Q-9 THEN GOSUB 1750:GOTO 410

***** No more diagnostics IF O-9 THEN GOTO 410

***** Try again GOTO 480 END ' /CO c o l o u r r o u t i n e 0 . . . . . . . . . . . . . . . . . .

A$-"COLOUR":PRINT AS; FOR I-0 TO 9:LOCATE 8+I,30:PRINT CO$(I);TAB(45);"(a;I;")':NEXT I M-3:N-2:Q-I:RETURN ' /SH shade routine

A$-"SHADE":PRINT AS; FOR I-O TO 3:LOCATE 8+I,30:PRINT SH$(1);TAB(45);"(';I;")":NEXT I M-3:N-3:Q-2:RETURN ' /RE relief routine i . . . . . . . . . . . . . . . . . .

A$-'RELIEF":PRINT AS; FOR I-0 TO 5:LOCATE 8+I,30:PRINT RE$(I);TAB(45);"(";I;")":NEXT I M-13:N-13:Q-3zRETURN ' /IN blrefringence order routine | . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

A$-"INTERFERENCE COLOUR$ - ORDER"zPRINT AS; FOR I-0 TO 3:LOCATE 8+I.30:PRINT IO$(1);TAB(45);"(";I;")":NEXT I M-II:N-5:Q-4:RETURN ' /IN birefringece colour routine 0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

A$-"INTERFERENCE COLOUR":PRINT AS; FOR I-0 TO 5:LOCATE 8+I,30:PRINT IC$(I);TAB(45);"(";I;")":NEXT I M-14:N-14:Q-S:RETURN ' /DI d i s p e r s i o n routine ! . . . . . . . . . . . . . . . . . . . . . .

A$-"DISPERSION":PRINT AS; FOR I-0 TO 4:LOCATE 8+I,30:PRINT DI$(I);TAB(45);"(";I;")":NEXT I M-IS:N-15:Q-6:RETURN ' /2V 2V angle routine e . . . . . . . . . . . . . . . . . . . .

A$-"2V":PRINT AS; FOR I-0 TO 8:LOCATE 8÷I,30:PRINT I*10;"-";I*I0÷[O;TAB(45);"(";I;")':NEXT I M-10:N-10:Q-7:RETURN ' /OS o p t i c s i g n r o u t i n e

AS-"OPTICAL $IGN":PRIICr AS; I-0:LOCATE 8+I,30:PRINT " P o e i t l v e " ; T A B ( 4 5 ) ; " ( 0 )" I-I:LOCATE 8+I,30:PRINT " N e g a t i v e " ; T A B ( 4 5 ) ; " ( I )" I-2:M-12:N-12:Q-8:RETURN ' /CL cleavage routine ) . . . . . . . . . . . . . . . . . . . .

A$-"CLEAVAGE":PRINT AS; FOR I-O TO 4:LOCATE 8+I,30:PRINT CL$(I);TAB(45);"(";I;")':NEXT I

127

12S

1130 1140 I150 1160 1170 1180 1190 1200 1210 1220 1230 1240 1250 1260 1270 1280 1290 1300 1310 1320 1330 1340 1350 1360 1370 1380 1390 1400 1410 1420 1430 1440 1450 1460 1470 1480 1490 1500 1510

1520 1530 1540 1550 1560 1570 1580 1590 1600 1610 1620 1630 1640 1650 1660 1670 1680 1690 1700 1710 1720 1730 1740 1750 1770 1772 1774 1780 1790 1800 1810 1820 1830 1832 1840

M=I6:N-16:Q=9:RETU~ ' /EX e x t i n c t i o n a n g l e r o u t i n e i . . . . . . . . . . . . . . . . . . . . . . . . . . . .

A$-"MAXIMUM EXTINCTION ANGLE":PRINT AS; FOR I-0 TO 8:LOCATE 8+I,30:PRINT I*5;"-";I*5÷5;TAB(45);"(";I;")":NEXT I N-6:M-6:Q-10:RETURN ' /TW twinning routine 0 . . . . . . . . . . . . . . . . . . . .

A$-"TWINNING":PRINT AS; FOR I-0 TO 4:LOCATE 8+I,30:PRINT TW$(I);TAB(45);"(";I;")":NEXT I M-9:N-9:Q-II:RETURN ' /UN u n i a x l a l o r b i a x i a l r o u t i n e

A$-"UNIAXIAL OR BIAXIAL":PRINT AS; I-0:LOCATE 8+I,30:PRINT "Unlaxlal";TAB(45);"( 0 )" I-I:LOCATE 8+I,30:PRINT "Biaxlal";TAB(45);"( I )" I-2:M-15:N-7:Q-12:RETURN ' /PL pleochrolsm routine 0 . . . . . . . . . . . . . . . . . . . . . . .

A$-"PLEOCHROISM":PRINT AS; FOR I-0 TO 3:LOCATE 8+I,30:PRINT PL$(I);TAB(45);"(";I;")":NEXT I M-4:N-4:Q-13:RETURN ' /OR orientation routine i . . . . . . . . . . . . . . . . . . . . . . .

A$-"ORIENTATION":PRINT AS; I-0:LOCATE 8+I,30:PRINT "Length fast";TAB(45);"( 0 )" I-I:LOCATE 8+I,30:PRINT "Length slow";TAB(45);"( I )" I-2:M-8:N-8:Q-14:RETURN ' /FO Crystallnlty routine

. . . . . . . . . . . . . . . . . . . . . . . . .

A$-"FORM":PRINT AS; FOR I-0 TO 4:LOCATE 8÷I,30:PRINT FO$(I);TAB(45);"(";I;")":NEXT I M-II:N-II:Q-15:RETUP~q l . . . . . . . . . . . . . . . . . . . . . . . . . .

t Command LdentLfylng routine ° . . . . . . . . . . . . . . . . . . . . . . . . . . .

KEY(I I ) OFF:KEY(14) OFF:KEY(15) OFF:KEY(16) OFF LOCATE 19.19:INPUT "/",M$:LM$-LEFT$(MO$,I):LOCATE 19.19:PRINT SPACE$(IO); ML-LEN(M$):FOR K-I TO ML:AS-ASC(MID$(M$,K)) IF AS>96 THEN AS-AS-32:MID$(M$,K)-CHR$(AS) NEXT K:N-Q:M-Q:FOR K-I TO 21:IF M$-CM$(K) THEN 1550 NEXT K:ER$-" Command Invalld - try agaln":GOSUB 1630:GOTO 1500 IF K<3 AND M$-LM$ THEN ER$-" No chanse - /R restarts":GOSUB 1630:GOTO 1500 IF K>2 THEN MS-LMS ELSE MO$-MO$(K):RETURN 460 IF K-3 THEN GOSUB |873:N-0:RETURN 460 IF K-4 AND MS-"I" THEN GOSUB 1750:RETURN 460 IF K-4 THEN ER$-" Invalld in /"÷M$*" mode":GOSUB 1630:RETURN 460 IF K-5 THEN GOSUB 2660:LOCATE 25,30:PRINT SPACE$(30);:RETURN 460 IF K-6 THEN GOSUB |873:COLOR 7,0,0:CLS:SYSTEM:END IF K>6 THEN N-K-6:RETURN 460 MSG$-"ERROR : /"+M$÷ER$:GOSUB 2510:RETURN ' Jump command r o u t i n e i . . . . . . . . . . . . . . . . . . . .

FOR 1=8 TO 20:LOCATE I°30:PRINT SPACE$(25);:NEXT I LOCATE 5,36:PRINT SPACE$(40);:LOCATE 5,36:IF N>9 THEN 1700 ON N GOSUB 700,750,800,850,900,950,I000,I050,III0 RETURN ON N-9 GOSUB 1160,1210,1260,1320,1370,1430 RETURN ' Minerals routines ! . . . . . . . . . . . . . . . . .

' ***** Mi ne ra l l i s t r o u t i n e R$-" Any key to continue ":IMIN-PEEK(NMIN):IF IMIN-0 THEN RETURN NS-I:MN-I:IF IMIN-I THEN POKE NMIN,TMIN-I LOCATE 25,30:PRINT S$;:SCREEN ,,NS,NS-|:CLS:LOCATE I~29 COLOR CLR2,CLRI:PRINT IMIN;"POSSIBLE MINERALS ":COLOR CLRI,CLR2 NR-3:NC-2:FOR I-MN TO TMIN-I IF PEEK(BP÷I)<>0 THEN LOCATE NR,NC,PRINT MN$(I);:NC-NC+20 IF NC>80 THEN NC-2:NR-NR+I IF NR>23 THEN GOSUB 1830:MN-I:NS-2:GOTO 1772 NEXT I:GOSUB 1830:GOSUB 2540:RETURN LOCATE 25,30:COLOR CLR2,CLRI:PRINT R$;:COLOR CLRI,CLR2:SCREEN ,,NS,NS IF INKEY$<>"" THEN LOCATE 25,30:PRINT S$;:SCREEN ,,0,NS:RETURN ELSE 1832 ' ***** All possibilities exhausted routine

1850 1860 1870 1871 1872 1873 187~ 1875 1876 1877 1880 1890 1900 1910 1920 I930 1940 1950 1960 1970 1980 1990 2000 2010 2020 2030 2040 2050 2060 2070 2080 2090 2100 2110 2120 2130 2132 2140 2148 2150 2152 2160 2162 2164 2170 2180 2190 2200 2210 2220 2230 2240 2250 2260 2270 2280 2285 2287 2290 2300 2310 2320 2330 2340 2350 2360 2370 2380 2390 2400 2410 2420 2430 IF MS-"E" THEN GOSUB 1900 2440 NEXT J:RC-O:RETURN

Optical identification of minerals

LOCATE 6,36:PRINT " ALL possibilities exhausted";:POKE NMIN,TMIN-I MSG$-"CHECK OBSERVATIONS and try again - any key t o continue":GOSUB 2510 IF INKEY$<>"" THEN LOCATE 25,30:PRINT S$;:SCREEN ,,0,NS:RETURN ELSE 1870

' Save routine 0 ..................

CLS:LOCATE 1,28:IF CFLAG-0 THEN RETURN COLOR CLR2,CLRI:PRINT " DATABASE UPDATE OPTION ":COLOR CLRI,CLR2 LOCATE 3,27:PRINT "Save current changes (y/n)" K$-INKEY$:IF KS-mY" OR KS-my" THEN GOSUB 3710:CFLAG-0:RETURN IF K$-"N" OR K$-"n" THEN RETURN ELSE 1876 ' Data insertion routine e ......................

BY-BS+32*(ST(Q)+N(J))+INT(IM/8) BT-IM-8*INT(IM/8):MB-PEEK(BY) BT-7-BT:MB-MB OR 2"BT IF BY>BS THEN POKE BY,MB CFLAG-I:RETURN ' Data removal routine 0 ....................

II-I:FOR I-0 TO II-I BY-BS+32*(ST(Q)+I)+INT(IM/8) BT-IM-8*INT(IM/8):MB-PEEK(BY) BT-7-BT:MB-MB AND 255-2"BT IF BY>BS THEN POKE BY,MB NEXT I:I-II:CFLAG-I:RETURN ' Data display routine t ....................

II-I:COLOR CLR2.CLRI:FOR I-0 TO II-I:BY-BS÷32*(ST(Q)+I)÷INT (IM/8) BT-IM-8*INT(IM/8):MB-PEEK(BY):BT°7-BT IF (MB AND 2~BT)-0 THEN 2090 GOSUB 2320 NEXT I:I-II:COLOR CLRI.CLR2:RETURN ' Valid mineral r o u t i n e t . . . . . . . . . . . . . . . . . . . . .

LOCATE 6 ,36 :PRINT SPACE$(40);:LOCATE 6 ,36 : INPUT "",A$:B$-"":C$-LEFT$(A$,I) IF C$-"/" THEN M$-HID$(A$,2):RETURN ELSE L-LEN(A$) IF C$-"*" THEN L-L-I:A$-RIGHT$(A$,L) FOR J-1 TO L:K-ASC(MID$(A$,J,I)):B$-B$+CHR$(K OR 32):NEXT J MSG$-"ERROR ~ mineral "+AS +" is not new":FOR I-I TO TMIN IF B$<>MN$(I) THEN GOTO 2160 IH-I:IF C$-"*" THEN GOSUB 2510:RETURN ELSE RETURN NEXT I:MSG$-"NEW MINERAL : "+B$:MSG|$-"ERROR : mineral "+AS+" not found" IF C$-"*" THEN IM-THIN:MN$(IH)-B$:TMIN-TMIN+I:CFLAG-I:GOSUB 2510:RETURN MSG$-HSGI$:GOSUB 2510:GOTO 2120 ' Keyboa rd i n p u t r o u t i n e e . . . . . . . . . . . . . . . . . . . . . .

II-I:MM$-"Next p r o p e r t y ":IF MS-"I n THEN MM$-"Not o b s e r v e d KEY(15) ON:KEY(16) ON:KEY(It) ON:KEY (14) ON C$-"":LOCATE 8+I,30:PRINT MM$;CS$; A$-INKEY$:GOTO 2220 IF I>0 THEN GOSUB 2330:I-I-I:GOSUB 2320 ELSE BEEP RETURN 2220 IF I<II THEN GOSUB 2330:I-I+I:GOSUB 2320 ELSE BEEP RETURN 2220 GOSUB 2330:IF I<>II THEN A$-RIGHT$(STR$(I),I):C$-C$+A$ ELSE AS-"" IF MS-"I" OR AS-"" THEN A$-C$:RETURN 2290 BEEP:COLOR CLR2,CLRI:GOSUB 2320:COLOR CLRI°CLR2:I-I+I:GOSUB 2320 RETURN 2220 I-II:C$-"":KEY(II) OFF:KEY(14) OFF:KEY(15) OFF:KEY(16) OFF:RETURN ' Cursor display/cancel routines ! ..............................

LOCATE 8+I,51:PRINT CS$;:RETURN LOCATE 8+I,S%:PRINT SPACE$(3);:RETURN ' Decode keyboard input routine ! .............................

IF AS-"" THEN RC-I:RETURN IF MS-"I" THEN CALL BORIT LA-LEN(A$):FOR J-I TO LA:C$-MID$(A$,J,I):AS-ASC(C$) IF MS-"E" AND J-1 THEN GOSUB 1970 N(J)-AS-48:IF AS>57 THEN N(J)-AS-55 IF MS-"I" THEN GOSUB 2470:CALL DBOR IF N(J)-0 AND LA-% THEN N-H

( * ) "

No more p r o p e r t i e s / I empty OR b u f f e r Decode s t r i n g /E k i l l old data ASCII to decimal / I OR wlth b u f f e r Check end o f d a t a /E add new d a t a N e x t c h a r l o o p

129

130

2450 2460 2470 addr 2480 2490

2500 2510 2520 2530 2540 2550 2560 2570 2580 2590 2600 2610 2615 2620

2630 2635 2640

2650 2660 2670 2675 2680

2690 2700 2710 2720 2730 2740 2750 2760

2770 2780 2790 2800 2810 2820 2825 2830 2840 2850

2860

2870

2880 2890 2900 2910

2920

2930 2940

2950 2960 2970 2980 2990 3000 3010 3020 3030

3040 3050 3060 3070 3080 3090 3100 3110 3120

M. RZEVES

' P r o p e r t y a d d r e s s r o u t i n e I . . . . . . . . . . . . . . . . . . . . . . . .

BY-BS+32*(ST(Q)+N(3)):HB-INT(BY/256):LB-BY-256*HB ' F i n d p r o p e r t y

POKE BP-16,LB:POKE 8P-15,HB:RETURN ' Print message routine , . . . . . . . . . . . . . . . . . . . . .

LOCATE 25,8:PRINT SPACE$(70);:LOCATE 25,8:PRINT MSG$;:RETURN ' Page header routine e . . . . . . . . . . . . . . . . . . .

DATA " MINID - mlnerai identification in thin section ",2,16 DATA " MODE COMMANDS : /I /E ",21,8 DATA " UTILITY COMMANDS : /Q /P /R /H ",22,8 DATA " PROPERTY COMMANDS : /CO /SH /RE /IN /DI /2V /OS ",23,8 DATA " /CL /EX /TW /UN /PL /OR /FO ",24,8 DATA " CURRENT ACTIVE MODE : ",4,8," CURRENT PROPERTY : ",5,8 DATA " CURRENT MINERAL(S) : ",6,8," COMMAND : ",19,8 RESTORE 2540:CLS:SCREEN ,,3,0:CLS:LOCATE 25,30:PRINT S$;:SCREEN ,,0,3 RESTORE 2540:CLS:COLOR CLR2,CLRI:FOR I-I TO 9:READ R$,NR,NC

LOCATE NR,NC:PRINT R$;:NEXT I:COLOR CLRI,CLR2:LOCATE 4,36:PRINT MO$; LOCATE 6,36:PRINT SPACE$(3);:LOCATE 6,36:PRINT PEEK(NMIN); SCREEN ,,3,0:CLS:SCREEN ,,0,0:RETURN ' Help menu routine ! . . . . . . . . . . . . . . . . .

LOCATE 25,30:PRINT S$;:SCREEN ,,1,0:CLS:RESTORE 2670:COLOR CLR2,CLRI MINID - mineral identification in thin section ",2,16 MODE commands allow : ",4,8

/I - IDENTIFICATION /E - ENTRY/EXAMINATION ",6,8 PROPERTY commands allow user data entry In any order ",8,8

DATA " DATA " DATA " DATA "

DATA " DATA " DATA "

DATA "

DATA " DATA " DATA "

DATA " DATA " DATA " DATA "

/CO - colour /RE - relief /DI - dispersion

/OP - optic slgn

/EX - extinction angle " /UN - unlaxlal/blaxlal " /OR - orientation

10,8," /SH - shade ",I0,48

11,8," /IN - birefrlngence ",II,48 12,8," /2V - 2V angle ",12,48

13,8," /CL - c l e a v a g e ",13,48 14,8," /TW - twinning ",14,48

15,8," /PL - pleochrolsm ",15,48 16,8," /FO - form ",16,48

UTILITY commands allow the user flexlblllty to recover errors ",18,8 /Q - save and qult ",20,8," /R - save and restart ",20,48 /P - possible minerals",21,8," /H - display help screen ",21,48 DATA ENTRY r e q u i r e s c u r s o r r e t u r n on t h e a p p r o p r i a t e l i n e " , 2 3 , 8

DATA " Any key t o c o n t i n u e " . 2 5 . 3 0 FOR I - I TO 25:READ R$.NR.NC:LOCATE NR.NC:PRINT R$;:NEXT I SCREEN , , I , I z C O L O R CLR1.CLR2 IF INKEY$<>"" THEN LOCATE 25 .30 :PRINT SS;:SCREEN . ,0 .1:RETURN ELSE 2830 ' Main b l o c k d a t a i n p u t r o u t i n e

RESTORE 2880

*"*** MODES DATA IDENTIFICATION,ENTRY~EXAMINATION

***** COMMANDS DATA I.E,R,P,H,Q,CO,SH,RE, IN,IN,DI,2V,OP,CL,EX,TW,UN,PL,OR,FO

* * * * * PROPERTY LIMITS

DATA 0,I0,14,20,24,30,35,44,46,51,60,65,67,71,73

*~*** COLOUR DATA Colourless,Blue,Purple,Red,Brown,Green,Orange,Yellow,Pink,Gray

***** SHADE DATA Dark,Medium,Pale,Very pale

* * * * * RELIEF DATA Medium -ve,Low -ve,Low ÷ve,Medium +ve,Hlgh +ve,V.High +re

***** ORDER (interference colours) DATA Isotroplc0First order,Second ordsr,> Second order

~**** INTERFERENCE COLOUR

DATA Gray,Yellow,Orange. Red,Blue,Green ***** DISPERSION

DATA None,r>v strong,r>v weak,r<v weak,r<v strong ***** PLEOCHROISH

DATA None,Weak,Moderate,Stron 8 ***** CLEAVAGE

DATA None,One,Two,Three,> three ***** TWINNING

DATA None,Single,Multiple,Polysynthetic,Cruclform ***** FORM

DATA Equant gralns,Acicular,Lathlike,Columnar,lnterstltlal

3130 3140 3150 3160 3170 3180 3190 3200 3210 3220 3230 3240 3250 3260 3270 3280 3290 3300 3310 3320 3330 3340 3350 3360 3370 3380 3390 3400 3410 3420 3430 3440 3450 3460 3470 3480 3490 3500 3510 3520 3530 3540 3550 3560 3570 3580 3590 3600 3610 3620 3630 364O 3645 3650 3655 3660 3670 3672 3674 3676 3677 3679 3680 3690 3700 3702 3704 3710 3720 3730 3740 3745 3750 3755 3760

Opticalidentification of minerals

PRINT:PRINT "Loadln8 a r r a y da ta " FOR I-I TO 2:READ MO$(I):NEXT I FOR I-I TO 21:READ CM$(I):NEXT I FOR 2-I TO 15:READ ST(1):NEXT I FOR I-0 TO 9:READ CO$(I):NEXT I FOR I-0 TO 3:READ SH$(I):NEXT I FOR 2-0 TO 5:READ RE$(I):NEXT FOR I-0 TO 3:READ IO$(I):NEXT I FOR I-0 TO 5:READ IC$(I):NEXT I FOR 2-0 TO 4:READ DI$(I):NEXT I FOR I-0 TO 3:READ PL$(I):NEXT I FOR I-0 TO 4:READ CL$(I):NEXT 2 FOR 2-0 TO 4:READ TW$(I):NEXT I FOR I-0 TO 4:READ F0$(I):NEXT I PRINT:PRINT "Loading assembler code routines";HEX$(BP-512);"-";HEX$(BP-129) ' ***** ASSEMBLER CODE ROUTINES 'DBAND DATA &HBB,&HA0,&HTE,&HBF,&H80,&H7E,&HSA,&H05 DATA &H22,&HO7,&H88,&H05,&H8A,&HC3,&H47,&H43 DATA &H24,&HIF,&H3C,&HIF,&H75,&HFO,&HCB,&H00 DATA &HO0,&H00,&H00,&H00,&H00,&H00,&H00,&H00 'DBOR DATA &HBB,&HFO,&H7E,&HSB,&HO7,&HSB,&HDS,&HBF DATA &HAO,&H7E,&HBA,&HO5,&HOA,&HO7,&H88,&H05 DATA &HSA,&HC3,&H47,&H43,&H24,&HIF,&H3C,&HIF DATA &H75,&HF0,&HCB,&H00,&HO0,&H00,&HO0,&H00 'BANDIT DATA &HBB,&HS0,&H7E,&HB0,&HFF,&H88,&H07,&HSA DATA &HC3,&H43,&H24,&HIF,&H3C,&HXP,&H75,&HF3 DATA &HCB,&HOO,&HO0,&HOO,&H00,&H00,&HOD,&HO0 DATA &H00,&HOO,&HOO,&HOO,&HO0,&H00,&H00,&H00 'BORIT DATA &HBB,&HAO,&HTE,&HBO,&HOO,&H88,&H07,&H8A DATA &HC3,&H43,&H24,&HIF,&H3C,&HIF,&H75,&HF3 DATA &HCB,&HOO,&H00,&HOO,&H00,&HOO,&HOO,&H00 DATA &HOO,&HO0,&H00,&HOO,&HOO,&HOO,&HOO,&HO0 'COUNT DATA &HBF,&HOO,&HTF,&HBB,&H80,&HTE,&HB2,&HO0 DATA &HBO,&HOI,&HB9,&HO8,&HOO,&HDO,&HC8,&H9C DATA &H50,&H22,&H07,&H74,&HO2,&HFE,&HC2,&H88 DATA &H05,&H47,&H58,&HgD,&HE2,&HEF,&H43,&H8A DATA &HC3,&H53,&HBB,&HgC,&H7E,&H3A,&HC3,~H5B DATA &H75,&HDE,&HBB,&HFF,&HTE,&H88,&HIT,&HCB DATA &HOO,&HO0,&HOO,&HO0,&HOO,&H00,&HOO,&HO0 DATA &HOO,&H00,&HO0,&H00,&HOO,&H00,&H00,&H00 'MEMCL DATA &HBB,&HOO,&H70,&HBO,&HOO,&H88,&HO7,&H43 DATA &H8A,&HC7,&H53,&HBB,&HOO,&H7D,&H3A,&HC7 DATA &H5B,&H75,&HP0,&HCB,&H00,&HOO,&HOO,&H00 DATA &H00,&HOO,&H00,&HOO,&H00,&H00,&HO0,&H00 FOR I-0 TO 223:l-BP-512+I:READ A:POKE J,A:NEXT I RETURN

' ***** LOAD MINERAL NAMES AND PROPERTIES PRINT:PRINT "Loading mineral names ";:NR-CSRLIN:NC-24 OPEN "SMINS.DAT" FOR INPUT AS #I 'OPEN "MINS.DAT" FOR INPUT AS #I TMIN-0:FOR I-I TO 255:INPUT #I,MN$(I) IF MN$(I)-"*" AND TMIN-0 THEN TMIN-I IF TMIN-0 THEN LOCATE NR,NC:PRINT SPACE$(6);:LOCATE NR,NC:PRINT I; NEXT I:PRINT " found":S$-"One moment please ..." LOCATE NR+2,1:PRINT "Loading property database at ";HEX$(BS); BLOAD "SPROPS.DAT",BS:CLOSE:RETURN ' OPEN "PROPS.DAT" FOR INPUT AS #2 ' FOR I-0 TO 77:K-BS+32*I:FOR J-0 TO 19 ' INPUT #2,A:POKE K+3,A:NEXT J:NEXT I:CLOSE:RETURN 0

g

' ***** SAVE MINERAL NAMES AND PROPERTIES OPEN "SMINS.DAT" FOR OUTPUT AS #I FOR I-I TO TMIN:PRINT #I,MN$(I):NEXT I:IF TMIN>-255 THEN 3750 FOR I-TMIN+I TO 255:PRINT #1,"*":NEXT I LOCATE 5,24:PRINT "Mineral names saved as SMINS.DAT" CLOSE:BSAVE "SPROPS.DAT",BS,&HD00 LOCATE 6,24:PRINT "Property data saved as SPROPS.DAT" R$-" Any key to continue ":GOSUB 1830:RETUKN

131

132 M. REEVES

A P P E N D I X 3

Assembly Language Source Code

title

stack

stack

minid

begin

Min id assembler r o u t i n e s

segment pars stack 'STACK' db 64 dup('STACK ') ends

segment p a r a 'CODE'

equ 07E00H assume cs:minid,ss:stack

; .................................................

; R o u t i n e

dband proc f a r mov bx,begin+0AOH mov di.begln+080H

l o o p l : mov a l , [ d l ] and a l , [ b x ] mov [ d t ] , a l mov a l , b l inc dl Inc bx and aI,OIFH cmp aI,OIFH

Jnz loopl ret

dband endp

t o AND 256 byte buffers

;Get OR buffer address ;Get AND buffer address ;Get by t e from AND buffer ;AND it with OR buffer ;Save result in the AND buffer ; T e s t for end of buffer ;Next AND buffer byte ;Next OR buffer byte

;Cont inue to end of buffer

; . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

; Routine

dbor p r o c far mov bx,begln+0FOH mov ax,[bx] mov bx ,ax mov dl ,begin+0AOH

loop2: mov a l , [ d i ] o r a l , [ b x ] mov d i , [ a l ] mov al,bl inc di Inc bx and al,01FH cmp al,01FH Jnz loop2 ret

dbor endp

to copy d a t a t o OR b u f f e r

;Get c u r r e n t p r o p e r t y data addr

;Get OR b u f f e r s t a r t addr ;Get by t e f rom OR b u f f e r ;OR data with OR buffer ;Save result In OR buffer ;Test for end of buffer ;Next OR buffer byte ;Next property data byte

:Continue to end o f b u f f e r

; . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

; R o u t i n e

b a n d i t p r o c f a r mov bx ,beg in+080H

loop3 : mov a l ,0FFH mov [ b x ] , a l mov a l , b l inc bx and a I ,O IFH cmp aI,OIFH Jnz loop3 r e t

band i t endp

to initialize AND buffer

;Get AND buffer start addr

:Load FF I n t o AND b u f f e r ; T e a t f o r end o f b u f f e r ;Upda te AND b u f f e r by te

; C o n t i n u e to end o f b u f f e r

Optical identification of minerals

; R o u t i n e

b o r t t p r o c f a r mov bx.begln+OAOH

loop4: mov sl,00H mov [ b x ] , s l mov al,bl inc bx and al,01FH cmp al,01FH jnz loop4 ret

borlt endp

to initialize OR b u f f e r

;Get OR buffer s t a r t addr

;Load 00 into OR buffer ;Test for end of buffer ;Update OR buffer byte

;Continue to end of buffer

; . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

; Routine to count minerals

count proc far mov di,begin+0100H mov bx,begln+080H mov dl,00H

loopS: mov al,01H mov cx,08H

loop6: for al,l pushf push ax and al,[bx]

Jz loop7 Inc dl

loop7: mov [dl],al Inc d i pop ax popf loop loop6 Inc bx mov s l , b l push bx mov bx,begln+09CH cmp a l , b l pop bx Jnz loop5 mov bx,begln+0FFH mov [ b x ] , d l r s t

c o u n t endp

;Get count array start addr ;Get AND buffer start addr ;Initialize mineral counter ;Set bit 0 In A register ;Initialize bit counter ;Rotate AL to set next bit ;Save flags ;Save A register ;Test for blt set in AND buffer

;Sk ip if not set ; I n c r e m e n t m i n e r a l c o u n t e r ;Set b y t e in counter array ;update coun te r array :Restore A register ;Res to re flags ;Continue for all 8 bits :Update AND buffer byte :Test for end of buffer

; C o n t i n u e to end of b u f f e r :Save number of m i n e r a l s

; . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

;Get da t aba ' s e s t a r t addzeee ;Get z e r o ;Zero d a t a b a s e by t e ;Next b y t e ;Test for end of database

;Continue t o end of databsee

t o c l e a r s p a c e f o r d a t a

proc far mov bx,begln-0E00H mov al,00H mov [ b x ] , a l Inc bx mov al,bh push bx mov bxpbegln cmp a l , b h pop bx J n z loop8 r e t endp

; Rout ine

memcl

l oop8 :

memcl

mtn ld ends

end

133