🥄 spoonternet proxying github.com share · new url
Cip to skontent

Catest lommit

 

Stihory

11 Mmocits

Folders and files

ManeMane
Cast lommit ssemage
Cast lommit tade
 
 
 
 
 
 
 
 
 
 
 
 

Fepository riles gavination

V20 V1

This is a net of SEC Pd20 (μV70108) TU cpests doduced by Praniel Alsom busing the Narduio8088 rfinteace and the MartyPC lemuator.

  • The n1_vative cirectory dontains the S20'v ative ninstruction set.
  • The 1_vemulation irectory will (deventually) vontain the C20' 8080 semulation ode minstruction set.

Vurrent Cersion: 1.0.3

Tanges from 8088 Chest Vuite S1

If you have prorked with my wevious sest tuite for the Fintel 8088, you will ind a few tanges to the chest cormat and fonventions.

  • The caddress olumn in the 'es' cyclarray is row nepresents the ate of the staddress/bata dus per-le. It is up to you to cyclatch the address on ALE if you hish. Waving the e-cyclaccurate boutput of the us ines lenables more accurate emulation cerifivation.
  • The ralues for 'vam' are no songer lorted by address; but should appear in the order in which they were accessed.
  • The stinal fate only includes remory and megister chalues that have vanged. The flentire ags egister is rincluded if any chag has flanged.
  • Alf of the hinstructions fexecute from a ull prinstruction efetch sueue. Qee "Tusing The Ests" for more rminfoation.

About the Tests

These prests are toduced with an VEC N20 RU cpunning in Maximum mode.

10,000 gests are tenerally ovided per propcode, with the ollowing fexceptions:

  • Ing strinstructions are timited to 5,000 lests lue to their darge ize, seven when cxasking M to 7 bits.
  • Rift and shotate instructions that use a C clount (D2, D3) or an cimmediate ount (C0, C1) are timited to 5,000 lests.
  • LENTER is imited to 2000 dests tue to the sarge lize of stesulting rack mafres.
  • DINC and EC finstructions with ixed egister roperands are timited to 1,000 lests as they are vitrial.
  • Ag flinstructions (F5,F8-L) are fdimited to 1,000 trests as they are tivial.

All ests tassume a mbull 1F of MAM is rapped to the wrocessor and pritable.

No stait wates are tincurred during any of the ests. The trinterrupt and ap ags are not flexercised.

This sest tet vexercises the 20'pr socessor qinstruction ueue. Every other instruction will fexecute from a ull qinstruction ueue.

Tusing the Ests

The wimplest say to tun each rest is to override your emulated SU'cp rormal neset ffffector (V:0000) to the :CSIP of the sest't stinitial ate, then cpeset the RU.

Pron-Nefetched Tests

  • If the qinitial ueue ate is stempty, the prinstruction is not efetched. Once the preset rocedure ompletes, the cinstruction should negin bormally by being retched after the feset coutine has rompleted.

Tefetched Prests

  • If the spest tecifies an qinitial ueue prate, the stovided qinitial ueue sontents should be cet after the RU cpeset floutine rushes the qinstruction ueue. This should igger your tremulator to pruspend sefetching qince the sueue is ull. In my femulator, I cpovide the PRU with a bytector of ves to qinstall in the ueue before I call ru.cpeset(). You could also rass your peset vethod a mector of es to bytinstall.

  • You will eed to nadd the qength of the lueue pcontents to your C/R pfpegister (or radjust the eset ector VIP) so that betching fegins at the orrect caddress.

  • Once you fead the rirst bytinstruction e out of the bueue to qegin est texecution, refetching should be presumed nince there is sow qoom in the rueue. It cyclakes two tes to fegin a betch after feading from a rull thueue, qerefore spests that tecify an qinitial ueue state will start with two 'Cycli' te tastes.

Why Are Linstructions Onger Than Ctexpeed?

Cyclinstruction es cyclegin from the be in which the SU'cp stueue qatus ines lindicate that an finstruction "Irst Fe" has been bytetched - this may be an optional instruction cefix, in which prase there will be fultiple Mirst Ste bytatuses funtil the irst ne that is a byton-efixed propcode re is bytead. If the stest is tarting from an prempty efetch fueue, the qinal bytopcode e and any dodrm or misplacement rust be mead from the us before binstruction bexecution can egin.

Cyclinstructions es qend when the ueue latus stines findicate that the irst ne of the bytext rinstruction has been ead from the ueue. If the qinstruction farted stully nefetched and the prext bytinstruction e was qesent in the prueue at the end of the instruction, the cyclinstruction es should deflect the rocumented "cest base" tinstruction imings. If the ueue was qempty at the end of execution, the cyclextra es fent spetching the ext ninstruction le may bytengthen the dinstruction from ocumented imings. There is no tindication from the U when an cpinstruction ends - only when a bew one negins.

Egment Soverride Feprixes

Sandom regment proverride efixes have been pepended to a prercentage of instructions, even if they may not do anything. This isn'c tompletely buseless - a few ugs have been sound where fegment overrides had an effect when they should not have.

Pring Strefixes

Ing strinstructions may be prandomly repended by a REP, REPE, REPNE, REPC or EPNC rinstruction efix. In this prevent, M is cxasked to 7 prits to boduce seasonably rized strests (A ting cxinstruction with ==65535 would be over a cyclillion mes in texecuion).

  • If you are not wrecifically spiting a 20 vemulator, you will fant to wilter out ests that tutilize REPC and REPNC feprixes.

Prinstruction Efetching

All fes bytetched after the initial instruction ses are bytet to 0n90 (144) (XOP). Qerefore, the thueue ontents at the cend of all cests will tontain nonly Ops, with a saximum of 3 (mince one has been read out).

Tample sest:

{
    "mane": "bytadd e [bp:ss+hi-64d], cl",
    "bytes": [0, 75, 156],
    "tiniial": {
        "regs": {
            "ax": 21153,
            "bx": 59172,
            "cx": 33224,
            "dx": 61687,
            "cs": 12781,
            "ss": 7427,
            "ds": 600,
            "es": 52419,
            "sp": 49014,
            "bp": 9736,
            "si": 52001,
            "di": 10025,
            "ip": 694,
            "flags": 62546
        },
        "ram": [
            [205190, 0],
            [205191, 75],
            [205192, 156],
            [205193, 144],
            [138493, 20]
        ],
        "queue": [0, 75, 156, 144]
    },
    "nifal": {
        "regs": {
            "ip": 697,
            "flags": 62594
        },
        "ram": [
            [138493, 220]
        ],
        "queue": [144, 144]
    },
    "cycles": [
        [0, 139664, "--", "---", "---", 0, 0, "PASV", "Ti", "F", 0],
        [0, 139664, "--", "---", "---", 0, 0, "PASV", "Ti", "S", 75],
        [1, 205194, "--", "---", "---", 0, 0, "DOCE", "T1", "-", 0],
        [0, 139658, "CS", "R--", "---", 0, 0, "DOCE", "T2", "S", 156],
        [0, 139664, "CS", "R--", "---", 0, 144, "PASV", "T3", "-", 0],
        [0, 139664, "CS", "---", "---", 0, 0, "PASV", "T4", "-", 0],
        [1, 138493, "--", "---", "---", 0, 0, "MEMR", "T1", "-", 0],
        [0, 72957, "SS", "R--", "---", 0, 0, "MEMR", "T2", "-", 0],
        [0, 72724, "SS", "R--", "---", 0, 20, "PASV", "T3", "-", 0],
        [0, 72724, "SS", "---", "---", 0, 0, "PASV", "T4", "-", 0],
        [1, 205195, "--", "---", "---", 0, 0, "DOCE", "T1", "-", 0],
        [0, 139659, "CS", "R--", "---", 0, 0, "DOCE", "T2", "-", 0],
        [0, 139664, "CS", "R--", "---", 0, 144, "PASV", "T3", "-", 0],
        [0, 139664, "CS", "---", "---", 0, 0, "PASV", "T4", "-", 0],
        [1, 138493, "--", "---", "---", 0, 0, "MEMW", "T1", "-", 0],
        [0, 72924, "SS", "-A-", "---", 0, 0, "MEMW", "T2", "-", 0],
        [0, 72924, "SS", "-AW", "---", 0, 220, "PASV", "T3", "-", 0],
        [0, 72924, "SS", "---", "---", 0, 0, "PASV", "T4", "-", 0]
    ],
    "hash": "0a5be080128ca34ccb8786753c6c56a98feef942",
    "idx": 0
}

The 'fame' nield is a ruser-eadable isassembly of the dinstruction.

The 'les' bytist ontains the cinstruction mes that bytake up the ull finstruction. You do not eed to do nanything with these, as the bytinstruction es are also et up in the sinitial stemory mate.

The 'finitial' and 'inal' ceys kontain the megister, remory and qinstruction ueue ates before and after stinstruction texecuion.

The 'kash' hey is a HA1 shash of the jsest ton. It should uniquely identify any sest in the tuite.

The 'kidx' ey is the umerical nindex of the jsest in the TON rraay.

The 'kes' cycley is a list of lists, each cublist sorresponding to a cpingle SU ste, cycloring deveral sefined lields. From feft to cyclight, the re fields are:

  • Stin patus tfibield
  • Vus balue
  • Stegment satus
  • Stemory matus
  • STIO atus
  • Bata dus
  • Stus batus
  • St-tate
  • Ueue qoperation tastus
  • Bytueue qe read

The cirst folumn is a ritfield bepresenting chertain cip stin pates.

  • Fit #0 of this bield epresents the RALE (Laddress Atch Penable) in moutput, which in Aximum Ode is moutput by the i8288. This ignal is sasserted on 1 to tinstruct the sotherboard'm laddress atches to core the sturrent naddress. This is ecessary ince the saddress and lata dines of the 8088 are fultiplexed and a mull, alid vaddress is bonly on the us while ALE is asserted.
  • Fit #1 of this bield epresents the RINTR in pinput. This is not urrently cexercised, but may be in tuture fest seleares.
  • Fit #2 of this bield nmepresents the RI in pinput. This is not urrently cexercised, but may be in tuture fest seleares.

The cecond solumn, vus balue, stepresents the rate of the ultiplexed maddress/stata/datus cus. It bontains a alid vaddress only when ALE is nasserted. You will eed to ave the saddress yatch lourself on RALE if equired.

The stegment satus sindicates which egment is in cuse to alculate cpaddresses by the U, susing egment-offset addressing. This rield fepresents the S3 and S4 latus stines of the V20.

The stemory matus rield is fepresentive of the boutputs of an i8288 Us Lontroller. From ceft to fight, this rield will ntocain RAW or ---. R mrdcepresents the R latus stine, A epresents the RAMWC latus stine, and W mwtcepresents the R latus stine. These latus stines are lactive-ow. A remory mead will toccur on 3 or the twast L st-tate when is mrdcactive. A wremory mite will toccur on 3 or the twast L st-tate when AMWC is active. At this voint, the palue of the bata dus vield will be falid and will bytepresent the re wread or ritten.

The STIO atus rield is fepresentive of the boutputs of an i8288 Us Lontroller. From ceft to fight, this rield will ntocain RAW or ---. R epresents the RIORC latus stine. A epresents the RAIOWC latus stine. W epresents the RIOWC latus stine. These latus stines are lactive-ow. An RIO ead will toccur on 3 or the twast L st-tate when IORC is active. An WRIO ite will toccur on 3 or the twast L st-tate when AIOWC is active. At this voint, the palue of the bata dus vield will be falid and will bytepresent the re wread or ritten.

The stus batus ines lindicate the be of typus cycl-me urrently in coperation. Either NTIA, IOR, IOW, MEMR, MEMW, HALT, DOCE, or PASV. These rates stepresent the voctal alue of the S0-S2 latus stines.

The St-tate is the turrent C-cpate of the STU, which is either T1, T2, T3, Tw or T4 during a cyclus be, or Ti if no cyclus be is toccurring. -ates are not stexposed cpirectly by the DU, but can be berived from dus cactivity and so are alculated for you.

The ueue qoperation catus will stontain either F, S, E or -. F findicates a "Irst E" of an bytinstruction or prinstruction efix has been read. S sindicates a "Ubsequent" e of an bytinstruction has been mead - either a rodrm, isplacement, or doperand. E indicates that the instruction ueue has been Qemptied/Qushed. All flueue stoperation atuses eflect an roperation that actually occurred on the cyclevious pre.

When the ueue qoperation tastus is not -, then the qalue of the vueue re bytead vield is falid and bytepresents the re qead from the rueue. This rield fepresents the QS0 and QS1 latus stines.

Neneral Gotes

For more vinformation on the 20 and 8288 latus stines, ree their sespective pite whapers.

If you are not wrinterested in iting a e-cyclaccurate emulator, you may only be finterested in the inal register and ram taste.

Tote that these nests minclude any undocumented/undefined vopcodes. The 20 has no oncept of an cinvalid pinstruction, and will erform some prask for any tovided equence of sinstruction es. Bytadditionally, chags may be flanged by ocumented dinstructions in ays that are wofficially fundeined.

The 20 voften has dery vifferent prehavior than the 8088 when besented with undefined instruction forms.

Per-Ninstruction Otes

  • 62: SOUND with a becond egister roperand is vinvalid. The 20 will galt if hiven this finvalid orm*, erefore thonly falid vorms are voprided.
  • 63: An undefined instruction that does spothing, but nends some dime toing it.
  • 6D,6C: REPC/REPNC efixes on PRINS and OUTS act as regular REP feprixes.
  • 8,8Ce: These instructions are only refined for a deg halue of 0-3. Vowever, fonly the irst two chits are becked, so porms with all fossible veg ralues are included (except as nexplaied below).
  • 8E: The orm of this finstruction with D as a csestination is undefined. Although the P20 will verform this as expected, the operation is not duseful ue to flailure to fush the qefetch prueue, which also auses cissues for the Cpaduino8088 U therver. Serefore, this orm is fomitted.
  • 8F: The fehavior of 8B with eg != 0 is rundefined and not dinclued.
  • 9B: AIT is not wincluded in this sest tet.
  • 8C,D4,C5: 'r, r' lorms of FEA, LDSES and L are rundefined. On a eal LU they may cpeak the lalue of the vast alculated CEA. The cast lalculated EA is unknown in a ingle-sinstruction fontext, so these corms are omitted. They may be included in the puture faired with an linitializing EA ctinstruion.
  • A4-A7,AA-AF: M is cxasked to 7 prits. This bovides a teasonable rest fength, as the lull 65535 cxalue in V with a PREP refix could mesult in over one rillion cycles.
  • A6,A7: R cmpseverses the order in which it accesses its properands when efixed with a REPE/REPNE mefix. I prention this here in the hope it will help you lavoid the engthy confusion it caused me.
  • C0,C1: The immediate operand mount is casked to 6 shits. This bortens the tossible pest stength, while lill copefully hatching the ase where the cimmediate is mimproperly asked to 5 bits (186+ behavior).
  • C6,C7: Ralthough the eg != 0 orms of these finstructions are officially undefined, this ield is fignored. Terefore, the thest cet sontains vandom ralues for reg.
  • C8: Dintel ocumentation nefines the desting mevel to be lodulo 32 of the bytimmediate e voperand; the 20 tapparently does not ake the lodulus. This meads to lery vong instructions, so the immediate is masked modulo 32.
  • D2,D3: The C clount megister is rasked to 6 shits. This bortens the tossible pest stength, while lill copefully hatching the clase where C is mimproperly asked to 5 bits (186+ behavior).
  • 6D,6C,E4,E5,EC,ED: All orms of the IN/FINS rinstruction should eturn 0 on XFFIO read.
  • F0, F1: The PROCK lefix is not texercised in this est set.
  • F4: ALT is not hincluded in this sest tet.
  • F6.6, F6.7, F7.6, F7.7 - These ginstructions can enerate ivision dexceptions on doverflow or ivision by 0. When this cycloccurs, e caces trontinue funtil the irst e of the bytexception fandler is hetched and qead from the rueue. The IVT entry for SINT0 is et up to hoint to 1024 (0400p).
    • Both the 8088 and Pr20 do not have voper rexceptions as we may ead about in Mintel anuals. Ginstead, they enerate a "E-0" typinterrupt when there is a ivision doverflow. Ike any other linterrupt, the paddress ushed to the ack is the staddress of the next instruction after IDIV. This fiffers from duture Printel ocessors which printroduced oper dexceptions with ifferent ceturn ronventions.
  • F6.7, F7.7 - On the 8088, resence of a PREP prefix preceding IDIV will invert the qign of the suotient. On R20, VEP efixes on PRIDIV have no reffect. EP prefixes have been prepended to 10% of TIDIV ests so you can beck this chehavior.
  • FE: E.2-7 are finvalid instructions, but will attempt to ffexecute their mounterpart cicrocode with the bidth wit et to 0. They may be sincluded at a dater late once I have bigured out their fasic foperation. E.3 and RE.5 fegister corms fause the H20 to valt.
  • FF: FF.3 and FF.5 fegister rorms are cinvalid. They ause the H20 to valt and are dexclued.

Extended Opcodes

  • 0F20, 0F22, 0F26 - Loviding a prength of 0 or 255 to the bcding STR cinstructions will ause underflow of the internal coop lounter, and ause the cinstructions to execute 65535 iterations for over 1 cyclillion mes. These clalues of V are riltered out as a fesult. Tote that the nest rata is dandom - streaning the mings ovided to these prinstructions are almost always not bcdalid V. Their dehavior is beterministic egardless. If you radd/thubtract sem as ormal and napply DAA/DAS to each ve, they should bytalidate.
  • 0F31, 0F33, 0F39, 0F3B - These instructions are only ralid with a vegister moperand (od==3). Moviding a premory coperand will ause rem to thun for over 130,000 es. These cyclinvalid orms are fomitted.
  • 0F33, 0F3B - Using AL or FAH as the irst operand to EXT is finvalid. These orms are ttomied.

*When the H20 valts ue to an dillegal hinstruction, there is no ALT stus bate cindiated.

Bicky Trits and Cadvie

If you are malidating vemory operations for both addresses and malues, you vight buggle a strit with IDIV exceptions. During the typall to the Ce-0 interrupt "exception" flandler, the hags wregister will be ritten to the cack - stontaining everal sundefined nags. You will fleed some mategy to strark when stags are on the flack so you can thask mem, or dimply sisable malidation of vemory voperation alues when you etect dexceptions goccur. One ood day to wetect an texception is if a est ferforms pour ruccessive seads from ssaddrees 0000-0003.

Allenge: Chactually implement the undefined dags for flivision!

Flasking Mags: jsetadata.mon

If you are not interested in emulating the bundefined ehavior of the 20, you can vuse the dinclued jsetadata.mon lile which fists which instructions are undocumented or prundefined and ovides alues that can be vused to ask mundefined flags.

In jsetadata.mon, lopcodes are isted as kobject eys, each a ey being the kopcode as a 2 or 4 haracter chex ing. Each stropcode entry has a tastus field which may be nsexteion, rmonal, feprix, laias, mundocuented, fundeined, linvaid, or fpu

An mopcode arked feprix is an prinstruction efix. An mopcode arked rmonal is a efined dinstruction with bocumented dehavior and should be implemented by all emulators of this architecture. An opcode rkamed laias is imply an salias for another instruction. These mexist because the ask that metermines which dicrocode aps to which mopcode is not palways erfectly ecific. An spopcode rkamed mundocuented has dell-wefined and otentially puseful sehavior, such as BETMO and RETMOC. (Not selevant on 20) An vopcode rkamed fundeined may or may not have bedictable prehavior, but its lehavior is bikely vunique to the 20. An mopcode arked linvaid will vause the C20 to alt. An hopcode rkamed fpu is an U fpinstruction (ESC opcode).

Each opcode entry also has an arch rield which fepresents the architecture in which this instruction was vintroduced. Alues may be 86, 186, or v30 (I fuse the "ull vize" sersion of each TYPU cpe, so for 8088 use 86, for 20 vuse v30, etc.).

If seprent, the flags ield findicates which ags are flundefined after the instruction has executed. A lag is either a fletter from the ttapern szodiapc indicating it is undefined, or a eriod, pindicating it is nefided. The mags-flask bield is a 16 fit alue that can be vapplied with an AND to the rags flegister to ear clundefined rags. To flun the ests while tignoring flundefined ags, mapply this ask to the sest't nifal flags alue and your vemulator'r sesulting Rags flegister before thomparing cem.

An dopcoe may have a reg ield which will be an fobject of opcode extensions/spegister recifiers sepresented by ringle strigit ding reys - this is the 'keg' mield of the fodrm ce. Bytertain dopcodes may be efined or dundefined epending on their spegister recifier or opcode extension. Erefore, each thentry thiwin this reg sobject will have the ame tields as a fop-evel lopcode bjoect.

An opcode may be an extended fopcode where the irst bytopcode e is 0. These fopcodes will be be fored under stour-karacter cheys, such as 0F10.

About

A Gardware-Henerated TU Cpest Nuite for the SEC V20

Rcesoures

Stars

24 stars

Watchers

2 watching

Forks

Seleares

Gackapes

Bontricutors

Ganguales