|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196 |
- /* Copyright (C) 2014-2015 Ben Kurtovic <ben.kurtovic@gmail.com>
- Released under the terms of the MIT License. See LICENSE for details. */
-
- /*
- This file is AUTO-GENERATED from 'instructions.yml'.
-
- `make` should trigger a rebuild when it is modified; if not, use:
- `python scripts/update_asm_instructions.py`.
-
- @AUTOGEN_DATE Fri May 22 01:01:58 2015 UTC
- */
-
- /* @AUTOGEN_INST_BLOCK_START */
-
- INST_FUNC(adc)
- {
- INST_TAKES_ARGS(
- AT_REGISTER,
- AT_IMMEDIATE|AT_INDEXED|AT_INDIRECT|AT_REGISTER,
- AT_NONE
- )
- if (INST_TYPE(0) == AT_REGISTER && INST_TYPE(1) == AT_REGISTER) {
- if (INST_REG(0) == REG_A && INST_REG(1) == REG_A)
- INST_RETURN(1, 0x8F)
- if (INST_REG(0) == REG_A && INST_REG(1) == REG_B)
- INST_RETURN(1, 0x88)
- if (INST_REG(0) == REG_A && INST_REG(1) == REG_C)
- INST_RETURN(1, 0x89)
- if (INST_REG(0) == REG_A && INST_REG(1) == REG_D)
- INST_RETURN(1, 0x8A)
- if (INST_REG(0) == REG_A && INST_REG(1) == REG_E)
- INST_RETURN(1, 0x8B)
- if (INST_REG(0) == REG_A && INST_REG(1) == REG_H)
- INST_RETURN(1, 0x8C)
- if (INST_REG(0) == REG_A && INST_REG(1) == REG_IXH)
- INST_RETURN(2, INST_IX_PREFIX, 0x8C)
- if (INST_REG(0) == REG_A && INST_REG(1) == REG_IYH)
- INST_RETURN(2, INST_IY_PREFIX, 0x8C)
- if (INST_REG(0) == REG_A && INST_REG(1) == REG_L)
- INST_RETURN(1, 0x8D)
- if (INST_REG(0) == REG_A && INST_REG(1) == REG_IXL)
- INST_RETURN(2, INST_IX_PREFIX, 0x8D)
- if (INST_REG(0) == REG_A && INST_REG(1) == REG_IYL)
- INST_RETURN(2, INST_IY_PREFIX, 0x8D)
- if (INST_REG(0) == REG_HL && INST_REG(1) == REG_BC)
- INST_RETURN(2, 0xED, 0x4A)
- if (INST_REG(0) == REG_HL && INST_REG(1) == REG_DE)
- INST_RETURN(2, 0xED, 0x5A)
- if (INST_REG(0) == REG_HL && INST_REG(1) == REG_HL)
- INST_RETURN(2, 0xED, 0x6A)
- if (INST_REG(0) == REG_HL && INST_REG(1) == REG_SP)
- INST_RETURN(2, 0xED, 0x7A)
- INST_ERROR(ARG_VALUE)
- }
- if (INST_TYPE(0) == AT_REGISTER && INST_TYPE(1) == AT_IMMEDIATE) {
- if (INST_REG(0) == REG_A && INST_IMM(1).mask & IMM_U8)
- INST_RETURN(2, 0xCE, INST_IMM(1).uval)
- INST_ERROR(ARG_VALUE)
- }
- if (INST_TYPE(0) == AT_REGISTER && INST_TYPE(1) == AT_INDIRECT &&
- (INST_INDIRECT(1).type == AT_REGISTER && INST_INDIRECT(1).addr.reg == REG_HL)) {
- if (INST_REG(0) == REG_A)
- INST_RETURN(1, 0x8E)
- INST_ERROR(ARG_VALUE)
- }
- if (INST_TYPE(0) == AT_REGISTER && INST_TYPE(1) == AT_INDEXED) {
- if (INST_REG(0) == REG_A)
- INST_RETURN(3, INST_INDEX_PREFIX(1), 0x8E, INST_INDEX(1).offset)
- INST_ERROR(ARG_VALUE)
- }
- INST_ERROR(ARG_TYPE)
- }
-
- INST_FUNC(add)
- {
- INST_TAKES_ARGS(
- AT_REGISTER,
- AT_IMMEDIATE|AT_INDEXED|AT_INDIRECT|AT_REGISTER,
- AT_NONE
- )
- if (INST_TYPE(0) == AT_REGISTER && INST_TYPE(1) == AT_REGISTER) {
- if (INST_REG(0) == REG_A && INST_REG(1) == REG_A)
- INST_RETURN(1, 0x87)
- if (INST_REG(0) == REG_A && INST_REG(1) == REG_B)
- INST_RETURN(1, 0x80)
- if (INST_REG(0) == REG_A && INST_REG(1) == REG_C)
- INST_RETURN(1, 0x81)
- if (INST_REG(0) == REG_A && INST_REG(1) == REG_D)
- INST_RETURN(1, 0x82)
- if (INST_REG(0) == REG_A && INST_REG(1) == REG_E)
- INST_RETURN(1, 0x83)
- if (INST_REG(0) == REG_A && INST_REG(1) == REG_H)
- INST_RETURN(1, 0x84)
- if (INST_REG(0) == REG_A && INST_REG(1) == REG_IXH)
- INST_RETURN(2, INST_IX_PREFIX, 0x84)
- if (INST_REG(0) == REG_A && INST_REG(1) == REG_IYH)
- INST_RETURN(2, INST_IY_PREFIX, 0x84)
- if (INST_REG(0) == REG_A && INST_REG(1) == REG_L)
- INST_RETURN(1, 0x85)
- if (INST_REG(0) == REG_A && INST_REG(1) == REG_IXL)
- INST_RETURN(2, INST_IX_PREFIX, 0x85)
- if (INST_REG(0) == REG_A && INST_REG(1) == REG_IYL)
- INST_RETURN(2, INST_IY_PREFIX, 0x85)
- if (INST_REG(0) == REG_HL && INST_REG(1) == REG_BC)
- INST_RETURN(1, 0x09)
- if (INST_REG(0) == REG_IX && INST_REG(1) == REG_BC)
- INST_RETURN(2, INST_IX_PREFIX, 0x09)
- if (INST_REG(0) == REG_IY && INST_REG(1) == REG_BC)
- INST_RETURN(2, INST_IY_PREFIX, 0x09)
- if (INST_REG(0) == REG_HL && INST_REG(1) == REG_DE)
- INST_RETURN(1, 0x19)
- if (INST_REG(0) == REG_IX && INST_REG(1) == REG_DE)
- INST_RETURN(2, INST_IX_PREFIX, 0x19)
- if (INST_REG(0) == REG_IY && INST_REG(1) == REG_DE)
- INST_RETURN(2, INST_IY_PREFIX, 0x19)
- if (INST_REG(0) == REG_HL && INST_REG(1) == REG_HL)
- INST_RETURN(1, 0x29)
- if (INST_REG(0) == REG_IX && INST_REG(1) == REG_IX)
- INST_RETURN(2, INST_IX_PREFIX, 0x29)
- if (INST_REG(0) == REG_IY && INST_REG(1) == REG_IY)
- INST_RETURN(2, INST_IY_PREFIX, 0x29)
- if (INST_REG(0) == REG_HL && INST_REG(1) == REG_SP)
- INST_RETURN(1, 0x39)
- if (INST_REG(0) == REG_IX && INST_REG(1) == REG_SP)
- INST_RETURN(2, INST_IX_PREFIX, 0x39)
- if (INST_REG(0) == REG_IY && INST_REG(1) == REG_SP)
- INST_RETURN(2, INST_IY_PREFIX, 0x39)
- INST_ERROR(ARG_VALUE)
- }
- if (INST_TYPE(0) == AT_REGISTER && INST_TYPE(1) == AT_IMMEDIATE) {
- if (INST_REG(0) == REG_A && INST_IMM(1).mask & IMM_U8)
- INST_RETURN(2, 0xC6, INST_IMM(1).uval)
- INST_ERROR(ARG_VALUE)
- }
- if (INST_TYPE(0) == AT_REGISTER && INST_TYPE(1) == AT_INDIRECT &&
- (INST_INDIRECT(1).type == AT_REGISTER && INST_INDIRECT(1).addr.reg == REG_HL)) {
- if (INST_REG(0) == REG_A)
- INST_RETURN(1, 0x86)
- INST_ERROR(ARG_VALUE)
- }
- if (INST_TYPE(0) == AT_REGISTER && INST_TYPE(1) == AT_INDEXED) {
- if (INST_REG(0) == REG_A)
- INST_RETURN(3, INST_INDEX_PREFIX(1), 0x86, INST_INDEX(1).offset)
- INST_ERROR(ARG_VALUE)
- }
- INST_ERROR(ARG_TYPE)
- }
-
- INST_FUNC(and)
- {
- INST_TAKES_ARGS(
- AT_IMMEDIATE|AT_INDEXED|AT_INDIRECT|AT_REGISTER,
- AT_NONE,
- AT_NONE
- )
- if (INST_TYPE(0) == AT_REGISTER) {
- if (INST_REG(0) == REG_A)
- INST_RETURN(1, 0xA7)
- if (INST_REG(0) == REG_B)
- INST_RETURN(1, 0xA0)
- if (INST_REG(0) == REG_C)
- INST_RETURN(1, 0xA1)
- if (INST_REG(0) == REG_D)
- INST_RETURN(1, 0xA2)
- if (INST_REG(0) == REG_E)
- INST_RETURN(1, 0xA3)
- if (INST_REG(0) == REG_H)
- INST_RETURN(1, 0xA4)
- if (INST_REG(0) == REG_IXH)
- INST_RETURN(2, INST_IX_PREFIX, 0xA4)
- if (INST_REG(0) == REG_IYH)
- INST_RETURN(2, INST_IY_PREFIX, 0xA4)
- if (INST_REG(0) == REG_L)
- INST_RETURN(1, 0xA5)
- if (INST_REG(0) == REG_IXL)
- INST_RETURN(2, INST_IX_PREFIX, 0xA5)
- if (INST_REG(0) == REG_IYL)
- INST_RETURN(2, INST_IY_PREFIX, 0xA5)
- INST_ERROR(ARG_VALUE)
- }
- if (INST_TYPE(0) == AT_IMMEDIATE) {
- if (INST_IMM(0).mask & IMM_U8)
- INST_RETURN(2, 0xE6, INST_IMM(0).uval)
- INST_ERROR(ARG_VALUE)
- }
- if (INST_TYPE(0) == AT_INDIRECT &&
- (INST_INDIRECT(0).type == AT_REGISTER && INST_INDIRECT(0).addr.reg == REG_HL)) {
- INST_RETURN(1, 0xA6)
- }
- if (INST_TYPE(0) == AT_INDEXED) {
- INST_RETURN(3, INST_INDEX_PREFIX(0), 0xA6, INST_INDEX(0).offset)
- }
- INST_ERROR(ARG_TYPE)
- }
-
- INST_FUNC(bit)
- {
- INST_TAKES_ARGS(
- AT_IMMEDIATE,
- AT_INDEXED|AT_INDIRECT|AT_REGISTER,
- AT_NONE
- )
- if (INST_TYPE(0) == AT_IMMEDIATE && INST_TYPE(1) == AT_REGISTER) {
- if (INST_IMM(0).mask & IMM_BIT && INST_REG(1) == REG_A)
- INST_RETURN(2, 0xCB, 0x47 + 8 * INST_IMM(0).uval)
- if (INST_IMM(0).mask & IMM_BIT && INST_REG(1) == REG_B)
- INST_RETURN(2, 0xCB, 0x40 + 8 * INST_IMM(0).uval)
- if (INST_IMM(0).mask & IMM_BIT && INST_REG(1) == REG_C)
- INST_RETURN(2, 0xCB, 0x41 + 8 * INST_IMM(0).uval)
- if (INST_IMM(0).mask & IMM_BIT && INST_REG(1) == REG_D)
- INST_RETURN(2, 0xCB, 0x42 + 8 * INST_IMM(0).uval)
- if (INST_IMM(0).mask & IMM_BIT && INST_REG(1) == REG_E)
- INST_RETURN(2, 0xCB, 0x43 + 8 * INST_IMM(0).uval)
- if (INST_IMM(0).mask & IMM_BIT && INST_REG(1) == REG_H)
- INST_RETURN(2, 0xCB, 0x44 + 8 * INST_IMM(0).uval)
- if (INST_IMM(0).mask & IMM_BIT && INST_REG(1) == REG_L)
- INST_RETURN(2, 0xCB, 0x45 + 8 * INST_IMM(0).uval)
- INST_ERROR(ARG_VALUE)
- }
- if (INST_TYPE(0) == AT_IMMEDIATE && INST_TYPE(1) == AT_INDIRECT &&
- (INST_INDIRECT(1).type == AT_REGISTER && INST_INDIRECT(1).addr.reg == REG_HL)) {
- if (INST_IMM(0).mask & IMM_BIT)
- INST_RETURN(2, 0xCB, 0x46 + 8 * INST_IMM(0).uval)
- INST_ERROR(ARG_VALUE)
- }
- if (INST_TYPE(0) == AT_IMMEDIATE && INST_TYPE(1) == AT_INDEXED) {
- if (INST_IMM(0).mask & IMM_BIT)
- INST_RETURN(4, INST_INDEX_PREFIX(1), 0xCB, INST_INDEX(1).offset, 0x46 + 8 * INST_IMM(0).uval)
- INST_ERROR(ARG_VALUE)
- }
- INST_ERROR(ARG_TYPE)
- }
-
- INST_FUNC(call)
- {
- INST_TAKES_ARGS(
- AT_CONDITION|AT_IMMEDIATE,
- AT_IMMEDIATE|AT_OPTIONAL,
- AT_NONE
- )
- if (INST_NARGS == 1 && INST_TYPE(0) == AT_IMMEDIATE) {
- if (INST_IMM(0).mask & IMM_U16)
- INST_RETURN(3, 0xCD, INST_IMM_U16_B1(INST_IMM(0)), INST_IMM_U16_B2(INST_IMM(0)))
- INST_ERROR(ARG_VALUE)
- }
- if (INST_NARGS == 2 && INST_TYPE(0) == AT_CONDITION && INST_TYPE(1) == AT_IMMEDIATE) {
- if (INST_COND(0) == COND_NZ && INST_IMM(1).mask & IMM_U16)
- INST_RETURN(3, 0xC4, INST_IMM_U16_B1(INST_IMM(1)), INST_IMM_U16_B2(INST_IMM(1)))
- if (INST_COND(0) == COND_Z && INST_IMM(1).mask & IMM_U16)
- INST_RETURN(3, 0xCC, INST_IMM_U16_B1(INST_IMM(1)), INST_IMM_U16_B2(INST_IMM(1)))
- if (INST_COND(0) == COND_NC && INST_IMM(1).mask & IMM_U16)
- INST_RETURN(3, 0xD4, INST_IMM_U16_B1(INST_IMM(1)), INST_IMM_U16_B2(INST_IMM(1)))
- if (INST_COND(0) == COND_C && INST_IMM(1).mask & IMM_U16)
- INST_RETURN(3, 0xDC, INST_IMM_U16_B1(INST_IMM(1)), INST_IMM_U16_B2(INST_IMM(1)))
- if (INST_COND(0) == COND_PO && INST_IMM(1).mask & IMM_U16)
- INST_RETURN(3, 0xE4, INST_IMM_U16_B1(INST_IMM(1)), INST_IMM_U16_B2(INST_IMM(1)))
- if (INST_COND(0) == COND_PE && INST_IMM(1).mask & IMM_U16)
- INST_RETURN(3, 0xEC, INST_IMM_U16_B1(INST_IMM(1)), INST_IMM_U16_B2(INST_IMM(1)))
- if (INST_COND(0) == COND_P && INST_IMM(1).mask & IMM_U16)
- INST_RETURN(3, 0xF4, INST_IMM_U16_B1(INST_IMM(1)), INST_IMM_U16_B2(INST_IMM(1)))
- if (INST_COND(0) == COND_M && INST_IMM(1).mask & IMM_U16)
- INST_RETURN(3, 0xFC, INST_IMM_U16_B1(INST_IMM(1)), INST_IMM_U16_B2(INST_IMM(1)))
- INST_ERROR(ARG_VALUE)
- }
- INST_ERROR(ARG_TYPE)
- }
-
- INST_FUNC(ccf)
- {
- INST_TAKES_NO_ARGS
- INST_RETURN(1, 0x3F)
- }
-
- INST_FUNC(cp)
- {
- INST_TAKES_ARGS(
- AT_IMMEDIATE|AT_INDEXED|AT_INDIRECT|AT_REGISTER,
- AT_NONE,
- AT_NONE
- )
- if (INST_TYPE(0) == AT_REGISTER) {
- if (INST_REG(0) == REG_A)
- INST_RETURN(1, 0xBF)
- if (INST_REG(0) == REG_B)
- INST_RETURN(1, 0xB8)
- if (INST_REG(0) == REG_C)
- INST_RETURN(1, 0xB9)
- if (INST_REG(0) == REG_D)
- INST_RETURN(1, 0xBA)
- if (INST_REG(0) == REG_E)
- INST_RETURN(1, 0xBB)
- if (INST_REG(0) == REG_H)
- INST_RETURN(1, 0xBC)
- if (INST_REG(0) == REG_IXH)
- INST_RETURN(2, INST_IX_PREFIX, 0xBC)
- if (INST_REG(0) == REG_IYH)
- INST_RETURN(2, INST_IY_PREFIX, 0xBC)
- if (INST_REG(0) == REG_L)
- INST_RETURN(1, 0xBD)
- if (INST_REG(0) == REG_IXL)
- INST_RETURN(2, INST_IX_PREFIX, 0xBD)
- if (INST_REG(0) == REG_IYL)
- INST_RETURN(2, INST_IY_PREFIX, 0xBD)
- INST_ERROR(ARG_VALUE)
- }
- if (INST_TYPE(0) == AT_INDIRECT &&
- (INST_INDIRECT(0).type == AT_REGISTER && INST_INDIRECT(0).addr.reg == REG_HL)) {
- INST_RETURN(1, 0xBE)
- }
- if (INST_TYPE(0) == AT_INDEXED) {
- INST_RETURN(3, INST_INDEX_PREFIX(0), 0xBE, INST_INDEX(0).offset)
- }
- if (INST_TYPE(0) == AT_IMMEDIATE) {
- if (INST_IMM(0).mask & IMM_U8)
- INST_RETURN(2, 0xFE, INST_IMM(0).uval)
- INST_ERROR(ARG_VALUE)
- }
- INST_ERROR(ARG_TYPE)
- }
-
- INST_FUNC(cpd)
- {
- INST_TAKES_NO_ARGS
- INST_RETURN(2, 0xED, 0xA9)
- }
-
- INST_FUNC(cpdr)
- {
- INST_TAKES_NO_ARGS
- INST_RETURN(2, 0xED, 0xB9)
- }
-
- INST_FUNC(cpi)
- {
- INST_TAKES_NO_ARGS
- INST_RETURN(2, 0xED, 0xA1)
- }
-
- INST_FUNC(cpir)
- {
- INST_TAKES_NO_ARGS
- INST_RETURN(2, 0xED, 0xB1)
- }
-
- INST_FUNC(cpl)
- {
- INST_TAKES_NO_ARGS
- INST_RETURN(1, 0x2F)
- }
-
- INST_FUNC(daa)
- {
- INST_TAKES_NO_ARGS
- INST_RETURN(1, 0x27)
- }
-
- INST_FUNC(dec)
- {
- INST_TAKES_ARGS(
- AT_INDEXED|AT_INDIRECT|AT_REGISTER,
- AT_NONE,
- AT_NONE
- )
- if (INST_TYPE(0) == AT_REGISTER) {
- if (INST_REG(0) == REG_A)
- INST_RETURN(1, 0x3D)
- if (INST_REG(0) == REG_B)
- INST_RETURN(1, 0x05)
- if (INST_REG(0) == REG_C)
- INST_RETURN(1, 0x0D)
- if (INST_REG(0) == REG_D)
- INST_RETURN(1, 0x15)
- if (INST_REG(0) == REG_E)
- INST_RETURN(1, 0x1D)
- if (INST_REG(0) == REG_H)
- INST_RETURN(1, 0x25)
- if (INST_REG(0) == REG_IXH)
- INST_RETURN(2, INST_IX_PREFIX, 0x25)
- if (INST_REG(0) == REG_IYH)
- INST_RETURN(2, INST_IY_PREFIX, 0x25)
- if (INST_REG(0) == REG_L)
- INST_RETURN(1, 0x2D)
- if (INST_REG(0) == REG_IXL)
- INST_RETURN(2, INST_IX_PREFIX, 0x2D)
- if (INST_REG(0) == REG_IYL)
- INST_RETURN(2, INST_IY_PREFIX, 0x2D)
- if (INST_REG(0) == REG_BC)
- INST_RETURN(1, 0x0B)
- if (INST_REG(0) == REG_DE)
- INST_RETURN(1, 0x1B)
- if (INST_REG(0) == REG_HL)
- INST_RETURN(1, 0x2B)
- if (INST_REG(0) == REG_IX)
- INST_RETURN(2, INST_IX_PREFIX, 0x2B)
- if (INST_REG(0) == REG_IY)
- INST_RETURN(2, INST_IY_PREFIX, 0x2B)
- if (INST_REG(0) == REG_SP)
- INST_RETURN(1, 0x3B)
- INST_ERROR(ARG_VALUE)
- }
- if (INST_TYPE(0) == AT_INDIRECT &&
- (INST_INDIRECT(0).type == AT_REGISTER && INST_INDIRECT(0).addr.reg == REG_HL)) {
- INST_RETURN(1, 0x35)
- }
- if (INST_TYPE(0) == AT_INDEXED) {
- INST_RETURN(3, INST_INDEX_PREFIX(0), 0x35, INST_INDEX(0).offset)
- }
- INST_ERROR(ARG_TYPE)
- }
-
- INST_FUNC(di)
- {
- INST_TAKES_NO_ARGS
- INST_RETURN(1, 0xF3)
- }
-
- INST_FUNC(djnz)
- {
- INST_TAKES_ARGS(
- AT_IMMEDIATE,
- AT_NONE,
- AT_NONE
- )
- if (INST_TYPE(0) == AT_IMMEDIATE) {
- if (INST_IMM(0).mask & IMM_REL)
- INST_RETURN(2, 0x10, INST_IMM(0).sval - 2)
- INST_ERROR(ARG_VALUE)
- }
- INST_ERROR(ARG_TYPE)
- }
-
- INST_FUNC(ei)
- {
- INST_TAKES_NO_ARGS
- INST_RETURN(1, 0xFB)
- }
-
- INST_FUNC(ex)
- {
- INST_TAKES_ARGS(
- AT_INDIRECT|AT_REGISTER,
- AT_REGISTER,
- AT_NONE
- )
- if (INST_TYPE(0) == AT_REGISTER && INST_TYPE(1) == AT_REGISTER) {
- if (INST_REG(0) == REG_AF && INST_REG(1) == REG_AF_)
- INST_RETURN(1, 0x08)
- if (INST_REG(0) == REG_DE && INST_REG(1) == REG_HL)
- INST_RETURN(1, 0xEB)
- INST_ERROR(ARG_VALUE)
- }
- if (INST_TYPE(0) == AT_INDIRECT && INST_TYPE(1) == AT_REGISTER) {
- if ((INST_INDIRECT(0).type == AT_REGISTER && INST_INDIRECT(0).addr.reg == REG_SP) && INST_REG(1) == REG_HL)
- INST_RETURN(1, 0xE3)
- if ((INST_INDIRECT(0).type == AT_REGISTER && INST_INDIRECT(0).addr.reg == REG_SP) && INST_REG(1) == REG_IX)
- INST_RETURN(2, INST_IX_PREFIX, 0xE3)
- if ((INST_INDIRECT(0).type == AT_REGISTER && INST_INDIRECT(0).addr.reg == REG_SP) && INST_REG(1) == REG_IY)
- INST_RETURN(2, INST_IY_PREFIX, 0xE3)
- INST_ERROR(ARG_VALUE)
- }
- INST_ERROR(ARG_TYPE)
- }
-
- INST_FUNC(exx)
- {
- INST_TAKES_NO_ARGS
- INST_RETURN(1, 0xD9)
- }
-
- INST_FUNC(halt)
- {
- INST_TAKES_NO_ARGS
- INST_RETURN(1, 0x76)
- }
-
- INST_FUNC(im)
- {
- INST_TAKES_ARGS(
- AT_IMMEDIATE,
- AT_NONE,
- AT_NONE
- )
- if (INST_TYPE(0) == AT_IMMEDIATE) {
- if ((INST_IMM(0).mask & IMM_IM && INST_IMM(0).uval == 0))
- INST_RETURN(2, 0xED, 0x46)
- if ((INST_IMM(0).mask & IMM_IM && INST_IMM(0).uval == 1))
- INST_RETURN(2, 0xED, 0x56)
- if ((INST_IMM(0).mask & IMM_IM && INST_IMM(0).uval == 2))
- INST_RETURN(2, 0xED, 0x5E)
- INST_ERROR(ARG_VALUE)
- }
- INST_ERROR(ARG_TYPE)
- }
-
- INST_FUNC(in)
- {
- INST_TAKES_ARGS(
- AT_PORT|AT_REGISTER,
- AT_OPTIONAL|AT_PORT,
- AT_NONE
- )
- if (INST_NARGS == 2 && INST_TYPE(0) == AT_REGISTER && INST_TYPE(1) == AT_PORT) {
- if (INST_REG(0) == REG_A && INST_PORT(1).type == AT_IMMEDIATE)
- INST_RETURN(2, 0xDB, INST_PORT(1).port.imm.uval)
- if (INST_REG(0) == REG_A && INST_PORT(1).type == AT_REGISTER)
- INST_RETURN(2, 0xED, 0x78)
- if (INST_REG(0) == REG_B && INST_PORT(1).type == AT_REGISTER)
- INST_RETURN(2, 0xED, 0x40)
- if (INST_REG(0) == REG_C && INST_PORT(1).type == AT_REGISTER)
- INST_RETURN(2, 0xED, 0x48)
- if (INST_REG(0) == REG_D && INST_PORT(1).type == AT_REGISTER)
- INST_RETURN(2, 0xED, 0x50)
- if (INST_REG(0) == REG_E && INST_PORT(1).type == AT_REGISTER)
- INST_RETURN(2, 0xED, 0x58)
- if (INST_REG(0) == REG_H && INST_PORT(1).type == AT_REGISTER)
- INST_RETURN(2, 0xED, 0x60)
- if (INST_REG(0) == REG_L && INST_PORT(1).type == AT_REGISTER)
- INST_RETURN(2, 0xED, 0x68)
- INST_ERROR(ARG_VALUE)
- }
- if (INST_NARGS == 1 && INST_TYPE(0) == AT_PORT) {
- if (INST_PORT(0).type == AT_REGISTER)
- INST_RETURN(2, 0xED, 0x70)
- INST_ERROR(ARG_VALUE)
- }
- INST_ERROR(ARG_TYPE)
- }
-
- INST_FUNC(inc)
- {
- INST_TAKES_ARGS(
- AT_INDEXED|AT_INDIRECT|AT_REGISTER,
- AT_NONE,
- AT_NONE
- )
- if (INST_TYPE(0) == AT_REGISTER) {
- if (INST_REG(0) == REG_A)
- INST_RETURN(1, 0x3C)
- if (INST_REG(0) == REG_B)
- INST_RETURN(1, 0x04)
- if (INST_REG(0) == REG_C)
- INST_RETURN(1, 0x0C)
- if (INST_REG(0) == REG_D)
- INST_RETURN(1, 0x14)
- if (INST_REG(0) == REG_E)
- INST_RETURN(1, 0x1C)
- if (INST_REG(0) == REG_H)
- INST_RETURN(1, 0x24)
- if (INST_REG(0) == REG_IXH)
- INST_RETURN(2, INST_IX_PREFIX, 0x24)
- if (INST_REG(0) == REG_IYH)
- INST_RETURN(2, INST_IY_PREFIX, 0x24)
- if (INST_REG(0) == REG_L)
- INST_RETURN(1, 0x2C)
- if (INST_REG(0) == REG_IXL)
- INST_RETURN(2, INST_IX_PREFIX, 0x2C)
- if (INST_REG(0) == REG_IYL)
- INST_RETURN(2, INST_IY_PREFIX, 0x2C)
- if (INST_REG(0) == REG_BC)
- INST_RETURN(1, 0x03)
- if (INST_REG(0) == REG_DE)
- INST_RETURN(1, 0x13)
- if (INST_REG(0) == REG_HL)
- INST_RETURN(1, 0x23)
- if (INST_REG(0) == REG_IX)
- INST_RETURN(2, INST_IX_PREFIX, 0x23)
- if (INST_REG(0) == REG_IY)
- INST_RETURN(2, INST_IY_PREFIX, 0x23)
- if (INST_REG(0) == REG_SP)
- INST_RETURN(1, 0x33)
- INST_ERROR(ARG_VALUE)
- }
- if (INST_TYPE(0) == AT_INDIRECT &&
- (INST_INDIRECT(0).type == AT_REGISTER && INST_INDIRECT(0).addr.reg == REG_HL)) {
- INST_RETURN(1, 0x34)
- }
- if (INST_TYPE(0) == AT_INDEXED) {
- INST_RETURN(3, INST_INDEX_PREFIX(0), 0x34, INST_INDEX(0).offset)
- }
- INST_ERROR(ARG_TYPE)
- }
-
- INST_FUNC(ind)
- {
- INST_TAKES_NO_ARGS
- INST_RETURN(2, 0xED, 0xAA)
- }
-
- INST_FUNC(indr)
- {
- INST_TAKES_NO_ARGS
- INST_RETURN(2, 0xED, 0xBA)
- }
-
- INST_FUNC(ini)
- {
- INST_TAKES_NO_ARGS
- INST_RETURN(2, 0xED, 0xA2)
- }
-
- INST_FUNC(inir)
- {
- INST_TAKES_NO_ARGS
- INST_RETURN(2, 0xED, 0xB2)
- }
-
- INST_FUNC(jp)
- {
- INST_TAKES_ARGS(
- AT_CONDITION|AT_IMMEDIATE|AT_INDEXED|AT_INDIRECT,
- AT_IMMEDIATE|AT_OPTIONAL,
- AT_NONE
- )
- if (INST_NARGS == 1 && INST_TYPE(0) == AT_IMMEDIATE) {
- if (INST_IMM(0).mask & IMM_U16)
- INST_RETURN(3, 0xC3, INST_IMM_U16_B1(INST_IMM(0)), INST_IMM_U16_B2(INST_IMM(0)))
- INST_ERROR(ARG_VALUE)
- }
- if (INST_NARGS == 2 && INST_TYPE(0) == AT_CONDITION && INST_TYPE(1) == AT_IMMEDIATE) {
- if (INST_COND(0) == COND_NZ && INST_IMM(1).mask & IMM_U16)
- INST_RETURN(3, 0xC2, INST_IMM_U16_B1(INST_IMM(1)), INST_IMM_U16_B2(INST_IMM(1)))
- if (INST_COND(0) == COND_Z && INST_IMM(1).mask & IMM_U16)
- INST_RETURN(3, 0xCA, INST_IMM_U16_B1(INST_IMM(1)), INST_IMM_U16_B2(INST_IMM(1)))
- if (INST_COND(0) == COND_NC && INST_IMM(1).mask & IMM_U16)
- INST_RETURN(3, 0xD2, INST_IMM_U16_B1(INST_IMM(1)), INST_IMM_U16_B2(INST_IMM(1)))
- if (INST_COND(0) == COND_C && INST_IMM(1).mask & IMM_U16)
- INST_RETURN(3, 0xDA, INST_IMM_U16_B1(INST_IMM(1)), INST_IMM_U16_B2(INST_IMM(1)))
- if (INST_COND(0) == COND_PO && INST_IMM(1).mask & IMM_U16)
- INST_RETURN(3, 0xE2, INST_IMM_U16_B1(INST_IMM(1)), INST_IMM_U16_B2(INST_IMM(1)))
- if (INST_COND(0) == COND_PE && INST_IMM(1).mask & IMM_U16)
- INST_RETURN(3, 0xEA, INST_IMM_U16_B1(INST_IMM(1)), INST_IMM_U16_B2(INST_IMM(1)))
- if (INST_COND(0) == COND_P && INST_IMM(1).mask & IMM_U16)
- INST_RETURN(3, 0xF2, INST_IMM_U16_B1(INST_IMM(1)), INST_IMM_U16_B2(INST_IMM(1)))
- if (INST_COND(0) == COND_M && INST_IMM(1).mask & IMM_U16)
- INST_RETURN(3, 0xFA, INST_IMM_U16_B1(INST_IMM(1)), INST_IMM_U16_B2(INST_IMM(1)))
- INST_ERROR(ARG_VALUE)
- }
- if (INST_NARGS == 1 && INST_TYPE(0) == AT_INDIRECT &&
- (INST_INDIRECT(0).type == AT_REGISTER && INST_INDIRECT(0).addr.reg == REG_HL)) {
- INST_RETURN(1, 0xE9)
- }
- if (INST_NARGS == 1 && INST_TYPE(0) == AT_INDEXED) {
- INST_RETURN(3, INST_INDEX_PREFIX(0), 0xE9, INST_INDEX(0).offset)
- }
- INST_ERROR(ARG_TYPE)
- }
-
- INST_FUNC(jr)
- {
- INST_TAKES_ARGS(
- AT_CONDITION|AT_IMMEDIATE,
- AT_IMMEDIATE|AT_OPTIONAL,
- AT_NONE
- )
- if (INST_NARGS == 1 && INST_TYPE(0) == AT_IMMEDIATE) {
- if (INST_IMM(0).mask & IMM_REL)
- INST_RETURN(2, 0x18, INST_IMM(0).sval - 2)
- INST_ERROR(ARG_VALUE)
- }
- if (INST_NARGS == 2 && INST_TYPE(0) == AT_CONDITION && INST_TYPE(1) == AT_IMMEDIATE) {
- if (INST_COND(0) == COND_NZ && INST_IMM(1).mask & IMM_REL)
- INST_RETURN(2, 0x20, INST_IMM(1).sval - 2)
- if (INST_COND(0) == COND_Z && INST_IMM(1).mask & IMM_REL)
- INST_RETURN(2, 0x28, INST_IMM(1).sval - 2)
- if (INST_COND(0) == COND_NC && INST_IMM(1).mask & IMM_REL)
- INST_RETURN(2, 0x30, INST_IMM(1).sval - 2)
- if (INST_COND(0) == COND_C && INST_IMM(1).mask & IMM_REL)
- INST_RETURN(2, 0x38, INST_IMM(1).sval - 2)
- INST_ERROR(ARG_VALUE)
- }
- INST_ERROR(ARG_TYPE)
- }
-
- INST_FUNC(ld)
- {
- INST_TAKES_ARGS(
- AT_INDEXED|AT_INDIRECT|AT_REGISTER,
- AT_IMMEDIATE|AT_INDEXED|AT_INDIRECT|AT_REGISTER,
- AT_NONE
- )
- if (INST_TYPE(0) == AT_REGISTER && INST_TYPE(1) == AT_REGISTER) {
- if (INST_REG(0) == REG_A && INST_REG(1) == REG_A)
- INST_RETURN(1, 0x7F)
- if (INST_REG(0) == REG_A && INST_REG(1) == REG_B)
- INST_RETURN(1, 0x78)
- if (INST_REG(0) == REG_A && INST_REG(1) == REG_C)
- INST_RETURN(1, 0x79)
- if (INST_REG(0) == REG_A && INST_REG(1) == REG_D)
- INST_RETURN(1, 0x7A)
- if (INST_REG(0) == REG_A && INST_REG(1) == REG_E)
- INST_RETURN(1, 0x7B)
- if (INST_REG(0) == REG_A && INST_REG(1) == REG_H)
- INST_RETURN(1, 0x7C)
- if (INST_REG(0) == REG_A && INST_REG(1) == REG_IXH)
- INST_RETURN(2, INST_IX_PREFIX, 0x7C)
- if (INST_REG(0) == REG_A && INST_REG(1) == REG_IYH)
- INST_RETURN(2, INST_IY_PREFIX, 0x7C)
- if (INST_REG(0) == REG_A && INST_REG(1) == REG_L)
- INST_RETURN(1, 0x7D)
- if (INST_REG(0) == REG_A && INST_REG(1) == REG_IXL)
- INST_RETURN(2, INST_IX_PREFIX, 0x7D)
- if (INST_REG(0) == REG_A && INST_REG(1) == REG_IYL)
- INST_RETURN(2, INST_IY_PREFIX, 0x7D)
- if (INST_REG(0) == REG_B && INST_REG(1) == REG_A)
- INST_RETURN(1, 0x47)
- if (INST_REG(0) == REG_B && INST_REG(1) == REG_B)
- INST_RETURN(1, 0x40)
- if (INST_REG(0) == REG_B && INST_REG(1) == REG_C)
- INST_RETURN(1, 0x41)
- if (INST_REG(0) == REG_B && INST_REG(1) == REG_D)
- INST_RETURN(1, 0x42)
- if (INST_REG(0) == REG_B && INST_REG(1) == REG_E)
- INST_RETURN(1, 0x43)
- if (INST_REG(0) == REG_B && INST_REG(1) == REG_H)
- INST_RETURN(1, 0x44)
- if (INST_REG(0) == REG_B && INST_REG(1) == REG_IXH)
- INST_RETURN(2, INST_IX_PREFIX, 0x44)
- if (INST_REG(0) == REG_B && INST_REG(1) == REG_IYH)
- INST_RETURN(2, INST_IY_PREFIX, 0x44)
- if (INST_REG(0) == REG_B && INST_REG(1) == REG_L)
- INST_RETURN(1, 0x45)
- if (INST_REG(0) == REG_B && INST_REG(1) == REG_IXL)
- INST_RETURN(2, INST_IX_PREFIX, 0x45)
- if (INST_REG(0) == REG_B && INST_REG(1) == REG_IYL)
- INST_RETURN(2, INST_IY_PREFIX, 0x45)
- if (INST_REG(0) == REG_C && INST_REG(1) == REG_A)
- INST_RETURN(1, 0x4F)
- if (INST_REG(0) == REG_C && INST_REG(1) == REG_B)
- INST_RETURN(1, 0x48)
- if (INST_REG(0) == REG_C && INST_REG(1) == REG_C)
- INST_RETURN(1, 0x49)
- if (INST_REG(0) == REG_C && INST_REG(1) == REG_D)
- INST_RETURN(1, 0x4A)
- if (INST_REG(0) == REG_C && INST_REG(1) == REG_E)
- INST_RETURN(1, 0x4B)
- if (INST_REG(0) == REG_C && INST_REG(1) == REG_H)
- INST_RETURN(1, 0x4C)
- if (INST_REG(0) == REG_C && INST_REG(1) == REG_IXH)
- INST_RETURN(2, INST_IX_PREFIX, 0x4C)
- if (INST_REG(0) == REG_C && INST_REG(1) == REG_IYH)
- INST_RETURN(2, INST_IY_PREFIX, 0x4C)
- if (INST_REG(0) == REG_C && INST_REG(1) == REG_L)
- INST_RETURN(1, 0x4D)
- if (INST_REG(0) == REG_C && INST_REG(1) == REG_IXL)
- INST_RETURN(2, INST_IX_PREFIX, 0x4D)
- if (INST_REG(0) == REG_C && INST_REG(1) == REG_IYL)
- INST_RETURN(2, INST_IY_PREFIX, 0x4D)
- if (INST_REG(0) == REG_D && INST_REG(1) == REG_A)
- INST_RETURN(1, 0x57)
- if (INST_REG(0) == REG_D && INST_REG(1) == REG_B)
- INST_RETURN(1, 0x50)
- if (INST_REG(0) == REG_D && INST_REG(1) == REG_C)
- INST_RETURN(1, 0x51)
- if (INST_REG(0) == REG_D && INST_REG(1) == REG_D)
- INST_RETURN(1, 0x52)
- if (INST_REG(0) == REG_D && INST_REG(1) == REG_E)
- INST_RETURN(1, 0x53)
- if (INST_REG(0) == REG_D && INST_REG(1) == REG_H)
- INST_RETURN(1, 0x54)
- if (INST_REG(0) == REG_D && INST_REG(1) == REG_IXH)
- INST_RETURN(2, INST_IX_PREFIX, 0x54)
- if (INST_REG(0) == REG_D && INST_REG(1) == REG_IYH)
- INST_RETURN(2, INST_IY_PREFIX, 0x54)
- if (INST_REG(0) == REG_D && INST_REG(1) == REG_L)
- INST_RETURN(1, 0x55)
- if (INST_REG(0) == REG_D && INST_REG(1) == REG_IXL)
- INST_RETURN(2, INST_IX_PREFIX, 0x55)
- if (INST_REG(0) == REG_D && INST_REG(1) == REG_IYL)
- INST_RETURN(2, INST_IY_PREFIX, 0x55)
- if (INST_REG(0) == REG_E && INST_REG(1) == REG_A)
- INST_RETURN(1, 0x5F)
- if (INST_REG(0) == REG_E && INST_REG(1) == REG_B)
- INST_RETURN(1, 0x58)
- if (INST_REG(0) == REG_E && INST_REG(1) == REG_C)
- INST_RETURN(1, 0x59)
- if (INST_REG(0) == REG_E && INST_REG(1) == REG_D)
- INST_RETURN(1, 0x5A)
- if (INST_REG(0) == REG_E && INST_REG(1) == REG_E)
- INST_RETURN(1, 0x5B)
- if (INST_REG(0) == REG_E && INST_REG(1) == REG_H)
- INST_RETURN(1, 0x5C)
- if (INST_REG(0) == REG_E && INST_REG(1) == REG_IXH)
- INST_RETURN(2, INST_IX_PREFIX, 0x5C)
- if (INST_REG(0) == REG_E && INST_REG(1) == REG_IYH)
- INST_RETURN(2, INST_IY_PREFIX, 0x5C)
- if (INST_REG(0) == REG_E && INST_REG(1) == REG_L)
- INST_RETURN(1, 0x5D)
- if (INST_REG(0) == REG_E && INST_REG(1) == REG_IXL)
- INST_RETURN(2, INST_IX_PREFIX, 0x5D)
- if (INST_REG(0) == REG_E && INST_REG(1) == REG_IYL)
- INST_RETURN(2, INST_IY_PREFIX, 0x5D)
- if (INST_REG(0) == REG_H && INST_REG(1) == REG_A)
- INST_RETURN(1, 0x67)
- if (INST_REG(0) == REG_IXH && INST_REG(1) == REG_A)
- INST_RETURN(2, INST_IX_PREFIX, 0x67)
- if (INST_REG(0) == REG_IYH && INST_REG(1) == REG_A)
- INST_RETURN(2, INST_IY_PREFIX, 0x67)
- if (INST_REG(0) == REG_H && INST_REG(1) == REG_B)
- INST_RETURN(1, 0x60)
- if (INST_REG(0) == REG_IXH && INST_REG(1) == REG_B)
- INST_RETURN(2, INST_IX_PREFIX, 0x60)
- if (INST_REG(0) == REG_IYH && INST_REG(1) == REG_B)
- INST_RETURN(2, INST_IY_PREFIX, 0x60)
- if (INST_REG(0) == REG_H && INST_REG(1) == REG_C)
- INST_RETURN(1, 0x61)
- if (INST_REG(0) == REG_IXH && INST_REG(1) == REG_C)
- INST_RETURN(2, INST_IX_PREFIX, 0x61)
- if (INST_REG(0) == REG_IYH && INST_REG(1) == REG_C)
- INST_RETURN(2, INST_IY_PREFIX, 0x61)
- if (INST_REG(0) == REG_H && INST_REG(1) == REG_D)
- INST_RETURN(1, 0x62)
- if (INST_REG(0) == REG_IXH && INST_REG(1) == REG_D)
- INST_RETURN(2, INST_IX_PREFIX, 0x62)
- if (INST_REG(0) == REG_IYH && INST_REG(1) == REG_D)
- INST_RETURN(2, INST_IY_PREFIX, 0x62)
- if (INST_REG(0) == REG_H && INST_REG(1) == REG_E)
- INST_RETURN(1, 0x63)
- if (INST_REG(0) == REG_IXH && INST_REG(1) == REG_E)
- INST_RETURN(2, INST_IX_PREFIX, 0x63)
- if (INST_REG(0) == REG_IYH && INST_REG(1) == REG_E)
- INST_RETURN(2, INST_IY_PREFIX, 0x63)
- if (INST_REG(0) == REG_H && INST_REG(1) == REG_H)
- INST_RETURN(1, 0x64)
- if (INST_REG(0) == REG_IXH && INST_REG(1) == REG_IXH)
- INST_RETURN(2, INST_IX_PREFIX, 0x64)
- if (INST_REG(0) == REG_IYH && INST_REG(1) == REG_IYH)
- INST_RETURN(2, INST_IY_PREFIX, 0x64)
- if (INST_REG(0) == REG_H && INST_REG(1) == REG_L)
- INST_RETURN(1, 0x65)
- if (INST_REG(0) == REG_IXH && INST_REG(1) == REG_IXL)
- INST_RETURN(2, INST_IX_PREFIX, 0x65)
- if (INST_REG(0) == REG_IYH && INST_REG(1) == REG_IYL)
- INST_RETURN(2, INST_IY_PREFIX, 0x65)
- if (INST_REG(0) == REG_L && INST_REG(1) == REG_A)
- INST_RETURN(1, 0x6F)
- if (INST_REG(0) == REG_IXL && INST_REG(1) == REG_A)
- INST_RETURN(2, INST_IX_PREFIX, 0x6F)
- if (INST_REG(0) == REG_IYL && INST_REG(1) == REG_A)
- INST_RETURN(2, INST_IY_PREFIX, 0x6F)
- if (INST_REG(0) == REG_L && INST_REG(1) == REG_B)
- INST_RETURN(1, 0x68)
- if (INST_REG(0) == REG_IXL && INST_REG(1) == REG_B)
- INST_RETURN(2, INST_IX_PREFIX, 0x68)
- if (INST_REG(0) == REG_IYL && INST_REG(1) == REG_B)
- INST_RETURN(2, INST_IY_PREFIX, 0x68)
- if (INST_REG(0) == REG_L && INST_REG(1) == REG_C)
- INST_RETURN(1, 0x69)
- if (INST_REG(0) == REG_IXL && INST_REG(1) == REG_C)
- INST_RETURN(2, INST_IX_PREFIX, 0x69)
- if (INST_REG(0) == REG_IYL && INST_REG(1) == REG_C)
- INST_RETURN(2, INST_IY_PREFIX, 0x69)
- if (INST_REG(0) == REG_L && INST_REG(1) == REG_D)
- INST_RETURN(1, 0x6A)
- if (INST_REG(0) == REG_IXL && INST_REG(1) == REG_D)
- INST_RETURN(2, INST_IX_PREFIX, 0x6A)
- if (INST_REG(0) == REG_IYL && INST_REG(1) == REG_D)
- INST_RETURN(2, INST_IY_PREFIX, 0x6A)
- if (INST_REG(0) == REG_L && INST_REG(1) == REG_E)
- INST_RETURN(1, 0x6B)
- if (INST_REG(0) == REG_IXL && INST_REG(1) == REG_E)
- INST_RETURN(2, INST_IX_PREFIX, 0x6B)
- if (INST_REG(0) == REG_IYL && INST_REG(1) == REG_E)
- INST_RETURN(2, INST_IY_PREFIX, 0x6B)
- if (INST_REG(0) == REG_L && INST_REG(1) == REG_H)
- INST_RETURN(1, 0x6C)
- if (INST_REG(0) == REG_IXL && INST_REG(1) == REG_IXH)
- INST_RETURN(2, INST_IX_PREFIX, 0x6C)
- if (INST_REG(0) == REG_IYL && INST_REG(1) == REG_IYH)
- INST_RETURN(2, INST_IY_PREFIX, 0x6C)
- if (INST_REG(0) == REG_L && INST_REG(1) == REG_L)
- INST_RETURN(1, 0x6D)
- if (INST_REG(0) == REG_IXL && INST_REG(1) == REG_IXL)
- INST_RETURN(2, INST_IX_PREFIX, 0x6D)
- if (INST_REG(0) == REG_IYL && INST_REG(1) == REG_IYL)
- INST_RETURN(2, INST_IY_PREFIX, 0x6D)
- if (INST_REG(0) == REG_A && INST_REG(1) == REG_IX)
- INST_RETURN(3, INST_IX_PREFIX, 0xED, 0x57)
- if (INST_REG(0) == REG_A && INST_REG(1) == REG_IY)
- INST_RETURN(3, INST_IY_PREFIX, 0xED, 0x57)
- if (INST_REG(0) == REG_IX && INST_REG(1) == REG_A)
- INST_RETURN(3, INST_IX_PREFIX, 0xED, 0x47)
- if (INST_REG(0) == REG_IY && INST_REG(1) == REG_A)
- INST_RETURN(3, INST_IY_PREFIX, 0xED, 0x47)
- if (INST_REG(0) == REG_A && INST_REG(1) == REG_R)
- INST_RETURN(2, 0xED, 0x5F)
- if (INST_REG(0) == REG_R && INST_REG(1) == REG_A)
- INST_RETURN(2, 0xED, 0x4F)
- if (INST_REG(0) == REG_SP && INST_REG(1) == REG_HL)
- INST_RETURN(1, 0xF9)
- if (INST_REG(0) == REG_SP && INST_REG(1) == REG_IX)
- INST_RETURN(2, INST_IX_PREFIX, 0xF9)
- if (INST_REG(0) == REG_SP && INST_REG(1) == REG_IY)
- INST_RETURN(2, INST_IY_PREFIX, 0xF9)
- INST_ERROR(ARG_VALUE)
- }
- if (INST_TYPE(0) == AT_REGISTER && INST_TYPE(1) == AT_IMMEDIATE) {
- if (INST_REG(0) == REG_A && INST_IMM(1).mask & IMM_U8)
- INST_RETURN(2, 0x3E, INST_IMM(1).uval)
- if (INST_REG(0) == REG_B && INST_IMM(1).mask & IMM_U8)
- INST_RETURN(2, 0x06, INST_IMM(1).uval)
- if (INST_REG(0) == REG_C && INST_IMM(1).mask & IMM_U8)
- INST_RETURN(2, 0x0E, INST_IMM(1).uval)
- if (INST_REG(0) == REG_D && INST_IMM(1).mask & IMM_U8)
- INST_RETURN(2, 0x16, INST_IMM(1).uval)
- if (INST_REG(0) == REG_E && INST_IMM(1).mask & IMM_U8)
- INST_RETURN(2, 0x1E, INST_IMM(1).uval)
- if (INST_REG(0) == REG_H && INST_IMM(1).mask & IMM_U8)
- INST_RETURN(2, 0x26, INST_IMM(1).uval)
- if (INST_REG(0) == REG_IXH && INST_IMM(1).mask & IMM_U8)
- INST_RETURN(3, INST_IX_PREFIX, 0x26, INST_IMM(1).uval)
- if (INST_REG(0) == REG_IYH && INST_IMM(1).mask & IMM_U8)
- INST_RETURN(3, INST_IY_PREFIX, 0x26, INST_IMM(1).uval)
- if (INST_REG(0) == REG_L && INST_IMM(1).mask & IMM_U8)
- INST_RETURN(2, 0x2E, INST_IMM(1).uval)
- if (INST_REG(0) == REG_IXL && INST_IMM(1).mask & IMM_U8)
- INST_RETURN(3, INST_IX_PREFIX, 0x2E, INST_IMM(1).uval)
- if (INST_REG(0) == REG_IYL && INST_IMM(1).mask & IMM_U8)
- INST_RETURN(3, INST_IY_PREFIX, 0x2E, INST_IMM(1).uval)
- if (INST_REG(0) == REG_BC && INST_IMM(1).mask & IMM_U16)
- INST_RETURN(3, 0x01, INST_IMM_U16_B1(INST_IMM(1)), INST_IMM_U16_B2(INST_IMM(1)))
- if (INST_REG(0) == REG_DE && INST_IMM(1).mask & IMM_U16)
- INST_RETURN(3, 0x11, INST_IMM_U16_B1(INST_IMM(1)), INST_IMM_U16_B2(INST_IMM(1)))
- if (INST_REG(0) == REG_HL && INST_IMM(1).mask & IMM_U16)
- INST_RETURN(3, 0x21, INST_IMM_U16_B1(INST_IMM(1)), INST_IMM_U16_B2(INST_IMM(1)))
- if (INST_REG(0) == REG_IX && INST_IMM(1).mask & IMM_U16)
- INST_RETURN(4, INST_IX_PREFIX, 0x21, INST_IMM_U16_B1(INST_IMM(1)), INST_IMM_U16_B2(INST_IMM(1)))
- if (INST_REG(0) == REG_IY && INST_IMM(1).mask & IMM_U16)
- INST_RETURN(4, INST_IY_PREFIX, 0x21, INST_IMM_U16_B1(INST_IMM(1)), INST_IMM_U16_B2(INST_IMM(1)))
- if (INST_REG(0) == REG_SP && INST_IMM(1).mask & IMM_U16)
- INST_RETURN(3, 0x31, INST_IMM_U16_B1(INST_IMM(1)), INST_IMM_U16_B2(INST_IMM(1)))
- INST_ERROR(ARG_VALUE)
- }
- if (INST_TYPE(0) == AT_REGISTER && INST_TYPE(1) == AT_INDIRECT &&
- (INST_INDIRECT(1).type == AT_REGISTER && INST_INDIRECT(1).addr.reg == REG_HL)) {
- if (INST_REG(0) == REG_A)
- INST_RETURN(1, 0x7E)
- if (INST_REG(0) == REG_B)
- INST_RETURN(1, 0x46)
- if (INST_REG(0) == REG_C)
- INST_RETURN(1, 0x4E)
- if (INST_REG(0) == REG_D)
- INST_RETURN(1, 0x56)
- if (INST_REG(0) == REG_E)
- INST_RETURN(1, 0x5E)
- if (INST_REG(0) == REG_H)
- INST_RETURN(1, 0x66)
- if (INST_REG(0) == REG_L)
- INST_RETURN(1, 0x6E)
- INST_ERROR(ARG_VALUE)
- }
- if (INST_TYPE(0) == AT_REGISTER && INST_TYPE(1) == AT_INDEXED) {
- if (INST_REG(0) == REG_A)
- INST_RETURN(3, INST_INDEX_PREFIX(1), 0x7E, INST_INDEX(1).offset)
- if (INST_REG(0) == REG_B)
- INST_RETURN(3, INST_INDEX_PREFIX(1), 0x46, INST_INDEX(1).offset)
- if (INST_REG(0) == REG_C)
- INST_RETURN(3, INST_INDEX_PREFIX(1), 0x4E, INST_INDEX(1).offset)
- if (INST_REG(0) == REG_D)
- INST_RETURN(3, INST_INDEX_PREFIX(1), 0x56, INST_INDEX(1).offset)
- if (INST_REG(0) == REG_E)
- INST_RETURN(3, INST_INDEX_PREFIX(1), 0x5E, INST_INDEX(1).offset)
- if (INST_REG(0) == REG_H)
- INST_RETURN(3, INST_INDEX_PREFIX(1), 0x66, INST_INDEX(1).offset)
- if (INST_REG(0) == REG_L)
- INST_RETURN(3, INST_INDEX_PREFIX(1), 0x6E, INST_INDEX(1).offset)
- INST_ERROR(ARG_VALUE)
- }
- if (INST_TYPE(0) == AT_REGISTER && INST_TYPE(1) == AT_INDIRECT) {
- if (INST_REG(0) == REG_A && (INST_INDIRECT(1).type == AT_REGISTER && INST_INDIRECT(1).addr.reg == REG_BC))
- INST_RETURN(1, 0x0A)
- if (INST_REG(0) == REG_A && (INST_INDIRECT(1).type == AT_REGISTER && INST_INDIRECT(1).addr.reg == REG_DE))
- INST_RETURN(1, 0x1A)
- if (INST_REG(0) == REG_HL && INST_INDIRECT(1).type == AT_IMMEDIATE)
- INST_RETURN(3, 0x2A, INST_IMM_U16_B1(INST_INDIRECT(1).addr.imm), INST_IMM_U16_B2(INST_INDIRECT(1).addr.imm))
- if (INST_REG(0) == REG_IX && INST_INDIRECT(1).type == AT_IMMEDIATE)
- INST_RETURN(4, INST_IX_PREFIX, 0x2A, INST_IMM_U16_B1(INST_INDIRECT(1).addr.imm), INST_IMM_U16_B2(INST_INDIRECT(1).addr.imm))
- if (INST_REG(0) == REG_IY && INST_INDIRECT(1).type == AT_IMMEDIATE)
- INST_RETURN(4, INST_IY_PREFIX, 0x2A, INST_IMM_U16_B1(INST_INDIRECT(1).addr.imm), INST_IMM_U16_B2(INST_INDIRECT(1).addr.imm))
- if (INST_REG(0) == REG_A && INST_INDIRECT(1).type == AT_IMMEDIATE)
- INST_RETURN(3, 0x3A, INST_IMM_U16_B1(INST_INDIRECT(1).addr.imm), INST_IMM_U16_B2(INST_INDIRECT(1).addr.imm))
- if (INST_REG(0) == REG_BC && INST_INDIRECT(1).type == AT_IMMEDIATE)
- INST_RETURN(4, 0xED, 0x4B, INST_IMM_U16_B1(INST_INDIRECT(1).addr.imm), INST_IMM_U16_B2(INST_INDIRECT(1).addr.imm))
- if (INST_REG(0) == REG_DE && INST_INDIRECT(1).type == AT_IMMEDIATE)
- INST_RETURN(4, 0xED, 0x5B, INST_IMM_U16_B1(INST_INDIRECT(1).addr.imm), INST_IMM_U16_B2(INST_INDIRECT(1).addr.imm))
- if (INST_REG(0) == REG_SP && INST_INDIRECT(1).type == AT_IMMEDIATE)
- INST_RETURN(4, 0xED, 0x7B, INST_IMM_U16_B1(INST_INDIRECT(1).addr.imm), INST_IMM_U16_B2(INST_INDIRECT(1).addr.imm))
- INST_ERROR(ARG_VALUE)
- }
- if (INST_TYPE(0) == AT_INDIRECT && INST_TYPE(1) == AT_REGISTER &&
- (INST_INDIRECT(0).type == AT_REGISTER && INST_INDIRECT(0).addr.reg == REG_HL)) {
- if (INST_REG(1) == REG_A)
- INST_RETURN(1, 0x77)
- if (INST_REG(1) == REG_B)
- INST_RETURN(1, 0x70)
- if (INST_REG(1) == REG_C)
- INST_RETURN(1, 0x71)
- if (INST_REG(1) == REG_D)
- INST_RETURN(1, 0x72)
- if (INST_REG(1) == REG_E)
- INST_RETURN(1, 0x73)
- if (INST_REG(1) == REG_H)
- INST_RETURN(1, 0x74)
- if (INST_REG(1) == REG_L)
- INST_RETURN(1, 0x75)
- INST_ERROR(ARG_VALUE)
- }
- if (INST_TYPE(0) == AT_INDEXED && INST_TYPE(1) == AT_REGISTER) {
- if (INST_REG(1) == REG_A)
- INST_RETURN(3, INST_INDEX_PREFIX(0), 0x77, INST_INDEX(0).offset)
- if (INST_REG(1) == REG_B)
- INST_RETURN(3, INST_INDEX_PREFIX(0), 0x70, INST_INDEX(0).offset)
- if (INST_REG(1) == REG_C)
- INST_RETURN(3, INST_INDEX_PREFIX(0), 0x71, INST_INDEX(0).offset)
- if (INST_REG(1) == REG_D)
- INST_RETURN(3, INST_INDEX_PREFIX(0), 0x72, INST_INDEX(0).offset)
- if (INST_REG(1) == REG_E)
- INST_RETURN(3, INST_INDEX_PREFIX(0), 0x73, INST_INDEX(0).offset)
- if (INST_REG(1) == REG_H)
- INST_RETURN(3, INST_INDEX_PREFIX(0), 0x74, INST_INDEX(0).offset)
- if (INST_REG(1) == REG_L)
- INST_RETURN(3, INST_INDEX_PREFIX(0), 0x75, INST_INDEX(0).offset)
- INST_ERROR(ARG_VALUE)
- }
- if (INST_TYPE(0) == AT_INDIRECT && INST_TYPE(1) == AT_IMMEDIATE &&
- (INST_INDIRECT(0).type == AT_REGISTER && INST_INDIRECT(0).addr.reg == REG_HL)) {
- if (INST_IMM(1).mask & IMM_U8)
- INST_RETURN(2, 0x36, INST_IMM(1).uval)
- INST_ERROR(ARG_VALUE)
- }
- if (INST_TYPE(0) == AT_INDEXED && INST_TYPE(1) == AT_IMMEDIATE) {
- if (INST_IMM(1).mask & IMM_U8)
- INST_RETURN(4, INST_INDEX_PREFIX(0), 0x36, INST_INDEX(0).offset, INST_IMM(1).uval)
- INST_ERROR(ARG_VALUE)
- }
- if (INST_TYPE(0) == AT_INDIRECT && INST_TYPE(1) == AT_REGISTER) {
- if ((INST_INDIRECT(0).type == AT_REGISTER && INST_INDIRECT(0).addr.reg == REG_BC) && INST_REG(1) == REG_A)
- INST_RETURN(1, 0x02)
- if ((INST_INDIRECT(0).type == AT_REGISTER && INST_INDIRECT(0).addr.reg == REG_DE) && INST_REG(1) == REG_A)
- INST_RETURN(1, 0x12)
- if (INST_INDIRECT(0).type == AT_IMMEDIATE && INST_REG(1) == REG_HL)
- INST_RETURN(3, 0x22, INST_IMM_U16_B1(INST_INDIRECT(0).addr.imm), INST_IMM_U16_B2(INST_INDIRECT(0).addr.imm))
- if (INST_INDIRECT(0).type == AT_IMMEDIATE && INST_REG(1) == REG_IX)
- INST_RETURN(4, INST_IX_PREFIX, 0x22, INST_IMM_U16_B1(INST_INDIRECT(0).addr.imm), INST_IMM_U16_B2(INST_INDIRECT(0).addr.imm))
- if (INST_INDIRECT(0).type == AT_IMMEDIATE && INST_REG(1) == REG_IY)
- INST_RETURN(4, INST_IY_PREFIX, 0x22, INST_IMM_U16_B1(INST_INDIRECT(0).addr.imm), INST_IMM_U16_B2(INST_INDIRECT(0).addr.imm))
- if (INST_INDIRECT(0).type == AT_IMMEDIATE && INST_REG(1) == REG_A)
- INST_RETURN(3, 0x32, INST_IMM_U16_B1(INST_INDIRECT(0).addr.imm), INST_IMM_U16_B2(INST_INDIRECT(0).addr.imm))
- if (INST_INDIRECT(0).type == AT_IMMEDIATE && INST_REG(1) == REG_BC)
- INST_RETURN(4, 0xED, 0x43, INST_IMM_U16_B1(INST_INDIRECT(0).addr.imm), INST_IMM_U16_B2(INST_INDIRECT(0).addr.imm))
- if (INST_INDIRECT(0).type == AT_IMMEDIATE && INST_REG(1) == REG_DE)
- INST_RETURN(4, 0xED, 0x53, INST_IMM_U16_B1(INST_INDIRECT(0).addr.imm), INST_IMM_U16_B2(INST_INDIRECT(0).addr.imm))
- if (INST_INDIRECT(0).type == AT_IMMEDIATE && INST_REG(1) == REG_SP)
- INST_RETURN(4, 0xED, 0x73, INST_IMM_U16_B1(INST_INDIRECT(0).addr.imm), INST_IMM_U16_B2(INST_INDIRECT(0).addr.imm))
- INST_ERROR(ARG_VALUE)
- }
- INST_ERROR(ARG_TYPE)
- }
-
- INST_FUNC(ldd)
- {
- INST_TAKES_NO_ARGS
- INST_RETURN(2, 0xED, 0xA8)
- }
-
- INST_FUNC(lddr)
- {
- INST_TAKES_NO_ARGS
- INST_RETURN(2, 0xED, 0xB8)
- }
-
- INST_FUNC(ldi)
- {
- INST_TAKES_NO_ARGS
- INST_RETURN(2, 0xED, 0xA0)
- }
-
- INST_FUNC(ldir)
- {
- INST_TAKES_NO_ARGS
- INST_RETURN(2, 0xED, 0xB0)
- }
-
- INST_FUNC(neg)
- {
- INST_TAKES_NO_ARGS
- INST_RETURN(2, 0xED, 0x44)
- }
-
- INST_FUNC(nop)
- {
- INST_TAKES_NO_ARGS
- INST_RETURN(1, 0x00)
- }
-
- INST_FUNC(or)
- {
- INST_TAKES_ARGS(
- AT_IMMEDIATE|AT_INDEXED|AT_INDIRECT|AT_REGISTER,
- AT_NONE,
- AT_NONE
- )
- if (INST_TYPE(0) == AT_REGISTER) {
- if (INST_REG(0) == REG_A)
- INST_RETURN(1, 0xB7)
- if (INST_REG(0) == REG_B)
- INST_RETURN(1, 0xB0)
- if (INST_REG(0) == REG_C)
- INST_RETURN(1, 0xB1)
- if (INST_REG(0) == REG_D)
- INST_RETURN(1, 0xB2)
- if (INST_REG(0) == REG_E)
- INST_RETURN(1, 0xB3)
- if (INST_REG(0) == REG_H)
- INST_RETURN(1, 0xB4)
- if (INST_REG(0) == REG_IXH)
- INST_RETURN(2, INST_IX_PREFIX, 0xB4)
- if (INST_REG(0) == REG_IYH)
- INST_RETURN(2, INST_IY_PREFIX, 0xB4)
- if (INST_REG(0) == REG_L)
- INST_RETURN(1, 0xB5)
- if (INST_REG(0) == REG_IXL)
- INST_RETURN(2, INST_IX_PREFIX, 0xB5)
- if (INST_REG(0) == REG_IYL)
- INST_RETURN(2, INST_IY_PREFIX, 0xB5)
- INST_ERROR(ARG_VALUE)
- }
- if (INST_TYPE(0) == AT_IMMEDIATE) {
- if (INST_IMM(0).mask & IMM_U8)
- INST_RETURN(2, 0xF6, INST_IMM(0).uval)
- INST_ERROR(ARG_VALUE)
- }
- if (INST_TYPE(0) == AT_INDIRECT &&
- (INST_INDIRECT(0).type == AT_REGISTER && INST_INDIRECT(0).addr.reg == REG_HL)) {
- INST_RETURN(1, 0xB6)
- }
- if (INST_TYPE(0) == AT_INDEXED) {
- INST_RETURN(3, INST_INDEX_PREFIX(0), 0xB6, INST_INDEX(0).offset)
- }
- INST_ERROR(ARG_TYPE)
- }
-
- INST_FUNC(otdr)
- {
- INST_TAKES_NO_ARGS
- INST_RETURN(2, 0xED, 0xBB)
- }
-
- INST_FUNC(otir)
- {
- INST_TAKES_NO_ARGS
- INST_RETURN(2, 0xED, 0xB3)
- }
-
- INST_FUNC(out)
- {
- INST_TAKES_ARGS(
- AT_PORT,
- AT_IMMEDIATE|AT_REGISTER,
- AT_NONE
- )
- if (INST_TYPE(0) == AT_PORT && INST_TYPE(1) == AT_REGISTER) {
- if (INST_PORT(0).type == AT_IMMEDIATE && INST_REG(1) == REG_A)
- INST_RETURN(2, 0xD3, INST_PORT(0).port.imm.uval)
- if (INST_PORT(0).type == AT_REGISTER && INST_REG(1) == REG_A)
- INST_RETURN(2, 0xED, 0x79)
- if (INST_PORT(0).type == AT_REGISTER && INST_REG(1) == REG_B)
- INST_RETURN(2, 0xED, 0x41)
- if (INST_PORT(0).type == AT_REGISTER && INST_REG(1) == REG_C)
- INST_RETURN(2, 0xED, 0x49)
- if (INST_PORT(0).type == AT_REGISTER && INST_REG(1) == REG_D)
- INST_RETURN(2, 0xED, 0x51)
- if (INST_PORT(0).type == AT_REGISTER && INST_REG(1) == REG_E)
- INST_RETURN(2, 0xED, 0x59)
- if (INST_PORT(0).type == AT_REGISTER && INST_REG(1) == REG_H)
- INST_RETURN(2, 0xED, 0x61)
- if (INST_PORT(0).type == AT_REGISTER && INST_REG(1) == REG_L)
- INST_RETURN(2, 0xED, 0x69)
- INST_ERROR(ARG_VALUE)
- }
- if (INST_TYPE(0) == AT_PORT && INST_TYPE(1) == AT_IMMEDIATE) {
- if (INST_PORT(0).type == AT_REGISTER && (INST_IMM(1).mask & IMM_U8 && INST_IMM(1).uval == 0))
- INST_RETURN(2, 0xED, 0x71)
- INST_ERROR(ARG_VALUE)
- }
- INST_ERROR(ARG_TYPE)
- }
-
- INST_FUNC(outd)
- {
- INST_TAKES_NO_ARGS
- INST_RETURN(2, 0xED, 0xAB)
- }
-
- INST_FUNC(outi)
- {
- INST_TAKES_NO_ARGS
- INST_RETURN(2, 0xED, 0xA3)
- }
-
- INST_FUNC(pop)
- {
- INST_TAKES_ARGS(
- AT_REGISTER,
- AT_NONE,
- AT_NONE
- )
- if (INST_TYPE(0) == AT_REGISTER) {
- if (INST_REG(0) == REG_BC)
- INST_RETURN(1, 0xC1)
- if (INST_REG(0) == REG_DE)
- INST_RETURN(1, 0xD1)
- if (INST_REG(0) == REG_HL)
- INST_RETURN(1, 0xE1)
- if (INST_REG(0) == REG_IX)
- INST_RETURN(2, INST_IX_PREFIX, 0xE1)
- if (INST_REG(0) == REG_IY)
- INST_RETURN(2, INST_IY_PREFIX, 0xE1)
- if (INST_REG(0) == REG_AF)
- INST_RETURN(1, 0xF1)
- INST_ERROR(ARG_VALUE)
- }
- INST_ERROR(ARG_TYPE)
- }
-
- INST_FUNC(push)
- {
- INST_TAKES_ARGS(
- AT_REGISTER,
- AT_NONE,
- AT_NONE
- )
- if (INST_TYPE(0) == AT_REGISTER) {
- if (INST_REG(0) == REG_BC)
- INST_RETURN(1, 0xC5)
- if (INST_REG(0) == REG_DE)
- INST_RETURN(1, 0xD5)
- if (INST_REG(0) == REG_HL)
- INST_RETURN(1, 0xE5)
- if (INST_REG(0) == REG_IX)
- INST_RETURN(2, INST_IX_PREFIX, 0xE5)
- if (INST_REG(0) == REG_IY)
- INST_RETURN(2, INST_IY_PREFIX, 0xE5)
- if (INST_REG(0) == REG_AF)
- INST_RETURN(1, 0xF5)
- INST_ERROR(ARG_VALUE)
- }
- INST_ERROR(ARG_TYPE)
- }
-
- INST_FUNC(res)
- {
- INST_TAKES_ARGS(
- AT_IMMEDIATE,
- AT_INDEXED|AT_INDIRECT|AT_REGISTER,
- AT_OPTIONAL|AT_REGISTER
- )
- if (INST_NARGS == 2 && INST_TYPE(0) == AT_IMMEDIATE && INST_TYPE(1) == AT_REGISTER) {
- if (INST_IMM(0).mask & IMM_BIT && INST_REG(1) == REG_A)
- INST_RETURN(2, 0xCB, 0x87 + 8 * INST_IMM(0).uval)
- if (INST_IMM(0).mask & IMM_BIT && INST_REG(1) == REG_B)
- INST_RETURN(2, 0xCB, 0x80 + 8 * INST_IMM(0).uval)
- if (INST_IMM(0).mask & IMM_BIT && INST_REG(1) == REG_C)
- INST_RETURN(2, 0xCB, 0x81 + 8 * INST_IMM(0).uval)
- if (INST_IMM(0).mask & IMM_BIT && INST_REG(1) == REG_D)
- INST_RETURN(2, 0xCB, 0x82 + 8 * INST_IMM(0).uval)
- if (INST_IMM(0).mask & IMM_BIT && INST_REG(1) == REG_E)
- INST_RETURN(2, 0xCB, 0x83 + 8 * INST_IMM(0).uval)
- if (INST_IMM(0).mask & IMM_BIT && INST_REG(1) == REG_H)
- INST_RETURN(2, 0xCB, 0x84 + 8 * INST_IMM(0).uval)
- if (INST_IMM(0).mask & IMM_BIT && INST_REG(1) == REG_L)
- INST_RETURN(2, 0xCB, 0x85 + 8 * INST_IMM(0).uval)
- INST_ERROR(ARG_VALUE)
- }
- if (INST_NARGS == 2 && INST_TYPE(0) == AT_IMMEDIATE && INST_TYPE(1) == AT_INDIRECT &&
- (INST_INDIRECT(1).type == AT_REGISTER && INST_INDIRECT(1).addr.reg == REG_HL)) {
- if (INST_IMM(0).mask & IMM_BIT)
- INST_RETURN(2, 0xCB, 0x86 + 8 * INST_IMM(0).uval)
- INST_ERROR(ARG_VALUE)
- }
- if (INST_NARGS == 2 && INST_TYPE(0) == AT_IMMEDIATE && INST_TYPE(1) == AT_INDEXED) {
- if (INST_IMM(0).mask & IMM_BIT)
- INST_RETURN(4, INST_INDEX_PREFIX(1), 0xCB, INST_INDEX(1).offset, 0x86 + 8 * INST_IMM(0).uval)
- INST_ERROR(ARG_VALUE)
- }
- if (INST_NARGS == 3 && INST_TYPE(0) == AT_IMMEDIATE && INST_TYPE(1) == AT_INDEXED && INST_TYPE(2) == AT_REGISTER) {
- if (INST_IMM(0).mask & IMM_BIT && INST_REG(2) == REG_A)
- INST_RETURN(4, INST_INDEX_PREFIX(1), 0xCB, INST_INDEX(1).offset, 0x87 + 8 * INST_IMM(0).uval)
- if (INST_IMM(0).mask & IMM_BIT && INST_REG(2) == REG_B)
- INST_RETURN(4, INST_INDEX_PREFIX(1), 0xCB, INST_INDEX(1).offset, 0x80 + 8 * INST_IMM(0).uval)
- if (INST_IMM(0).mask & IMM_BIT && INST_REG(2) == REG_C)
- INST_RETURN(4, INST_INDEX_PREFIX(1), 0xCB, INST_INDEX(1).offset, 0x81 + 8 * INST_IMM(0).uval)
- if (INST_IMM(0).mask & IMM_BIT && INST_REG(2) == REG_D)
- INST_RETURN(4, INST_INDEX_PREFIX(1), 0xCB, INST_INDEX(1).offset, 0x82 + 8 * INST_IMM(0).uval)
- if (INST_IMM(0).mask & IMM_BIT && INST_REG(2) == REG_E)
- INST_RETURN(4, INST_INDEX_PREFIX(1), 0xCB, INST_INDEX(1).offset, 0x83 + 8 * INST_IMM(0).uval)
- if (INST_IMM(0).mask & IMM_BIT && INST_REG(2) == REG_H)
- INST_RETURN(4, INST_INDEX_PREFIX(1), 0xCB, INST_INDEX(1).offset, 0x84 + 8 * INST_IMM(0).uval)
- if (INST_IMM(0).mask & IMM_BIT && INST_REG(2) == REG_L)
- INST_RETURN(4, INST_INDEX_PREFIX(1), 0xCB, INST_INDEX(1).offset, 0x85 + 8 * INST_IMM(0).uval)
- INST_ERROR(ARG_VALUE)
- }
- INST_ERROR(ARG_TYPE)
- }
-
- INST_FUNC(ret)
- {
- INST_TAKES_ARGS(
- AT_CONDITION|AT_OPTIONAL,
- AT_NONE,
- AT_NONE
- )
- if (INST_NARGS == 0) {
- INST_RETURN(1, 0xC9)
- }
- if (INST_NARGS == 1 && INST_TYPE(0) == AT_CONDITION) {
- if (INST_COND(0) == COND_NZ)
- INST_RETURN(1, 0xC0)
- if (INST_COND(0) == COND_Z)
- INST_RETURN(1, 0xC8)
- if (INST_COND(0) == COND_NC)
- INST_RETURN(1, 0xD0)
- if (INST_COND(0) == COND_C)
- INST_RETURN(1, 0xD8)
- if (INST_COND(0) == COND_PO)
- INST_RETURN(1, 0xE0)
- if (INST_COND(0) == COND_PE)
- INST_RETURN(1, 0xE8)
- if (INST_COND(0) == COND_P)
- INST_RETURN(1, 0xF0)
- if (INST_COND(0) == COND_M)
- INST_RETURN(1, 0xF8)
- INST_ERROR(ARG_VALUE)
- }
- INST_ERROR(ARG_TYPE)
- }
-
- INST_FUNC(reti)
- {
- INST_TAKES_NO_ARGS
- INST_RETURN(2, 0xED, 0x4D)
- }
-
- INST_FUNC(retn)
- {
- INST_TAKES_NO_ARGS
- INST_RETURN(2, 0xED, 0x45)
- }
-
- INST_FUNC(rl)
- {
- INST_TAKES_ARGS(
- AT_INDEXED|AT_INDIRECT|AT_REGISTER,
- AT_OPTIONAL|AT_REGISTER,
- AT_NONE
- )
- if (INST_NARGS == 1 && INST_TYPE(0) == AT_REGISTER) {
- if (INST_REG(0) == REG_A)
- INST_RETURN(2, 0xCB, 0x17)
- if (INST_REG(0) == REG_B)
- INST_RETURN(2, 0xCB, 0x10)
- if (INST_REG(0) == REG_C)
- INST_RETURN(2, 0xCB, 0x11)
- if (INST_REG(0) == REG_D)
- INST_RETURN(2, 0xCB, 0x12)
- if (INST_REG(0) == REG_E)
- INST_RETURN(2, 0xCB, 0x13)
- if (INST_REG(0) == REG_H)
- INST_RETURN(2, 0xCB, 0x14)
- if (INST_REG(0) == REG_L)
- INST_RETURN(2, 0xCB, 0x15)
- INST_ERROR(ARG_VALUE)
- }
- if (INST_NARGS == 1 && INST_TYPE(0) == AT_INDIRECT &&
- (INST_INDIRECT(0).type == AT_REGISTER && INST_INDIRECT(0).addr.reg == REG_HL)) {
- INST_RETURN(2, 0xCB, 0x16)
- }
- if (INST_NARGS == 1 && INST_TYPE(0) == AT_INDEXED) {
- INST_RETURN(4, INST_INDEX_PREFIX(0), 0xCB, INST_INDEX(0).offset, 0x16)
- }
- if (INST_NARGS == 2 && INST_TYPE(0) == AT_INDEXED && INST_TYPE(1) == AT_REGISTER) {
- if (INST_REG(1) == REG_A)
- INST_RETURN(4, INST_INDEX_PREFIX(0), 0xCB, INST_INDEX(0).offset, 0x17)
- if (INST_REG(1) == REG_B)
- INST_RETURN(4, INST_INDEX_PREFIX(0), 0xCB, INST_INDEX(0).offset, 0x10)
- if (INST_REG(1) == REG_C)
- INST_RETURN(4, INST_INDEX_PREFIX(0), 0xCB, INST_INDEX(0).offset, 0x11)
- if (INST_REG(1) == REG_D)
- INST_RETURN(4, INST_INDEX_PREFIX(0), 0xCB, INST_INDEX(0).offset, 0x12)
- if (INST_REG(1) == REG_E)
- INST_RETURN(4, INST_INDEX_PREFIX(0), 0xCB, INST_INDEX(0).offset, 0x13)
- if (INST_REG(1) == REG_H)
- INST_RETURN(4, INST_INDEX_PREFIX(0), 0xCB, INST_INDEX(0).offset, 0x14)
- if (INST_REG(1) == REG_L)
- INST_RETURN(4, INST_INDEX_PREFIX(0), 0xCB, INST_INDEX(0).offset, 0x15)
- INST_ERROR(ARG_VALUE)
- }
- INST_ERROR(ARG_TYPE)
- }
-
- INST_FUNC(rla)
- {
- INST_TAKES_NO_ARGS
- INST_RETURN(1, 0x17)
- }
-
- INST_FUNC(rlc)
- {
- INST_TAKES_ARGS(
- AT_INDEXED|AT_INDIRECT|AT_REGISTER,
- AT_OPTIONAL|AT_REGISTER,
- AT_NONE
- )
- if (INST_NARGS == 1 && INST_TYPE(0) == AT_REGISTER) {
- if (INST_REG(0) == REG_A)
- INST_RETURN(2, 0xCB, 0x07)
- if (INST_REG(0) == REG_B)
- INST_RETURN(2, 0xCB, 0x00)
- if (INST_REG(0) == REG_C)
- INST_RETURN(2, 0xCB, 0x01)
- if (INST_REG(0) == REG_D)
- INST_RETURN(2, 0xCB, 0x02)
- if (INST_REG(0) == REG_E)
- INST_RETURN(2, 0xCB, 0x03)
- if (INST_REG(0) == REG_H)
- INST_RETURN(2, 0xCB, 0x04)
- if (INST_REG(0) == REG_L)
- INST_RETURN(2, 0xCB, 0x05)
- INST_ERROR(ARG_VALUE)
- }
- if (INST_NARGS == 1 && INST_TYPE(0) == AT_INDIRECT &&
- (INST_INDIRECT(0).type == AT_REGISTER && INST_INDIRECT(0).addr.reg == REG_HL)) {
- INST_RETURN(2, 0xCB, 0x06)
- }
- if (INST_NARGS == 1 && INST_TYPE(0) == AT_INDEXED) {
- INST_RETURN(4, INST_INDEX_PREFIX(0), 0xCB, INST_INDEX(0).offset, 0x06)
- }
- if (INST_NARGS == 2 && INST_TYPE(0) == AT_INDEXED && INST_TYPE(1) == AT_REGISTER) {
- if (INST_REG(1) == REG_A)
- INST_RETURN(4, INST_INDEX_PREFIX(0), 0xCB, INST_INDEX(0).offset, 0x07)
- if (INST_REG(1) == REG_B)
- INST_RETURN(4, INST_INDEX_PREFIX(0), 0xCB, INST_INDEX(0).offset, 0x00)
- if (INST_REG(1) == REG_C)
- INST_RETURN(4, INST_INDEX_PREFIX(0), 0xCB, INST_INDEX(0).offset, 0x01)
- if (INST_REG(1) == REG_D)
- INST_RETURN(4, INST_INDEX_PREFIX(0), 0xCB, INST_INDEX(0).offset, 0x02)
- if (INST_REG(1) == REG_E)
- INST_RETURN(4, INST_INDEX_PREFIX(0), 0xCB, INST_INDEX(0).offset, 0x03)
- if (INST_REG(1) == REG_H)
- INST_RETURN(4, INST_INDEX_PREFIX(0), 0xCB, INST_INDEX(0).offset, 0x04)
- if (INST_REG(1) == REG_L)
- INST_RETURN(4, INST_INDEX_PREFIX(0), 0xCB, INST_INDEX(0).offset, 0x05)
- INST_ERROR(ARG_VALUE)
- }
- INST_ERROR(ARG_TYPE)
- }
-
- INST_FUNC(rlca)
- {
- INST_TAKES_NO_ARGS
- INST_RETURN(1, 0x07)
- }
-
- INST_FUNC(rld)
- {
- INST_TAKES_NO_ARGS
- INST_RETURN(2, 0xED, 0x6F)
- }
-
- INST_FUNC(rr)
- {
- INST_TAKES_ARGS(
- AT_INDEXED|AT_INDIRECT|AT_REGISTER,
- AT_OPTIONAL|AT_REGISTER,
- AT_NONE
- )
- if (INST_NARGS == 1 && INST_TYPE(0) == AT_REGISTER) {
- if (INST_REG(0) == REG_A)
- INST_RETURN(2, 0xCB, 0x1F)
- if (INST_REG(0) == REG_B)
- INST_RETURN(2, 0xCB, 0x18)
- if (INST_REG(0) == REG_C)
- INST_RETURN(2, 0xCB, 0x19)
- if (INST_REG(0) == REG_D)
- INST_RETURN(2, 0xCB, 0x1A)
- if (INST_REG(0) == REG_E)
- INST_RETURN(2, 0xCB, 0x1B)
- if (INST_REG(0) == REG_H)
- INST_RETURN(2, 0xCB, 0x1C)
- if (INST_REG(0) == REG_L)
- INST_RETURN(2, 0xCB, 0x1D)
- INST_ERROR(ARG_VALUE)
- }
- if (INST_NARGS == 1 && INST_TYPE(0) == AT_INDIRECT &&
- (INST_INDIRECT(0).type == AT_REGISTER && INST_INDIRECT(0).addr.reg == REG_HL)) {
- INST_RETURN(2, 0xCB, 0x1E)
- }
- if (INST_NARGS == 1 && INST_TYPE(0) == AT_INDEXED) {
- INST_RETURN(4, INST_INDEX_PREFIX(0), 0xCB, INST_INDEX(0).offset, 0x1E)
- }
- if (INST_NARGS == 2 && INST_TYPE(0) == AT_INDEXED && INST_TYPE(1) == AT_REGISTER) {
- if (INST_REG(1) == REG_A)
- INST_RETURN(4, INST_INDEX_PREFIX(0), 0xCB, INST_INDEX(0).offset, 0x1F)
- if (INST_REG(1) == REG_B)
- INST_RETURN(4, INST_INDEX_PREFIX(0), 0xCB, INST_INDEX(0).offset, 0x18)
- if (INST_REG(1) == REG_C)
- INST_RETURN(4, INST_INDEX_PREFIX(0), 0xCB, INST_INDEX(0).offset, 0x19)
- if (INST_REG(1) == REG_D)
- INST_RETURN(4, INST_INDEX_PREFIX(0), 0xCB, INST_INDEX(0).offset, 0x1A)
- if (INST_REG(1) == REG_E)
- INST_RETURN(4, INST_INDEX_PREFIX(0), 0xCB, INST_INDEX(0).offset, 0x1B)
- if (INST_REG(1) == REG_H)
- INST_RETURN(4, INST_INDEX_PREFIX(0), 0xCB, INST_INDEX(0).offset, 0x1C)
- if (INST_REG(1) == REG_L)
- INST_RETURN(4, INST_INDEX_PREFIX(0), 0xCB, INST_INDEX(0).offset, 0x1D)
- INST_ERROR(ARG_VALUE)
- }
- INST_ERROR(ARG_TYPE)
- }
-
- INST_FUNC(rra)
- {
- INST_TAKES_NO_ARGS
- INST_RETURN(1, 0x1F)
- }
-
- INST_FUNC(rrc)
- {
- INST_TAKES_ARGS(
- AT_INDEXED|AT_INDIRECT|AT_REGISTER,
- AT_OPTIONAL|AT_REGISTER,
- AT_NONE
- )
- if (INST_NARGS == 1 && INST_TYPE(0) == AT_REGISTER) {
- if (INST_REG(0) == REG_A)
- INST_RETURN(2, 0xCB, 0x0F)
- if (INST_REG(0) == REG_B)
- INST_RETURN(2, 0xCB, 0x08)
- if (INST_REG(0) == REG_C)
- INST_RETURN(2, 0xCB, 0x09)
- if (INST_REG(0) == REG_D)
- INST_RETURN(2, 0xCB, 0x0A)
- if (INST_REG(0) == REG_E)
- INST_RETURN(2, 0xCB, 0x0B)
- if (INST_REG(0) == REG_H)
- INST_RETURN(2, 0xCB, 0x0C)
- if (INST_REG(0) == REG_L)
- INST_RETURN(2, 0xCB, 0x0D)
- INST_ERROR(ARG_VALUE)
- }
- if (INST_NARGS == 1 && INST_TYPE(0) == AT_INDIRECT &&
- (INST_INDIRECT(0).type == AT_REGISTER && INST_INDIRECT(0).addr.reg == REG_HL)) {
- INST_RETURN(2, 0xCB, 0x0E)
- }
- if (INST_NARGS == 1 && INST_TYPE(0) == AT_INDEXED) {
- INST_RETURN(4, INST_INDEX_PREFIX(0), 0xCB, INST_INDEX(0).offset, 0x0E)
- }
- if (INST_NARGS == 2 && INST_TYPE(0) == AT_INDEXED && INST_TYPE(1) == AT_REGISTER) {
- if (INST_REG(1) == REG_A)
- INST_RETURN(4, INST_INDEX_PREFIX(0), 0xCB, INST_INDEX(0).offset, 0x0F)
- if (INST_REG(1) == REG_B)
- INST_RETURN(4, INST_INDEX_PREFIX(0), 0xCB, INST_INDEX(0).offset, 0x08)
- if (INST_REG(1) == REG_C)
- INST_RETURN(4, INST_INDEX_PREFIX(0), 0xCB, INST_INDEX(0).offset, 0x09)
- if (INST_REG(1) == REG_D)
- INST_RETURN(4, INST_INDEX_PREFIX(0), 0xCB, INST_INDEX(0).offset, 0x0A)
- if (INST_REG(1) == REG_E)
- INST_RETURN(4, INST_INDEX_PREFIX(0), 0xCB, INST_INDEX(0).offset, 0x0B)
- if (INST_REG(1) == REG_H)
- INST_RETURN(4, INST_INDEX_PREFIX(0), 0xCB, INST_INDEX(0).offset, 0x0C)
- if (INST_REG(1) == REG_L)
- INST_RETURN(4, INST_INDEX_PREFIX(0), 0xCB, INST_INDEX(0).offset, 0x0D)
- INST_ERROR(ARG_VALUE)
- }
- INST_ERROR(ARG_TYPE)
- }
-
- INST_FUNC(rrca)
- {
- INST_TAKES_NO_ARGS
- INST_RETURN(1, 0x0F)
- }
-
- INST_FUNC(rrd)
- {
- INST_TAKES_NO_ARGS
- INST_RETURN(2, 0xED, 0x67)
- }
-
- INST_FUNC(rst)
- {
- INST_TAKES_ARGS(
- AT_IMMEDIATE,
- AT_NONE,
- AT_NONE
- )
- if (INST_TYPE(0) == AT_IMMEDIATE) {
- if (INST_IMM(0).mask & IMM_RST)
- INST_RETURN(1, 0xC7 + INST_IMM(0).uval)
- INST_ERROR(ARG_VALUE)
- }
- INST_ERROR(ARG_TYPE)
- }
-
- INST_FUNC(sbc)
- {
- INST_TAKES_ARGS(
- AT_REGISTER,
- AT_IMMEDIATE|AT_INDEXED|AT_INDIRECT|AT_REGISTER,
- AT_NONE
- )
- if (INST_TYPE(0) == AT_REGISTER && INST_TYPE(1) == AT_REGISTER) {
- if (INST_REG(0) == REG_A && INST_REG(1) == REG_A)
- INST_RETURN(1, 0x9F)
- if (INST_REG(0) == REG_A && INST_REG(1) == REG_B)
- INST_RETURN(1, 0x98)
- if (INST_REG(0) == REG_A && INST_REG(1) == REG_C)
- INST_RETURN(1, 0x99)
- if (INST_REG(0) == REG_A && INST_REG(1) == REG_D)
- INST_RETURN(1, 0x9A)
- if (INST_REG(0) == REG_A && INST_REG(1) == REG_E)
- INST_RETURN(1, 0x9B)
- if (INST_REG(0) == REG_A && INST_REG(1) == REG_H)
- INST_RETURN(1, 0x9C)
- if (INST_REG(0) == REG_A && INST_REG(1) == REG_IXH)
- INST_RETURN(2, INST_IX_PREFIX, 0x9C)
- if (INST_REG(0) == REG_A && INST_REG(1) == REG_IYH)
- INST_RETURN(2, INST_IY_PREFIX, 0x9C)
- if (INST_REG(0) == REG_A && INST_REG(1) == REG_L)
- INST_RETURN(1, 0x9D)
- if (INST_REG(0) == REG_A && INST_REG(1) == REG_IXL)
- INST_RETURN(2, INST_IX_PREFIX, 0x9D)
- if (INST_REG(0) == REG_A && INST_REG(1) == REG_IYL)
- INST_RETURN(2, INST_IY_PREFIX, 0x9D)
- if (INST_REG(0) == REG_HL && INST_REG(1) == REG_BC)
- INST_RETURN(2, 0xED, 0x42)
- if (INST_REG(0) == REG_HL && INST_REG(1) == REG_DE)
- INST_RETURN(2, 0xED, 0x52)
- if (INST_REG(0) == REG_HL && INST_REG(1) == REG_HL)
- INST_RETURN(2, 0xED, 0x62)
- if (INST_REG(0) == REG_HL && INST_REG(1) == REG_SP)
- INST_RETURN(2, 0xED, 0x72)
- INST_ERROR(ARG_VALUE)
- }
- if (INST_TYPE(0) == AT_REGISTER && INST_TYPE(1) == AT_IMMEDIATE) {
- if (INST_REG(0) == REG_A && INST_IMM(1).mask & IMM_U8)
- INST_RETURN(2, 0xDE, INST_IMM(1).uval)
- INST_ERROR(ARG_VALUE)
- }
- if (INST_TYPE(0) == AT_REGISTER && INST_TYPE(1) == AT_INDIRECT &&
- (INST_INDIRECT(1).type == AT_REGISTER && INST_INDIRECT(1).addr.reg == REG_HL)) {
- if (INST_REG(0) == REG_A)
- INST_RETURN(1, 0x9E)
- INST_ERROR(ARG_VALUE)
- }
- if (INST_TYPE(0) == AT_REGISTER && INST_TYPE(1) == AT_INDEXED) {
- if (INST_REG(0) == REG_A)
- INST_RETURN(3, INST_INDEX_PREFIX(1), 0x9E, INST_INDEX(1).offset)
- INST_ERROR(ARG_VALUE)
- }
- INST_ERROR(ARG_TYPE)
- }
-
- INST_FUNC(scf)
- {
- INST_TAKES_NO_ARGS
- INST_RETURN(1, 0x37)
- }
-
- INST_FUNC(set)
- {
- INST_TAKES_ARGS(
- AT_IMMEDIATE,
- AT_INDEXED|AT_INDIRECT|AT_REGISTER,
- AT_OPTIONAL|AT_REGISTER
- )
- if (INST_NARGS == 2 && INST_TYPE(0) == AT_IMMEDIATE && INST_TYPE(1) == AT_REGISTER) {
- if (INST_IMM(0).mask & IMM_BIT && INST_REG(1) == REG_A)
- INST_RETURN(2, 0xCB, 0xC7 + 8 * INST_IMM(0).uval)
- if (INST_IMM(0).mask & IMM_BIT && INST_REG(1) == REG_B)
- INST_RETURN(2, 0xCB, 0xC0 + 8 * INST_IMM(0).uval)
- if (INST_IMM(0).mask & IMM_BIT && INST_REG(1) == REG_C)
- INST_RETURN(2, 0xCB, 0xC1 + 8 * INST_IMM(0).uval)
- if (INST_IMM(0).mask & IMM_BIT && INST_REG(1) == REG_D)
- INST_RETURN(2, 0xCB, 0xC2 + 8 * INST_IMM(0).uval)
- if (INST_IMM(0).mask & IMM_BIT && INST_REG(1) == REG_E)
- INST_RETURN(2, 0xCB, 0xC3 + 8 * INST_IMM(0).uval)
- if (INST_IMM(0).mask & IMM_BIT && INST_REG(1) == REG_H)
- INST_RETURN(2, 0xCB, 0xC4 + 8 * INST_IMM(0).uval)
- if (INST_IMM(0).mask & IMM_BIT && INST_REG(1) == REG_L)
- INST_RETURN(2, 0xCB, 0xC5 + 8 * INST_IMM(0).uval)
- INST_ERROR(ARG_VALUE)
- }
- if (INST_NARGS == 2 && INST_TYPE(0) == AT_IMMEDIATE && INST_TYPE(1) == AT_INDIRECT &&
- (INST_INDIRECT(1).type == AT_REGISTER && INST_INDIRECT(1).addr.reg == REG_HL)) {
- if (INST_IMM(0).mask & IMM_BIT)
- INST_RETURN(2, 0xCB, 0xC6 + 8 * INST_IMM(0).uval)
- INST_ERROR(ARG_VALUE)
- }
- if (INST_NARGS == 2 && INST_TYPE(0) == AT_IMMEDIATE && INST_TYPE(1) == AT_INDEXED) {
- if (INST_IMM(0).mask & IMM_BIT)
- INST_RETURN(4, INST_INDEX_PREFIX(1), 0xCB, INST_INDEX(1).offset, 0xC6 + 8 * INST_IMM(0).uval)
- INST_ERROR(ARG_VALUE)
- }
- if (INST_NARGS == 3 && INST_TYPE(0) == AT_IMMEDIATE && INST_TYPE(1) == AT_INDEXED && INST_TYPE(2) == AT_REGISTER) {
- if (INST_IMM(0).mask & IMM_BIT && INST_REG(2) == REG_A)
- INST_RETURN(4, INST_INDEX_PREFIX(1), 0xCB, INST_INDEX(1).offset, 0xC7 + 8 * INST_IMM(0).uval)
- if (INST_IMM(0).mask & IMM_BIT && INST_REG(2) == REG_B)
- INST_RETURN(4, INST_INDEX_PREFIX(1), 0xCB, INST_INDEX(1).offset, 0xC0 + 8 * INST_IMM(0).uval)
- if (INST_IMM(0).mask & IMM_BIT && INST_REG(2) == REG_C)
- INST_RETURN(4, INST_INDEX_PREFIX(1), 0xCB, INST_INDEX(1).offset, 0xC1 + 8 * INST_IMM(0).uval)
- if (INST_IMM(0).mask & IMM_BIT && INST_REG(2) == REG_D)
- INST_RETURN(4, INST_INDEX_PREFIX(1), 0xCB, INST_INDEX(1).offset, 0xC2 + 8 * INST_IMM(0).uval)
- if (INST_IMM(0).mask & IMM_BIT && INST_REG(2) == REG_E)
- INST_RETURN(4, INST_INDEX_PREFIX(1), 0xCB, INST_INDEX(1).offset, 0xC3 + 8 * INST_IMM(0).uval)
- if (INST_IMM(0).mask & IMM_BIT && INST_REG(2) == REG_H)
- INST_RETURN(4, INST_INDEX_PREFIX(1), 0xCB, INST_INDEX(1).offset, 0xC4 + 8 * INST_IMM(0).uval)
- if (INST_IMM(0).mask & IMM_BIT && INST_REG(2) == REG_L)
- INST_RETURN(4, INST_INDEX_PREFIX(1), 0xCB, INST_INDEX(1).offset, 0xC5 + 8 * INST_IMM(0).uval)
- INST_ERROR(ARG_VALUE)
- }
- INST_ERROR(ARG_TYPE)
- }
-
- INST_FUNC(sl1)
- {
- INST_TAKES_ARGS(
- AT_INDEXED|AT_INDIRECT|AT_REGISTER,
- AT_OPTIONAL|AT_REGISTER,
- AT_NONE
- )
- if (INST_NARGS == 1 && INST_TYPE(0) == AT_REGISTER) {
- if (INST_REG(0) == REG_A)
- INST_RETURN(2, 0xCB, 0x37)
- if (INST_REG(0) == REG_B)
- INST_RETURN(2, 0xCB, 0x30)
- if (INST_REG(0) == REG_C)
- INST_RETURN(2, 0xCB, 0x31)
- if (INST_REG(0) == REG_D)
- INST_RETURN(2, 0xCB, 0x32)
- if (INST_REG(0) == REG_E)
- INST_RETURN(2, 0xCB, 0x33)
- if (INST_REG(0) == REG_H)
- INST_RETURN(2, 0xCB, 0x34)
- if (INST_REG(0) == REG_L)
- INST_RETURN(2, 0xCB, 0x35)
- INST_ERROR(ARG_VALUE)
- }
- if (INST_NARGS == 1 && INST_TYPE(0) == AT_INDIRECT &&
- (INST_INDIRECT(0).type == AT_REGISTER && INST_INDIRECT(0).addr.reg == REG_HL)) {
- INST_RETURN(2, 0xCB, 0x36)
- }
- if (INST_NARGS == 1 && INST_TYPE(0) == AT_INDEXED) {
- INST_RETURN(4, INST_INDEX_PREFIX(0), 0xCB, INST_INDEX(0).offset, 0x36)
- }
- if (INST_NARGS == 2 && INST_TYPE(0) == AT_INDEXED && INST_TYPE(1) == AT_REGISTER) {
- if (INST_REG(1) == REG_A)
- INST_RETURN(4, INST_INDEX_PREFIX(0), 0xCB, INST_INDEX(0).offset, 0x37)
- if (INST_REG(1) == REG_B)
- INST_RETURN(4, INST_INDEX_PREFIX(0), 0xCB, INST_INDEX(0).offset, 0x30)
- if (INST_REG(1) == REG_C)
- INST_RETURN(4, INST_INDEX_PREFIX(0), 0xCB, INST_INDEX(0).offset, 0x31)
- if (INST_REG(1) == REG_D)
- INST_RETURN(4, INST_INDEX_PREFIX(0), 0xCB, INST_INDEX(0).offset, 0x32)
- if (INST_REG(1) == REG_E)
- INST_RETURN(4, INST_INDEX_PREFIX(0), 0xCB, INST_INDEX(0).offset, 0x33)
- if (INST_REG(1) == REG_H)
- INST_RETURN(4, INST_INDEX_PREFIX(0), 0xCB, INST_INDEX(0).offset, 0x34)
- if (INST_REG(1) == REG_L)
- INST_RETURN(4, INST_INDEX_PREFIX(0), 0xCB, INST_INDEX(0).offset, 0x35)
- INST_ERROR(ARG_VALUE)
- }
- INST_ERROR(ARG_TYPE)
- }
-
- INST_FUNC(sla)
- {
- INST_TAKES_ARGS(
- AT_INDEXED|AT_INDIRECT|AT_REGISTER,
- AT_OPTIONAL|AT_REGISTER,
- AT_NONE
- )
- if (INST_NARGS == 1 && INST_TYPE(0) == AT_REGISTER) {
- if (INST_REG(0) == REG_A)
- INST_RETURN(2, 0xCB, 0x27)
- if (INST_REG(0) == REG_B)
- INST_RETURN(2, 0xCB, 0x20)
- if (INST_REG(0) == REG_C)
- INST_RETURN(2, 0xCB, 0x21)
- if (INST_REG(0) == REG_D)
- INST_RETURN(2, 0xCB, 0x22)
- if (INST_REG(0) == REG_E)
- INST_RETURN(2, 0xCB, 0x23)
- if (INST_REG(0) == REG_H)
- INST_RETURN(2, 0xCB, 0x24)
- if (INST_REG(0) == REG_L)
- INST_RETURN(2, 0xCB, 0x25)
- INST_ERROR(ARG_VALUE)
- }
- if (INST_NARGS == 1 && INST_TYPE(0) == AT_INDIRECT &&
- (INST_INDIRECT(0).type == AT_REGISTER && INST_INDIRECT(0).addr.reg == REG_HL)) {
- INST_RETURN(2, 0xCB, 0x26)
- }
- if (INST_NARGS == 1 && INST_TYPE(0) == AT_INDEXED) {
- INST_RETURN(4, INST_INDEX_PREFIX(0), 0xCB, INST_INDEX(0).offset, 0x26)
- }
- if (INST_NARGS == 2 && INST_TYPE(0) == AT_INDEXED && INST_TYPE(1) == AT_REGISTER) {
- if (INST_REG(1) == REG_A)
- INST_RETURN(4, INST_INDEX_PREFIX(0), 0xCB, INST_INDEX(0).offset, 0x27)
- if (INST_REG(1) == REG_B)
- INST_RETURN(4, INST_INDEX_PREFIX(0), 0xCB, INST_INDEX(0).offset, 0x20)
- if (INST_REG(1) == REG_C)
- INST_RETURN(4, INST_INDEX_PREFIX(0), 0xCB, INST_INDEX(0).offset, 0x21)
- if (INST_REG(1) == REG_D)
- INST_RETURN(4, INST_INDEX_PREFIX(0), 0xCB, INST_INDEX(0).offset, 0x22)
- if (INST_REG(1) == REG_E)
- INST_RETURN(4, INST_INDEX_PREFIX(0), 0xCB, INST_INDEX(0).offset, 0x23)
- if (INST_REG(1) == REG_H)
- INST_RETURN(4, INST_INDEX_PREFIX(0), 0xCB, INST_INDEX(0).offset, 0x24)
- if (INST_REG(1) == REG_L)
- INST_RETURN(4, INST_INDEX_PREFIX(0), 0xCB, INST_INDEX(0).offset, 0x25)
- INST_ERROR(ARG_VALUE)
- }
- INST_ERROR(ARG_TYPE)
- }
-
- INST_FUNC(sll)
- {
- INST_TAKES_ARGS(
- AT_INDEXED|AT_INDIRECT|AT_REGISTER,
- AT_OPTIONAL|AT_REGISTER,
- AT_NONE
- )
- if (INST_NARGS == 1 && INST_TYPE(0) == AT_REGISTER) {
- if (INST_REG(0) == REG_A)
- INST_RETURN(2, 0xCB, 0x37)
- if (INST_REG(0) == REG_B)
- INST_RETURN(2, 0xCB, 0x30)
- if (INST_REG(0) == REG_C)
- INST_RETURN(2, 0xCB, 0x31)
- if (INST_REG(0) == REG_D)
- INST_RETURN(2, 0xCB, 0x32)
- if (INST_REG(0) == REG_E)
- INST_RETURN(2, 0xCB, 0x33)
- if (INST_REG(0) == REG_H)
- INST_RETURN(2, 0xCB, 0x34)
- if (INST_REG(0) == REG_L)
- INST_RETURN(2, 0xCB, 0x35)
- INST_ERROR(ARG_VALUE)
- }
- if (INST_NARGS == 1 && INST_TYPE(0) == AT_INDIRECT) {
- INST_RETURN(2, 0xCB, 0x36)
- }
- if (INST_NARGS == 2 && INST_TYPE(0) == AT_INDEXED && INST_TYPE(1) == AT_REGISTER) {
- if (INST_REG(1) == REG_A)
- INST_RETURN(4, INST_INDEX_PREFIX(0), 0xCB, INST_INDEX(0).offset, 0x37)
- if (INST_REG(1) == REG_B)
- INST_RETURN(4, INST_INDEX_PREFIX(0), 0xCB, INST_INDEX(0).offset, 0x30)
- if (INST_REG(1) == REG_C)
- INST_RETURN(4, INST_INDEX_PREFIX(0), 0xCB, INST_INDEX(0).offset, 0x31)
- if (INST_REG(1) == REG_D)
- INST_RETURN(4, INST_INDEX_PREFIX(0), 0xCB, INST_INDEX(0).offset, 0x32)
- if (INST_REG(1) == REG_E)
- INST_RETURN(4, INST_INDEX_PREFIX(0), 0xCB, INST_INDEX(0).offset, 0x33)
- if (INST_REG(1) == REG_H)
- INST_RETURN(4, INST_INDEX_PREFIX(0), 0xCB, INST_INDEX(0).offset, 0x34)
- if (INST_REG(1) == REG_L)
- INST_RETURN(4, INST_INDEX_PREFIX(0), 0xCB, INST_INDEX(0).offset, 0x35)
- INST_ERROR(ARG_VALUE)
- }
- INST_ERROR(ARG_TYPE)
- }
-
- INST_FUNC(sls)
- {
- INST_TAKES_ARGS(
- AT_INDEXED|AT_INDIRECT|AT_REGISTER,
- AT_OPTIONAL|AT_REGISTER,
- AT_NONE
- )
- if (INST_NARGS == 1 && INST_TYPE(0) == AT_REGISTER) {
- if (INST_REG(0) == REG_A)
- INST_RETURN(2, 0xCB, 0x37)
- if (INST_REG(0) == REG_B)
- INST_RETURN(2, 0xCB, 0x30)
- if (INST_REG(0) == REG_C)
- INST_RETURN(2, 0xCB, 0x31)
- if (INST_REG(0) == REG_D)
- INST_RETURN(2, 0xCB, 0x32)
- if (INST_REG(0) == REG_E)
- INST_RETURN(2, 0xCB, 0x33)
- if (INST_REG(0) == REG_H)
- INST_RETURN(2, 0xCB, 0x34)
- if (INST_REG(0) == REG_L)
- INST_RETURN(2, 0xCB, 0x35)
- INST_ERROR(ARG_VALUE)
- }
- if (INST_NARGS == 1 && INST_TYPE(0) == AT_INDIRECT) {
- INST_RETURN(2, 0xCB, 0x36)
- }
- if (INST_NARGS == 2 && INST_TYPE(0) == AT_INDEXED && INST_TYPE(1) == AT_REGISTER) {
- if (INST_REG(1) == REG_A)
- INST_RETURN(4, INST_INDEX_PREFIX(0), 0xCB, INST_INDEX(0).offset, 0x37)
- if (INST_REG(1) == REG_B)
- INST_RETURN(4, INST_INDEX_PREFIX(0), 0xCB, INST_INDEX(0).offset, 0x30)
- if (INST_REG(1) == REG_C)
- INST_RETURN(4, INST_INDEX_PREFIX(0), 0xCB, INST_INDEX(0).offset, 0x31)
- if (INST_REG(1) == REG_D)
- INST_RETURN(4, INST_INDEX_PREFIX(0), 0xCB, INST_INDEX(0).offset, 0x32)
- if (INST_REG(1) == REG_E)
- INST_RETURN(4, INST_INDEX_PREFIX(0), 0xCB, INST_INDEX(0).offset, 0x33)
- if (INST_REG(1) == REG_H)
- INST_RETURN(4, INST_INDEX_PREFIX(0), 0xCB, INST_INDEX(0).offset, 0x34)
- if (INST_REG(1) == REG_L)
- INST_RETURN(4, INST_INDEX_PREFIX(0), 0xCB, INST_INDEX(0).offset, 0x35)
- INST_ERROR(ARG_VALUE)
- }
- INST_ERROR(ARG_TYPE)
- }
-
- INST_FUNC(sra)
- {
- INST_TAKES_ARGS(
- AT_INDEXED|AT_INDIRECT|AT_REGISTER,
- AT_OPTIONAL|AT_REGISTER,
- AT_NONE
- )
- if (INST_NARGS == 1 && INST_TYPE(0) == AT_REGISTER) {
- if (INST_REG(0) == REG_A)
- INST_RETURN(2, 0xCB, 0x2F)
- if (INST_REG(0) == REG_B)
- INST_RETURN(2, 0xCB, 0x28)
- if (INST_REG(0) == REG_C)
- INST_RETURN(2, 0xCB, 0x29)
- if (INST_REG(0) == REG_D)
- INST_RETURN(2, 0xCB, 0x2A)
- if (INST_REG(0) == REG_E)
- INST_RETURN(2, 0xCB, 0x2B)
- if (INST_REG(0) == REG_H)
- INST_RETURN(2, 0xCB, 0x2C)
- if (INST_REG(0) == REG_L)
- INST_RETURN(2, 0xCB, 0x2D)
- INST_ERROR(ARG_VALUE)
- }
- if (INST_NARGS == 1 && INST_TYPE(0) == AT_INDIRECT &&
- (INST_INDIRECT(0).type == AT_REGISTER && INST_INDIRECT(0).addr.reg == REG_HL)) {
- INST_RETURN(2, 0xCB, 0x2E)
- }
- if (INST_NARGS == 1 && INST_TYPE(0) == AT_INDEXED) {
- INST_RETURN(4, INST_INDEX_PREFIX(0), 0xCB, INST_INDEX(0).offset, 0x2E)
- }
- if (INST_NARGS == 2 && INST_TYPE(0) == AT_INDEXED && INST_TYPE(1) == AT_REGISTER) {
- if (INST_REG(1) == REG_A)
- INST_RETURN(4, INST_INDEX_PREFIX(0), 0xCB, INST_INDEX(0).offset, 0x2F)
- if (INST_REG(1) == REG_B)
- INST_RETURN(4, INST_INDEX_PREFIX(0), 0xCB, INST_INDEX(0).offset, 0x28)
- if (INST_REG(1) == REG_C)
- INST_RETURN(4, INST_INDEX_PREFIX(0), 0xCB, INST_INDEX(0).offset, 0x29)
- if (INST_REG(1) == REG_D)
- INST_RETURN(4, INST_INDEX_PREFIX(0), 0xCB, INST_INDEX(0).offset, 0x2A)
- if (INST_REG(1) == REG_E)
- INST_RETURN(4, INST_INDEX_PREFIX(0), 0xCB, INST_INDEX(0).offset, 0x2B)
- if (INST_REG(1) == REG_H)
- INST_RETURN(4, INST_INDEX_PREFIX(0), 0xCB, INST_INDEX(0).offset, 0x2C)
- if (INST_REG(1) == REG_L)
- INST_RETURN(4, INST_INDEX_PREFIX(0), 0xCB, INST_INDEX(0).offset, 0x2D)
- INST_ERROR(ARG_VALUE)
- }
- INST_ERROR(ARG_TYPE)
- }
-
- INST_FUNC(srl)
- {
- INST_TAKES_ARGS(
- AT_INDEXED|AT_INDIRECT|AT_REGISTER,
- AT_OPTIONAL|AT_REGISTER,
- AT_NONE
- )
- if (INST_NARGS == 1 && INST_TYPE(0) == AT_REGISTER) {
- if (INST_REG(0) == REG_A)
- INST_RETURN(2, 0xCB, 0x3F)
- if (INST_REG(0) == REG_B)
- INST_RETURN(2, 0xCB, 0x38)
- if (INST_REG(0) == REG_C)
- INST_RETURN(2, 0xCB, 0x39)
- if (INST_REG(0) == REG_D)
- INST_RETURN(2, 0xCB, 0x3A)
- if (INST_REG(0) == REG_E)
- INST_RETURN(2, 0xCB, 0x3B)
- if (INST_REG(0) == REG_H)
- INST_RETURN(2, 0xCB, 0x3C)
- if (INST_REG(0) == REG_L)
- INST_RETURN(2, 0xCB, 0x3D)
- INST_ERROR(ARG_VALUE)
- }
- if (INST_NARGS == 1 && INST_TYPE(0) == AT_INDIRECT &&
- (INST_INDIRECT(0).type == AT_REGISTER && INST_INDIRECT(0).addr.reg == REG_HL)) {
- INST_RETURN(2, 0xCB, 0x3E)
- }
- if (INST_NARGS == 1 && INST_TYPE(0) == AT_INDEXED) {
- INST_RETURN(4, INST_INDEX_PREFIX(0), 0xCB, INST_INDEX(0).offset, 0x3E)
- }
- if (INST_NARGS == 2 && INST_TYPE(0) == AT_INDEXED && INST_TYPE(1) == AT_REGISTER) {
- if (INST_REG(1) == REG_A)
- INST_RETURN(4, INST_INDEX_PREFIX(0), 0xCB, INST_INDEX(0).offset, 0x3F)
- if (INST_REG(1) == REG_B)
- INST_RETURN(4, INST_INDEX_PREFIX(0), 0xCB, INST_INDEX(0).offset, 0x38)
- if (INST_REG(1) == REG_C)
- INST_RETURN(4, INST_INDEX_PREFIX(0), 0xCB, INST_INDEX(0).offset, 0x39)
- if (INST_REG(1) == REG_D)
- INST_RETURN(4, INST_INDEX_PREFIX(0), 0xCB, INST_INDEX(0).offset, 0x3A)
- if (INST_REG(1) == REG_E)
- INST_RETURN(4, INST_INDEX_PREFIX(0), 0xCB, INST_INDEX(0).offset, 0x3B)
- if (INST_REG(1) == REG_H)
- INST_RETURN(4, INST_INDEX_PREFIX(0), 0xCB, INST_INDEX(0).offset, 0x3C)
- if (INST_REG(1) == REG_L)
- INST_RETURN(4, INST_INDEX_PREFIX(0), 0xCB, INST_INDEX(0).offset, 0x3D)
- INST_ERROR(ARG_VALUE)
- }
- INST_ERROR(ARG_TYPE)
- }
-
- INST_FUNC(sub)
- {
- INST_TAKES_ARGS(
- AT_IMMEDIATE|AT_INDEXED|AT_INDIRECT|AT_REGISTER,
- AT_NONE,
- AT_NONE
- )
- if (INST_TYPE(0) == AT_REGISTER) {
- if (INST_REG(0) == REG_A)
- INST_RETURN(1, 0x97)
- if (INST_REG(0) == REG_B)
- INST_RETURN(1, 0x90)
- if (INST_REG(0) == REG_C)
- INST_RETURN(1, 0x91)
- if (INST_REG(0) == REG_D)
- INST_RETURN(1, 0x92)
- if (INST_REG(0) == REG_E)
- INST_RETURN(1, 0x93)
- if (INST_REG(0) == REG_H)
- INST_RETURN(1, 0x94)
- if (INST_REG(0) == REG_IXH)
- INST_RETURN(2, INST_IX_PREFIX, 0x94)
- if (INST_REG(0) == REG_IYH)
- INST_RETURN(2, INST_IY_PREFIX, 0x94)
- if (INST_REG(0) == REG_L)
- INST_RETURN(1, 0x95)
- if (INST_REG(0) == REG_IXL)
- INST_RETURN(2, INST_IX_PREFIX, 0x95)
- if (INST_REG(0) == REG_IYL)
- INST_RETURN(2, INST_IY_PREFIX, 0x95)
- INST_ERROR(ARG_VALUE)
- }
- if (INST_TYPE(0) == AT_IMMEDIATE) {
- if (INST_IMM(0).mask & IMM_U8)
- INST_RETURN(2, 0xD6, INST_IMM(0).uval)
- INST_ERROR(ARG_VALUE)
- }
- if (INST_TYPE(0) == AT_INDIRECT &&
- (INST_INDIRECT(0).type == AT_REGISTER && INST_INDIRECT(0).addr.reg == REG_HL)) {
- INST_RETURN(1, 0x96)
- }
- if (INST_TYPE(0) == AT_INDEXED) {
- INST_RETURN(3, INST_INDEX_PREFIX(0), 0x96, INST_INDEX(0).offset)
- }
- INST_ERROR(ARG_TYPE)
- }
-
- INST_FUNC(xor)
- {
- INST_TAKES_ARGS(
- AT_IMMEDIATE|AT_INDEXED|AT_INDIRECT|AT_REGISTER,
- AT_NONE,
- AT_NONE
- )
- if (INST_TYPE(0) == AT_REGISTER) {
- if (INST_REG(0) == REG_A)
- INST_RETURN(1, 0xAF)
- if (INST_REG(0) == REG_B)
- INST_RETURN(1, 0xA8)
- if (INST_REG(0) == REG_C)
- INST_RETURN(1, 0xA9)
- if (INST_REG(0) == REG_D)
- INST_RETURN(1, 0xAA)
- if (INST_REG(0) == REG_E)
- INST_RETURN(1, 0xAB)
- if (INST_REG(0) == REG_H)
- INST_RETURN(1, 0xAC)
- if (INST_REG(0) == REG_IXH)
- INST_RETURN(2, INST_IX_PREFIX, 0xAC)
- if (INST_REG(0) == REG_IYH)
- INST_RETURN(2, INST_IY_PREFIX, 0xAC)
- if (INST_REG(0) == REG_L)
- INST_RETURN(1, 0xAD)
- if (INST_REG(0) == REG_IXL)
- INST_RETURN(2, INST_IX_PREFIX, 0xAD)
- if (INST_REG(0) == REG_IYL)
- INST_RETURN(2, INST_IY_PREFIX, 0xAD)
- INST_ERROR(ARG_VALUE)
- }
- if (INST_TYPE(0) == AT_IMMEDIATE) {
- if (INST_IMM(0).mask & IMM_U8)
- INST_RETURN(2, 0xEE, INST_IMM(0).uval)
- INST_ERROR(ARG_VALUE)
- }
- if (INST_TYPE(0) == AT_INDIRECT &&
- (INST_INDIRECT(0).type == AT_REGISTER && INST_INDIRECT(0).addr.reg == REG_HL)) {
- INST_RETURN(1, 0xAE)
- }
- if (INST_TYPE(0) == AT_INDEXED) {
- INST_RETURN(3, INST_INDEX_PREFIX(0), 0xAE, INST_INDEX(0).offset)
- }
- INST_ERROR(ARG_TYPE)
- }
-
- /* @AUTOGEN_INST_BLOCK_END */
-
- /*
- Return the relevant ASMInstParser function for the given encoded mnemonic.
- */
- static ASMInstParser lookup_parser(uint32_t key)
- {
- /* @AUTOGEN_LOOKUP_BLOCK_START */
- HANDLE(adc)
- HANDLE(add)
- HANDLE(and)
- HANDLE(bit)
- HANDLE(call)
- HANDLE(ccf)
- HANDLE(cp)
- HANDLE(cpd)
- HANDLE(cpdr)
- HANDLE(cpi)
- HANDLE(cpir)
- HANDLE(cpl)
- HANDLE(daa)
- HANDLE(dec)
- HANDLE(di)
- HANDLE(djnz)
- HANDLE(ei)
- HANDLE(ex)
- HANDLE(exx)
- HANDLE(halt)
- HANDLE(im)
- HANDLE(in)
- HANDLE(inc)
- HANDLE(ind)
- HANDLE(indr)
- HANDLE(ini)
- HANDLE(inir)
- HANDLE(jp)
- HANDLE(jr)
- HANDLE(ld)
- HANDLE(ldd)
- HANDLE(lddr)
- HANDLE(ldi)
- HANDLE(ldir)
- HANDLE(neg)
- HANDLE(nop)
- HANDLE(or)
- HANDLE(otdr)
- HANDLE(otir)
- HANDLE(out)
- HANDLE(outd)
- HANDLE(outi)
- HANDLE(pop)
- HANDLE(push)
- HANDLE(res)
- HANDLE(ret)
- HANDLE(reti)
- HANDLE(retn)
- HANDLE(rl)
- HANDLE(rla)
- HANDLE(rlc)
- HANDLE(rlca)
- HANDLE(rld)
- HANDLE(rr)
- HANDLE(rra)
- HANDLE(rrc)
- HANDLE(rrca)
- HANDLE(rrd)
- HANDLE(rst)
- HANDLE(sbc)
- HANDLE(scf)
- HANDLE(set)
- HANDLE(sl1)
- HANDLE(sla)
- HANDLE(sll)
- HANDLE(sls)
- HANDLE(sra)
- HANDLE(srl)
- HANDLE(sub)
- HANDLE(xor)
- /* @AUTOGEN_LOOKUP_BLOCK_END */
- return NULL;
- }
|