EM220 - 8080A Microprocessor Instruction Set Emulator Page 1 by Jeffery Sheese Computer Education Program Coordinator Detroit Engineering Institute 2030 West Grand River Detroit, Michigan 48226 (313) 222-7450 USENET - ihnp4!{m-net,aix,crlt,chinet,itivax!gdsb}!jeffery Revision 2.20 - Made following changes: (JES) 05-07-86 Ascié characteró maù no÷ bå entereä aó singlå operandó      delimiteä bù singlå quotes¬ sucè aó MVÉ A,'G'® Thå onlù      probleí witè thió ió thaô thå characteró thaô appeaò iî thå      operaîd fielä arå converteä tï thå uppeò caså ascié codes®      Foò instance¬ 'g§ ½ 67h¬ buô ió converteä tï 'G'¬ whicè ió      47h. Alì CPÕ registeró defaulô tï zero¬ excepô thå PÃ anä SP¬      which default to 2000h and 2500h respectively. Revision 2.12 - Fixed following bugs: (JES) 10-22-85 Conditional jumps and calls will now work. Revision 2.11 - Fixed following bugs: (JES) 09-06-85 Thå backspacå keù wilì no÷ eraså characteró oî thå entrù      line® Thå cursoò wilì nï longeò backspaceä intï thå commanä      linå prompt. Revision 2.10 - Rewrote Introduction (JES) 09-06-85 Revision 2.00 - Original Release (JES) 08-18-82 Iæ anù bugó arå noted¬ oò correctionó made¬ pleaså refeò theí tï thå abovå address. Thå 8080Á Instructioî Seô Emulatoò ió á teachinç tooì useä tï demonstratå thå operatioî oæ 8080 assemblù languagå commandó anä ho÷ theù affecô thå memorù anä microprocessoò registeò contents® Thå emulatoò waó designeä tï acô aó á machinå languagå 'interpreter'¬ whicè closelù resembleó á BASIÃ interpreter® Thió allowó thå machinå languagå studenô tï operatå thå computeò iî á machinå languagå 'direct§ mode® Iî BASIC¬ thå 'direct§ modå ió wheî á persoî typeó iî á commanä sucè aó PRINÔ anä watcheó thå resultó oæ thå command® Thå emulatoò wilì speeä learninç anä comprehensioî iî á positivå anä instructivå atmosphere. Wheî thå prograí ió run¬ á sign-oî messagå ió printeä oî thå screen¬ anä immediatelù followinç ió thå prompt: Initial status: PC S Z A P C A B C D E H L M SP STACK 2000 0 0 0 0 0 00 00 00 00 00 00 00 C3 2500 3236 Instruction: _ Copyright 1986 All Rights Reserved EM220 - 8080A Microprocessor Instruction Set Emulator Page 2 Thå firsô linå ió á descriptioî oæ thå typå oæ registeró iî thå 808° microprocessor® Undeò eacè descriptioî ió thå actuaì contenô oæ thå register® Thå letteró S¬ Z¬ A¬ P¬ anä Ã arå thå statuó flags® Theù changå aó thå microprocessoò statuó changes® Theiò functionó anä descriptionó follow: Sign (S) - Thió flaç showó iæ thå sigî oæ thå resulô oæ thå                lasô operatioî waó positivå oò negative® Thå sigî                flaç wilì bå á ± iæ negative¬ oò á ° iæ positive. Zero (Z) - Thió flaç showó iæ thå resulô oæ thå lasô                operatioî waó zero® Iæ thå resulô ió zero¬ thå                flaç wilì bå 1® Iæ iô waó noô zero¬ thå flaç wilì                bå 0. Auxiliary Carry (A) - Iæ thå resulô oæ thå lasô operatioî causeä á carrù                froí biô threå tï biô fouò oæ thå accumulator¬                thió flaç wilì bå á 1® Sincå iô ió onlù useä foò                thå DAÁ instruction¬ iô ió generallù noô testeä bù                thå useró program. Parity(P) - Thió flaç showó iæ thå resulô oæ thå lasô                operatioî resulteä iî aî eveî oò odä numbeò oæ                oneó iî thå resultinç byte® Iô wilì bå á ¿ iæ                therå ió aî eveî numbeò oæ seô bits¬ oò ¿ iæ therå                ió aî odä numbeò oæ ¿ bits. Carry (C) - Thió flaç showó iæ thå resulô oæ thå lasô                operatioî causeä á carrù oò á borro÷ froí thå mosô                significanô biô oæ thå result® Iô wilì bå ± iæ á                carrù oò á borro÷ diä occur¬ oò iô wilì bå ° iæ iô                diä noô occur. Thå resô oæ thå linå wilì sho÷ thå microprocessor'ó generaì purposå registers® Á descriptioî oæ eacè registeò follows: PC - Thió wilì sho÷ thå currenô addresó oæ thå prograí           counter® Dï noô leô thió gï belo÷ 2000H® Iæ iô does¬           yoõ maù accidentallù alteò memorù thaô ió essentiaì foò           thå emulatoò oò thå operatinç systeí oæ youò computer. A - Thió wilì sho÷ thå contentó oæ thå accumulatoò afteò           thå lasô instructioî typed. B - Thió wilì sho÷ thå contentó oæ thå Â registeò afteò thå           lasô instructioî typed. C - Thió wilì sho÷ thå contentó oæ thå Ã registeò afteò thå           lasô instructioî typed. D - Thió wilì sho÷ thå contentó oæ thå Ä registeò afteò thå           lasô instructioî typed. Copyright 1986 All Rights Reserved EM220 - 8080A Microprocessor Instruction Set Emulator Page 3 E - Thió wilì sho÷ thå contentó oæ thå Å registeò afteò thå           lasô instructioî typed. H - Thió wilì sho÷ thå contentó oæ thå È registeò afteò thå           lasô instructioî typed. L - Thió wilì sho÷ thå contentó oæ thå Ì registeò afteò thå           lasô instructioî typed. M - Thió wilì sho÷ thå contentó oæ thå memorù addresó           pointeä tï bù thå H-Ì registeò pair. SP - Thió wilì sho÷ thå addresó thaô ió thå currenô toð oæ           thå stack. STACK-  Thió wilì sho÷ thå twï byteó thaô arå storeä aô thå toð           oæ thå stack® Thió ió data¬ noô á memorù address. Thå nexô thinç tï dï ió tï actuallù typå iî aî 8080Á mnemonic® Iæ yoõ havå á copù oæ thå 8080Á instructioî set¬ yoõ typå iî thå mnemoniã thå samå aó iæ yoõ werå enterinç anä executinç aî assemblù languagå program® Thió emulatoò doeó noô supporô thå uså oæ labels® Alì numberó arå entereä anä displayeä iî hexidecimaì format® Afteò typinç iî thå instruction¬ presó return¬ anä thå emulatoò wilì displaù thå ne÷ status. Iî ordeò tï exiô á session¬ jusô typå 'Control-C'® Bù typinç Control-Ã aô anù placå oî thå inpuô line¬ oò attemptinç tï executå thå HLÔ command¬ wilì causå thå emulatoò tï displaù thå linå '**ª Warí Booô ***§ anä exiô viá thå warí booô vectoò aô 0000è iî pagå zero® Thió featurå ió tï allo÷ iô tï bå useä oî á computeò 'remotely§ viá thå modeí bù educationaì institutionó oò special interest groups. WARNING: DÏ NOÔ ALTEÒ ANÙ MEMORÙ LOCATIONÓ BELO× 200° HEX® THESÅ      MEMORÙ LOCATIONÓ ARÅ ESSENTIAÌ FOÒ THÅ EMULATOÒ PROGRAÍ ANÄ      THÅ OPERATINÇ SYSTEÍ OÆ YOUÒ COMPUTER® THÅ MNEMONICÓ ANÄ      COMMANDÓ THAÔ ARÅ TYPEÄ IÎ ARÅ ACTUALLÙ STOREÄ ANÄ EXECUTEÄ      AÔ THÅ ADDRESSEÓ NOTEÄ IÎ THÅ PROGRAÍ COUNTER. Authors Note: I'í surå manù peoplå kno÷ thå feelinç oæ thå initiaì shocë wheî theù writå á prograí anä releaså iô intï thå publiã domain¬ anä yearó lateò finä iô oî aî RCP/Í boarä 20° mileó away¡ Thió shockeä må intï thå realizatioî thaô peoplå arå actuallù usinç thió program® Duå tï thå manù bugó presenô iî thió program¬ É definitelù felô thå neeä tï correcô sucè bugs® Thå firsô steð waó tï seperatå thå documentatioî froí thå actuaì prograí sourcå anä makå quitå á fe÷ changeó iî thå documentatioî foò clarity® Futurå revisionó wilì bå madå tï thå prograí tï fiø thå manù bugó currentlù present. Copyright 1986 All Rights Reserved EM220 - 8080A Microprocessor Instruction Set Emulator Page 4 Thå sourcå codå ió nï longeò distributeä witè thå librarù becauså variouó 'idiots§ havå beeî revisinç iô tï crasè whateveò computeò iô ió assembleä foò bù usinç thå BIOÓ routineó tï wipå ouô thå directorù tracks® Theù havå theî recombineä iô intï á librarù anä re-releaseä iô foò distribution. Also¬ iô makeó thå librarù á biô smalleò becauså thå sourcå code takes up about 22k when unsqueezed. Iæ yoõ woulä likå á copù oæ thå sourcå code¬ senä á $µ donatioî tï thå abovå address® Shoulä É nï longeò bå reachablå aô thaô address¬ yoõ caî stilì contacô må viá USENEÔ maiì aô ihnp4!m-net!jeffery. Future revisions planned: 1. ASCIÉ valueó caî no÷ bå entereä aó singlå quotes¬ buô thå      valueó arå converteä tï uppeò caså bù thå inpuô routine® É      woulä likå tï bå ablå tï havå iô uså botè uppeò anä loweò      caså iî thå operanä fielä wheî delimiteä bù singlå quotes. 2. Aî offseô valuå tï bå used¬ pluó erroò checking¬ tï prevenô      modifyinç memorù requireä bù botè thå prograí anä thå      operatinç system® Somå stilì thinë thió aó á 'feature§      becauså oæ thå facô thaô thå instructionó thaô arå actuallù      typed in are executed at the addresses noted. Anù otheò bugó presenô anä founä iî thió prograí shoulä bå reporteä tï thå namå anä addresó noteä aô thå beginninç oæ thió file® Pleaså feeì freå tï adä whateveò correctionó anä featureó tï thió prograí thaô arå necessary¬ provideä theså changeó arå broughô tï mù attention¬ foò everyonå tï enjoy® Happù hacking! - Jefæ Sheeså - Copyright 1986 All Rights Reserved