home *** CD-ROM | disk | FTP | other *** search
/ ftp.whtech.com / ftp.whtech.com.7z / ftp.whtech.com / emulators / v9t9 / linux / sources / V9t9 / source / vdp.h < prev    next >
Encoding:
C/C++ Source or Header  |  2006-10-19  |  4.0 KB  |  186 lines

  1.  
  2. /*
  3.         VDP.H
  4.         =====
  5.         
  6.         Video display processor functions
  7.  
  8. */
  9.  
  10. #ifndef __VDP_H__
  11. #define __VDP_H__
  12.  
  13. #include "16bit.h"
  14. #include "command.h"
  15.  
  16. #include "centry.h"
  17.  
  18. /*  vdpaddr == register value  */
  19. extern void vdpupdate(u32 addr);
  20. extern void vdpcompleteredraw(void);
  21. extern void    vdpinit(void);
  22.  
  23. /*
  24.  *    Force current changes to be sent to video module
  25.  */
  26. extern void    vdp_update(void);
  27.  
  28. /*    
  29.  * Notify that an address in VDP has been modified externally.
  30.  */
  31. extern void    vdp_touch(u32 addr);
  32.  
  33. extern     u16     vdp_mmio_get_addr(void);
  34. extern    void vdp_mmio_set_addr(u16 addr);
  35. extern    bool vdp_mmio_addr_is_complete(void);
  36.  
  37. extern     void vdp_memory_init(void);
  38. extern    void vdp_mmio_write(u16 addr,u8 val);
  39. extern    s8      vdp_mmio_read(u16 addr);
  40.  
  41. extern    u8     vdp_mmio_get_status(void);
  42. extern    void vdp_mmio_set_status(u8 status);
  43.  
  44. /*
  45.  *    Force an update of a given region of the screen.
  46.  *    Coordinates and offsets given in pixels.
  47.  */
  48. extern void vdp_dirty_screen(u32 x, u32 y, s32 dx, s32 dy);
  49.  
  50. extern    u32 screenxsize,screenysize;
  51. extern    u8    vdpregs[8];    
  52. extern    u8 vdpbg,vdpfg;
  53.  
  54. extern     bool draw_sprites;
  55. extern     bool five_sprites_on_a_line;
  56. extern    int    videoupdatespeed;
  57.  
  58. //extern    u8    vdpstatus;
  59.  
  60. #define VDP_INTERRUPT     0x80
  61. #define VDP_COINC        0x40
  62. #define VDP_FIVE_SPRITES 0x20
  63. #define VDP_FIFTH_SPRITE 0x1f
  64.  
  65. // Palette of standard TI colors.
  66. // Each one is RGB, in that order, from 0 to 255.
  67. // Color 0, which is clear, and color 17, which is
  68. // the foreground in text mode, may be ignored,
  69. // but beware that these will be generated in updarea.
  70. extern u8 vdp_palette[17][3];
  71.  
  72. #define RGB_8_TO_16(x)    (((x)<<8) + (((x)&1) ? 0xff : 0))
  73. #define RGB_8_TO_6(x)    ((x) >> 2)
  74.  
  75. #define SPRBIT(x) (1<<(x))
  76.  
  77. #define R0_BITMAP 2
  78. #define R0_EXTERNAL 1
  79.  
  80. #define R1_RAMSIZE 128
  81. #define R1_NOBLANK 64
  82. #define R1_INT 32
  83. #define R1_TEXT 16
  84. #define R1_MULTI 8
  85. #define R1_SPR4 2
  86. #define R1_SPRMAG 1
  87.  
  88. #define MODE_BITMAP 1
  89. #define MODE_GRAPHICS 0
  90. #define MODE_TEXT 2
  91. #define MODE_MULTI 3
  92.  
  93. /*
  94.  *    Command interface callbacks
  95.  */
  96. DECL_SYMBOL_ACTION(vdp_set_register);
  97. DECL_SYMBOL_ACTION(vdp_set_read_ahead);
  98. DECL_SYMBOL_ACTION(vdp_set_addr_flag);
  99. DECL_SYMBOL_ACTION(vdp_take_screenshot);
  100.  
  101.  
  102. /*
  103.  *    This information should only be visible to vdp.c and vdpsprites.c
  104.  */
  105.  
  106.  
  107. #ifdef __VDP_INTERNAL__
  108.  
  109. #define UPDPTR(y,x) (&vdp_updarea[((y)*UPDATEBLOCK_ROW_STRIDE)+(x)+32])
  110.  
  111. extern    u8 vdp_updarea[UPDATEBLOCK_ROW_STRIDE*256];
  112.  
  113. /*    Values in screenchanges[] after handlespritechanges() */
  114. enum
  115. {
  116.     SC_UNTOUCHED     = 0,    // block not changed
  117.     SC_BACKGROUND    = 1,    // background changed
  118.     SC_SPRITE_DELETED = 2,    // sprite deleted, revealing block
  119.     SC_SPRITE_COVERING = 3    // sprite is covering the block
  120. };
  121.  
  122. extern    u8 screenchanges[960];
  123. extern    u8 pattchanges[768];
  124. extern    u8 colorchanges[768];
  125.  
  126. extern    u16 bitpattmask,bitcolormask;
  127.  
  128. extern    u8 sprpatchanges[256];
  129. extern    u8 sprpatvisible[256];
  130. extern    u32 spritechanges;
  131.  
  132. extern    u32    sprwidth;    /* in pixels */
  133.  
  134. extern void (*vdpdrawrow[])(u8 *,u8,u8);
  135. extern void (*vdpdrawrowtext[])(u8 *);
  136.  
  137. typedef void (*vdp_redrawfunc)(void);
  138.  
  139. //extern    redrawfunc redrawscreen;
  140.  
  141. typedef void (*vdp_modifyfunc)(u32 addr);
  142.  
  143. typedef struct vdp_area
  144. {
  145.     u32    base, size;
  146. }    vdp_area;
  147.  
  148. typedef struct vdp_mode_info
  149. {
  150.     vdp_area screen,         // screen image table
  151.         patt,                 // pattern definition table
  152.         color,                 // color definition table
  153.         sprite,             // sprite definition table
  154.         sprpat;                // sprite pattern definition table
  155. }    vdp_mode_info;
  156.  
  157. extern    vdp_mode_info vdp_mode;
  158.  
  159. typedef struct vdp_modify_info
  160. {
  161.     vdp_modifyfunc screen,    // modified screen image table
  162.         patt,                // modified pattern definition table
  163.         color,                // modified color definition table
  164.         sprite,                // modified sprite definition table
  165.         sprpat;                // modified sprite pattern table
  166. }    vdp_modify_info;
  167.  
  168. extern     vdp_modify_info vdp_modify;
  169.  
  170. typedef struct vdp_changes_info
  171. {
  172.     u8    screen[1024];        // 1: block changed
  173.     u8    patt[768];            // 1: pattern changed
  174.     u8    color[768];            // 1: color changed
  175.     u32 sprite;                // (1<<x): sprite #x changed
  176.     u8    sprpat[256];        // 1: sprite pattern changed
  177. }    vdp_changes_info;        
  178.  
  179. extern vdp_changes_info vdp_changes;
  180.  
  181. #endif // __VDP_INTERNAL__
  182.  
  183. #include "cexit.h"
  184.  
  185. #endif
  186.