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 / BEEHIVE / ZCAT / SYSIOP21.LBR / HD64180.MZB / HD64180.MLB
Text File  |  2000-06-30  |  6KB  |  253 lines

  1. ;+
  2. ; Edit Version 1.10
  3. ;**************************************************************************
  4. ;***    Hitachi HD64180 macro library.                    ***
  5. ;**************************************************************************
  6. ;
  7. ; File Name        : HD64180.MLB
  8. ; Author        : Edmund Cramp
  9. ; Creation Date        : 23-Dec-1985
  10. ;
  11. ; Proccesor Type    : Hitachi HD64180
  12. ; Assembler Name    : Z80ASM (SLR systems)
  13. ;
  14. ; Ammendment Record
  15. ; *****************
  16. ; Name        Date        Details of Ammendment
  17. ; ------------    -----------    ---------------------
  18. ; Edmund Cramp    23-Dec-1985    Initial Creation.
  19. ; Edmund Cramp    25-Dec-1985    Instruction documentation added.
  20. ; Edmund Cramp    14-Jan-1986    File extension changed (MacroLiBrary).
  21. ;
  22. ; Module Function
  23. ; ***************
  24. ;    Support the Hitachi HD64180 processor with the SLR system assembler
  25. ; since there are no other assemblers that have the speed or functionality.
  26. ;-
  27.  
  28. ;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  29. ;+++    CPU Control                            +++
  30. ;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  31.  
  32. ;+
  33. ; SLEEP.
  34. ;    The SLP instruction causes the HD64180 to enter SLEEP low power
  35. ; consumption mode.  See the Hitachi Data Manual.
  36. ;-
  37. SLP    MACRO            ; Enter SLEEP mode.
  38.     DEFB    0EDH,076H
  39.     ENDM
  40.  
  41. ;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  42. ;+++    Arithmetic Instructions.                    +++
  43. ;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  44.  
  45. ;+
  46. ; MULTIPLY.
  47. ;    The MLT performs unsigned multiplication on two 8 bit numbers yielding
  48. ; a 16 bit result.  MLT may specify BC, DE, HL or SP registers to recieve the
  49. ; 16-bit result.
  50. ;-
  51. MLT    MACRO    P1        ; 8 bit multiply with 16 bit result.
  52.     IFIDN    <P1>,<BC>
  53.         DEFB    0EDH,04CH
  54.         EXITM
  55.     ENDIF
  56.     IFIDN    <P1>,<DE>
  57.         DEFB    0EDH,05CH
  58.         EXITM
  59.     ENDIF
  60.     IFIDN    <P1>,<HL>
  61.         DEFB    0EDH,06CH
  62.         EXITM
  63.     ENDIF
  64.     IFIDN    <P1>,<SP>
  65.         DEFB    0EDH,07CH
  66.         EXITM
  67.     ENDIF
  68.         .PRINTX "NO PARAMETER - HD64180 - MLT"
  69.         DEFB    00,00
  70.     ENDM
  71.  
  72. ;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  73. ;+++    Input/Output.                            +++
  74. ;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  75.  
  76. ;+
  77. ; INPUT, IMMEDIATE I/O ADDRESS.
  78. ;    The contents of the specified register are output to the immediately
  79. ; specified 8-bit I/O address.  When I/O is accessed, 00H is output in the
  80. ; high-order bits of the address automatically.
  81. ;-
  82. IN0    MACRO    P1,P2        ; Input from immediate I/O to register.
  83.     IFIDN    <P1>,<B>
  84.         DEFB    0EDH,00H,P2
  85.         EXITM
  86.     ENDIF
  87.     IFIDN    <P1>,<C>
  88.         DEFB    0EDH,08H,P2
  89.         EXITM
  90.     ENDIF
  91.     IFIDN    <P1>,<D>
  92.         DEFB    0EDH,10H,P2
  93.         EXITM
  94.     ENDIF
  95.     IFIDN    <P1>,<E>
  96.         DEFB    0EDH,18H,P2
  97.         EXITM
  98.     ENDIF
  99.     IFIDN    <P1>,<H>
  100.         DEFB    0EDH,20H,P2
  101.         EXITM
  102.     ENDIF
  103.     IFIDN    <P1>,<L>
  104.         DEFB    0EDH,28H,P2
  105.         EXITM
  106.     ENDIF
  107.     IFIDN    <P1>,<A>
  108.         DEFB    0EDH,38H,P2
  109.         EXITM
  110.     ENDIF
  111.         .PRINTX "ERROR - HD64180 IN0"
  112.         DEFB    00,00,00
  113.     ENDM
  114.     
  115. ;+
  116. ; OUTPUT, IMMEDIATE I/O ADDRESS.
  117. ;    The contents of the specified register are output to the immediately
  118. ; specified 8-bit I/O address.  When I/O is accessed, 00H is output in the
  119. ; high-order bits of the address automatically.
  120. ;-
  121. OUT0    MACRO    P1,P2        ; Output register to immediate I/O address.
  122.     IFIDN    <P2>,<B>
  123.         DEFB    0EDH,01H,P1
  124.         EXITM
  125.     ENDIF
  126.     IFIDN    <P2>,<C>
  127.         DEFB    0EDH,09H,P1
  128.         EXITM
  129.     ENDIF
  130.     IFIDN    <P2>,<D>
  131.         DEFB    0EDH,11H,P1
  132.         EXITM
  133.     ENDIF
  134.     IFIDN    <P2>,<E>
  135.         DEFB    0EDH,19H,P1
  136.         EXITM
  137.     ENDIF
  138.     IFIDN    <P2>,<H>
  139.         DEFB    0EDH,20H,P1
  140.         EXITM
  141.     ENDIF
  142.     IFIDN    <P2>,<L>
  143.         DEFB    0EDH,29H,P1
  144.         EXITM
  145.     ENDIF
  146.     IFIDN    <P2>,<A>
  147.         DEFB    0EDH,39H,P1
  148.         EXITM
  149.     ENDIF
  150.         .PRINTX "ERROR - MISSING HD64180 PARAMETER - OUT0"
  151.         DEFB    00,00,00
  152.     ENDM
  153.  
  154. ;+
  155. ; OTIM, OTIMR, OTDM, OTDMR:- BLOCK I/O.
  156. ;    The contents of memory pointed to by HL is output to the I/O address
  157. ; in (C).  The memory address (HL) and the I/O address (C) are incremented
  158. ; in OTIM and OTIMR and decremented in OTDM and OTDMR respectivly.  The B
  159. ; register is decremented.  The OTIMR and OTDMR variants repeat the above
  160. ; sequence until register B is decremented to 0.  Since the I/O address (C)
  161. ; is automatically incremented or decremented, these instructions are useful
  162. ; for block I/O (such as the HD64180 on-chip I/O) initialisation.  When I/O
  163. ; is accessed, 00h is output in the high-order bits of the address
  164. ; automatically.
  165. ;-
  166. OTIM    MACRO
  167.     DEFB    0EDH,83H
  168.     ENDM
  169.  
  170. OTIMR    MACRO
  171.     DEFB    0EDH,93H
  172.     ENDM
  173.  
  174. OTDM    MACRO
  175.     DEFB    0EDH,8BH
  176.     ENDM
  177.  
  178. OTDMR    MACRO
  179.     DEFB    0EDH,9BH
  180.     ENDM
  181.  
  182. ;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  183. ;+++    Test                                 +++
  184. ;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  185.  
  186. ;+ 
  187. ; TEST I/O PORT.
  188. ;    The contents of the I/O port addressed by C are ANDed with the
  189. ; immediately specified 8-bit data and the status flags are updated.  The
  190. ; I/O port contents are not written (non-destructive AND). When I/O is
  191. ; accessed, 00H is output in the higher bits of the address automatically.
  192. ; This is an improvement on the obscure ZILOG instruction "IN  AF,(C).
  193. ;-
  194.     
  195. TSTIO    MACRO    P1        ; I/O AND immediate
  196.     IFNDEF    P1
  197.         .PRINTX "ERROR HD64180 TSTIO PARAMETER"
  198.     ELSE
  199.         DEFB    0EDH,74H,P1
  200.     ENDIF
  201.     ENDM
  202.  
  203. ;+
  204. ; TEST REGISTER.
  205. ;    The contents of the specified register are ANDed with the accumulator
  206. ; (A) and the status flags updated.  The accumulator and specified register
  207. ; are not changed (non-destructive AND).
  208. ; TEST IMMEDIATE.
  209. ;    The contents of the immediately specified 8-bit data are ANDed with
  210. ; the accumulator (A) and the status flags updated.  The accumulator is not
  211. ; changed (non-destructive AND).
  212. ; TEST MEMORY.
  213. ;    The contents of memory pointed to by HL are ANDed with the accumulator
  214. ; (A) and the status flags updated.  The memory contents and the accumulator
  215. ; are not changed (non-destructive AND).
  216. ;-
  217. TST    MACRO    P1        ; Acc AND target (non-destructive)
  218.     IFIDN    <P1>,<B>
  219.         DEFB    0EDH,04H
  220.         EXITM
  221.     ENDIF
  222.     IFIDN    <P1>,<C>
  223.         DEFB    0EDH,0CH
  224.         EXITM
  225.     ENDIF
  226.     IFIDN    <P1>,<D>
  227.         DEFB    0EDH,14H
  228.         EXITM
  229.     ENDIF
  230.     IFIDN    <P1>,<E>
  231.         DEFB    0EDH,1CH
  232.         EXITM
  233.     ENDIF
  234.     IFIDN    <P1>,<H>
  235.         DEFB    0EDH,24H
  236.         EXITM
  237.     ENDIF
  238.     IFIDN    <P1>,<L>
  239.         DEFB    0EDH,2CH
  240.         EXITM
  241.     ENDIF
  242.     IFIDN    <P1>,<A>        ;; TST A
  243.         DEFB    0EDH,3CH
  244.         EXITM
  245.     ENDIF
  246.     IFIDN    <P1>,<(HL)>        ;; TST (HL)
  247.         DEFB    0EDH,34H
  248.         EXITM
  249.     ENDIF
  250.         ;; Should be TST byte.
  251.         DEFB    0EDH,64H,P1    
  252.     ENDM
  253.