home *** CD-ROM | disk | FTP | other *** search
/ ftp.barnyard.co.uk / 2015.02.ftp.barnyard.co.uk.tar / ftp.barnyard.co.uk / cpm / walnut-creek-CDROM / ENTERPRS / CPM / UTILS / S / Z80ASM24.ZIP / Z80.DOC < prev    next >
Text File  |  1991-10-06  |  9KB  |  405 lines

  1.   Z-80 Macro Library Documentation
  2.   --------------------------------
  3.  
  4. I.
  5.     The purpose of this library is to enable the assembly of the Z-80
  6.     instruction set on a CP/M sytem using the CP/M MAC macro assembler.
  7.  
  8.     This library is invoked with the pseudo-op:
  9.  
  10.   "  MACLIB  Z80 "
  11.  
  12. II.
  13.     The following symbols and notations are used in the individual macro
  14.     descriptions;
  15.  
  16.  R - Any of the 8 bit registers: A, B, C, D, E, H, L, or M
  17.  RR - Any of the 16 bit register pairs: BC, DE, HL, or SP
  18.  NN - 8 bit immediate data (0 through 255)
  19.  D  - 8 bit signed displacment (-128 through +127)
  20.  NNNN - 16 bit address or immediate data (0 through 65535)
  21.  B  - bit number (0-7, 7 is most significant, 0 is least)
  22.  ADDR - 16 bit address within PC+127 through PC-128
  23.  M(ZZZ) - Memory at address "ZZZ"
  24.  
  25. III.
  26.  
  27.  MACLIB ver.    Zilog ver     TDL ver
  28. --------------  -------------  -------------
  29.  
  30. LDX R,D  LD R,(IX+D) MOV R,D(IX)
  31.     Load register from indexed memory (with IX)
  32.  
  33. LDY R,D  LD R,(IY+D) MOV R,D(IY)
  34.     Load register from indexed memory (with IY)
  35.  
  36. STX R,D  LD (IX+D),R MOV D(IX),R
  37.     Store register to indexed memory (with IX)
  38.  
  39. STY R,D  LD (IY+D),R MOV D(IY),R
  40.     Store register to indexed memory (with IY)
  41.  
  42. MVIX NN,D  LD (IX+D),NN MVI D(IX)
  43.     Move immediate to indexed memory (with IX)
  44.  
  45. MVIY NN,D  LD (IY+D),NN MVI D(IY)
  46.     Move immediate to indexed memory (with IY)
  47.  
  48. LDAI   LD A,I  LDAI
  49.     Move I to A
  50.  
  51. LDAR   LD A,R  LDAR
  52.     Move R to A
  53.  
  54. STAI   LD I,A  STAI
  55.     Move A to I
  56.  
  57. STAR   LD R,A  STAR
  58.     Move A to R
  59.  
  60. LXIX NNNN  LD IX,NNNN  LXI IX,NNNN
  61.     Load IX immediate (16 bits)
  62.  
  63. LXIY NNNN  LD IY,NNNN  LXI IY,NNNN
  64.     Load IY immediate (16 bits)
  65.  
  66. LBCD NNNN  LD BC,(NNNN) LBCD NNNN
  67.     Load BC direct (from memory at NNNN)
  68.  
  69. LDED NNNN  LD DE,(NNNN) LDED NNNN
  70.     Load DE direct
  71.  
  72. LSPD NNNN  LD SP,(NNNN) LSPD NNNN
  73.     Load SP direct
  74.  
  75. LIXD NNNN  LD IX,(NNNN) LIXD NNNN
  76.     Load IX direct
  77.  
  78. LIYD NNNN  LD IY,(NNNN) LIYD NNNN
  79.     Load IY direct
  80.  
  81. SBCD NNNN  LD (NNNN),BC SBCD NNNN
  82.     Store BC direct (to memory at NNNN)
  83.  
  84. SDED NNNN  LD (NNNN),DE SDED NNNN
  85.     Store DE direct
  86.  
  87. SSPD NNNN  LD (NNNN),SP SSPD NNNN
  88.     Store SP direct
  89.  
  90. SIXD NNNN  LD (NNNN),IX SIXD NNNN
  91.     Store IX direct
  92.  
  93. SIYD NNNN  LD (NNNN),IY SIYD NNNN
  94.     Store IY direct
  95.  
  96. SPIX   LD SP,IX  SPIX
  97.     Copy IX to the SP
  98.  
  99. SPIY   LD SP,IY  SPIY
  100.     Copy IY to the SP
  101.  
  102. PUSHIX   PUSH IX  PUSH IX
  103.     Push IX into the stack
  104.  
  105. PUSHIY   PUSH IY  PUSH IY
  106.     Push IY into the stack
  107.  
  108. POPIX   POP IX  POP IX
  109.     Pop IX from the stack
  110.  
  111. POPIY   POP IY  POP IY
  112.     Pop IY from the stack
  113.  
  114. EXAF   EX AF,AF'  EXAF
  115.     Exchange AF and the alternate, AF'
  116.  
  117. EXX   EXX   EXX
  118.     Exchange BC DE HL with BC' DE' HL'
  119.  
  120. XTIX   EX (SP),IX  XTIX
  121.     Exchange IX with the top of the stack
  122.  
  123. XTIY   EX (SP),IY  XTIY
  124.     Exchange IY with the top of the stack
  125.  
  126. LDI   LDI   LDI
  127.     Move m(HL) to m(DE), increment DE and HL, decrement BC
  128.  
  129. LDIR   LDIR   LDIR
  130.     Repeat LDI until BC = 0
  131.  
  132. LDD   LDD   LDD
  133.     Move m(HL) to m(DE), decrement HL, DE, and BC
  134.  
  135. LDDR   LDDR   LDDR
  136.     Repeat LDD until BC = 0
  137.  
  138. CCI   CPI   CCI
  139.     Compare A with m(HL), increment HL, decrement BC
  140.  
  141. CCIR   CPIR   CCIR
  142.     Repeat CCI until BC = 0  or  A = m(HL)
  143.  
  144. CCD   CPD   CCD
  145.     Compare A with m(HL), decrement HL and BC
  146.  
  147. CCDR   CPDR   CCDR
  148.     Repeat CCD until BC = 0 or A = m(HL)
  149.  
  150. ADDX D  ADD (IX+D)  ADD D(IX)
  151.     Indexed add to A
  152.  
  153. ADDY D  ADD (IY+D)  ADD D(IY)
  154.     Indexed add to A
  155.  
  156. ADCX D  ADC (IX+D)  ADC D(IX)
  157.     Indexed add with carry
  158.  
  159. ADCY D  ADC (IY+D)  ADC D(IY)
  160.     Indexed add with carry
  161.  
  162. SUBX D  SUB (IX+D)  SUB D(IX)
  163.     Indexed subtract
  164.  
  165. SUBY D  SUB (IY+D)  SUB D(IY)
  166.     Indexed Subtract
  167.  
  168. SBCX D  SBC (IX+D)  SBB D(IX)
  169.     Indexed subtract with "borrow"
  170.  
  171. SBCY D  SBC (IY+D)  SBB D(IY)
  172.     Indexed subtract with borrow
  173.  
  174. ANDX D  AND (IX+D)  ANA D(IX)
  175.     Indexed logical and
  176.  
  177. ANDY D  AND (IY+D)  ANA D(IY)
  178.     Indexed logical and
  179.  
  180. XORX D  XOR (IX+D)  XRA D(IX)
  181.     Indexed logical exclusive or
  182.  
  183. XORY D  XOR (IY+D)  XRA D(IY)
  184.     Indexed logical exclusive or
  185.  
  186. ORX D  OR (IX+D)  ORA D(IX)
  187.     Indexed logical or
  188.  
  189. ORY D  OR (IY+D)  ORA D(IY)
  190.     Indexed logical exclusive or
  191.  
  192. CMPX D  CP (IX+D)  CMP D(IX)
  193.     Indexed compare
  194.  
  195. CMPY D  CP (IY+D)  CMP D(IY)
  196.     Index compare
  197.  
  198. INRX D  INC (IX+D)  INR D(IX)
  199.     Increment memory at M(IX+D)
  200.  
  201. INRY D  INC (IY+D)  INR D(IY)
  202.     Increment memory at M(IY+D)
  203.  
  204. DCRX D  INC (IX+D)  INR D(IX)
  205.     Decrement memory at M(IX+D)
  206.  
  207. DCRY D  DEC (IY+D)  DCR D(IY)
  208.     Decrement memory at M(IX+D)
  209.  
  210. NEG   NEG   NEG
  211.     Negate A (two's complement)
  212.  
  213. IM0   IM0   IM0
  214.     Set interrupt mode 0
  215.  
  216. IM1   IM1   IM1
  217.     Set interrupt mode 1
  218.  
  219. IM2   IM2   IM2
  220.     Set interrupt mode 2
  221.  
  222. DADC RR  ADC HL,RR  DADC RR
  223.     Add with carry rr to HL
  224.  
  225. DSBC RR  SBC HL,RR  DSBC RR
  226.     Subtract with "borrow" RR from HL
  227.  
  228. DADX RR  ADD IX,RR  DADX RR
  229.     Add rr to IX (RR may be BC, DE, SP, IX)
  230.  
  231. DADY RR  ADD IY,RR  DADY RR
  232.     Add RR to IY (RR may be BC, DE, SP, IY)
  233.  
  234. INXIX   INC IX  INX IX
  235.     Increment IX
  236.  
  237. INXIY   INC IY  INX IY
  238.     Increment IY
  239.  
  240. DCXIX   DEC IX  DCX IX
  241.     Decrement IX
  242.  
  243. DCXIY   DEC IY  DCX IY
  244.     Decrement IY
  245.  
  246. BIT B,R  BIT B,R  BIT B,R
  247.     Test bit B in register R
  248.  
  249. SETB B,R  SET B,R  SET B,R
  250.     Set bit b in register r
  251.  
  252. RES B,R  RES B,R  RES B,R
  253.     Reset bit B in register R
  254.  
  255. BITX B,D  BIT B,(IX+D) BIT B,D(IX)
  256.     Test bit B in memory at M(IX+D)
  257.  
  258. BITY B,D  BIT B,(IY+D) BIT B,D(IY)
  259.     Test bit b in memory at M(IY+D)
  260.  
  261. SETX B,D  SET B,(IX+D) SET B,D(IX)
  262.     Set bit B in memory at M(IX+D)
  263.  
  264. SETY B,D  SET B,(IY+D) SET B,D(IY)
  265.     Set bit B in memory at M(IY+D)
  266.  
  267. RESX B,D  RES B,(IX+D) RES B,D(IX)
  268.     Reset bit b in memory at m(IX+D)
  269.  
  270. RESY B,D  RES B,(IY+D) RES B,D(IY)
  271.     Reset bit b in memory at m(IY+D)
  272.  
  273. JR ADDR  JR ADDR-$  JMPR ADDR
  274.     Jump relative unconditional
  275.  
  276. JRC ADDR  JR C,ADDR-$ JRC ADDR
  277.     Jump relative if Carry indicator true
  278.  
  279. JRNC ADDR  JR NC,ADDR-$ JRNC ADDR
  280.     Jump relative if carry indicator false
  281.  
  282. JRZ ADDR  JR Z,ADDR-$ JRC ADDR
  283.     Jump relative if Zero indicator true
  284.  
  285. JRNZ ADDR  JR NZ,ADDR-$ JRNZ ADDR
  286.     Jump relative if Zero indicator false
  287.  
  288. DJNZ ADDR  DJNZ ADDR-$  DJNZ ADDR
  289.     Decrement B, jump relative if non-zero
  290.  
  291. PCIX   JMP (IX)  PCIX
  292.     Jump to address in IX i.e., Load PC from IX
  293.  
  294. PCIY   JMP (IY)  PCIY
  295.     Jump to address in IY
  296.  
  297. RETI   RETI   RETI
  298.     Return from interrupt
  299.  
  300. RETN   RETN   RETN
  301.     Return from non-maskable interrupt
  302.  
  303. INP R  IN R,(C)  INP R
  304.     Input from port C to register R
  305.  
  306. OUTP R  OUT (C),R  OUTP R
  307.     Output from register R to port (C)
  308.  
  309. INI   INI   INI
  310.     Input from port (C) to M(HL), increment HL, decrement B
  311.  
  312. INIR   INIR   INIR
  313.     Input from port (C) to M(HL), increment HL, decrement B, repeat if B <> 0
  314.  
  315. OUTI   OTI   OUTI
  316.     Output from M(HL) to port (C), increment HL, decrement B
  317.  
  318. OUTIR   OTIR   OUTIR
  319.     Repeat OUTI until B = 0
  320.  
  321. IND   IND   IND
  322.     Input from port (C) to M(HL), decrement HL snd B
  323.  
  324. INDR   INDR   INDR
  325.     Repeat IND until B = 0
  326.  
  327. OUTD   OTD   OUTD
  328.     Output from M(HL) to port (C), decrement HL and B
  329.  
  330. OUTDR   OTDR   OUTDR
  331.     Repeat OUTD until B = 0
  332.  
  333. RLCR R  RLC R  RLCR R
  334.     Rotate left circular register
  335.  
  336. RLCX D  RLC (IX+D)  RLCR D(IX)
  337.     Rotate left circular indexed memory
  338.  
  339. RLCY D  RLC (IY+D)  RLCR D(IY)
  340.     Rotate left circular indexed memory
  341.  
  342. RALR R  RL R  RALR R
  343.     Rotate left arithmetic register
  344.  
  345. RALX D  RL (IX+D)  RALR D(IX)
  346.     Rotate left arithmetic indexed memory
  347.  
  348. RALY D  RL (IY+D)  RALR D(IY)
  349.     Rotate left arithmetic indexed memory
  350.  
  351. RRCR R  RRC R  RRCR R
  352.     Rotate right circular register
  353.  
  354. RRCX D  RRC (IX+D)  RRCR D(IX)
  355.     Rotate right circular indexed
  356.  
  357. RRCY D        RRC     (IY+D)        RRCR    D(IY)
  358.     Rotate right circular indexed
  359.  
  360. RARR R  RR R  RARR R
  361.     Rotate right arithmetic register
  362.  
  363. RARX D  RR (IX+D)  RARR D(IX)
  364.     Rotate right arithmetic indexed memory
  365.  
  366. RARY D  RR (IY+D)  RARR D(IY)
  367.     Rotate right arithmetic indexed memory
  368.  
  369. SLAR R  SLA R  SLAR R
  370.     Shift left register
  371.  
  372. SLAX D  SLA (IX+D)  SLAR D(IX)
  373.     Shift left indexed memory
  374.  
  375. SLAY D  SLA (IY+D)  SLAR D(IY)
  376.     Shift left indexed memory
  377.  
  378. SRAR R  SRA R  SRAR R
  379.     Shift right arithmetic register
  380.  
  381. SRAX D  SRA (IX+D)  SRAR D(IX)
  382.     Shift right arithmetic indexed memory
  383.  
  384. SRAY D  SRA (IY+D)  SRAR D(IY)
  385.     Shift right arithmetic indexed memory
  386.  
  387. SRLR R  SRL R  SRLR R
  388.     Shift right logical register
  389.  
  390. SRLX D  SRL (IX+D)  SRLR D(IX)
  391.     Shift right logical indexed memory
  392.  
  393. SRLY D  SRL (IY+D)  SRLR D(IY)
  394.     Shift right logical indexed memory
  395.  
  396. RLD   RLD   RLD
  397.     Rotate left digit
  398.  
  399. RRD   RRD   RRD
  400.     Rotate right digit
  401.  
  402.     end
  403.  
  404. 
  405.