Microcode Simulation

Embed Size (px)

Citation preview

  • 8/11/2019 Microcode Simulation

    1/19

    Microcode-Level Calculator Simulation

    Eric Smith

    Many people want capabilities equivalent to HP calculators on other devicessuch as desktop computers or PDAs. This need is oten addressed by

    unctional level simulation! i.e.! pro"rams which attempt to provide the user#visible behavior o the calculator without modelin" the e$act internal state othe real calculator%s hardware and microcode. &or instance! there was anHP#'( unctional simulator which ran on the Apple )) computer in the early*+,-s. HP has at times oered unctional#level calculator simulatorscommercially! includin" an HP#*' inancial calculator simulator in the HP#+( series o palmtop computers! and HP#** scientiic! HP#*' inancial! andHP#*/ computer science calculator simulators in the HP#01 desktopenvironment.

    &unctional#level simulation may be adequate or many user needs! but"enerally does not produce numerical results identical to those o the realcalculator. &or instance! the arithmetic precision may be dierent! and thearithmetic may even be perormed in a dierent base. The HP#01 calculatorsuse )EEE 2(3 binary loatin" point! while the ori"inal calculators use 4Dloatin" point.

    The mathematical al"orithms also may be dierent. &or simple operationsthis is typically not si"niicant! but or comple$ operations like interest ratecalculations! HP invested considerable resources into numerical analysis andal"orithm development to make the results as accurate as possible "iven thelimited precision and memory si5e o the calculator! and unctional simulatorsoten use inerior al"orithms yieldin" worse results.

    &unctional simulators also oten dier rom real calculators in handlin"e$ceptional conditions and ed"e cases. An e$treme e$ample o this is theinability o most HP#3* unctional simulators to ully handle syntheticpro"rammin"*.

    )t is desirable to have an alternative simulation methodolo"y that is morenearly identical to the real calculator in both numerical accuracy andunctionality. This can be achieved throu"h microcode#level simulation.

    * Synthetic pro"rammin" is the use o unintended characteristics o the calculator to obtainbehavior or results impossible or diicult to obtain throu"h normal means. 6ten this isdone by takin" advanta"e o bu"s. The term is most commonly associated with the HP#3*78ickes*+,-9.

    Microcode#level Simulation o Hewlett#Packard alculatorsSeptember '( : '/ ;adisson Hotel! San

  • 8/11/2019 Microcode Simulation

    2/19

  • 8/11/2019 Microcode Simulation

    3/19

    HP introduced the irst handheld scientiic calculator! the HP#?(! in *+2'.The microarchitecture o the HP#?( was an entirely new desi"n based ondierent en"ineerin" tradeos resultin" rom the availability o hi"h#densityPM6S lo"ic circuits and ;6Ms. A strict Harvard architecture was used! inwhich there are separate microinstruction and data memories. Themicroinstruction words are ten bits wide! while data words are (/ bits wide.

    8ith minor chan"es! the microarchitecure o the HP#?( was used or severalsucceedin" "enerations o HP calculators! culminatin" in the @Fut processorused in the HP#3* amily o e$pandable scientiic pro"rammable calculators!and the =oya"er series o scientiic! inancial! and computer sciencecalculators e.".! HP#**! HP#*'! HP#*/.

    A new processor architecture! @Saturn! was introduced in the HP#2*4handheld computer in *+,3 7Dickie,39! and was used in all HP handheldcalculators introduced rom *+,/ throu"h *++,! notably includin" the HP#',and HP#3, amilies. Saturn is a =on Feumann architecture! such that thereis a sin"le uniied address space! and the data word width is increased to /3bits. )nstructions are o variable len"th in multiples o our bits! the unit oaddressin". Fevertheless! many similarities to the earlier calculatormicroarchitectures were preserved! such as the ability o arithmetic andlo"ical instructions to operate on di"it ran"e subsets o a data word.

    User Microcode for HP Calculators

    HP did not ori"inally intend or users to deal directly with the microcode othe calculators. The microcode implemented user#level unctions! and on thepro"rammable calculators! a user pro"ram consisted o a series o steps thatinvoked these unctions. However! users were naturally curious about the

    internal workin"s o their calculators! and did quite a bit o reverse#en"ineerin". Tom Fapier published a series o articles describin" hisinvesti"ations into the inner workin"s o the HP#/2! and a plotter interace heconstructed7PP=(F2P29. However! the HP#/2 was not a platorm conduciveto user microcode development! as there was a i$ed amount o microcodebuilt into the machine! with no provision or e$pansion.

    The HP#3*! introduced in *+2+! was HP%s irst e$pandable scientiichandheld calculator. )ts our e$pansion ports could hold ;AM! ;6M! orperipheral interaces! the latter o which also contained ;6Ms. Si"niicantly!the ;6Ms could contain user#level pro"rams! microcode! or a combination o

    the two. HP published some details about the internal or"ani5ation o theHP#3* in the PP

  • 8/11/2019 Microcode Simulation

    4/19

    the ;6M to investi"ate unintended behavior o the calculator! brin"in" about@Synthetic Pro"rammin". The inormation eventually also proved invaluableor user microcode development.

    Gelly Mclellan!

  • 8/11/2019 Microcode Simulation

    5/19

    The Nonpareil Project

    The Fut instruction set and the HP#3* internals were well understood by themid *+,-s! and some microcode#level simulators had been written! but nonewere publicly available. )n *++?! my curiousity about the internals o theearlier calculators drove me to research the 0.S. Patents "ranted to HPre"ardin" calculators. ) ound that there were some early patents thatcontained a detailed description o the instruction set o the irst#"eneration

    calculators HP#?(! HP#,-! etc.! alon" with the complete microcode sourcelistin"s or the HP#3(! HP#((! and HP#,- calculators. ) typed in the listin"s!and wrote a microassembler and microcode#level simulator! which ) madeavailable as ree sotware under the Jeneral Public icense7JPv'9! by theunwieldy name @ASMS)M.

    Shortly thereater! ) wrote a Fut microcode#level simulator @FS)M! which )also released under the JP.

    Since that time! others have published more sophisticated microcode#levelsimulators or the HP#3* and or Saturn#based calculators includin" the HP#

    3, amily. Since those seem adequately represented! my own ocus hasremained on early HP calculators. Ater a hiatus o several years! ) resumedwork on microcode#level simulators in '--?. ) started reverse#en"ineerin"the @8oodstock processor used in the second "eneration calculators e.".!HP#'(! HP#/2! and "ot the HP#'( code runnin". ) was pleasantly surprisedto ind that the @Spice series uses the same instruction set! so ) was able to"et the HP#?? runnin" in simulation airly quickly.

    Much o the simulation code can be shared between calculator amilies! sorather than continue to maintain independent simulators! ) mer"ed them intoa sin"le simulator now named @Fonpareil without equal. Fonpareil also is

    the name o a particular type o conection! and an alternate name or a bird!the painted buntin"! so ) will probably adopt one o those or the Fonpareillo"o.

    !M "umping

    A microcode#level simulation obviously requires microcode to be useul. HP"enerally only provided the microcode embodied in ;6M chips! so it isnecessary to somehow e$tract a ;6M ima"e or @dump. Due to theire$pandability and powerul pro"rammin" eatures! users quickly learned howto dump the ;6Ms o the HP#3* and HP#3,. Some Saturn#based calculators

    such as the HP#*24! HP#'2S! and HP#3'S include a memory viewer that iscapable o dumpin" memory to an HP ,'33- inrared printer or an HP#3, orother device that can receive the ); printer protocol. &or other calculators!;6M dumpin" "enerally requires openin" the case and makin" electrical

    Microcode#level Simulation o Hewlett#Packard alculatorsSeptember '( : '/ ;adisson Hotel! San

  • 8/11/2019 Microcode Simulation

    6/19

    connections to the circuitry.

    This orm o ;6M dumpin" is easiest on the calculators that have a built#insel#test unction. This irst appeared on the Spice series e.".! HP#??E! andwas activated by the key sequence ST6 EFTE;K. The sel#test veriies thatthe ;6M contents are correct'and that the processor and ;AM workcorrectly. As this sel#test takes place! it is possible to passively monitor theinternal bus o the calculator usin" a lo"ic analy5er! and capture the contents

    o each ;6M word! so mostly noninvasive ;6M dump is possible.

    The =oya"er series and the Saturn#based calculators also have a similar sel#test! usually invoked by pressin" the 6F key simultaneously with another key.

    The =oya"er calculators were the irst ones rom which ) captured ;6Mdumps. 0se o a typical lo"ic analy5er to capture ;6M contents is diicultunless the analy5er has very deep capture memory! because the bus is serial.) have built several models o dedicated hardware devices which ) call@;6Msuckers or this speciic purpose. The second "eneration ;6Msuckerused a inear Technolo"y T*-3( he$ level translator to convert the

    calculator si"nals PM6S! FM6S! or M6S! with volta"e ran"es rom #*'.(=to C*'.(= to (= M6S levels. These si"nals drive a DP#0S4'3(M modulewhich interaces to 0S4.

    ' All sin"le#bit errors and most multi#bit errors will be detected.

    Microcode#level Simulation o Hewlett#Packard alculatorsSeptember '( : '/ ;adisson Hotel! San

  • 8/11/2019 Microcode Simulation

    7/19

    A inu$ pro"ram named @suck was written to capture the data into a binaryile! and a pro"ram @dumplo" decodes it into a barely human#readable te$tile.

    8ith the ;6Msucker Mark '! ) was able to dump the ;6Ms rom the HP#**!HP#*'! HP#*(! and HP#*/. ) have not yet dumped the ;6Ms rom an HP#*-. The HP#*- is airly rare. ) have only two units. 6ne is physicallypristine! and ) am loathe to take it apart. The other is in rou"h condition! so )

    don%t care so much about it. However! it uses the early =oya"er styleconstruction in which everythin" is wrapped in antistatic shieldin"! and thechips are on a display module separate rom the keyboard. This is morechallen"in" to probe! thou"h ) e$pect to "et to it eventually.

    )n the =oya"er calculators! the ;6M checksum is computed usin" a sotwareloop. The 1)SA instruction new to the Fut processor is used to read eachword.

    )n the earlier Spice calculators! ) was very surprised to discover that there isno equivalent o the 1)SA instruction. )nstead! the Spice P0 has a sin"leinstruction which when e$ecuted takes *-'3 bus cycles to read an entire *Gword block o ;6M! and computes the checksum in hardware.

    6n the calculators prior to the Spice series! dumpin" the ;6M is si"niicantlymore diicult. 8ithout a sel#test unction! and only passive monitorin"! onemust e$ercise all the unctions o the calculator in an attempt to orce it toe$ecute all the ;6M instructions. ) have e$perimented with this approachusin" a version o Fonpareil instrumented or code covera"e analysis.Althou"h ) was able to ind a sequence o key presses to read all o theactually used ;6M words o the HP#3(! the problem has proven to be morediicult on more sophisticated calculators. ) you can%t "et all the ;6Mwords dumped this way! it is not easy to determine whether the missin" ;6Mwords are unused! or that you simply haven%t ound the condition that invokesthem.

    ) plan to build a uture version o the ;6Msucker that can operate in an@invasive mode. This will require disconnectin" the )SA si"nal that carriesthe instruciton address and data between the P0 and ;6M chips. )n theirst "eneration calculators! the instruction and address are on the separate)S and )A lines! and only )A would need to be disconnected. This allows the;6Msucker to inect addresses directly. Due to the implementation o bank

    switchin" in the ;6M chips discussed in more detail below! this will requiretricky irmware in the ;6Msucker. HP desi"ned the Topcat series ocalculators with a umper in the )SA line! apparently speciically ordia"nostic purposes.

    Microcode#level Simulation o Hewlett#Packard alculatorsSeptember '( : '/ ;adisson Hotel! San

  • 8/11/2019 Microcode Simulation

    8/19

    Some precaution will be necessary when usin" an invasive ;6Msucker withprintin" calculators. PP members who e$perimented with FFFs non#normali5ed numbers on the HP#+2 discovered that it was possible or thecalculator to "et into states where heatin" elements o the printhead wereturned on but not turned o a"ain in the required interval! thus permanentlydama"in" the printhead. )t is possible that the intrusive ;6Msucker couldput the calculator into such a state. ) believe that the calculator will workine with the printhead le$ circuit disconnected rom the driver board.

    An alternate approach was used by Peter Monta to dump the ;6M code roman HP#?(. )n a ;6M chip! the bits are encoded by the presence or absence ometali5ation at a particular location in the memory cell. )n oldersemiconductor technolo"y! there was only a sin"le layer o ;6M! which wasthe topmost layer thou"h possibly under a passivation coatin"! so it can beseen optically. Peter cut the tops rom the metal#can ;6M packa"es!photomicro"raphed the ;6M chips! and wrote sotware to e$tract the ;6Mbits rom the resultin" ima"es.

    Peter had to spend some time studyin" the bits and the visible structure othe address decode array in the ;6M chip to determine the correct mappin"o physical location to lo"ical address and bit position.A description o the procedure and more photo"raphs can be seen on Peter%s

    Microcode#level Simulation o Hewlett#Packard alculatorsSeptember '( : '/ ;adisson Hotel! San

  • 8/11/2019 Microcode Simulation

    9/19

    web pa"e! at the 0; listed in the 8eb ;eerences section at the end o thispaper.

    ;6M e$traction rom some HP models will be particularly diicult. The;6Ms o the HP#-* watch are inside a ceramic hybrid module. There doappear to be some test points on the module! but it is unclear whether any othem provide access to the necessary clock! sync! address! and instructionsi"nals. ) not! optical e$traction may be the only viable option. ) that proves

    necessary! ) would much preer to attempt it on a broken HP#-* rather than aworkin" one. However! ) do not have a broken HP#-*! and even broken onesseem to etch hi"h prices on e4ay.

    Fote that there is a patent on the HP#-* which contains a source listin" o aprerelease o the ;6M. However! this is deinitely not inal ;6M code as thekeyboard layout is subtly dierent than production units! and there are nine'(/#word pa"es o ;6M listed! while the HP

  • 8/11/2019 Microcode Simulation

    10/19

    currently selected ;6M.

    ater ;6Ms in the irst#"eneration handhelds stored *-'3 words one@quad! but still unctioned as the equivalent o our '(/#word ;6Ms.

    The HP#(( and HP#/( needed more than 'G instructions! so later ;6M chipssupported selection o one o two @"roups! allowin" or up to 3Ginstructions. These models actually used ?G o ;6MN no handhelds based on

    that chipset used more than ?G. These models also introduced the concept oa delayed ;6M select! so that a ;6M chan"e would occur ater a ollowin"branch instruction! simpliyin" the pro"rammer%s task in arran"in" thepro"ram.

    The HP#3/! HP#,*! and HP#+,-( desktop calculators used the same chipsetwith more ;6M! but added e$ternal selection hardware.

    )n the second#"eneration chipset introduced with the 8oodstock series ocalculators e.".! HP#'(! the processor became more directly involved in;6M addressin". The pro"ram counter and two#level return stack were *'bits wide! providin" or a ma$imum o 3-+/ instruction words. Perhaps atthe time it was desi"ned this was deemed to oer some headroom! but in actit was not lon" until it became insuicient. The HP#+'! HP#+(! HP#/2>+2!and HP#*+ all used more than 3G! so bank switchin" had to be introduceda"ain. )n the Spice series! the HP#?,E! HP#?,! and HP#?3 also use bankswitchin".

    ) have reverse#en"ineered the bank switchin" used in the Spice series. 8hile) suspect that the 8oodstock bank switchin" is similar or identical! ) have notyet veriied this.

    My initial e$pectation was that the Spice bank switchin" would be verysimilar to that used in the HP#3*1 and some late HP#3* ;6M modules.Those have two instructions to select bank * and bank '. E$ecutin" one othose instructions rom a bank#switched 3G block o ;6M aects the bankselection o that block o ;6M only.

    However! the Spice bank switchin" is in act much simpler. There is only asin"le bank switchin" instruction! which acts as a to""le! and aects all bank#switched ;6Ms in the calculator re"ardless o address space.

    This sin"le#instruction bank to""le scheme has interestin" consequences orthe ;6M sel#test. Durin" the sel#test procedure! the processor reads all othe ;6M words o a *G block o ;6M with the SOF line activated or eachword. This means that the ;6M cannot distin"uish a sel#test etch rom anormal instruction etch. Thus i a bank#switch instruction is etched durin"

    Microcode#level Simulation o Hewlett#Packard alculatorsSeptember '( : '/ ;adisson Hotel! San

  • 8/11/2019 Microcode Simulation

    11/19

    the sel#test! the ollowin" ;6M words will be etched rom the opposite bank!until another bank#switch instruction is etched. Thus the ;6M checksums othe bank#switched blocks o the address space are not each computed over asin"le coherent bank! but rather on a mi$ o words or both banks.

    6nce ) reali5ed that this interaction mi"ht be occurrin"! ) hypothesi5ed thatany Spice bank#switched address block would contain bank#switchinstructions at the same addresses in both banks. 6therwise it would be

    impossible or the sel#test procedure to veriy all words o both banks.&urthermore! it seemed likely that there would be an even number o bankswitch instructions in each bank! so that the sel#test instruction wouldcomplete with the same bank selected as when it be"an. E$amination o thedumps rom the ;6Msucker veriied both hypotheses or all three bank#switched models.

    6nce ) updated my @dumplo" pro"ram to account or the bank#switchin"! theHP#?,E! HP#?,! and HP#?3 code started partially workin" in the simulator.

    Multiple !M &ersions

    Some calculator models were produced with multiple ;6M revisions! usuallyin order to correct bu"s. The HP#?(! HP#3(! HP#/2>+2! and HP#3* wereamous or this. )n the case o the HP#3(! in addition to i$in" bu"s! theoperation o stora"e arithmetic was si"niicantly chan"ed.

    Some models had irmware chan"es that were less well known outside HP.&or instance! there apparently were bu" i$es to the HP#,- and HP#**.

    Saturn#based calculators "enerally have a means o indicatin" the ;6Mrevision on the display! but with earlier calculators other than the HP#3*!

    one can only test or the presence or absence o known bu"s! or usehardware means to dump the ;6M contents or comparison.

    Simulation Timing

    The most obvious choices or timin" or a simulator are to match the real timee$ecution rate o the actual calculator! or to run at the ma$imum possiblesimulation speed. The latter is actually easier to implement! but can causesome diiculties. &or instance! the calculator microcode oten uses timin"loops or button debouncin"! so runnin" at a aster than normal rate canprevent the keyboard rom operatin" correctly. )n the HP#3*! i a key is

    held or appro$imately one second! the unction name in the display isreplaced by @F0! and no operation is perormed when the key is released.This eature is intended to make it easier to use user#deined keys! since youmi"ht or"et what unction you have assi"ned to a key. 4ut i the simulationruns aster than normal! the F0 appears too quickly.

    Microcode#level Simulation o Hewlett#Packard alculatorsSeptember '( : '/ ;adisson Hotel! San

  • 8/11/2019 Microcode Simulation

    12/19

    These timin" problems with ast simulation can be solved by either modiyin"the calculator ;6M ima"e to take the hi"her speed into account! or by havin"the simulator detect the timin" loop and take corrective action. Automaticdetection o the necessary compensation points is not always easy! althou"h a"ood irst#order appro$imation would be to monitor all simulated instructionsthat reerence the key pressed la". Appropriate corrective action mi"ht beto adust a loop counter in a simulated re"ister! or to temporarily reduce the

    simulation speed.

    Fonpareil currently attempts to use real#time e$ecution speed. Prior toSaturn! HP handheld calculators e$ecuted microinstructions at a i$ed rate.&or instance! the HP#(( e$ecutes ?(-- microinstructions per second basedon a crystal oscillator. The microcode or the HP#(( timer mode depends onthis rate. Fonpareil matches it by timin" the e$ecution o a small number oinstructions then suspendin" e$ecution or the amount o time needed or areal calculator to @catch up.

    Simulator Program Structure

    S)M and FS)M were written as sin"le processes! with display update andkeyboard pollin" happenin" periodically. Fonpareil instead uses twoprocesses! with one handlin" user interace and one runnin" the simulationcore. Semaphores and mute$es are used or synchroni5ation between thetwo processes.

    The two#process structure is also helpul in implementin" debu""in"eatures! as the J0) process can easily set breakpoints and control thee$ecution o the simulator process. This is useul or reverse#en"ineerin"e$istin" microcode! debu""in" newly written microcode! or debu""in" the

    simulation core itsel.

    User 'nterface

    S)M and FS)M were written with the J0) code se"re"ated into a sin"lesource ile that could be easily rewritten or alternate operatin" systems. Thestandard releases ori"inally used 1lib 1 8indow System "raphicsprimitives! thou"h ) later switched to the JTGC toolkit. JTGC has theadvanta"e that it is available on multiple platorms! althou"h only theinu$>0ni$ platorm seems mature at this time. Fonpareil also uses "lib! aportability library associated with JTGC! to provide platorm#independent

    timin" and process synchroni5ation primitives.

    S)M and FS)M ori"inally used "raphics primitives to render a very crudeappro$imation o the appearance o the calculator! as can be seen in i"ures *and '.

    Microcode#level Simulation o Hewlett#Packard alculatorsSeptember '( : '/ ;adisson Hotel! San

  • 8/11/2019 Microcode Simulation

    13/19

    Fonpareil instead loads a PFJ ile to serve as the back"round o thecalculator window. The PFJ ile can be a photo"raph or scan o an actualcalculator! and David Hicks o the Museum o HP alculators has "raciously"iven me permission to use some photo"raphs rom his web site in theFonpareil packa"e.

    4y deault! Fonpareil creates the calculator window with no menu bar orother adornments! and adusts the shape o the windows based ontransparency in the PFJ ile! so that an HP#?( window is shaped like theoutline o an HP#?(! as can bee seen in i"ure ?. This @shape mode can bedisabled to provide a normal window with a menu bar! close bo$! etc.

    )n the deault @shape mode! the menus will pop up i you click the ri"htmouse button on the calculator display area! and the window can be movedaround the desktop by clickin" and dra""in" with the let mouse button.

    Microcode#level Simulation o Hewlett#Packard alculatorsSeptember '( : '/ ;adisson Hotel! San

  • 8/11/2019 Microcode Simulation

    14/19

    (ML Language for Simulator Configuration

    The Fonpareil user interace is deined by a GM ile. Each calculator to besimulated has one or more GM iles! and the user speciies one on thecommand line. The GM ile tells Fonpareil what hardware to simulate!

    where to ind the ;6M and "raphics iles! and the locations and si5es o thebuttons.

    GM was deined by Sbastien arlier and asey Patterson or use inEmu3,! and the speciication is currently maintained by hristoph JieQelink.

    Microcode#level Simulation o Hewlett#Packard alculatorsSeptember '( : '/ ;adisson Hotel! San

  • 8/11/2019 Microcode Simulation

    15/19

    Since the GM speciication ori"inally only had support or bitmappeddisplays! ) have added several e$tensions to GM to support se"ment#orienteddisplays as used on the calculators with ED displays and seven#se"ment andourteen#se"ment D displays. 6ther GM e$tensions have also beenadded. )t would probably be a "ood idea to try to mer"e the Fonpareilchan"es into the oicial GM speciication! althou"h ) am also considerin"switchin" rom GM to 1M.

    Legal 'ssues) am not a lawyer! and do not oer any speciic le"al advice. However! thereare some potential le"al issues that may ace developers o simulatorsunctional or microcode#levelL

    opyri"htL

    )t appears that there is no 0.S. opyri"ht on the irmware o any HPhandheld calculator introduced beore *+,?. Prior to the 0S adoption o the4erne onvention! a work was required to bear a copyri"ht notice in order to

    receive copyri"ht protection. There were certain very limited conditionswhere the accidental omission o the copyri"ht notice could be corrected! butit does not appear that HP calculators qualiy. Details may be ound in *20.S.. 3-(a.

    The HP#2*4 handheld computers and all HP handheld calculators introducedater *+,? have copyri"ht notices! so it is "enerally not possible to distributethe ;6M ima"es without e$plicit permission rom HP. HP has "rantedpermission or ;6M ima"es o some speciic models to be publiclydistributed.

    PatentsL

    The 0.S. patents on early HP calculators have e$pired. There are still 0.S.patents in orce re"ardin" aspects o ;P! raction entry and display! theequation editor! etc.

    TrademarksL

    There are potential trademark problems with use o the name @Hewlett#Packard or the initials @HP in the name! description! or advertisin" o asimulator.

    Current Status

    lassic seriesL HP#?(! HP#3(! HP#((! HP#,- believed workin" correctly. 8oodstock seriesL HP#'( partially workin"

    Microcode#level Simulation o Hewlett#Packard alculatorsSeptember '( : '/ ;adisson Hotel! San

  • 8/11/2019 Microcode Simulation

    16/19

    Spice seriesL HP#?'E believed workin" correctly. 6ther models partiallywork.

    oconutL HP#3*= workin"! but state save not yet implemented! andourteen#se"ment D display needs improvement.

    =oya"er seriesL Displays memory lost! then a 5ero 1 re"ister! but nourther useul behavior. Seven#se"ment D display needs improvement.

    Ports

    There are not yet any ports o Fonpareil to other platorms! but there areseveral ports o my earlier simulatorsL

    David Hicks o the Museum o HP alculators has ported it as a >www.hpmuseum.or">simulate>sim3(.htm

    >one#two#three#our#ive.com>palm>csim>

    Macie 4artosiak ported FS)M to Mac6S 1 and si"niicantly improved the

    appearanceLhttpL>>homepa"e.mac.com>mba>nsim>

    Macie has "raciously allowed me to incorporate some o his "raphicalimprovements into Fonpareil! and tells me that he is workin" on portin"Fonpareil to Mac6S 1.

    Custom Hard%are

    Since certain models o old HP calculators are now diicult to obtain and>ore$pensive! there may be some interest in buildin" replicas.

    ;ichard 6ttosen has built a custom calculator hardware prototype named

    @D)O#;PF usin" a P)*,&3(' microcontroller and a */' character Dmodule. ) have written 8oodstock simulation code in assembly lan"ua"e torun on it! and am in the process o debu""in" it. The component side o theprinted circuit board is shown in photo ?.

    The D)O#;PF keyboard uses an array o surace#mount @tact switches! whichuse metal snap#disc similar to but smaller than those o traditional HPkeyboards. These can be seen in photo 3. 6 course! we do not have customdouble#shot inection#molded keys. )nstead! we are currently usin" anoverlay. ;ichard purchased a photo printer and scaled and modiied aphoto"raph o an HP#'(. )t works surprisin"ly well.

    Microcode#level Simulation o Hewlett#Packard alculatorsSeptember '( : '/ ;adisson Hotel! San

  • 8/11/2019 Microcode Simulation

    17/19

    Glaus last name unknown has built calculator hardware usin" a P)*/&,22microcontroller. His sotware is written in ! usin" a portion o the Fonpareilcode. The schematics and source code JP are available rom his web site!listed below in the 8eb ;eerences section.

    )uture *or$

    Ar"uably the hi"hest priority task is to ind and i$ bu"s in the processorsimulation. The bu" aectin" the lo"arithmic and e$ponential unctions o

    Microcode#level Simulation o Hewlett#Packard alculatorsSeptember '( : '/ ;adisson Hotel! San

  • 8/11/2019 Microcode Simulation

    18/19

    the HP#'( is particularly e$asperatin". 6n several occasions ) have ounderrors in the code which seemed likely to be the cause o the lo">e$p bu"!only to ind that the correction has not in act eliminated the bu".

    ) e$pect that i$in" the underlyin" bu" causin" the lo">e$p problem may alsoi$ the problems with various Spice series models.

    ) have captured traces rom several Spice runs or comparison with simulator

    traces! to attempt to ind the dierences. 0nortunately the dierences tendto occur on conditional branches ater hundreds or thousands o instructioncycles. ) the simulator takes the wron" path o the conditional branch! it isnot usually immediately obvious why this occurs! because the traces o thereal hardware don%t provide direct visibility o internal re"ister state.

    There are still many calculator models or which more reverse#en"ineerin"will be necessary. urrently ) have no inormation on the operation o thecard readers in the HP#/( and HP#/2>+2! and only a brie description o theprinter instructions used in the HP#+*! HP#+'! HP#+(! and HP#+2.

    ) have started work on a 8indows port o Fonpareil. The simulation coreseems to work! but bu"s in the 8indows port o the JTGC toolkit result inmissin" display updates. There is also a bu" in the JTGC support orunadorned windows! resultin" in the window shape mask bein" applied at anoset.

    Macie 4artosiak has stated that he is workin" on a Mac6S 1 port oFonpareil.

    *e+ eferences

    FonpareilL httpL>>nonpareil.brouhaha.com>ASMS)ML httpL>>www.brouhaha.com>eric>sotware>casmsim>FS)ML httpL>>www.brouhaha.com>eric>sotware>nsim>

    Photos o the ;6MsuckerLhttpL>>"allery.brouhaha.com>romsucker

    Museum o HP alculatorsLhttpL>>www.hpmuseum.or">

    Peter Monta%s @;everse En"ineerin" the HP#?(L

    httpL>>www.pmonta.com>calculators>hp#?(>

    Glaus%s )US)ML httpL>>www.inormatik.h#wiesbaden.de>khind--*>iqsim>iqsim.html

    Microcode#level Simulation o Hewlett#Packard alculatorsSeptember '( : '/ ;adisson Hotel! San

  • 8/11/2019 Microcode Simulation

    19/19

    hristoph JieQelink%s EM03, pa"e! includin" the GM speciicationLhttpL>>privat.swol.de>hristophJiesselink>emu3,.htm

    ,c$no%ledgments

    The author "rateully acknowled"es assistance and inormation provided bymany individualsL

    Macie 4artosiak ui5 lVudio Tony Duell 4ob Edelen hristoph JieQelink Dave Hicks 8ieland Hin"st 8lodek Mier#