annotate src/vdp.h @ 19:04fc17376999

Sort of working tile rendering and tile test ROM
author Michael Pavone <pavone@retrodev.com>
date Mon, 28 Mar 2016 23:43:31 -0700
parents 04d8efe7a1f0
children 407725d9a02f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
8
5176efdda5ae Initial work on VDP emulation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1 #ifndef VDP_H_
5176efdda5ae Initial work on VDP emulation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2 #define VDP_H_
5176efdda5ae Initial work on VDP emulation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
3
5176efdda5ae Initial work on VDP emulation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
4 typedef struct {
11
04d8efe7a1f0 Initial stab at video output and background color rendering. Fixed address decoding in address port write handler.
Michael Pavone <pavone@retrodev.com>
parents: 8
diff changeset
5 uint16_t *framebuffer;
04d8efe7a1f0 Initial stab at video output and background color rendering. Fixed address decoding in address port write handler.
Michael Pavone <pavone@retrodev.com>
parents: 8
diff changeset
6 uint8_t *drawbuffer;
04d8efe7a1f0 Initial stab at video output and background color rendering. Fixed address decoding in address port write handler.
Michael Pavone <pavone@retrodev.com>
parents: 8
diff changeset
7 uint8_t *readbuffer;
8
5176efdda5ae Initial work on VDP emulation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
8 uint32_t cycles;
5176efdda5ae Initial work on VDP emulation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
9 uint32_t clock_inc;
11
04d8efe7a1f0 Initial stab at video output and background color rendering. Fixed address decoding in address port write handler.
Michael Pavone <pavone@retrodev.com>
parents: 8
diff changeset
10 int pitch;
8
5176efdda5ae Initial work on VDP emulation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
11
5176efdda5ae Initial work on VDP emulation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
12 uint16_t fifo;
5176efdda5ae Initial work on VDP emulation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
13 uint16_t dest_offset;
5176efdda5ae Initial work on VDP emulation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
14 uint16_t status;
5176efdda5ae Initial work on VDP emulation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
15
5176efdda5ae Initial work on VDP emulation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
16 uint16_t vcounter;
5176efdda5ae Initial work on VDP emulation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
17 uint16_t hcounter;
5176efdda5ae Initial work on VDP emulation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
18
5176efdda5ae Initial work on VDP emulation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
19 uint16_t vscroll;
5176efdda5ae Initial work on VDP emulation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
20 uint16_t hscroll;
5176efdda5ae Initial work on VDP emulation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
21
19
04fc17376999 Sort of working tile rendering and tile test ROM
Michael Pavone <pavone@retrodev.com>
parents: 11
diff changeset
22 uint16_t draw_source;
04fc17376999 Sort of working tile rendering and tile test ROM
Michael Pavone <pavone@retrodev.com>
parents: 11
diff changeset
23 uint16_t draw_dest;
04fc17376999 Sort of working tile rendering and tile test ROM
Michael Pavone <pavone@retrodev.com>
parents: 11
diff changeset
24
8
5176efdda5ae Initial work on VDP emulation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
25 uint16_t vram[32*512];
19
04fc17376999 Sort of working tile rendering and tile test ROM
Michael Pavone <pavone@retrodev.com>
parents: 11
diff changeset
26 uint8_t linebuffers[328*2];
8
5176efdda5ae Initial work on VDP emulation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
27 uint16_t sram[64*2];
5176efdda5ae Initial work on VDP emulation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
28 uint16_t cram[64];
5176efdda5ae Initial work on VDP emulation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
29
5176efdda5ae Initial work on VDP emulation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
30 uint8_t fifo_dest;
19
04fc17376999 Sort of working tile rendering and tile test ROM
Michael Pavone <pavone@retrodev.com>
parents: 11
diff changeset
31 uint8_t draw_counter;
04fc17376999 Sort of working tile rendering and tile test ROM
Michael Pavone <pavone@retrodev.com>
parents: 11
diff changeset
32 uint8_t palpriority;
8
5176efdda5ae Initial work on VDP emulation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
33 } vdp;
5176efdda5ae Initial work on VDP emulation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
34
5176efdda5ae Initial work on VDP emulation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
35 enum {
5176efdda5ae Initial work on VDP emulation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
36 FIFO_DEST_INVALID,
5176efdda5ae Initial work on VDP emulation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
37 FIFO_DEST_VRAM,
5176efdda5ae Initial work on VDP emulation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
38 FIFO_DEST_SRAM,
5176efdda5ae Initial work on VDP emulation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
39 FIFO_DEST_CRAM
5176efdda5ae Initial work on VDP emulation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
40 };
5176efdda5ae Initial work on VDP emulation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
41
11
04d8efe7a1f0 Initial stab at video output and background color rendering. Fixed address decoding in address port write handler.
Michael Pavone <pavone@retrodev.com>
parents: 8
diff changeset
42 #define VDP_STATUS_FIFO 1
04d8efe7a1f0 Initial stab at video output and background color rendering. Fixed address decoding in address port write handler.
Michael Pavone <pavone@retrodev.com>
parents: 8
diff changeset
43 #define VDP_STATUS_VRAM 2
04d8efe7a1f0 Initial stab at video output and background color rendering. Fixed address decoding in address port write handler.
Michael Pavone <pavone@retrodev.com>
parents: 8
diff changeset
44 #define VDP_STATUS_SRAM 4
04d8efe7a1f0 Initial stab at video output and background color rendering. Fixed address decoding in address port write handler.
Michael Pavone <pavone@retrodev.com>
parents: 8
diff changeset
45 #define VDP_STATUS_ENABLED 8
8
5176efdda5ae Initial work on VDP emulation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
46
5176efdda5ae Initial work on VDP emulation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
47 void vdp_init(vdp *context, uint32_t clock_div);
5176efdda5ae Initial work on VDP emulation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
48 void vdp_run(vdp *context, uint32_t target);
5176efdda5ae Initial work on VDP emulation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
49 void vdp_write_address(vdp *context, uint16_t value);
5176efdda5ae Initial work on VDP emulation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
50 void vdp_write_data(vdp *context, uint16_t value);
19
04fc17376999 Sort of working tile rendering and tile test ROM
Michael Pavone <pavone@retrodev.com>
parents: 11
diff changeset
51 void vdp_write_hscroll(vdp *context, uint16_t value);
8
5176efdda5ae Initial work on VDP emulation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
52
5176efdda5ae Initial work on VDP emulation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
53 #endif //VDP_H_