require 'scv' location(0x8000, 0x8FFF) section{"rom", org=0x8000} dc.b 'H' @main block calb ei daa di ex exx halt jb nop ret reti rets sio softi stm table dcr a dcr b dcr c inr a inr b inr c dcx sp inx sp mvi a,0xca mvi b,0xfe mvi c,0xbe mvi d,0xef mvi e,0xf0 mvi h,0x0d mvi l,0x78 mvi v,0x01 aci a,0x0f adi a,0x1e adinc a,0x2d ani a,0x3c eqi a,0x4b gti a,0x5a lti a,0x69 nei a,0x87 offi a,0x96 oni a,0xa5 ori a,0xb4 sbi a,0xc3 sui a,0xd2 suinb a,0xe1 xri a,0xf0 lxi bc,0xabcd lxi de,0xbeef lxi hl,0xcafe lxi sp,0xf00d call 0xd701 jmp 0x8e07 clc pen per pex rld rrd stc mov a,b mov a,c mov a,d mov a,e mov a,h mov a,l mov b,a mov c,a mov d,a mov e,a mov h,a mov l,a @l0 jre l0 @l1 nop jre l1 @l2 nop nop jre l2 @l3 nop nop nop jre l3 @l4 nop nop nop nop jre l4 jre l5 @l5 jre l6 nop @l6 jre l7 nop nop @l7 jre l8 nop nop nop @l8 jre l9 nop nop nop nop @l9 ldax (bc) ldax (de) ldax (hl) stax (bc) stax (de) stax (hl) inrw (v,0x01) ldaw (v,0x23) dcrw (v,0x45) staw (v,0x67) bit0 (v,0x89) bit1 (v,0xab) bit2 (v,0xcd) bit3 (v,0xef) bit4 (v,0xfe) bit5 (v,0xdc) bit6 (v,0xba) bit7 (v,0x98) dcx bc dcx de dcx hl inx bc inx de inx hl mvix (bc),0xf9 mvix (de),0xe8 mvix (hl),0xd7 mviw (v,0x9a),0x3f eqiw (v,0xc5),0x1b ldaxd (de) ldaxi (de) ldaxd (hl) ldaxi (hl) staxd (de) staxi (de) staxd (hl) staxi (hl) push bc push de push hl pop hl pop de pop bc push va pop va rll a rlr a rll c rlr c sll a slr a sll c slr c skc skz sknc sknz skit f0 skit ft skit f1 skit f2 skit fs sknit f0 sknit ft sknit f1 sknit f2 sknit fs in 0x00 in 0xa7 in 0xbf out 0x00 out 0x5a out 0xbf mov a,pa mov a,pb mov a,pc mov a,mk mov a,mb mov a,mc mov a,tm0 mov a,tm1 mov a,s mov pa,a mov pb,a mov pc,a mov mk,a mov mb,a mov mc,a mov tm0,a mov tm1,a mov s,a ana v,a ana a,a ana b,a ana c,a ana d,a ana e,a ana h,a ana l,a xra v,a xra a,a xra b,a xra c,a xra d,a xra e,a xra h,a xra l,a ora v,a ora a,a ora b,a ora c,a ora d,a ora e,a ora h,a ora l,a addnc v,a addnc a,a addnc b,a addnc c,a addnc d,a addnc e,a addnc h,a addnc l,a gta v,a gta a,a gta b,a gta c,a gta d,a gta e,a gta h,a gta l,a subnb v,a subnb a,a subnb b,a subnb c,a subnb d,a subnb e,a subnb h,a subnb l,a lta v,a lta a,a lta b,a lta c,a lta d,a lta e,a lta h,a lta l,a add v,a add a,a add b,a add c,a add d,a add e,a add h,a add l,a adc v,a adc a,a adc b,a adc c,a adc d,a adc e,a adc h,a adc l,a sub v,a sub a,a sub b,a sub c,a sub d,a sub e,a sub h,a sub l,a nea v,a nea a,a nea b,a nea c,a nea d,a nea e,a nea h,a nea l,a sbb v,a sbb a,a sbb b,a sbb c,a sbb d,a sbb e,a sbb h,a sbb l,a eqa v,a eqa a,a eqa b,a eqa c,a eqa d,a eqa e,a eqa h,a eqa l,a ana a,v ana a,a ana a,b ana a,c ana a,d ana a,e ana a,h ana a,l xra a,v xra a,a xra a,b xra a,c xra a,d xra a,e xra a,h xra a,l ora a,v ora a,a ora a,b ora a,c ora a,d ora a,e ora a,h ora a,l addnc a,v addnc a,a addnc a,b addnc a,c addnc a,d addnc a,e addnc a,h addnc a,l gta a,v gta a,a gta a,b gta a,c gta a,d gta a,e gta a,h gta a,l subnb a,v subnb a,a subnb a,b subnb a,c subnb a,d subnb a,e subnb a,h subnb a,l lta a,v lta a,a lta a,b lta a,c lta a,d lta a,e lta a,h lta a,l add a,v add a,a add a,b add a,c add a,d add a,e add a,h add a,l ona a,v ona a,a ona a,b ona a,c ona a,d ona a,e ona a,h ona a,l adc a,v adc a,a adc a,b adc a,c adc a,d adc a,e adc a,h adc a,l offa a,v offa a,a offa a,b offa a,c offa a,d offa a,e offa a,h offa a,l sub a,v sub a,a sub a,b sub a,c sub a,d sub a,e sub a,h sub a,l nea a,v nea a,a nea a,b nea a,c nea a,d nea a,e nea a,h nea a,l sbb a,v sbb a,a sbb a,b sbb a,c sbb a,d sbb a,e sbb a,h sbb a,l eqa a,v eqa a,a eqa a,b eqa a,c eqa a,d eqa a,e eqa a,h eqa a,l ani v,0x00 ani a,0x01 ani b,0x02 ani c,0x03 ani d,0x04 ani e,0x05 ani h,0x06 ani l,0x07 xri v,0x08 xri a,0x09 xri b,0x0a xri c,0x0b xri d,0x0c xri e,0x0d xri h,0x0e xri l,0x0f ori v,0x10 ori a,0x11 ori b,0x12 ori c,0x13 ori d,0x14 ori e,0x15 ori h,0x16 ori l,0x17 adinc v,0x18 adinc a,0x19 adinc b,0x1a adinc c,0x1b adinc d,0x1c adinc e,0x1d adinc h,0x1e adinc l,0x1f gti v,0x20 gti a,0x21 gti b,0x22 gti c,0x23 gti d,0x24 gti e,0x25 gti h,0x26 gti l,0x27 suinb v,0x28 suinb a,0x29 suinb b,0x2a suinb c,0x2b suinb d,0x2c suinb e,0x2d suinb h,0x2e suinb l,0x2f lti v,0x30 lti a,0x31 lti b,0x32 lti c,0x33 lti d,0x34 lti e,0x35 lti h,0x36 lti l,0x37 adi v,0x38 adi a,0x39 adi b,0x3a adi c,0x3b adi d,0x3c adi e,0x3d adi h,0x3e adi l,0x4f oni v,0x40 oni a,0x41 oni b,0x42 oni c,0x43 oni d,0x44 oni e,0x45 oni h,0x46 oni l,0x47 aci v,0x48 aci a,0x49 aci b,0x4a aci c,0x4b aci d,0x4c aci e,0x4d aci h,0x4e aci l,0x4f offi v,0x50 offi a,0x51 offi b,0x52 offi c,0x53 offi d,0x54 offi e,0x55 offi h,0x56 offi l,0x57 sui v,0x58 sui a,0x59 sui b,0x5a sui c,0x5b sui d,0x5c sui e,0x5d sui h,0x5e sui l,0x5f nei v,0x60 nei a,0x61 nei b,0x62 nei c,0x63 nei d,0x64 nei e,0x65 nei h,0x66 nei l,0x67 sbi v,0x68 sbi a,0x69 sbi b,0x6a sbi c,0x6b sbi d,0x6c sbi e,0x6d sbi h,0x6e sbi l,0x6f eqi v,0x70 eqi a,0x71 eqi b,0x72 eqi c,0x73 eqi d,0x74 eqi e,0x75 eqi h,0x76 eqi l,0x77 ani pa,0x78 ani pb,0x79 ani pc,0x7a ani mk,0x7b xri pa,0x7c xri pb,0x7d xri pc,0x7e xri mk,0x7f ori pa,0x80 ori pb,0x81 ori pc,0x82 ori mk,0x83 adinc pa,0x84 adinc pb,0x85 adinc pc,0x86 adinc mk,0x87 gti pa,0x88 gti pb,0x89 gti pc,0x8a gti mk,0x8b suinb pa,0x8c suinb pb,0x8d suinb pc,0x8e suinb mk,0x8f lti pa,0x90 lti pb,0x91 lti pc,0x92 lti mk,0x93 adi pa,0x94 adi pb,0x95 adi pc,0x96 adi mk,0x97 oni pa,0x98 oni pb,0x99 oni pc,0x9a oni mk,0x9b aci pa,0x9c aci pb,0x9d aci pc,0x9e aci mk,0x9f offi pa,0xa0 offi pb,0xa1 offi pc,0xa2 offi mk,0xa3 sui pa,0xa4 sui pb,0xa5 sui pc,0xa6 sui mk,0xa7 nei pa,0xa8 nei pb,0xa9 nei pc,0xaa nei mk,0xab sbi pa,0xac sbi pb,0xad sbi pc,0xae sbi mk,0xaf eqi pa,0xb0 eqi pb,0xb1 eqi pc,0xb2 eqi mk,0xb3 anaw (v,0xf0) xraw (v,0xe1) oraw (v,0xd2) addncw (v,0xc3) gtaw (v,0xb4) subnbw (v,0xa5) ltaw (v,0x96) addw (v,0x87) onaw (v,0x78) adcw (v,0x69) offaw (v,0x5a) subw (v,0x4b) neaw (v,0x3c) sbbw (v,0x2d) eqaw (v,0x1e) sspd (0x8000) lspd (0x8001) sbcd (0x8010) lbcd (0x8011) sded (0x8100) lded (0x8101) shld (0x8110) lhld (0x8111) mov (0xab00),v mov (0xbc01),a mov (0xde02),b mov (0xfa03),c mov (0xeb04),d mov (0xdc05),e mov (0xcd06),h mov (0xbe07),l mov v,(0x000f) mov a,(0x00f0) mov b,(0x00ff) mov c,(0x0f00) mov d,(0x0f0f) mov e,(0x0ff0) mov h,(0x0fff) mov l,(0xf000) writebin(filename .. '.bin')