src/emu/sound/cdp1869.c
| r6489 | r6490 | |
| 8 | 8 | |
| 9 | 9 | TODO: |
| 10 | 10 | |
| 11 | | - remove CDP1802 dependency |
| 11 | - remove CDP1802 dependency |
| 12 | - sound base frequencies are TPA/TPB |
| 12 | 13 | - white noise |
| 13 | 14 | - scanline based update |
| 14 | 15 | - CMSEL output |
| r6489 | r6490 | |
| 51 | 52 | devcb_resolved_read8 in_page_ram_func; |
| 52 | 53 | devcb_resolved_write8 out_page_ram_func; |
| 53 | 54 | devcb_resolved_write_line out_prd_func; |
| 55 | devcb_resolved_read_line in_pal_ntsc_func; |
| 54 | 56 | |
| 55 | 57 | const device_config *device; |
| 56 | 58 | const cdp1869_interface *intf; /* interface */ |
| r6489 | r6490 | |
| 104 | 106 | IMPLEMENTATION |
| 105 | 107 | ***************************************************************************/ |
| 106 | 108 | |
| 109 | #define CDP1869_IS_NTSC \ |
| 110 | (!devcb_call_read_line(&cdp1869->in_pal_ntsc_func)) |
| 111 | |
| 107 | 112 | /*------------------------------------------------- |
| 108 | 113 | update_prd_changed_timer - update predisplay |
| 109 | 114 | changed timer |
| r6489 | r6490 | |
| 118 | 123 | int scanline = video_screen_get_vpos(cdp1869->screen); |
| 119 | 124 | int next_scanline; |
| 120 | 125 | |
| 121 | | if (cdp1869->intf->pal_ntsc == CDP1869_NTSC) |
| 126 | if (CDP1869_IS_NTSC) |
| 122 | 127 | { |
| 123 | 128 | start = CDP1869_SCANLINE_PREDISPLAY_START_NTSC; |
| 124 | 129 | end = CDP1869_SCANLINE_PREDISPLAY_END_NTSC; |
| r6489 | r6490 | |
| 507 | 512 | cdp1869->cmem = BIT(word, 0); |
| 508 | 513 | cdp1869->line9 = BIT(word, 3); |
| 509 | 514 | |
| 510 | | if (cdp1869->intf->pal_ntsc == CDP1869_NTSC) |
| 515 | if (CDP1869_IS_NTSC) |
| 511 | 516 | { |
| 512 | 517 | cdp1869->line16 = BIT(word, 5); |
| 513 | 518 | } |
| r6489 | r6490 | |
| 719 | 724 | |
| 720 | 725 | rectangle screen_rect, outer; |
| 721 | 726 | |
| 722 | | switch (cdp1869->intf->pal_ntsc) |
| 727 | if (CDP1869_IS_NTSC) |
| 723 | 728 | { |
| 724 | | case CDP1869_NTSC: |
| 725 | 729 | outer.min_x = CDP1869_HBLANK_END; |
| 726 | 730 | outer.max_x = CDP1869_HBLANK_START - 1; |
| 727 | 731 | outer.min_y = CDP1869_SCANLINE_VBLANK_END_NTSC; |
| r6489 | r6490 | |
| 730 | 734 | screen_rect.max_x = CDP1869_SCREEN_END - 1; |
| 731 | 735 | screen_rect.min_y = CDP1869_SCANLINE_DISPLAY_START_NTSC; |
| 732 | 736 | screen_rect.max_y = CDP1869_SCANLINE_DISPLAY_END_NTSC - 1; |
| 733 | | break; |
| 734 | | |
| 735 | | default: |
| 736 | | case CDP1869_PAL: |
| 737 | } |
| 738 | else |
| 739 | { |
| 737 | 740 | outer.min_x = CDP1869_HBLANK_END; |
| 738 | 741 | outer.max_x = CDP1869_HBLANK_START - 1; |
| 739 | 742 | outer.min_y = CDP1869_SCANLINE_VBLANK_END_PAL; |
| r6489 | r6490 | |
| 742 | 745 | screen_rect.max_x = CDP1869_SCREEN_END - 1; |
| 743 | 746 | screen_rect.min_y = CDP1869_SCANLINE_DISPLAY_START_PAL; |
| 744 | 747 | screen_rect.max_y = CDP1869_SCANLINE_DISPLAY_END_PAL - 1; |
| 745 | | break; |
| 746 | 748 | } |
| 747 | 749 | |
| 748 | 750 | sect_rect(&outer, cliprect); |
| r6489 | r6490 | |
| 869 | 871 | devcb_resolve_read8(&cdp1869->in_page_ram_func, &cdp1869->intf->in_page_ram_func, device); |
| 870 | 872 | devcb_resolve_write8(&cdp1869->out_page_ram_func, &cdp1869->intf->out_page_ram_func, device); |
| 871 | 873 | devcb_resolve_write_line(&cdp1869->out_prd_func, &cdp1869->intf->out_prd_func, device); |
| 874 | devcb_resolve_read_line(&cdp1869->in_pal_ntsc_func, &cdp1869->intf->in_pal_ntsc_func, device); |
| 872 | 875 | |
| 873 | 876 | /* set initial values */ |
| 874 | 877 | cdp1869->device = device; |
src/emu/sound/cdp1869.h
| r6489 | r6490 | |
| 113 | 113 | #define CDP1869_CHAR_RAM_WRITE(name) void name(const device_config *device, UINT16 pma, UINT8 cma, UINT8 data) |
| 114 | 114 | #define CDP1869_PCB_READ(name) int name(const device_config *device, UINT16 pma, UINT8 cma) |
| 115 | 115 | |
| 116 | #define CDP1869_PAL \ |
| 117 | DEVCB_LINE_VCC |
| 118 | |
| 119 | #define CDP1869_NTSC \ |
| 120 | DEVCB_LINE_GND |
| 121 | |
| 116 | 122 | /*************************************************************************** |
| 117 | 123 | TYPE DEFINITIONS |
| 118 | 124 | ***************************************************************************/ |
| r6489 | r6490 | |
| 121 | 127 | typedef void (*cdp1869_char_ram_write_func)(const device_config *device, UINT16 pma, UINT8 cma, UINT8 data); |
| 122 | 128 | typedef int (*cdp1869_pcb_read_func)(const device_config *device, UINT16 pma, UINT8 cma); |
| 123 | 129 | |
| 124 | | enum _cdp1869_format { |
| 125 | | CDP1869_NTSC = 0, |
| 126 | | CDP1869_PAL |
| 127 | | }; |
| 128 | | typedef enum _cdp1869_format cdp1869_format; |
| 129 | | |
| 130 | 130 | /* interface */ |
| 131 | 131 | typedef struct _cdp1869_interface cdp1869_interface; |
| 132 | 132 | struct _cdp1869_interface |
| r6489 | r6490 | |
| 137 | 137 | /* pixel clock of the chip is the device clock */ |
| 138 | 138 | int color_clock; /* the chroma clock of the chip */ |
| 139 | 139 | |
| 140 | | cdp1869_format pal_ntsc; /* screen format */ |
| 140 | /* screen format */ |
| 141 | devcb_read_line in_pal_ntsc_func; |
| 141 | 142 | |
| 142 | 143 | /* page memory read function */ |
| 143 | 144 | devcb_read8 in_page_ram_func; |