home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 2 / FFMCD02.bin / new / misc / emu / z80 / impldept.i < prev    next >
Text File  |  1993-12-21  |  3KB  |  133 lines

  1. ** The implementation-dependent Z80 instructions.
  2. ** (More or less just the label-defining mechanisms.)
  3.  
  4. ** If the label GENERIC_OBJECT is defined, these instructions will be
  5. ** assumed defined in a separate object file. When for instance "In A,(n)"
  6. ** is executed, a jump will be made to the XREF:ed label "Z80_In_A_1n1".
  7. ** They will be about 12 clocks slower, but it provides more flexibility
  8. ** (and some more address space for the cache vectors).
  9. ** The file 'extern_instr.a' compiles to such an object file.
  10.  
  11. ** If GENERIC_OBJECT is not defined, they will be inline expanded like
  12. ** normal instruction routines, the macros taken from a file named
  13. ** 'machine_macs.i'. (I expect the macros in 'generic_macs.i' will never
  14. ** be used for this purpose - if you compile for maximum speed, why use
  15. ** the non-optimised routines?) This will create a machine-specific object
  16. ** file, not needing any XREF:ed instructions, but clearly only useful for
  17. ** a single project. Note: There is nothing stopping you from making some
  18. ** (or even all, but why?) of the macros in 'machine_macs.i' jump to
  19. ** external labels, if you wish to create a "slightly more specialised"
  20. ** Z80 emulator object file.
  21.  
  22. ** The macro names are made from the instruction labels with "_mac"
  23. ** appended, and the external labels are "Z80_" with the instruction
  24. ** labels appended.
  25. ** There must be a separate macro for each instruction label.
  26.  
  27. ** Tests for self-modifying code should not be included in the macros!
  28. ** They are executed before the macro expansion/jump to label.
  29.  
  30. ** ======================================================================
  31.  
  32.     IFD VERBOSE
  33.     LIST
  34. ** Compiling the impldept.i file.
  35.     NOLIST
  36.     ENDC
  37.  
  38.  
  39.     IFD    GENERIC_OBJECT
  40.  
  41.  
  42.     IFD VERBOSE
  43.     LIST
  44. ** Creating a generic object file. Jumps to external labels are created
  45. **   for the implementation-dependent instruction routines.
  46.     NOLIST
  47.     ENDC
  48.  
  49.     ;Macro to cross-ref and jump
  50.  
  51. IMPLDEPT MACRO    ;Instruction_name, [ do_before_call ]
  52.     XREF    Z80_\1
  53. \1    \2
  54.     jmp    Z80_\1
  55.     ENDM
  56.  
  57.  
  58.     ELSE
  59.  
  60.  
  61.     IFD VERBOSE
  62.     LIST
  63. ** Using machine-specific macros from the file machine.i, and expanding
  64. **   the macros inline.
  65.     NOLIST
  66.     ENDC
  67.  
  68.     ;Get the instruction macros
  69.  
  70.     INCLUDE machine_macs.i    
  71.  
  72.     ;Macro to inline expand instruction macro
  73.  
  74. IMPLDEPT MACRO    ;Instruction_name, [ do_before_call ]
  75. \1    \2
  76.     \1_mac
  77.     ENDM
  78.  
  79.     ENDC ;IFD GENERIC_OBJECT
  80.  
  81.  
  82. **
  83. ** The instruction labels begin here:
  84. **
  85.  
  86. In_r_1C1 MACRO
  87.     IMPLDEPT    In_\1_1C1,opcode_2_bytes
  88.     ENDM
  89.     do_r In_r_1C1
  90.  
  91.     IMPLDEPT    In_H_1C1,opcode_2_bytes
  92.  
  93.     IMPLDEPT    In_xx_1C1,opcode_2_bytes    ;undocumented
  94.  
  95.     IMPLDEPT    In_A_1n1
  96.  
  97.     IMPLDEPT    Ind,opcode_2_bytes
  98.  
  99.     IMPLDEPT    Indr,opcode_2_bytes
  100.  
  101.     IMPLDEPT    Ini,opcode_2_bytes
  102.  
  103.     IMPLDEPT    Inir,opcode_2_bytes
  104.  
  105.     IMPLDEPT    Ld_A_R,opcode_2_bytes
  106.  
  107.     IMPLDEPT    Ld_R_A,opcode_2_bytes
  108.  
  109.     IMPLDEPT    Otdr,opcode_2_bytes
  110.  
  111.     IMPLDEPT    Otir,opcode_2_bytes
  112.  
  113. Out_1C1_r MACRO
  114.     IMPLDEPT    Out_1C1_\1,opcode_2_bytes
  115.     ENDM
  116.     do_r Out_1C1_r
  117.  
  118.     IMPLDEPT    Out_1C1_H,opcode_2_bytes
  119.  
  120.     IMPLDEPT    Out_1C1_xx,opcode_2_bytes    ;undocumented
  121.  
  122.     IMPLDEPT    Out_1n1_A
  123.  
  124.     IMPLDEPT    Outd,opcode_2_bytes
  125.  
  126.     IMPLDEPT    Outi,opcode_2_bytes
  127.  
  128.     IMPLDEPT    Reti,opcode_2_bytes
  129.  
  130.     IMPLDEPT    Retn,opcode_2_bytes
  131.  
  132. ** =====================================================================
  133.