8/7/2019 The Transactor V2 06 1979 Nov 30 http://slidepdf.com/reader/full/the-transactor-v2-06-1979-nov-30 1/42 (Kcommodore comments and bulletins concerning your COMMODORE PET TI'I The Transactor Vol. 2 BULLETIN #6 PET™ is a re istered Trademark of Commodore Inc. November 30, 1979 Inside the 2040 Disk Drive Jim Butterfield, Toronto Yes, you can look at the programs inside the 2040. But unless you're strong in machine language - and have a bit of hardware background - it won't makemuchsense. There are two processors in there. One looks out toward the PET •• I'll call it the IEEEprocessor; the other looks in toward the disk mechanics .. t~is one I'll call the disk processor. Eac~ ?rocessor has a comoletely different set of programs. The two processors talk to each other by sharing a little memoryspace: about 4K of RAM is commono both mic1'oprocessors. The IEEEprocessor is relatively easy to look into. You have the M-R, or memoryread, commandwhichallows you to look at the whole 64K memoryspace of this processor. Not all of this is actually fitted with memory, of course. As far as I can tell, ROMoccupies hex locations EOOCo FFFF. There's RAMn zero page; and the RAMwhichis shared with the disk microprocessor is in hex 1000 to lFFF. The 6532 PIA chips seem to be in i;im addresses $0200 to $03FF. To analyze a completely unknown 650Xprogram, you must start by inspecting 1we tjII locations $FFFAto $FFFF. This g1 ves you the three main vectors, for NMI,Reset, and !NT. As far as I can tell, NMIisn't used - the vector points at non-existent memory. Reset is of course used; in m:r 2040 it points at F480, and that's where the main code for initialization begins. It looks to me as if the interrupt line must be kicked by the IEEEATN(attention) line: when I follow the vector (FDDE)in my machine, it looks like an IEEEhandshake is taking place. That's all vefy well for the IEEE processor, but how can you get a look at the inner, disk processor? I had trouble with this one. until one day I discovered that the IEEE processor can download the disk processor - via the shared RAM and makeit execute this new code! So all that 's needed is a little program to tell the disk processor to copy part of its memoryto the shared RAMpace, where it can be examined by using the M-Rcommand. Commodore Systems, 3370 Pharmacy Avenue, Agincourt, Onto (416-499-4292
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
PET™ is a re istered Trademark of Commodore Inc. November 30, 1979
Inside the 2040Disk Drive Jim Butterfield, Toronto
Yes, you can look at the programs inside the 2040. But unless you're
strong in machine language - and have a bit of hardware background -
it won't makemuchsense.
There are two processors in there. Onelooks out toward the PET••I'll call it the IEEEprocessor; the other looks in toward the diskmechanics .. t~is one I'll call the disk processor. Eac~?rocessorhas a comoletely different set of programs. The two processors talkto each other by sharing a little memoryspace: about 4K of R A M
is commono both mic1'oprocessors.
The IEEEprocessor is relatively easy to look into. Youhave theM-R, or memoryread, commandwhich allows you to look at the whole64K memoryspace of this processor. Not all of this is actually
fitted with memory,of course. As far as I can tell, ROMoccupieshex locations EOOCo FFFF. There's RAMn zero page; and theRAMwhich is shared with the disk microprocessor is in hex 1000 to lFFF.The 6532PIA chips seem to be ini;im addresses $0200 to $03FF.
To analyze a completely unknown 650Xprogram, you must start byinspecting 1we tjII locations $FFFAto $FFFF. This g1ves youthe three main vectors, for NMI,Reset, and !NT. As far as I cantell, NMIisn't used - the vector points at non-existent memory.Reset is of course used; in m : r 2040 it points at F480, and that'swhere the main code for initialization begins. It looks to meas if the interrupt line must be kicked by the IEEEATN(attention)
line: whenI follow the vector (FDDE)in m y machine, it looks like
an IEEEhandshake is taking place.
That's all vefy well for the IEEEprocessor, but howcan you get
a look at the inner, disk processor? I had trouble with this one.
until one day I discovered that the IEEEprocessor can downloadthedisk processor - via the shared RAM and makeit execute this newcode! So all that 's needed is a little program to tell the diskprocessor to copy part of its memoryto the shared RAMpace,where it can be examinedby using the M-Rcommand.
C om mo do re S yst em s, 3370 Pharmacy Avenue, Agincourt, Onto (416-499-4292
I couldn't get this to work, however, until I discovered the vital \ /missing link. The shared RAM,which is seen at locations 1000 to 1.FFF 6.by the IEEEprocessor, is seen in a completely different location
by the disk processorl •• in this case, hex 0400 to l3FF.The hardware just "maps" the memoryinto a different location.I might never have spotted this if the memories had not overlapped;
but a little rummagingaround and tearing of hair showed that my
early programs seemed to be putting data into the wrong buffer.
Eventually, the penny dropped, and the system became clear.
I'm far from being able to give details about the inner secrets ofthe 2040. But with the enclosed DISKPEEKprogram, you too can
rummagearound in there - in either processor's memoryspace -and comeup with interesting data.
1 O ~ 3 F ' F : I t n " : : 1 [ 1 S K t · 1 E t · 1 0 F . : ' T 'I S P L A ' T ' J I t ' 1B U T T E F : F I E L I ! "1 1 0 D A T A 7 7 1 4 5 1 8 7 1 0 1 1 8 . 1 6 . 1 6 2 . 0 . 1 8 91 2 0 D A T A I 5 7 1 6 4 1 0 6 . 2 3 2 1 2 2 4 , 1 6 , 2 0 8 , 2 4 5 . 7 6 1 1 9 3 , 2 5 41 3 0 F O R J = I T 0 9 : R E A D X : C $ = C $ + C H R $ ( X ) : N E X T J
1 4 0 F O R J = l T 0 1 1 : R E A D X : D $ = D $ + C H R $ ( X ) : N E X T J1 ~ C " 1 P R I H T " : ~ I T H E R E A R E n · J O P R O C E ~ = ; S O F . : : = ; :I
1 6 0 P R I t H " 1 ) T H E IE E P R O C E : : ; ~ : ; O R ;"17 0 P F . :tH" 2 ) T H E D I S K P F . : O C E : : ; ~ : ; O F . :;"1 :::(1 I t ' ~ P U T "~ · J H C H D O ' T ' O U ~ ' ~ A t , nT O P E E K . : : O R 2 : : ' , ;Ii1 9 0 P R I t'n" I t ' ~ P U T t · 1 E t · 1 0 F . : ' T 'D D R E S S "2 ~ Z H 3 P F . :tn III t , ~H E i ' : : A D E CI t ' 1 A L: II :O P E t - ~1 • 8 " 1 52 1 ( 1 PRnn" ••••• ~"2 2 0 I t ' ~ P U T Z $2 : : X 1 P R l t n l ~ " , ;: I F L E t ' ~ ( Z $ ) < ) 4 T H H ~ G O T 0 2 1 02 4 0 F O R J = 1 T 0 4 : Y = A S C ( M I D S ( Z S , J »2 5 0 I F Y < 5 8 T H E N Y = Y - 4 8
2 6 0 I F Y ) 6 4 T H E N Y = Y - 5 52 7 0 I F Y < 0 0 R Y ) 1 6 G O T 0 2 1 02 8 ( 1 ' 7 ' ( J::.' T ' t'~E::nJ:K = 0 : P F . : t ' n" 1 " , ;2 9 0 O N D G O T 0 3 0 0 , 3 2 0 : G O T 0 1 8 03 0 0 U = Y ( 3 ) * 1 6 + Y ( 4 : : ' : V = Y ( 1 ) * 1 6 + Y ( 2 )3 1 0 G O S U B 3 6 0 : G O T 0 2 1 0320 P R I N T # 1 I C S ; C H R $ ( Y ( 3 ) * 1 6 + Y ( 4 » ; C H R $ ( Y 1 ) * 1 6 + Y ( 2 » ; D $: 3 : 3 ~ . : : t p F . : n n # 1 1 I t ' 1 - ~ · ~ ": H R $ ( 4 ) , : H R $ ( 1 6 ) , : H R i ( ) , : H F . : $ ( 2 2 4 )
. 3 4 0 PPHill 1 L! t 'l-F.: ' ~ , : . t = : H R $4 ) , : H F . : $ ' : :6 : : ' ;CHF: t ( 1 : : .;: : H F . : $ ' ; :2 4 )3 4 5 G E T # 1 , X $ : I F X $ = C H F . : $ ( 2 2 4 ) G O T 0 3 4 03 5 0 U = 6 4 : V = 1 8 : G O S U B 3 6 0 : G O T 0 2 1 03 6 t 1 p F . : n n # l " IIt 1 - F . :I, : H R $ ( U ) , ; H F . : $ ( \ , ' )
370 G E T # I . ,: : - : ; $I F : : - : ; $ =I I I T H E t ' n - : ; $ = C H F . : $(1):~::=!0 F ' F . : I t·~T·I II.;: : : · : :=A::;C:( : : ': :$ : : ' , / 163 9 0 F O R J = I T 0 2 : X % = X : X = ( X - X % ) t 1 6 : I F X % ) 9 T H E N X % = X % + 74 0 0 P R I N T C H R $ ( X % + 4 8 ) ; : N E X T J4 1 0 U = U + l : I F U = 2 5 6 T H E N U = 0 ~ V = V + l4 2 0 K = K + l : I F K { 8 G O T 0 3 6 04 3 0 Y ( 0 ) = 0 : Y ( 4 ) = Y ( 4 ) + 8 : J = 4440 I F ' T ' ' : : . J : : ' : >5 T H E H ' T ' ' : : . _ T : : '' T ' ' : : . J )1 6 : .J= ,T~L : ' T ' ' : : . J : : ''T ' ( . J : : ' + 1 : G O T 0 4 4 04 5 0 .PRItH :PRI t - n " _ _ " - . ; : FOP}: 1 T 0 4 - :' T ' = ' T '. ] : : .I F ' T ' ) 9 T H E H ' 7 ' = ' T ' +4 6 ~ Z 1 P F . : H T C H F . : $ ( ' T ' + 4 8 : : ' . :t ' ~ E : : - : : TJ :P R I u r II~" :R E T U R t , ~
* * * * T H E L A S T T H R E E I T E M S I N L I N E 1 2 0 (76,1931254) M A Y B E C H A N G E D
I F N E C E S S A R Y T O A R E S E T S E Q U E N C E O F 108.2521255 * * * *
inc lude OI.~t·'SOr" i . , , : : . f t. ·t· 1 ::~h:~ 3.nd..·Ot·· de le te. FiL::(. , . , :< Cr·,.:<r··.:;'.ct?r··
I::.:)untet·' i(li':_1ht: be l'".::r::lr··~::.:)t···:;..t~·d ~:') limit i::~'!e inr;",.lt stt··in':'1
len:~th.
ThE.' +01 101.'1 in':_1,:'t·'O·:'1t·'·:<JlI'-:I J 1 if' Buti::er··+ ie Id shol.!.Is the tr··I.~e
......: :. ' i.;_-ie 0+ ,:;..dec i;(,.::<1+ Io = . : . . . 1 :: in':_1;::-.::'n+ t"!i.Hflbet·· .;::._;_:::i::or-'ed b·::.~FET 1n-f 10,::<.t n::'l b i n,;::",t···=,. The ':"'··O·::'W'·:;'I!'Illustt-·.:=.tes hol.'': sor!!e dec iff,.:;I.l
i . _ . i . : : a . l l . . . ~ e : . = - C : . : ; t . r - j f ' - , r : : r t ~)e t-'er:'!-'eSEtrlte:(~ irl t, ir··I·='!~·':1 e . : · : . · ~ . c : t 1 ~::I. . T r ~ o I : : 1 1.1,3.1:_';E;rS
0+ 1. 1 1.;;:: ,:=.nd 1. 7.
t00 PRINT ' INPUT V
1 1 (1 F'F . : I r'n I t-H ( './ ::.; " • "j
1?~ V = (V - INT(V») * 10
130 PRINT CHP$(V + 48);
140 OOTC! 120
I F I·.·'~-::OOTe) 100
7"he +01 101,1.'1 n':;_1-·e+er·ence t.:;.b lEo shol.lJS
POVE lcII::.:.t ions. r'k:i::e the st·:=..t",t .::<.n.:4ndthe rnc,s"i:: s 1 · : . 1 t " 1 i- + i ':'1.:;'["ltd i '::'1t.:: .~:::' h.=,'s been
the t.:..b Ie. P>2:·r:·r··nt.;::·d -ft·'clrf' the C.OfMflodor··e
Entr":1 PO i n+s seen in 1 , ) . : ' . 1 ' " ' iOI_~S~:,t-·o·:.w·.:.mmet-·.S rII·:'.d-1ine 1.:'.n·:'11_~·:.:~e~:,t-·Ct·~t-··:.ms.The user is c.:'.,-~tioned to chec:k out the I·}·:.riousr'ol_~tines car-e+u 11':1 foro, ~:,t-·or.'et-·setw:· befor'e '::.:'.11in·:'1., t-·e·:'1s+er-sI.~sed., etc.
D6SD D68FD6C4 D6C6D?:3C II77:~;DBFD D9:34D9B4 D9EEDA74 DAAEDBIB DB55DC9F DCD9DCA9 DCE3DCAF DCE9E::::Eti E : 3 I I : : :
na E775
na E7A?n·:. . E7:E:6F(1B6 F0:B6F0BA F0:E:AF1 2C : F 1 2:::E7IIE F156F16? F16FF17A F17FF17E Fl:::3
FIB? F1SCF 2 C : : : ! F2A9F2CD F2AE
DESCF.:PTI O H
?OUT OF t'1ENOF.:'r'
Send Bas ic er-r-or- rt'less.:.,.·E;le-~,J.:.rr i l star·t .' Bas icCrunch & insert lineFix chainin9 & READY.Fi: < chai ninSi
Cr-unch tc,kensFind line in BaS1CDCI t'~B'JDo CLRRe-set B·:.si c to st.:.r·tCon+i nue Bas ic e-::<ecl~tionGet f i;<ed-pc, i nt number- +r-om B·:,si o ,
Se-nd ReturnJLF if in screen modeSend ReturnJ Linefee-dPt-.i nt s+r- in-::tPrint precomputed stringProi rrt ch.:.r.:..ctet-·Check fl:lt-· C1:1flirft.:'.
BI...lfiIP , / . : . . 1 ' " ' i . : . J : r le Adck'ess b':I 2F loa+ t'J Fi>~edcon ....r-sionFi;:.::ed to FIoa+ conver-s ionGet b~te- to X re-g
E'.}.:t.ll~.:.:te Stt-·in ':_i
Ge-t tlJ.ICIp.:.r·aIiletet-·sAdd (from memor~)t , 1 t . ~1tip 1':1 b':I memoP':I lcu::.:t.t1ont ' 1 i . . - I 1t i ;:,1':1h':! t.enUnp.:t.c:k mertKlt-":I 1.. . .. 1 " ' i . : . J : I Ie tCI ACCI..jril # 1Celm;:'eticln of Fixed to F l'J.3.t conver-sionPrint fixed-point valuePr - int flO.:'.tin·~-t:'CIint I.}.:'. It..jeConvert number to ASCII strin9Proi nt .:'. c:h.:..r-.:..cte-t"·Ol.At~:'ut b':lte as 2 he::.;: d i ' : ' i i+sInput 2 hex di9its to AInput 1 hex di9it to ASend /talk/ to IEEESend /listen/ to IEEESe-nd Sec:,:,nd.:..t"·':1Addt-'ess!:;end c·:'.nne(~ mess·:':E;leSend ch.:..t"'.:...::ter· to IEEE~ : :e t- Ia :~ un+a 1 1 - : : _ . '
Senl~ I _ m 1i sten ...
I t"lt:'ut + r - o m IEEEClose logical fileClose logical file in A
F32R F301 Check -Fm-'Stm:· l.::e·::IF33F F315 Send messa:E.1e-FDi r'€';:;~modena F322 LORDsubr-ou+ineF3DB F3E6 ?LORDERF~ORF3E5 F3EF Prorrt RERII'T'& t-'eset Basi c +o sta.t-·tF3FF F40A Print SEARCHING••F411 F41D Print -File nameF43F F447 Get LOAD/SR'·..E type t:·ar·alileter·sF462 F466 Open IEEE channel -For output.F495 F494 Find stjel::i -Fic ta.t:·e headet-· block
FS04 F4FD Get str'i n~F52A F521 Open los ica I -Fi le -Ft-'ominput t:·ar·.:'IiletepsF52D' F524 Open Ios i ca.1 -F IeF579 F56E ?FILE N O T FOIJHDJc lear' I,..JOFS7B F570 Send error messa~eF5AE F5A6 Find .any ta.tje headet-· b IockF64D F63C Get pointers +or- tape LOADF667 F656 Set tape tll.J-f-fer·st.:;.r-·t acldt-'essF67D F66C Set cassette bu-f-Fer pointersF6E6 F6F0 Close IEEE ohanne I
F78B F77l:1Set int:·ut device -t=r·I::.mO:1ica 1 -fi Ie numbet-·F7DC F7Be: Set output de'~.'ce -ft-"omLFN.F83B F812 PRESSPLA'y'• ; w.:..iF87F F855 Read taPe to bu-f-fet-·F88A F85E Read taPeF8B9 F886 Wri te tape -Fr'ombl.J-fferF8C1 F88E Wri te tape ~ leader' length inAF913 F8E6 Wait - F c . " . . . I/O complete car Stop l.<e·:.iFBDCFB76 Reset tape I/O poi rrter-
FD1B FC9B Set inter"rl.Jpt .vectorFFC6 FFC6 Set input deviceFFC9FFC9 Set output device
FFCCFFCC Restore de-fault 110 devices. FFCF FFCF Input char'ac:ter'FFD2 FFD2 Output char'ac:ter'FFE4 FFE4 Get character
E•...en 1.1.1th ·a :32K PET., i tis des ir'.able to ha..·)e .:.. me·:.t"ls ofh.:..nd1in·:'1pt··O·:'W·.BIflSnsect ions , tCI be Ioaded .BS neceSS·Br':!. ThePET i rflP leulent.B.t i on of the 10.B.dcommend ft··om .B.pt··O-:'W··3Ifloes not
f'eset .3.n':!po i nter·s., so th.3.t 1),Br i- E f bles - ·2Ire pt··eset··,...d. HCIIJJel...t··.,·:en':!nel.l.lpr·o·:.1t"··2IIfIl.~st be the S·2IIflelen·:'1th ot·· shot··tet·· th.:e.t1 ~he
first of the series.
In o r-d er - to rn.2Ikecet··t.B.in det.B.i Is such .BS -f ilen.;:'IIIes .;:..nd the diskcomm.3.ndstr··.BnSP.Brent to the end uset··., it riI ': '.'::I be des i t··ed to h.3.'.}e.:;..sma l 1 +r-on+ end o r- menu pr·o·:'W·.:;'IfI0.B.dothet··., 10t·r:'1et··"':'t··0·:'W··9Ins.
t·tO1·..3ri .3bles need be p.:'.ssed betl.lJeen the Pt··O·:'1t··aIfIS.'CI ·9. Sim~:'IeLOAI ! IIne::·::tm-"o·:'W·.;:'Ifl" .' :;:: suff ic:es.
Ho1.1.1'·)er·.. Sinee the •·..r-i; : ' . b Ie poin+er-s ·:;'j'"·e nc.t r·eset., the':! IJJ11be ~:'o n + i n·:'1into the IOt-·O·:'W··:;'IfI. As soon ·;:.s .3.t)':! 1·}·2Ir.3hles .B1"'e'
I_~sed..the Pt-·O·:'W··BIIIs d i stuf·bed.. .;:.nd ·B.m.B.C:hne crash fO':'.':!"esu 1t.
Cer·t.B,in I':!.. th i s ~I.Ill (:·;:.use .3.non-t-·eco'·.·let-·.:e1:,e en-·or·. Th is m·B.':!be ·3.'·..0i c~edb';;.4nc Iud in·:'1the fo 1101.1.1n·:'11ine .3S the f it-·st of theP to . (I: 'W· .3m
POKE42 ..EEK(201):POKE43 ..EEK(202):CLR
This t-'esets the bottc'rfI of te::·::t »oin+er- .3nd then the eLF:: r··esetsa l l the o+her- »oin+er-s , The ~:W·0·:.1t"·.3Ifl ~I.lill nOIJ.I nom.
If th i sis the f ir-s+ 1i ne in.:.. pr-·CI·:'W·.Blfl.'Bnd ';;.4CII.4modif':! thet:'r-·O·:'W··BIfl.'O t·KlTuse the F.:Ut·tcommand 1 . 1 . 1 i th no par.BIIIetet-·s. :;:;t.B.,...tr - un ine the pr·0·:'W·.3IIIr - om b e 101.1.1his l ine , or- the pointer's I.vi 11
be r··esE't to thE' Pt··e'·.Jiol.~Send of the Pt··o·:w·.;:.II'I.In ·:'1ener-·.B.l..';;.40UIJ.lOljd lose the S·BIfie nl.~mbE'r·clf b';;.4tesas 1.I.IE't··eaddec4.
BI.~t 1.l)h.3.t;:.J)OI.~toi n·:'1·B.link of tl.l.lO~:,t··O·:.it"··3If1Snd t:'·BSSit·I':'1 da.t.:..betl.lJE'en them?
Thi sis t-'e1.3.t',,)ehI s i fflPle , A scr-a+ch file C·Bnbe c:t··eatedf 1led J . I J ith the I....r-i .3.bles to bE' p.3ssed. These 1·..B1"'.3bIesthen t··ea.db';;.4he second t=ot-·o·:w·2IIfI.
.Bnd·;:'1"'e
HOI.lJe'..er·.. bec.B.t~SE'of thE' disk ..s h,Bnd1i n·:'1 of se':'I.1.4E'nta l +i Ies . itis .B.d'...S.BJ:,e to ·:'1E'net··.;:'.te;;.4ow·,rum (:·3rr i·3.-:'1E'··E'tw··ns betu.lE'en d.9.t.B.itE'riis. Usin·:'1the fot··rfJ.3.t
1.1.1ll . :C. '·}O i d .Bi"I';;.4com»1i ca.t ions due to unw.B.t"Ited 1i neCh.B.t"·.:c.c:tet··s.
It I , I . IC'U Id be .:t.·:'iood i de.:t. to h·:t.'·.·'ehe f i t-'st m - " _ ) :g-' sm check for' ·3 .
Pt-'e-e>::st i n·:'ifile .:t.nde i thE:,t-·d€' lete 1 t., (;r-' IJ.I.;:,rn the user' + , - ,d-,.:tn~e disks. Ob'....ious 1 ': :1 ., . ; : , . dif+E:<t-'ent fi len.;:'Iflecsnno+ be used.,unless user intervention is provided~ which in general would
slow the s~stem down.
The ex is+ence of a. pt-·e'.'ic"JS fi le c:·: ;t.n be checked most e·:=..si1';:1 b'::Iopen ing the f i len.:tme., e i thet-· for' t-·e·;:,dr - I.IW· i te., and C::-,E'ck in·: '1the er-r-or- channe 1. If .:t.r·e.:t.dPt-'od'-Kes IIFILE t·KlT FoUt·mI or - ' ·3 .
IJW'i te succeeds then the f i len.:.me h.:..s not been I_~sed. Othen.1.!ise ..some ac+ ion shou Id be t.:tl::en. ~:;ct-·a.tch files sh("ll_~d .:t.lso bede leted 1.l.Ihenhe'=, ar'e of no fw-·thet-· use.
This a lso a l 101. I . IS Iorre Pt-·O·:'it-·.:'JilSf the number+cr-unch in ':_1 !...'.::;.~-.iet':.{to be intet-·t-·w:oted and f-·estar·ted. One cou Id wri te t:'t-·':'·='w"·:;;Jf!:;.d th.:t.'....t-·'='Ions r-un time so th.:'.t the'=, C:.:t.nI':'"'0 to sleep II eii::het-· b'::Ike'=,l:"j.:.r·dcommand ot-· .:..fter· .:..set t i if,e.
The ril.:.d-,ne II I illis not +ound,
Programming
PET DOS SUPPORT PROGRAM By R. J. Fairbairn
Now that the COMMODORE 2040 Floppy Disk System is reaching
PET owners more support programs are needed. The PET DOS
SUPPORT Program is an aid to the 2040 User which humanizes
the PET to 2040 interface better than direct mode BASICstatements.
This program consists of two routines; a BASIC driver routineand a machine language routine. The BASIC program calls the
machine language which moves the working portion of itself
up into high memory. The subroutine then links itself into
the CHRGET subroutine in page zero and before returning moves
the top of memory pointer down so BASIC will not destroy the
working portion. The BASIC program then clears the PET
screen and displays an abbreviated set of instructions before
executing a NEW command.
Figure A and Figure B are the BASIC and ASSEMBLY Listings of
the DOS SUPPORT Program. The programs are entered into thePET as follows. First reset the PET so the memory is initial~
ized, this makes entry of machine code simpler. After the
PET has been reset type in the BASIC program exactly as
listed in figure A. Then using the machine language monitor
enter the object code for the machine language subroutine at
$0700 hex. After entry save both routines from the monitor
{SA =$0400,EA = $08B8}. Finally, using the instructions
included in this article test the program to insure correctoperation. Good luck and happy computing.
WARNING: It is advisable to use diskettes that are new orthat contain no valuable data during the test phase. Thiswill avoid loss of important data and your time.
The purpose of this program is to aid the CBM or PET 2001User in operating the 2040 Dual Floppy Disk System. Thisinstruction sheet has been written with the assumption thatthe reader has a working knowledge of the 2001 series and
the 2040.
NOTE: This program has been placed in the public domainbut if you would like us to produce a copy for you, sendus a blank disk and we'll duplicate the DOS SUPPORT Programon it at no charge. Though, we do ask that you include aself-addressed ,stamped envelope. If you have any commentsor suggestions on the following, please refer them to the
!editor.
The normal method with which the PET communicates with anIEEE Buss device is by the BASIC commands OPEN, PRINT, GET,
INPUT and CLOSE. These statements are somewhat verbose innature and therefore more prone to operator error. Thereis also the limitation that INPUT and GET cannot be used indirect mode due to shared buffer areas. These conditionsare easily handled with the DOS SUPPORT PROGRAM.
DOS SUPPORT PROGRAM may be loaded (saved) as if it werea normal BASIC program. Note should be made of the factthat the 2040 has a special load file name '*' which ifused immediatly after power up (reset) executes the following:
1. Initalizes Drive 02. Loads the first file on that drive
Thus if the command LOAD"*",8 is executed and the DOSSUPPORT Program is the first directory entry it will beloaded. When the DOS SUPPORT Program is executed it re-locates itself up into the highest available RAM memorylocations, links into the CHRGET routine and adjusts BASIC'stop of memory pointer down. This technique uses about 350
bytes of the Users memory but normal machine operations mayproceed without having to reload the DOS SUPPORT Programuntil such time that a system reset is performed.
The DOS SUPPORT Program functions by capturing the data thatthe PET operating system passes to BASIC, before the inter-
preter has a chance to parse it. Thus we can look for Key(escape) characters and process the disk command whichfollows without the use or knowledge of the BASIC interpreter.
There are four key characters that are recognized by theDOS SUPPORT Program. They will be processed only when theyare found in column one of an input line, otherwise a SYNTAXERROR will occur.
The greater than symbol when used preceeding a 2040 Diskcommand passes that command directly to the Floppy Disk
System. See the following examples.
Thus:>I$J
is the same as:PRINT#15,"I$J"
and:>S$J:FILEI
is equal to:
PRINT#15,"S$J:FILEl"
As you can see the > symbol is a substitute for the PRINT#15statement. Remember that an OPEN statement is requiredbefore a PRINT may be executed but no OPEN is required forthe DOS SUPPORT Program.
The second function of the > command is the directory listcommand. As you know the directory of a minidisk can be
loaded with a LOAD"$$J",8. This LOAD will destroy any pro-
gram you might have in memory. To avoid the destruction
of the current program the DOS SUPPORT program prints the
directory on the screen.
To avoid possible directory sorolling,you may depress theSPACE key to stop the listing of a directory. Depress anykey to continue the listing - or you may depress the RUN/STOP key to stop the directory listing and return to BASIC.
>$$J
Means - Display the entire directory of Drive $J
>$l:Q*
Means - Display the directory entries of all files on Drive 1
that have names starting with the letter Q.
The third function of the > command is the error channel in-
terrogation feature. The error channel is read by typing a >
followed immediately by a RETURN. This is equivilent to thefollowing program segment.
Fe,t-· 1 [1 inde::< r-·E,cor-·ds. 'St? I . : : : +or .:=.nd : : . = : i:":=' . i n r·'.::'Cor-·ds ..··s>:?c-f::Ot-·, onE'
,:. 1.::..1"'1.1.101. .41d be ·9' ::: ' +c: 1 1..)I.I.I~:::
Fecot-·d r ·k , T 1'- ' .:;,,::i:: ho. '::;e c i::'.)t-· r ~ o .
2(1(1I
20(1)
1
2(11 400 i 2(1.. . .1
4 1 7 1 j t::0~:'1.. .
1 ,20:;
601 :=:[1(1 4 • 20::;[1 • I
000 '-!,
' : ; ; : 0. i i
1001 1.~:O0 2 : ; I . 20.2[11 • 40[1 -,
1 . 20. i
t 401. .::i()(1 - I I (1- :.- J. ~
Record No. Track No.
I - 567 9 - 17 (1 - ,20
Tr-·.;:.ck 1 . ; : : ~ t-·eser~·i·..'e(~9;;;.7 19
+CW' dit-·ec:i::Ot-·~24 [I 19
125.L
1':5~:::1() 31-,<::,. .: . , _ . '
17..- (2)1,=,252
E.:;'Dh 0+ ·the +Oi .W· t·1.=,j n Pec:c,t-'d are.:;'s 1.1.1ll be knOi.iw!
i:r.::ODk zones ,·~.S
Note .::1::' A 1thou':~h ser::i::ot-· (1 is .:r.u.:=.j.l..:;.}) Ie on ·tt-·.9Dks 1 - ::::.' it-IS no·t r_~: : : : l :?d in -I::his E·.:·:·;:'f!l~:' le •
16 NE>::TJ:NE::-::TI29 P~:I t4T";:']1I4f1 N$=IIII7(1 pr;;:I tH "THE pr;;:OGRAt1~lESON THIS TAPE ARE80 P~:INTII # HAr'lE LEt·K;TH F. Fl~D-SEC85 P~:INTII- -- "1f10 P~:I ~n II 1 OSEF.:O " .; If II.;L ( 1 .' 2) .; II If .; L C1.'3)1f1 5 PF.:NT If 2 NUr'lGAr1E If .; If " .; L ( 2 .'2) ; II II.;L (2., 3)I1f1 PRINTII
:::: E:LACK..JACKII.:" II.;L(3., 2).;
115 PF.:INT" 4 STAR TREK II.; II '.; LC4. 2).;12~3 PF.:INTII 5 TF.:ENDLINE".;125 P~:I NT"6 ~100NLANIIER" .;
1::;~71PF.: t·n "7 CHECKERS " .;1:;:5 PF.: t·n" s CLOCK " .;140 PRI NT" 9 C0t'1DEr'10 " .;145 PF.:NT" A BNSLOGO II.;147 PF.: t 'n "B E::'::CDEf'10 " .;149 PF.:INT" C TAPEDUr'lP II.;151 PF.:INT II D HANGt'lAN II.;15:;: PF.:NT II E E:t'~SDEt10 II .;155 PF.:Iur "F CF.:EATEFLE II.; ,157 PF.:I·n" C i DUt'lfr1'T' II .;II
159 PRI t·n "H DUNt'l'r' " .; "160 PRI NT"I DUt'l~l'T' " .;"
161 PRIt·n " . _ T DUr'1t'l'T' " .; " " .;L ( 19., 2) .; II " .;L < : 19.,3)162 PRHn" K Dur'1N'T' ".; " ".; L(20., 2).; II ".;L(20., 3)164 F 'R I t·n"PF.:P:;S F. Fl~D KE'T' Ot ·~ CASSETTE THEN"166 PF.:I·n"ENTER # OF DESI RED pF.:CIl3r;;:Af'1~lEI.;II,"200 CiEn~$: I Ft'~$(}" "THEt4230210 IFPEEK(519)=0THENPOKE519,52:POKE59411.6122(1 GOnJ2~~H3230 N=ASC(LEFT$(N$,I»-49:PRINT"SEARCHING FOR ";N$;"231 IFN)9THENN=N-7240 POKE59411J53:TS=TI+L(N+l.3)*60250 IFTI(TSTHEN250260 POKE59411., 61270 PRlt·n":-!Q='F.:ESS "'STOP'" Ot·~CASSETTE AND LOAD"
28(1 PRIH" SELECTED PF.:OGF.:At'lt'lEOF.:t'lALL'T'••• :l!llf285 PRI tH" ORl!l".-"-:lH PF.: t·n IfSAVE N E l , J PF.:OGRAt'U'lEON THI S TAPE HEF.:Ef
1 D!t'1L C36., 5)2 DH1P$(36)5 PPI HT" : : ' I l ! ! ! l! ! l l ! ! ! l! ! ! l! ! I l ! ! ! l! ! l l ! !l l ! ! l l ! ! )• •• • • • • • l f .C F . : E A T I t·m I t·mE;:'::TABLE*"9 L(0,1)=0.0:L(0,2)=0:L(0,3)=0:L(0,4)=0
1(1 FOPI=1 T03611 F.:EAD;:':::.:EAm-::
12 L':: I , 1 ) =;:.::13 L(I,2)=1.875*(730.15+(2*(192+X)/l.84968901»/60
The sununer season of 1979 at East K arnak w itnessed the first on-site use of a
microcomp u~ er for al l asp ects of archaeol ogocal fiel dw ork and rep ort p rep aration.
The p urp ose of the p resent p ap er is to highl ight some of the more imp ortant
op erations that are ab l e to b e carried out b y comp uter, as w el l as give a summary
of the sununer season' s w ork.
*******
The concep t of using comp uters in archaeol ogy is not new . Significant
advances in the use of l arge scal e comp uters has b een taking p l ace for the
l ast doz en years in North America, Great B ritain, Europ e, and Israel . It
w as noted earl y that a comp uter' s ab il ity to handl e l arge amoun t .s of data
w ith unmatched sp eed and efficiency w oul d b e a b oon to the social and
historical sciences and archaeol ogy in p articul ar. Thus there have b een
many recent articl es in the l iterature devoted to this idea.
H ow ever, w hen one ex~ nes in more dep th the systems referred to~ one
sees that very few of them have even arrived at the stage of feeding the
site data into the machine. The constraints and restrictions p l aced on
archaeol ogists p reventing them from gaining access to comp uter facil ities
p romp ted the p resent author (G.D.H .) to attemp t to rectify the situation.L ate in 1978, the author ap p roached Professor Donal d B . Redford of the
Dep t. of Near Eastern Studies, University of Toronto, for assistance and!
a testing ground for a p rop osed comp uter scheme. It w as decided to p ut
together a p rel iminary p rogram of activities for fiel d trial s at E. K arnak
the fol l ow ing sununer. If such a s cheme w oul d w ork in the heat of the
Egyp tian day, it w oul d l ikel y w ork anyw here.
It is this tab l e that serves to drive the data inp ut section of the
p rogram. This inp ut section al l ow s even unskil l ed op erators to handl e
efficient data entry. The op ~ rator simp l y sp ecifies the artifact w hich he
or she is ab out to describ e and the comp uter resp onds b y p resenting the
op erato~ w ith a set of mul ti-choice questions. These questions corresp ond
to each of the attrib utes found on the Typ ograp iry ~ art for the sel ected
artifact. The op erator simp l Y answ ers the questions one b y one b y
p ressing singl Q.keys on the comp uter keyb oard. This is done sequential ly
until the attrib utes are comp l ete for that artifact. At this p oint thecomp uter automatical l y stores al l the descrip tions of the artifact on its
mass storage disks and w aits for the next artifact to b e sp ecified. This
al l ow s any artifact to b e entered at any time and ob viates the need for
group ing, for examp l e, al l p ots together and entering them at once. The
method corresp onds most cl osel y to the w ay data is recorded b y site
sup ervisors in their site b ooks.
After the day' s data has b een entered into the mass memory disks, any
numb er of requests may b e made of it, or any data stored p reviousl y. The
director can ask to see, for examp l e, al l green gl az ed rim sherds from
feature 25 A ; stratum 15 . The comp uter resp onds b y p rinting out comp l ete
descrip tions of al l p ots corresp onding to this request. In this w ay, the
director can p erform his searching and sorting on al l the data for thatseason b efore the dig ends and thus save w eeks of w ork. This is one of the
more imp ortant and unique features of this set of p rograms.
In order to revise and up date the data al ready in memory, a comp rehensive
scheme of editing is incl uded in the p rograms. If it is found that an
artifact has b een imp rop erl y entered, the op erator can retrieve that datum
b y means of its descrip tion or numb er, and al ter it in any manner desired.
Once the data has b een entered to the satisfaction of the director, the
sorted and p artitioned data set created b y his requests can b e sub jected to
numerous statistical anal yses. These incl ude the simp l e stats such as
frequency histograms, averages, standard deviations, correl ation coefficients
etc., as w el l as more sop histicated techniques such as anal ysis of variance,
seriation, mul ti-variate regression, and eventual ly discriminant anal ysisand cl uster anal ysis. These l ast are incl uded at the discretion of the
director and must b e of a siz e smal l enough to fit onto the microcomp uter
used.
Another unique feature of the P.E.T. comp uter is its ab il ity to draw
schematiz ed rep resentations of the site p l ans on its screen and p rint them
on p ap er (diag. 1) • These are p articul arl y useful w hen new features are
discovered and areas of the site need to b e highl ighted. The director can
hand these to his resp ective site sup ervisors w ith p ertinent information
pinpointed.
A future version of the p rograms w il l incl ude the ab il ity to show
automatical l y on the p rop er site schematic the resp onses to the archaeol ogist' s
requests. F or examp l e, at the archaeol ogist' s request, al l green gl az ed
rim sherds coul d b e p l otted automatical l y on the correct site p l an w ithout
human intervention.
The data inp ut, b asic stats and site p l an draw ing sections of the
p rogram w ere comp l eted b efore travel l ing to Egyp t, as w as the format for the
Typ ograp hy Chart. This chart w as then al tered w hil e in Egyp t to suit the
E. K arnak site artifact distrib utions. Work is now al most comp l ete on the
remaining sections of the p rograms - data requests and retrieval , data
al teration, and advanced statistics. By Autumn 1979 final testing w il l take
p l ace in ~ oronto on data b rought b ack from E. K arnak.
This w as the p art of the p rogr~ of activities that hel d the greatest
p otential for troub l e, b ut it al l w ent quite smoothl y. The comp uter w asdismantl ed into 4 smal l sectional comp onents: Printer, TV screen (CRT),
M ain Comp uter and K eyb oard, and Disk Drives (mass storage). These comp onents
w ere p acked in sturdy b oxes, the w hol e p ackage taking up l ess than 4 cu. ft.
The disk drives and CRT w ere p ut on the airp l ane as cargo and the comp uter and
p rinter w ere taken as hand l uggage. Disks w i t h p rograms re corded on them
w ere p acked inside the main comp uter for p rotection from magnetic fiel ds
and X-rays at airp ort security.
Al l customs checkp oints w ere p assed w i th no interrup tions or del ays. The
comp uter system w as carried b y tw o p eop l e (G.D.H . and w ife) from Canada to
New York, to L ondon, to Cairo, to L uxor, to K arnak and stil l w orked p erfectl y.
The p rinter w as adj usted for op eration at 5 0 H z . and the w hol e system w as
p ow ered b y a variab l e rheostat to enab l e constant 120 V.AC op eration fromvarying (and intenrittent) Egyp tian 220 V.AC mains current.
TASK 4. F IEL D TESTING
~ e system w as instal l ed on a tab l e in the office of the Insp ector of
K arnak Antiquities, Sayed Ab dul H amid, to w hom w e ow e a deb t of gratitude.
It w as discovered that air conditioning w as required to keep the system cool .
F ortunatel y, the insp ector' s office offered the necessary air conditioning
and a rel ativel y dust-free atmosp here. This w as esp ecial l y imp ortant for thedel icate disk drives w hich are notoriousl y suscep tib l e to dust and dirt.
/'Thus each night, sp ecial p l astic b ags w ere p ut around the disks and disk
drives.
In actual op eration, every afternoon the vol tage w as adj usted and the
comp uter system turned on. The morning' s site b ooks or artifacts w ere
b rought to the op erator for entry. At the end of the comp uter session,
w ith al l the data recorded and requ~ sts made, the machine w as turned off
and encl osed in the b ags. Al l systems and modes op erated successful l y as
designed.
Actual test data from the site w ere used to demonstrate the usage of
the p rograms, and suggest al terations to b oth modes of data entry and
eocp ected typ ograp hy of the site. These tests as w el l w ere carried out tothe satisfaction of the director and the op erators.