Subversion Repositories pentevo

Rev

Blame | Last modification | View Log | Download | RSS feed

  1.         page    0
  2.         cpu     8008
  3.  
  4.         z80syntax on
  5.  
  6. ;-----------------------------------
  7. ; CPU Control Group
  8.  
  9.         halt
  10.         hlt
  11.  
  12. ;-----------------------------------
  13. ; Input and Output Group
  14.  
  15.         inp     5
  16.         in      a,5
  17.  
  18.         out     13h
  19.         out     13h,a
  20.  
  21. ;-----------------------------------
  22. ; Jump Group
  23.  
  24.         ; in non-exclusive Z80 mode, JP with one
  25.         ; argument is interpreted as original 8008 mnemonic
  26.         ; (jump if parity even)
  27.         ; There is no ambiguity with J
  28.  
  29.         jmp     1234h
  30.         jp      1234h           ; as below
  31.         j       1234h           ; -> JMP
  32.  
  33.         jfc     1234h
  34.         jp      nc,1234h
  35.         j       nc,1234h
  36.         jfz     1234h
  37.         jp      nz,1234h
  38.         j       nz,1234h
  39.         jfs     1234h
  40.         jp      p,1234h
  41.         j       p,1234h
  42.         jfp     1234h
  43.         jp      po,1234h
  44.         j       po,1234h
  45.         jc      1234h
  46.         jp      c,1234h
  47.         j       c,1234h
  48.         jz      1234h
  49.         jp      z,1234h
  50.         j       z,1234h
  51.         js      1234h
  52.         jp      m,1234h
  53.         j       m,1234h
  54.         jp      1234h
  55.         jp      pe,1234h
  56.         j       pe,1234h
  57.  
  58. ;-----------------------------------
  59. ; Call and Return Group
  60.  
  61.         ; in non-exclusive Z80 mode, CP with one
  62.         ; argument is interpreted as original 8008 mnemonic
  63.         ; (call if parity even)
  64.  
  65.         cal     1234h
  66.         call    1234h
  67.  
  68.         cfc     1234h
  69.         call    nc,1234h
  70.         cfz     1234h
  71.         call    nz,1234h
  72.         cfs     1234h
  73.         call    p,1234h
  74.         cfp     1234h
  75.         call    po,1234h
  76.         cc      1234h
  77.         call    c,1234h
  78.         cz      1234h
  79.         call    z,1234h
  80.         cs      1234h
  81.         call    m,1234h
  82.         cp      1234h
  83.         call    pe,1234h
  84.  
  85.         ret
  86.  
  87.         rfc
  88.         ret     nc
  89.         rfz
  90.         ret     nz
  91.         rfs
  92.         ret     p
  93.         rfp
  94.         ret     po
  95.         rc
  96.         ret     c
  97.         rz
  98.         ret     z
  99.         rs
  100.         ret     m
  101.         rp
  102.         ret     pe
  103.  
  104.         rst     38h
  105.  
  106. ;-----------------------------------
  107. ; Load Group
  108.  
  109.         laa
  110.         ld      a,a
  111.         lab
  112.         ld      a,b
  113.         lac
  114.         ld      a,c
  115.         lad
  116.         ld      a,d
  117.         lae
  118.         ld      a,e
  119.         lah
  120.         ld      a,h
  121.         lal
  122.         ld      a,l
  123.         lba
  124.         ld      b,a
  125.         lbb
  126.         ld      b,b
  127.         lbc
  128.         ld      b,c
  129.         lbd
  130.         ld      b,d
  131.         lbe
  132.         ld      b,e
  133.         lbh
  134.         ld      b,h
  135.         lbl
  136.         ld      b,l
  137.         lca
  138.         ld      c,a
  139.         lcb
  140.         ld      c,b
  141.         lcc
  142.         ld      c,c
  143.         lcd
  144.         ld      c,d
  145.         lce
  146.         ld      c,e
  147.         lch
  148.         ld      c,h
  149.         lcl
  150.         ld      c,l
  151.         lda
  152.         ld      d,a
  153.         ldb
  154.         ld      d,b
  155.         ldc
  156.         ld      d,c
  157.         ldd
  158.         ld      d,d
  159.         lde
  160.         ld      d,e
  161.         ldh
  162.         ld      d,h
  163.         ldl
  164.         ld      d,l
  165.         lea
  166.         ld      e,a
  167.         leb
  168.         ld      e,b
  169.         lec
  170.         ld      e,c
  171.         led
  172.         ld      e,d
  173.         lee
  174.         ld      e,e
  175.         leh
  176.         ld      e,h
  177.         lel
  178.         ld      e,l
  179.         lha
  180.         ld      h,a
  181.         lhb
  182.         ld      h,b
  183.         lhc
  184.         ld      h,c
  185.         lhd
  186.         ld      h,d
  187.         lhe
  188.         ld      h,e
  189.         lhh
  190.         ld      h,h
  191.         lhl
  192.         ld      h,l
  193.         lla
  194.         ld      l,a
  195.         llb
  196.         ld      l,b
  197.         llc
  198.         ld      l,c
  199.         lld
  200.         ld      l,d
  201.         lle
  202.         ld      l,e
  203.         llh
  204.         ld      l,h
  205.         lll
  206.         ld      l,l
  207.  
  208.         lam
  209.         ld      a,(hl)
  210.         lbm
  211.         ld      b,(hl)
  212.         lcm
  213.         ld      c,(hl)
  214.         ldm
  215.         ld      d,(hl)
  216.         lem
  217.         ld      e,(hl)
  218.         lhm
  219.         ld      h,(hl)
  220.         llm
  221.         ld      l,(hl)
  222.  
  223.         lma
  224.         ld      (hl),a
  225.         lmb
  226.         ld      (hl),b
  227.         lmc
  228.         ld      (hl),c
  229.         lmd
  230.         ld      (hl),d
  231.         lme
  232.         ld      (hl),e
  233.         lmh
  234.         ld      (hl),h
  235.         lml
  236.         ld      (hl),l
  237.  
  238.         lai     55h
  239.         ld      a,55h
  240.         lbi     55h
  241.         ld      b,55h
  242.         lci     55h
  243.         ld      c,55h
  244.         ldi     55h
  245.         ld      d,55h
  246.         lei     55h
  247.         ld      e,55h
  248.         lhi     55h
  249.         ld      h,55h
  250.         lli     55h
  251.         ld      l,55h
  252.  
  253.         lmi     55h
  254.         ld      (hl),55h
  255.  
  256. ;-----------------------------------
  257. ; Arithmetic Group
  258.  
  259.         ada
  260.         add     a,a
  261.         adb
  262.         add     a,b
  263.         adc
  264.         add     a,c
  265.         add
  266.         add     a,d
  267.         ade
  268.         add     a,e
  269.         adh
  270.         add     a,h
  271.         adl
  272.         add     a,l
  273.         adm
  274.         add     a,(hl)
  275.         adi     55h
  276.         add     a,55h
  277.  
  278.         aca
  279.         adc     a,a
  280.         acb
  281.         adc     a,b
  282.         acc
  283.         adc     a,c
  284.         acd
  285.         adc     a,d
  286.         ace
  287.         adc     a,e
  288.         ach
  289.         adc     a,h
  290.         acl
  291.         adc     a,l
  292.         acm
  293.         adc     a,(hl)
  294.         aci     55h
  295.         adc     a,55h
  296.  
  297.         sua
  298.         sub     a,a
  299.         sub
  300.         sub     a,b
  301.         suc
  302.         sub     a,c
  303.         sud
  304.         sub     a,d
  305.         sue
  306.         sub     a,e
  307.         suh
  308.         sub     a,h
  309.         sul
  310.         sub     a,l
  311.         sum
  312.         sub     a,(hl)
  313.         sui     55h
  314.         sub     a,55h
  315.  
  316.         sba
  317.         sbc     a,a
  318.         sbb
  319.         sbc     a,b
  320.         sbc
  321.         sbc     a,c
  322.         sbd
  323.         sbc     a,d
  324.         sbe
  325.         sbc     a,e
  326.         sbh
  327.         sbc     a,h
  328.         sbl
  329.         sbc     a,l
  330.         sbm
  331.         sbc     a,(hl)
  332.         sbi     55h
  333.         sbc     a,55h
  334.  
  335.         nda
  336.         and     a
  337.         ndb
  338.         and     b
  339.         ndc
  340.         and     c
  341.         ndd
  342.         and     d
  343.         nde
  344.         and     e
  345.         ndh
  346.         and     h
  347.         ndl
  348.         and     l
  349.         ndm
  350.         and     (hl)
  351.         ndi     55h
  352.         and     55h
  353.  
  354.         xra
  355.         xor     a
  356.         xrb
  357.         xor     b
  358.         xrc
  359.         xor     c
  360.         xrd
  361.         xor     d
  362.         xre
  363.         xor     e
  364.         xrh
  365.         xor     h
  366.         xrl
  367.         xor     l
  368.         xrm
  369.         xor     (hl)
  370.         xri     55h
  371.         xor     55h
  372.  
  373.         ora
  374.         or      a
  375.         orb
  376.         or      b
  377.         orc
  378.         or      c
  379.         ord
  380.         or      d
  381.         ore
  382.         or      e
  383.         orh
  384.         or      h
  385.         orl
  386.         or      l
  387.         orm
  388.         or      (hl)
  389.         ori     55h
  390.         or      55h
  391.  
  392.         ; in non-exclusive Z80 syntax, CP with one
  393.         ; argument is call-if-parity-even
  394.  
  395.         cpa
  396.         if      mompass>1
  397.         expect  1010
  398.         endif
  399.         cp      a
  400.         if      mompass>1
  401.         endexpect
  402.         endif
  403.         cpb
  404.         if      mompass>1
  405.         expect  1010
  406.         endif
  407.         cp      b
  408.         if      mompass>1
  409.         endexpect
  410.         endif
  411.         cpc
  412.         if      mompass>1
  413.         expect  1010
  414.         endif
  415.         cp      c
  416.         if      mompass>1
  417.         endexpect
  418.         endif
  419.         cpd
  420.         if      mompass>1
  421.         expect  1010
  422.         endif
  423.         cp      d
  424.         if      mompass>1
  425.         endexpect
  426.         endif
  427.         cpe
  428.         if      mompass>1
  429.         expect  1010
  430.         endif
  431.         cp      e
  432.         if      mompass>1
  433.         endexpect
  434.         endif
  435.         cph
  436.         if      mompass>1
  437.         expect  1010
  438.         endif
  439.         cp      h
  440.         if      mompass>1
  441.         endexpect
  442.         endif
  443.         cpl
  444.         if      mompass>1
  445.         expect  1010
  446.         endif
  447.         cp      l
  448.         if      mompass>1
  449.         endexpect
  450.         endif
  451.         cpm
  452.         if      mompass>1
  453.         expect  1010
  454.         endif
  455.         cp      (hl)
  456.         if      mompass>1
  457.         endexpect
  458.         endif
  459.         cpi     55h
  460.         cp      55h             ; -> call if parity even in non-exclusive mode
  461.  
  462.         inb
  463.         inc     b
  464.         inc
  465.         inc     c
  466.         ind
  467.         inc     d
  468.         ine
  469.         inc     e
  470.         inh
  471.         inc     h
  472.         inl
  473.         inc     l
  474.  
  475.         dcb
  476.         dec     b
  477.         dcc
  478.         dec     c
  479.         dcd
  480.         dec     d
  481.         dce
  482.         dec     e
  483.         dch
  484.         dec     h
  485.         dcl
  486.         dec     l
  487.  
  488. ;-----------------------------------
  489. ; Rotate Group
  490.  
  491.         rlc
  492.         rlca
  493.         rrc
  494.         rrca
  495.         ral
  496.         rla
  497.         rar
  498.         rra
  499.  
  500. ;===================================
  501. ; we repeat only the instructions different in new 8008 syntax
  502.  
  503.         cpu     8008new
  504.  
  505.         z80syntax on
  506.  
  507. ;-----------------------------------
  508. ; Input and Output Group
  509.  
  510.         in      5
  511.         in      a,5
  512.  
  513. ;-----------------------------------
  514. ; Jump Group
  515.  
  516.         ; in non-exclusive Z80 mode, JP with one
  517.         ; argument is interpreted as original 8008
  518.         ; mnemonic (jump if positive)
  519.         ; There is no ambiguity with J
  520.  
  521.         jmp     1234h
  522.         jp      1234h
  523.         j       1234h           ; -> JMP
  524.  
  525.         jnc     1234h
  526.         jp      nc,1234h
  527.         j       nc,1234h
  528.         jnz     1234h
  529.         jp      nz,1234h
  530.         j       nz,1234h
  531.         jp      1234h
  532.         jp      p,1234h
  533.         j       p,1234h
  534.         jpo     1234h
  535.         jp      po,1234h
  536.         j       po,1234h
  537.         jc      1234h
  538.         jp      c,1234h
  539.         j       c,1234h
  540.         jz      1234h
  541.         jp      z,1234h
  542.         j       z,1234h
  543.         jm      1234h
  544.         jp      m,1234h
  545.         j       m,1234h
  546.         jpe     1234h
  547.         jp      pe,1234h
  548.         j       pe,1234h
  549.  
  550. ;-----------------------------------
  551. ; Call and Return Group
  552.  
  553.         call    1234h
  554.  
  555.         cnc     1234h
  556.         call    nc,1234h
  557.         cnz     1234h
  558.         call    nz,1234h
  559.         cp      1234h
  560.         call    p,1234h
  561.         cpo     1234h
  562.         call    po,1234h
  563.         cc      1234h
  564.         call    c,1234h
  565.         cz      1234h
  566.         call    z,1234h
  567.         cm      1234h
  568.         call    m,1234h
  569.         cpe     1234h
  570.         call    pe,1234h
  571.  
  572.         ret
  573.  
  574.         rnc
  575.         ret     nc
  576.         rnz
  577.         ret     nz
  578.         rp
  579.         ret     p
  580.         rpo
  581.         ret     po
  582.         rc
  583.         ret     c
  584.         rz
  585.         ret     z
  586.         rm
  587.         ret     m
  588.         rpe
  589.         ret     pe
  590.  
  591.         rst     38h
  592.  
  593. ;-----------------------------------
  594. ; Load Group
  595.  
  596.         mov     a,a
  597.         ld      a,a
  598.         mov     a,b
  599.         ld      a,b
  600.         mov     a,c
  601.         ld      a,c
  602.         mov     a,d
  603.         ld      a,d
  604.         mov     a,e
  605.         ld      a,e
  606.         mov     a,h
  607.         ld      a,h
  608.         mov     a,l
  609.         ld      a,l
  610.         mov     b,a
  611.         ld      b,a
  612.         mov     b,b
  613.         ld      b,b
  614.         mov     b,c
  615.         ld      b,c
  616.         mov     b,d
  617.         ld      b,d
  618.         mov     b,e
  619.         ld      b,e
  620.         mov     b,h
  621.         ld      b,h
  622.         mov     b,l
  623.         ld      b,l
  624.         mov     c,a
  625.         ld      c,a
  626.         mov     c,b
  627.         ld      c,b
  628.         mov     c,c
  629.         ld      c,c
  630.         mov     c,d
  631.         ld      c,d
  632.         mov     c,e
  633.         ld      c,e
  634.         mov     c,h
  635.         ld      c,h
  636.         mov     c,l
  637.         ld      c,l
  638.         mov     d,a
  639.         ld      d,a
  640.         mov     d,b
  641.         ld      d,b
  642.         mov     d,c
  643.         ld      d,c
  644.         mov     d,d
  645.         ld      d,d
  646.         mov     d,e
  647.         ld      d,e
  648.         mov     d,h
  649.         ld      d,h
  650.         mov     d,l
  651.         ld      d,l
  652.         mov     e,a
  653.         ld      e,a
  654.         mov     e,b
  655.         ld      e,b
  656.         mov     e,c
  657.         ld      e,c
  658.         mov     e,d
  659.         ld      e,d
  660.         mov     e,e
  661.         ld      e,e
  662.         mov     e,h
  663.         ld      e,h
  664.         mov     e,l
  665.         ld      e,l
  666.         mov     h,a
  667.         ld      h,a
  668.         mov     h,b
  669.         ld      h,b
  670.         mov     h,c
  671.         ld      h,c
  672.         mov     h,d
  673.         ld      h,d
  674.         mov     h,e
  675.         ld      h,e
  676.         mov     h,h
  677.         ld      h,h
  678.         mov     h,l
  679.         ld      h,l
  680.         mov     l,a
  681.         ld      l,a
  682.         mov     l,b
  683.         ld      l,b
  684.         mov     l,c
  685.         ld      l,c
  686.         mov     l,d
  687.         ld      l,d
  688.         mov     l,e
  689.         ld      l,e
  690.         mov     l,h
  691.         ld      l,h
  692.         mov     l,l
  693.         ld      l,l
  694.  
  695.         mov     a,m
  696.         ld      a,(hl)
  697.         mov     b,m
  698.         ld      b,(hl)
  699.         mov     c,m
  700.         ld      c,(hl)
  701.         mov     d,m
  702.         ld      d,(hl)
  703.         mov     e,m
  704.         ld      e,(hl)
  705.         mov     h,m
  706.         ld      h,(hl)
  707.         mov     l,m
  708.         ld      l,(hl)
  709.  
  710.         mov     m,a
  711.         ld      (hl),a
  712.         mov     m,b
  713.         ld      (hl),b
  714.         mov     m,c
  715.         ld      (hl),c
  716.         mov     m,d
  717.         ld      (hl),d
  718.         mov     m,e
  719.         ld      (hl),e
  720.         mov     m,h
  721.         ld      (hl),h
  722.         mov     m,l
  723.         ld      (hl),l
  724.  
  725.         mvi     a,55h
  726.         ld      a,55h
  727.         mvi     b,55h
  728.         ld      b,55h
  729.         mvi     c,55h
  730.         ld      c,55h
  731.         mvi     d,55h
  732.         ld      d,55h
  733.         mvi     e,55h
  734.         ld      e,55h
  735.         mvi     h,55h
  736.         ld      h,55h
  737.         mvi     l,55h
  738.         ld      l,55h
  739.  
  740.         mvi     m,55h
  741.         ld      (hl),55h
  742.  
  743.         lxi     b,1234h         ; convenience built-in macro:
  744.         ld      bc,1234h
  745.         lxi     d,1234h         ; LXI is assembled as 2 x MVI
  746.         ld      de,1234h
  747.         lxi     h,1234h
  748.         ld      hl,1234h
  749.  
  750. ;-----------------------------------
  751. ; Arithmetic Group
  752.  
  753.         add     a
  754.         add     a,a
  755.         add     b
  756.         add     a,b
  757.         add     c
  758.         add     a,c
  759.         add     d
  760.         add     a,d
  761.         add     e
  762.         add     a,e
  763.         add     h
  764.         add     a,h
  765.         add     l
  766.         add     a,l
  767.         add     m
  768.         add     a,(hl)
  769.         adi     55h
  770.         add     a,55h
  771.  
  772.         adc     a
  773.         adc     a,a
  774.         adc     b
  775.         adc     a,b
  776.         adc     c
  777.         adc     a,c
  778.         adc     d
  779.         adc     a,d
  780.         adc     e
  781.         adc     a,e
  782.         adc     h
  783.         adc     a,h
  784.         adc     l
  785.         adc     a,l
  786.         adc     m
  787.         adc     a,(hl)
  788.         aci     55h
  789.         adc     a,55h
  790.  
  791.         ; note that A as destination is optional in Z80 syntax,
  792.         ; since Z80 cannot use anything else as dest for SUB.
  793.         ; However, M as source or SUI remains unallowed in
  794.         ; pure Z80 mode.  The 'unknown symbol' error for M will
  795.         ; not occur in pass 1:
  796.  
  797.         sub     a
  798.         sub     a,a
  799.         sub     b
  800.         sub     a,b
  801.         sub     c
  802.         sub     a,c
  803.         sub     d
  804.         sub     a,d
  805.         sub     e
  806.         sub     a,e
  807.         sub     h
  808.         sub     a,h
  809.         sub     l
  810.         sub     a,l
  811.         sub     m
  812.         sub     (hl)
  813.         sub     a,(hl)
  814.         sui     55h
  815.         sub     a,55h
  816.  
  817.         sbb     a
  818.         sbc     a,a
  819.         sbb     b
  820.         sbc     a,b
  821.         sbb     c
  822.         sbc     a,c
  823.         sbb     d
  824.         sbc     a,d
  825.         sbb     e
  826.         sbc     a,e
  827.         sbb     h
  828.         sbc     a,h
  829.         sbb     l
  830.         sbc     a,l
  831.         sbb     m
  832.         sbc     a,(hl)
  833.         sbi     55h
  834.         sbc     a,55h
  835.  
  836.         ana     a
  837.         and     a,a
  838.         ana     b
  839.         and     a,b
  840.         ana     c
  841.         and     a,c
  842.         ana     d
  843.         and     a,d
  844.         ana     e
  845.         and     a,e
  846.         ana     h
  847.         and     a,h
  848.         ana     l
  849.         and     a,l
  850.         ana     m
  851.         and     a,(hl)
  852.         ani     55h
  853.         and     a,55h
  854.  
  855.         xra     a
  856.         xor     a,a
  857.         xra     b
  858.         xor     a,b
  859.         xra     c
  860.         xor     a,c
  861.         xra     d
  862.         xor     a,d
  863.         xra     e
  864.         xor     a,e
  865.         xra     h
  866.         xor     a,h
  867.         xra     l
  868.         xor     a,l
  869.         xra     m
  870.         xor     a,(hl)
  871.         xri     55h
  872.         xor     a,55h
  873.  
  874.         ora     a
  875.         or      a,a
  876.         ora     b
  877.         or      a,b
  878.         ora     c
  879.         or      a,c
  880.         ora     d
  881.         or      a,d
  882.         ora     e
  883.         or      a,e
  884.         ora     h
  885.         or      a,h
  886.         ora     l
  887.         or      a,l
  888.         ora     m
  889.         or      a,(hl)
  890.         ori     55h
  891.         or      a,55h
  892.  
  893.         cmp     a
  894.         cp      a,a
  895.         cmp     b
  896.         cp      a,b
  897.         cmp     c
  898.         cp      a,c
  899.         cmp     d
  900.         cp      a,d
  901.         cmp     e
  902.         cp      a,e
  903.         cmp     h
  904.         cp      a,h
  905.         cmp     l
  906.         cp      a,l
  907.         cmp     m
  908.         cp      a,(hl)
  909.         cpi     55h
  910.         cp      a,55h
  911.  
  912.         inr     b
  913.         inc     b
  914.         inr     c
  915.         inc     c
  916.         inr     d
  917.         inc     d
  918.         inr     e
  919.         inc     e
  920.         inr     h
  921.         inc     h
  922.         inr     l
  923.         inc     l
  924.  
  925.         dcr     b
  926.         dec     b
  927.         dcr     c
  928.         dec     c
  929.         dcr     d
  930.         dec     d
  931.         dcr     e
  932.         dec     e
  933.         dcr     h
  934.         dec     h
  935.         dcr     l
  936.         dec     l
  937.