Skip to content

Commit f93d2f8

Browse files
committed
*/vrender0.cpp and related drivers/devices: Cleanup
- Fix naming (Use snake_case as default naming convention for consistency) - Use shortened typename value for consistency - Fix spacings - Use lowercase hexadecimal values - Make some variables constant - Suppress side effects for debugger reads - Fix variable and function order in header files - Reduce defines cpu/se3208/se3208.cpp: - Make interrupt pin define as enum - Use logmacro.h for logging feature cpu/se3208/se3208dis.cpp: - Fix naming for reduce confusion sound/vrender0.cpp: - Update per-channel cache when texture memory pointer is changed - Use refefence instead pointer as possible video/vrender0.cpp: - Use template and function arrays for textured draw function - Use device_memory_interface for external memory space - Split shade and alpha function - Minor fixes in single color fill function - Use refefence instead pointer as possible lib/util/coretmpl.h: - Add allow/disallow side effects in fifo dequeue function misc/crospuzl.cpp: - Fix filename in comment (is_busy() is now moved into machine/nandflash.h) misc/crystal.cpp: - Add notes for flash memory emulations - Remove unused finder - Reduce literal tag usages misc/ddz.cpp: - Reduce literal tag usages misc/menghong.cpp: - Add notes for flash memory emulations misc/psattack.cpp: - Fix logging - Reduce literal tag usages misc/trivrus.cpp: - Add notes for flash memory emulations
1 parent 5be959e commit f93d2f8

File tree

19 files changed

+2476
-2480
lines changed

19 files changed

+2476
-2480
lines changed

src/devices/cpu/se3208/se3208.cpp

Lines changed: 654 additions & 677 deletions
Large diffs are not rendered by default.

src/devices/cpu/se3208/se3208.h

Lines changed: 122 additions & 117 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,17 @@ enum
1111
SE3208_R0, SE3208_R1, SE3208_R2, SE3208_R3, SE3208_R4, SE3208_R5, SE3208_R6, SE3208_R7
1212
};
1313

14-
#define SE3208_INT 0
1514

1615

1716
class se3208_device : public cpu_device
1817
{
1918
public:
19+
enum
20+
{
21+
SE3208_INT = 0
22+
};
2023
// construction/destruction
21-
se3208_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
24+
se3208_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
2225

2326
// callback configuration
2427
auto machinex_cb() { return m_machinex_cb.bind(); }
@@ -30,8 +33,8 @@ class se3208_device : public cpu_device
3033
virtual void device_reset() override ATTR_COLD;
3134

3235
// device_execute_interface implementation
33-
virtual uint32_t execute_min_cycles() const noexcept override { return 1; }
34-
virtual uint32_t execute_max_cycles() const noexcept override { return 1; }
36+
virtual u32 execute_min_cycles() const noexcept override { return 1; }
37+
virtual u32 execute_max_cycles() const noexcept override { return 1; }
3538
virtual bool execute_input_edge_triggered(int inputnum) const noexcept override { return inputnum == INPUT_LINE_NMI; }
3639
virtual void execute_run() override;
3740
virtual void execute_set_input(int inputnum, int state) override;
@@ -52,126 +55,128 @@ class se3208_device : public cpu_device
5255
devcb_read8 m_iackx_cb;
5356

5457
//GPR
55-
uint32_t m_R[8];
58+
u32 m_R[8]{};
5659
//SPR
57-
uint32_t m_PC;
58-
uint32_t m_SR;
59-
uint32_t m_SP;
60-
uint32_t m_ER;
61-
uint32_t m_PPC;
60+
u32 m_PC;
61+
u32 m_SR;
62+
u32 m_SP;
63+
u32 m_ER;
64+
u32 m_PPC;
6265

6366
memory_access<32, 2, 0, ENDIANNESS_LITTLE>::cache m_cache;
6467
memory_access<32, 2, 0, ENDIANNESS_LITTLE>::specific m_program;
65-
uint8_t m_IRQ;
66-
uint8_t m_NMI;
68+
u8 m_IRQ;
69+
u8 m_NMI;
6770

6871
int m_icount;
6972

70-
inline void CLRFLAG(uint32_t f) { m_SR&=~f; }
71-
inline void SETFLAG(uint32_t f) { m_SR|=f; }
72-
inline bool TESTFLAG(uint32_t f) const { return m_SR&f; }
73-
74-
inline uint8_t SE3208_Read8(uint32_t addr);
75-
inline uint16_t SE3208_Read16(uint32_t addr);
76-
inline uint32_t SE3208_Read32(uint32_t addr);
77-
inline void SE3208_Write8(uint32_t addr,uint8_t val);
78-
inline void SE3208_Write16(uint32_t addr,uint16_t val);
79-
inline void SE3208_Write32(uint32_t addr,uint32_t val);
80-
inline uint32_t AddWithFlags(uint32_t a,uint32_t b);
81-
inline uint32_t SubWithFlags(uint32_t a,uint32_t b);
82-
inline uint32_t AdcWithFlags(uint32_t a,uint32_t b);
83-
inline uint32_t SbcWithFlags(uint32_t a,uint32_t b);
84-
inline uint32_t MulWithFlags(uint32_t a,uint32_t b);
85-
inline uint32_t NegWithFlags(uint32_t a);
86-
inline uint32_t AsrWithFlags(uint32_t Val, uint8_t By);
87-
inline uint32_t LsrWithFlags(uint32_t Val, uint8_t By);
88-
inline uint32_t AslWithFlags(uint32_t Val, uint8_t By);
89-
inline void PushVal(uint32_t Val);
90-
inline uint32_t PopVal();
91-
inline void TakeExceptionVector(uint8_t vector);
92-
93-
typedef void (se3208_device::*OP)(uint16_t Opcode);
94-
OP OpTable[0x10000];
95-
96-
void INVALIDOP(uint16_t Opcode);
97-
void LDB(uint16_t Opcode);
98-
void STB(uint16_t Opcode);
99-
void LDS(uint16_t Opcode);
100-
void STS(uint16_t Opcode);
101-
void LD(uint16_t Opcode);
102-
void ST(uint16_t Opcode);
103-
void LDBU(uint16_t Opcode);
104-
void LDSU(uint16_t Opcode);
105-
void LERI(uint16_t Opcode);
106-
void LDSP(uint16_t Opcode);
107-
void STSP(uint16_t Opcode);
108-
void PUSH(uint16_t Opcode);
109-
void POP(uint16_t Opcode);
110-
void LEATOSP(uint16_t Opcode);
111-
void LEAFROMSP(uint16_t Opcode);
112-
void LEASPTOSP(uint16_t Opcode);
113-
void MOV(uint16_t Opcode);
114-
void LDI(uint16_t Opcode);
115-
void LDBSP(uint16_t Opcode);
116-
void STBSP(uint16_t Opcode);
117-
void LDSSP(uint16_t Opcode);
118-
void STSSP(uint16_t Opcode);
119-
void LDBUSP(uint16_t Opcode);
120-
void LDSUSP(uint16_t Opcode);
121-
void ADDI(uint16_t Opcode);
122-
void SUBI(uint16_t Opcode);
123-
void ADCI(uint16_t Opcode);
124-
void SBCI(uint16_t Opcode);
125-
void ANDI(uint16_t Opcode);
126-
void ORI(uint16_t Opcode);
127-
void XORI(uint16_t Opcode);
128-
void CMPI(uint16_t Opcode);
129-
void TSTI(uint16_t Opcode);
130-
void ADD(uint16_t Opcode);
131-
void SUB(uint16_t Opcode);
132-
void ADC(uint16_t Opcode);
133-
void SBC(uint16_t Opcode);
134-
void AND(uint16_t Opcode);
135-
void OR(uint16_t Opcode);
136-
void XOR(uint16_t Opcode);
137-
void CMP(uint16_t Opcode);
138-
void TST(uint16_t Opcode);
139-
void MULS(uint16_t Opcode);
140-
void NEG(uint16_t Opcode);
141-
void CALL(uint16_t Opcode);
142-
void JV(uint16_t Opcode);
143-
void JNV(uint16_t Opcode);
144-
void JC(uint16_t Opcode);
145-
void JNC(uint16_t Opcode);
146-
void JP(uint16_t Opcode);
147-
void JM(uint16_t Opcode);
148-
void JNZ(uint16_t Opcode);
149-
void JZ(uint16_t Opcode);
150-
void JGE(uint16_t Opcode);
151-
void JLE(uint16_t Opcode);
152-
void JHI(uint16_t Opcode);
153-
void JLS(uint16_t Opcode);
154-
void JGT(uint16_t Opcode);
155-
void JLT(uint16_t Opcode);
156-
void JMP(uint16_t Opcode);
157-
void JR(uint16_t Opcode);
158-
void CALLR(uint16_t Opcode);
159-
void ASR(uint16_t Opcode);
160-
void LSR(uint16_t Opcode);
161-
void ASL(uint16_t Opcode);
162-
void EXTB(uint16_t Opcode);
163-
void EXTS(uint16_t Opcode);
164-
void SET(uint16_t Opcode);
165-
void CLR(uint16_t Opcode);
166-
void SWI(uint16_t Opcode);
167-
void HALT(uint16_t Opcode);
168-
void MVTC(uint16_t Opcode);
169-
void MVFC(uint16_t Opcode);
170-
171-
void BuildTable(void);
172-
OP DecodeOp(uint16_t Opcode);
173-
void SE3208_NMI();
174-
void SE3208_Interrupt();
73+
typedef void (se3208_device::*OP)(u16 opcode);
74+
OP m_optable[0x10000];
75+
76+
inline void CLRFLAG(u32 f) { m_SR &= ~f; }
77+
inline void SETFLAG(u32 f) { m_SR |= f; }
78+
inline bool TESTFLAG(u32 f) const { return m_SR & f; }
79+
80+
inline u8 read8(u32 addr);
81+
inline u16 read16(u32 addr);
82+
inline u32 read32(u32 addr);
83+
inline void write8(u32 addr, u8 val);
84+
inline void write16(u32 addr, u16 val);
85+
inline void write32(u32 addr, u32 val);
86+
inline u32 add_with_lfags(u32 a, u32 b);
87+
inline u32 sub_with_lfags(u32 a, u32 b);
88+
inline u32 adc_with_lfags(u32 a, u32 b);
89+
inline u32 sbc_with_lfags(u32 a, u32 b);
90+
inline u32 mul_with_lfags(u32 a, u32 b);
91+
inline u32 neg_with_lfags(u32 a);
92+
inline u32 asr_with_lfags(u32 Val, u8 By);
93+
inline u32 lsr_with_lfags(u32 Val, u8 By);
94+
inline u32 asl_with_lfags(u32 Val, u8 By);
95+
inline u32 get_index(u32 index);
96+
inline u32 get_extended_operand(u32 imm, u8 shift);
97+
inline void push_val(u32 Val);
98+
inline u32 pop_val();
99+
inline void take_exception_vector(u8 vector);
100+
101+
void INVALIDOP(u16 opcode);
102+
void LDB(u16 opcode);
103+
void STB(u16 opcode);
104+
void LDS(u16 opcode);
105+
void STS(u16 opcode);
106+
void LD(u16 opcode);
107+
void ST(u16 opcode);
108+
void LDBU(u16 opcode);
109+
void LDSU(u16 opcode);
110+
void LERI(u16 opcode);
111+
void LDSP(u16 opcode);
112+
void STSP(u16 opcode);
113+
void PUSH(u16 opcode);
114+
void POP(u16 opcode);
115+
void LEATOSP(u16 opcode);
116+
void LEAFROMSP(u16 opcode);
117+
void LEASPTOSP(u16 opcode);
118+
void MOV(u16 opcode);
119+
void LDI(u16 opcode);
120+
void LDBSP(u16 opcode);
121+
void STBSP(u16 opcode);
122+
void LDSSP(u16 opcode);
123+
void STSSP(u16 opcode);
124+
void LDBUSP(u16 opcode);
125+
void LDSUSP(u16 opcode);
126+
void ADDI(u16 opcode);
127+
void SUBI(u16 opcode);
128+
void ADCI(u16 opcode);
129+
void SBCI(u16 opcode);
130+
void ANDI(u16 opcode);
131+
void ORI(u16 opcode);
132+
void XORI(u16 opcode);
133+
void CMPI(u16 opcode);
134+
void TSTI(u16 opcode);
135+
void ADD(u16 opcode);
136+
void SUB(u16 opcode);
137+
void ADC(u16 opcode);
138+
void SBC(u16 opcode);
139+
void AND(u16 opcode);
140+
void OR(u16 opcode);
141+
void XOR(u16 opcode);
142+
void CMP(u16 opcode);
143+
void TST(u16 opcode);
144+
void MULS(u16 opcode);
145+
void NEG(u16 opcode);
146+
void CALL(u16 opcode);
147+
void JV(u16 opcode);
148+
void JNV(u16 opcode);
149+
void JC(u16 opcode);
150+
void JNC(u16 opcode);
151+
void JP(u16 opcode);
152+
void JM(u16 opcode);
153+
void JNZ(u16 opcode);
154+
void JZ(u16 opcode);
155+
void JGE(u16 opcode);
156+
void JLE(u16 opcode);
157+
void JHI(u16 opcode);
158+
void JLS(u16 opcode);
159+
void JGT(u16 opcode);
160+
void JLT(u16 opcode);
161+
void JMP(u16 opcode);
162+
void JR(u16 opcode);
163+
void CALLR(u16 opcode);
164+
void ASR(u16 opcode);
165+
void LSR(u16 opcode);
166+
void ASL(u16 opcode);
167+
void EXTB(u16 opcode);
168+
void EXTS(u16 opcode);
169+
void SET(u16 opcode);
170+
void CLR(u16 opcode);
171+
void SWI(u16 opcode);
172+
void HALT(u16 opcode);
173+
void MVTC(u16 opcode);
174+
void MVFC(u16 opcode);
175+
176+
void build_table();
177+
OP decode_op(u16 opcode);
178+
void nmi_execute();
179+
void interrupt_execute();
175180

176181
};
177182

0 commit comments

Comments
 (0)