Mercurial > repos > simple16
annotate src/vdp.h @ 31:b87b3ad5068c
Forgot to add the controller source files
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Sun, 03 Apr 2016 18:37:31 -0700 |
parents | 083347ccd508 |
children | 6e7bfe83d2b0 |
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 { |
22
407725d9a02f
Implemented sprite drawing. Added small sprite example.
Michael Pavone <pavone@retrodev.com>
parents:
19
diff
changeset
|
5 uint16_t source; |
407725d9a02f
Implemented sprite drawing. Added small sprite example.
Michael Pavone <pavone@retrodev.com>
parents:
19
diff
changeset
|
6 uint16_t x; |
407725d9a02f
Implemented sprite drawing. Added small sprite example.
Michael Pavone <pavone@retrodev.com>
parents:
19
diff
changeset
|
7 uint8_t hflip; |
407725d9a02f
Implemented sprite drawing. Added small sprite example.
Michael Pavone <pavone@retrodev.com>
parents:
19
diff
changeset
|
8 uint8_t palpriority; |
407725d9a02f
Implemented sprite drawing. Added small sprite example.
Michael Pavone <pavone@retrodev.com>
parents:
19
diff
changeset
|
9 } sprite_draw; |
407725d9a02f
Implemented sprite drawing. Added small sprite example.
Michael Pavone <pavone@retrodev.com>
parents:
19
diff
changeset
|
10 |
407725d9a02f
Implemented sprite drawing. Added small sprite example.
Michael Pavone <pavone@retrodev.com>
parents:
19
diff
changeset
|
11 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
|
12 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
|
13 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
|
14 uint8_t *readbuffer; |
8
5176efdda5ae
Initial work on VDP emulation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
15 uint32_t cycles; |
5176efdda5ae
Initial work on VDP emulation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
16 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
|
17 int pitch; |
8
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 fifo; |
5176efdda5ae
Initial work on VDP emulation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
20 uint16_t dest_offset; |
5176efdda5ae
Initial work on VDP emulation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
21 uint16_t status; |
5176efdda5ae
Initial work on VDP emulation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
22 |
5176efdda5ae
Initial work on VDP emulation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
23 uint16_t vcounter; |
5176efdda5ae
Initial work on VDP emulation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
24 uint16_t hcounter; |
5176efdda5ae
Initial work on VDP emulation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
25 |
5176efdda5ae
Initial work on VDP emulation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
26 uint16_t vscroll; |
5176efdda5ae
Initial work on VDP emulation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
27 uint16_t hscroll; |
5176efdda5ae
Initial work on VDP emulation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
28 |
19
04fc17376999
Sort of working tile rendering and tile test ROM
Michael Pavone <pavone@retrodev.com>
parents:
11
diff
changeset
|
29 uint16_t draw_source; |
04fc17376999
Sort of working tile rendering and tile test ROM
Michael Pavone <pavone@retrodev.com>
parents:
11
diff
changeset
|
30 uint16_t draw_dest; |
04fc17376999
Sort of working tile rendering and tile test ROM
Michael Pavone <pavone@retrodev.com>
parents:
11
diff
changeset
|
31 |
22
407725d9a02f
Implemented sprite drawing. Added small sprite example.
Michael Pavone <pavone@retrodev.com>
parents:
19
diff
changeset
|
32 |
8
5176efdda5ae
Initial work on VDP emulation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
33 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
|
34 uint8_t linebuffers[328*2]; |
8
5176efdda5ae
Initial work on VDP emulation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
35 uint16_t sram[64*2]; |
5176efdda5ae
Initial work on VDP emulation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
36 uint16_t cram[64]; |
5176efdda5ae
Initial work on VDP emulation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
37 |
22
407725d9a02f
Implemented sprite drawing. Added small sprite example.
Michael Pavone <pavone@retrodev.com>
parents:
19
diff
changeset
|
38 sprite_draw sprite_draws[40]; |
407725d9a02f
Implemented sprite drawing. Added small sprite example.
Michael Pavone <pavone@retrodev.com>
parents:
19
diff
changeset
|
39 |
8
5176efdda5ae
Initial work on VDP emulation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
40 uint8_t fifo_dest; |
19
04fc17376999
Sort of working tile rendering and tile test ROM
Michael Pavone <pavone@retrodev.com>
parents:
11
diff
changeset
|
41 uint8_t draw_counter; |
23 | 42 uint8_t hflip; |
19
04fc17376999
Sort of working tile rendering and tile test ROM
Michael Pavone <pavone@retrodev.com>
parents:
11
diff
changeset
|
43 uint8_t palpriority; |
22
407725d9a02f
Implemented sprite drawing. Added small sprite example.
Michael Pavone <pavone@retrodev.com>
parents:
19
diff
changeset
|
44 uint8_t current_draw; |
8
5176efdda5ae
Initial work on VDP emulation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
45 } vdp; |
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 enum { |
5176efdda5ae
Initial work on VDP emulation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
48 FIFO_DEST_INVALID, |
5176efdda5ae
Initial work on VDP emulation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
49 FIFO_DEST_VRAM, |
5176efdda5ae
Initial work on VDP emulation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
50 FIFO_DEST_SRAM, |
5176efdda5ae
Initial work on VDP emulation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
51 FIFO_DEST_CRAM |
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 |
26
083347ccd508
Implemented vblank interrupts and fixed a bug in exception vector address calculation
Michael Pavone <pavone@retrodev.com>
parents:
23
diff
changeset
|
54 #define VDP_STATUS_FIFO 1 |
083347ccd508
Implemented vblank interrupts and fixed a bug in exception vector address calculation
Michael Pavone <pavone@retrodev.com>
parents:
23
diff
changeset
|
55 #define VDP_STATUS_VRAM 2 |
083347ccd508
Implemented vblank interrupts and fixed a bug in exception vector address calculation
Michael Pavone <pavone@retrodev.com>
parents:
23
diff
changeset
|
56 #define VDP_STATUS_SRAM 4 |
083347ccd508
Implemented vblank interrupts and fixed a bug in exception vector address calculation
Michael Pavone <pavone@retrodev.com>
parents:
23
diff
changeset
|
57 #define VDP_STATUS_ENABLED 8 |
083347ccd508
Implemented vblank interrupts and fixed a bug in exception vector address calculation
Michael Pavone <pavone@retrodev.com>
parents:
23
diff
changeset
|
58 #define VDP_STATUS_SPRITE_SCAN 16 |
083347ccd508
Implemented vblank interrupts and fixed a bug in exception vector address calculation
Michael Pavone <pavone@retrodev.com>
parents:
23
diff
changeset
|
59 #define VDP_STATUS_PENDING_VINT 32 |
8
5176efdda5ae
Initial work on VDP emulation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
60 |
5176efdda5ae
Initial work on VDP emulation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
61 void vdp_init(vdp *context, uint32_t clock_div); |
5176efdda5ae
Initial work on VDP emulation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
62 void vdp_run(vdp *context, uint32_t target); |
5176efdda5ae
Initial work on VDP emulation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
63 void vdp_write_address(vdp *context, uint16_t value); |
5176efdda5ae
Initial work on VDP emulation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
64 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
|
65 void vdp_write_hscroll(vdp *context, uint16_t value); |
26
083347ccd508
Implemented vblank interrupts and fixed a bug in exception vector address calculation
Michael Pavone <pavone@retrodev.com>
parents:
23
diff
changeset
|
66 uint32_t vdp_next_interrupt(vdp *context); |
083347ccd508
Implemented vblank interrupts and fixed a bug in exception vector address calculation
Michael Pavone <pavone@retrodev.com>
parents:
23
diff
changeset
|
67 void vdp_ack_interrupt(vdp *context); |
083347ccd508
Implemented vblank interrupts and fixed a bug in exception vector address calculation
Michael Pavone <pavone@retrodev.com>
parents:
23
diff
changeset
|
68 uint8_t vdp_interrupt_pending(vdp *context); |
8
5176efdda5ae
Initial work on VDP emulation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
69 |
5176efdda5ae
Initial work on VDP emulation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
70 #endif //VDP_H_ |