-
Notifications
You must be signed in to change notification settings - Fork 1
/
spectrum.h
102 lines (88 loc) · 2.9 KB
/
spectrum.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
#ifndef SPECTRUM_H
#define SPECTRUM_H
#ifdef __cplusplus
extern "C" {
#endif
#include "z80.h"
enum models_enum { SPECMDL_16K=1, SPECMDL_48K, SPECMDL_INVES, SPECMDL_128K, SPECMDL_PLUS2,
SPECMDL_PLUS3, SPECMDL_48KIF1, SPECMDL_48KTRANSTAPE };
enum inttypes_enum { NORMAL=1, INVES };
#define RO_PAGE 1
#define RW_PAGE 0
#define SYSTEM_PAGE 0
#define NOSYS_PAGE 1
typedef struct {
int ts_lebo; // left border t states
int ts_grap; // graphic zone t states
int ts_ribo; // right border t states
int ts_hore; // horizontal retrace t states
int ts_line; // to speed the calc, the sum of 4 abobe
int line_poin; // lines in retraze post interrup
int line_upbo; // lines of upper border
int line_grap; // lines of graphic zone = 192
int line_bobo; // lines of bottom border
int line_retr; // lines of the retrace
int TSTATES_PER_LINE;
int TOP_BORDER_LINES;
int SCANLINES;
int BOTTOM_BORDER_LINES;
int tstate_border_left;
int tstate_graphic_zone;
int tstate_border_right;
int hw_model;
int int_type;
int videopage;
int BANKM;
int BANK678;
int emulate_FF;
uint8_t BorderColor;
uint8_t portFF;
uint8_t SoundBits;
} tipo_hwopt ;
typedef struct { //estructura de memoria
uint8_t *p; // pointer to memory poll
int mp; // bitmap for page bits in z80 mem
int md; // bitmap for dir bits in z80 mem
int np; // number of pages of memory
int ro[16]; // map of pages for read (map ar alwais a offset for *p)
int wo[16]; // map of pages for write
int sro[16]; // map of system memory pages for read (to remember when perife-
int swo[16]; // map of system memory pages for write -rical is paged)
int vn; // number of video pages
int vo[2]; // map of video memory
int roo; // offset to dummy page for readonly emulation
// Precalculated data
int mr; // times left rotations for page ( number of zero of mp)
int sp; // size of pages (hFFFF / mp)
} tipo_mem;
// de Aspectrum
//extern uint8_t z80_mem[];
uint8_t z80_peek(uint16_t dir);
void z80_poke(uint16_t dir, uint8_t dato);
uint8_t readvmem(uint16_t offset, int page);
void pagein(int size, int bloq, int page, int ro, int issystem);
void pageout(int size, int bloq, int page);
uint8_t z80_in(uint16_t dir);
void z80_out(uint16_t dir,uint8_t dato);
int init_spectrum(int model,char *romfile);
int end_spectrum(void);
int reset_spectrum(Z80Regs *);
int init_48k(char *romfile);
int init_16k(char *romfile);
int init_inves(char *romfile);
int init_plus2(void);
int init_128k(void);
int reset_128k(void);
void outbankm_128k(uint8_t dato);
int init_plus3(void);
int reset_plus3(void);
void outbankm_p31(uint8_t dato);
void outbankm_p37(uint8_t dato);
// esto esta en main.ino
int load_48krom(char *);
int load_128krom(char *);
int load_p3rom(char *);
#ifdef __cplusplus
}
#endif
#endif // #ifdef SPECTRUM_H