@@ -155,14 +155,14 @@ union ADDR_REG
155
155
};
156
156
157
157
/* Blitter register flag bits */
158
- # define CMD_RUN 0x01
159
- # define CMD_COLST 0x02
160
- # define CMD_PARRD 0x04 /* Never used? */
161
- # define CMD_SRCUP 0x08
162
- # define CMD_DSTUP 0x10
163
- # define CMD_LT0 0x20
164
- # define CMD_LT1 0x40
165
- # define CMD_LINEDRAW 0x80
158
+ static constexpr uint8_t CMD_RUN = 0x01 ;
159
+ static constexpr uint8_t CMD_COLST = 0x02 ;
160
+ static constexpr uint8_t CMD_PARRD = 0x04 ; /* Never used? */
161
+ static constexpr uint8_t CMD_SRCUP = 0x08 ;
162
+ static constexpr uint8_t CMD_DSTUP = 0x10 ;
163
+ static constexpr uint8_t CMD_LT0 = 0x20 ;
164
+ static constexpr uint8_t CMD_LT1 = 0x40 ;
165
+ static constexpr uint8_t CMD_LINEDRAW = 0x80 ;
166
166
167
167
168
168
/* All unconfirmed */
@@ -172,20 +172,20 @@ union ADDR_REG
172
172
#define SRCDST_A_1 0x80 /* This might be correct for line drawing? */
173
173
174
174
/* These appear to be correct */
175
- # define MODE_SSIGN 0x80
176
- # define MODE_DSIGN 0x40
177
- # define MODE_YFRAC 0x20
178
- # define MODE_BITTOBYTE 0x04
179
- # define MODE_PALREMAP 0x10
180
-
181
- # define CMPFUNC_LT 0x01
182
- # define CMPFUNC_EQ 0x02
183
- # define CMPFUNC_GT 0x04
184
- # define CMPFUNC_BEQ 0x08
185
- # define CMPFUNC_LOG0 0x10
186
- # define CMPFUNC_LOG1 0x20
187
- # define CMPFUNC_LOG2 0x40
188
- # define CMPFUNC_LOG3 0x80
175
+ static constexpr uint8_t MODE_SSIGN = 0x80 ;
176
+ static constexpr uint8_t MODE_DSIGN = 0x40 ;
177
+ static constexpr uint8_t MODE_YFRAC = 0x20 ;
178
+ static constexpr uint8_t MODE_BITTOBYTE = 0x04 ;
179
+ static constexpr uint8_t MODE_PALREMAP = 0x10 ;
180
+
181
+ static constexpr uint8_t CMPFUNC_LT = 0x01 ;
182
+ static constexpr uint8_t CMPFUNC_EQ = 0x02 ;
183
+ static constexpr uint8_t CMPFUNC_GT = 0x04 ;
184
+ static constexpr uint8_t CMPFUNC_BEQ = 0x08 ;
185
+ static constexpr uint8_t CMPFUNC_LOG0 = 0x10 ;
186
+ static constexpr uint8_t CMPFUNC_LOG1 = 0x20 ;
187
+ static constexpr uint8_t CMPFUNC_LOG2 = 0x40 ;
188
+ static constexpr uint8_t CMPFUNC_LOG3 = 0x80 ;
189
189
190
190
/*
191
191
Blitter state
@@ -194,26 +194,26 @@ struct bf_blitter_t
194
194
{
195
195
ADDR_REG program;
196
196
197
- uint8_t control = 0 ;
198
- uint8_t status = 0 ;
197
+ uint8_t control = 0 ;
198
+ uint8_t status = 0 ;
199
199
200
- uint8_t command = 0 ;
200
+ uint8_t command = 0 ;
201
201
ADDR_REG source;
202
202
ADDR_REG dest;
203
- uint8_t modectl = 0 ;
204
- uint8_t compfunc = 0 ;
205
- uint8_t outercnt = 0 ;
203
+ uint8_t modectl = 0 ;
204
+ uint8_t compfunc = 0 ;
205
+ uint8_t outercnt = 0 ;
206
206
207
- uint8_t innercnt = 0 ;
208
- uint8_t step = 0 ;
209
- uint8_t pattern = 0 ;
207
+ uint8_t innercnt = 0 ;
208
+ uint8_t step = 0 ;
209
+ uint8_t pattern = 0 ;
210
210
};
211
211
212
212
#define LOOPTYPE ( ( blitter.command&0x60 ) >> 5 )
213
213
214
214
struct fdc_t
215
215
{
216
- uint8_t MSR = 0 ;
216
+ uint8_t MSR = 0 ;
217
217
218
218
int side = 0 ;
219
219
int track = 0 ;
@@ -231,8 +231,8 @@ struct fdc_t
231
231
int cmd_cnt = 0 ;
232
232
int res_len = 0 ;
233
233
int res_cnt = 0 ;
234
- uint8_t cmd[10 ]{};
235
- uint8_t results[8 ]{};
234
+ uint8_t cmd[10 ]{};
235
+ uint8_t results[8 ]{};
236
236
};
237
237
238
238
@@ -304,7 +304,7 @@ class bfcobra_state : public driver_device
304
304
void reset_fdc ();
305
305
void exec_w_phase (uint8_t data);
306
306
void init_ram ();
307
- void command_phase (struct fdc_t &fdc, uint8_t data);
307
+ void command_phase (fdc_t &fdc, uint8_t data);
308
308
inline uint8_t * blitter_get_addr (uint32_t addr);
309
309
inline void z80_bank (int num, int data);
310
310
@@ -339,7 +339,7 @@ class bfcobra_state : public driver_device
339
339
uint8_t m_col7bit[256 ]{};
340
340
uint8_t m_col6bit[256 ]{};
341
341
struct bf_blitter_t m_blitter;
342
- struct fdc_t m_fdc;
342
+ fdc_t m_fdc;
343
343
required_device<cpu_device> m_maincpu;
344
344
required_device<cpu_device> m_audiocpu;
345
345
required_device<acia6850_device> m_acia6850_0;
@@ -1058,7 +1058,7 @@ enum command
1058
1058
1059
1059
void bfcobra_state::reset_fdc ()
1060
1060
{
1061
- memset (& m_fdc, 0 , sizeof (m_fdc) );
1061
+ m_fdc = fdc_t ( );
1062
1062
1063
1063
m_fdc.MSR = 0x80 ;
1064
1064
m_fdc.phase = COMMAND;
@@ -1075,71 +1075,70 @@ uint8_t bfcobra_state::fdctrl_r()
1075
1075
1076
1076
uint8_t bfcobra_state::fddata_r ()
1077
1077
{
1078
- struct fdc_t &fdc = m_fdc;
1079
- #define BPS 1024
1080
- #define SPT 10
1081
- #define BPT 1024 *10
1078
+ constexpr int BPS = 1024 ;
1079
+ constexpr int SPT = 10 ;
1080
+ constexpr int BPT = BPS * SPT;
1082
1081
1083
1082
uint8_t val = 0 ;
1084
1083
1085
- if (fdc .phase == EXECUTION_R)
1084
+ if (m_fdc .phase == EXECUTION_R)
1086
1085
{
1087
- switch (fdc .cmd [0 ] & 0x1f )
1086
+ switch (m_fdc .cmd [0 ] & 0x1f )
1088
1087
{
1089
1088
/* Specify */
1090
1089
case READ_DATA:
1091
1090
{
1092
- if (fdc .setup_read )
1091
+ if (m_fdc .setup_read )
1093
1092
{
1094
- fdc .track = fdc .cmd [2 ];
1095
- fdc .side = fdc .cmd [3 ];
1096
- fdc .sector = fdc .cmd [4 ];
1097
- fdc .number = fdc .cmd [5 ];
1098
- fdc .stop_track = fdc .cmd [6 ];
1099
- // int GPL = fdc .cmd[7];
1100
- // int DTL = fdc .cmd[8];
1101
-
1102
- fdc .setup_read = 0 ;
1103
- fdc .byte_pos = 0 ;
1093
+ m_fdc .track = m_fdc .cmd [2 ];
1094
+ m_fdc .side = m_fdc .cmd [3 ];
1095
+ m_fdc .sector = m_fdc .cmd [4 ];
1096
+ m_fdc .number = m_fdc .cmd [5 ];
1097
+ m_fdc .stop_track = m_fdc .cmd [6 ];
1098
+ // int GPL = m_fdc .cmd[7];
1099
+ // int DTL = m_fdc .cmd[8];
1100
+
1101
+ m_fdc .setup_read = 0 ;
1102
+ m_fdc .byte_pos = 0 ;
1104
1103
}
1105
1104
1106
- fdc .offset = (BPT * fdc .track *2 ) + (fdc .side ? BPT : 0 ) + (BPS * (fdc .sector -1 )) + fdc .byte_pos ++;
1107
- val = *(memregion (" user2" )->base () + fdc .offset );
1105
+ m_fdc .offset = (BPT * m_fdc .track *2 ) + (m_fdc .side ? BPT : 0 ) + (BPS * (m_fdc .sector -1 )) + m_fdc .byte_pos ++;
1106
+ val = *(memregion (" user2" )->base () + m_fdc .offset );
1108
1107
1109
1108
/* Move on to next sector? */
1110
- if (fdc .byte_pos == 1024 )
1109
+ if (m_fdc .byte_pos == 1024 )
1111
1110
{
1112
- fdc .byte_pos = 0 ;
1111
+ m_fdc .byte_pos = 0 ;
1113
1112
1114
- if (fdc .sector == fdc .stop_track || ++fdc .sector == 11 )
1113
+ if (m_fdc .sector == m_fdc .stop_track || ++m_fdc .sector == 11 )
1115
1114
{
1116
1115
/* End of read operation */
1117
- fdc .MSR = 0xd0 ;
1118
- fdc .phase = RESULTS;
1116
+ m_fdc .MSR = 0xd0 ;
1117
+ m_fdc .phase = RESULTS;
1119
1118
1120
- fdc .results [0 ] = 0 ;
1121
- fdc .results [1 ] = 0 ;
1122
- fdc .results [2 ] = 0 ;
1119
+ m_fdc .results [0 ] = 0 ;
1120
+ m_fdc .results [1 ] = 0 ;
1121
+ m_fdc .results [2 ] = 0 ;
1123
1122
1124
- fdc .results [3 ] = 0 ;
1125
- fdc .results [4 ] = 0 ;
1126
- fdc .results [5 ] = 0 ;
1127
- fdc .results [6 ] = 0 ;
1123
+ m_fdc .results [3 ] = 0 ;
1124
+ m_fdc .results [4 ] = 0 ;
1125
+ m_fdc .results [5 ] = 0 ;
1126
+ m_fdc .results [6 ] = 0 ;
1128
1127
}
1129
1128
}
1130
1129
break ;
1131
1130
}
1132
1131
}
1133
1132
}
1134
- else if (fdc .phase == RESULTS)
1133
+ else if (m_fdc .phase == RESULTS)
1135
1134
{
1136
- val = fdc .results [fdc .res_cnt ++];
1135
+ val = m_fdc .results [m_fdc .res_cnt ++];
1137
1136
1138
- if (fdc .res_cnt == fdc .res_len )
1137
+ if (m_fdc .res_cnt == m_fdc .res_len )
1139
1138
{
1140
- fdc .phase = COMMAND;
1141
- fdc .res_cnt = 0 ;
1142
- fdc .MSR &= ~0x40 ;
1139
+ m_fdc .phase = COMMAND;
1140
+ m_fdc .res_cnt = 0 ;
1141
+ m_fdc .MSR &= ~0x40 ;
1143
1142
}
1144
1143
}
1145
1144
@@ -1148,12 +1147,11 @@ uint8_t bfcobra_state::fddata_r()
1148
1147
1149
1148
void bfcobra_state::fdctrl_w (uint8_t data)
1150
1149
{
1151
- struct fdc_t &fdc = m_fdc;
1152
- switch (fdc.phase )
1150
+ switch (m_fdc.phase )
1153
1151
{
1154
1152
case COMMAND:
1155
1153
{
1156
- command_phase (fdc , data);
1154
+ command_phase (m_fdc , data);
1157
1155
break ;
1158
1156
}
1159
1157
case EXECUTION_W:
@@ -1168,7 +1166,7 @@ void bfcobra_state::fdctrl_w(uint8_t data)
1168
1166
}
1169
1167
}
1170
1168
1171
- void bfcobra_state::command_phase (struct fdc_t &fdc, uint8_t data)
1169
+ void bfcobra_state::command_phase (fdc_t &fdc, uint8_t data)
1172
1170
{
1173
1171
if (fdc.cmd_cnt == 0 )
1174
1172
{
0 commit comments