File tree Expand file tree Collapse file tree 2 files changed +51
-51
lines changed
Expand file tree Collapse file tree 2 files changed +51
-51
lines changed Original file line number Diff line number Diff line change @@ -49,57 +49,6 @@ void MB128::Reset()
4949 m_retval = 0 ;
5050}
5151
52- void MB128::Connect (bool connected)
53- {
54- m_connected = connected;
55- if (!m_connected)
56- Reset ();
57- }
58-
59- void MB128::Write (u8 value)
60- {
61- if (!m_connected)
62- {
63- m_prev_data = value;
64- return ;
65- }
66-
67- bool old_clr = IS_SET_BIT (m_prev_data, 1 );
68- bool new_sel = IS_SET_BIT (value, 0 );
69- bool new_clr = IS_SET_BIT (value, 1 );
70-
71- // Rising edge of CLR
72- if (!old_clr && new_clr)
73- {
74- if (m_active)
75- SendBit (new_sel);
76- else
77- {
78- // Detect the 0xA8 pattern.
79- m_shiftreg = (m_shiftreg >> 1 ) | (new_sel ? 0x80 : 0x00 );
80-
81- if (m_shiftreg == 0xA8 )
82- {
83- m_state = MODE_A1;
84- m_active = true ;
85- }
86- }
87- }
88-
89- m_prev_data = value;
90- }
91-
92- u8 MB128::Read ()
93- {
94- if (!m_connected)
95- return 0 ;
96-
97- if (!m_active)
98- return 0 ;
99-
100- return m_retval & 0x0F ;
101- }
102-
10352void MB128::SendBit (bool sel_bit)
10453{
10554 u8 temp_byte;
Original file line number Diff line number Diff line change @@ -42,4 +42,55 @@ INLINE const u8* MB128::GetRAM() const
4242 return m_ram ;
4343}
4444
45+ INLINE void MB128 ::Connect (bool connected )
46+ {
47+ m_connected = connected ;
48+ if (!m_connected )
49+ Reset ();
50+ }
51+
52+ INLINE void MB128 ::Write (u8 value )
53+ {
54+ if (!m_connected )
55+ {
56+ m_prev_data = value ;
57+ return ;
58+ }
59+
60+ bool old_clr = IS_SET_BIT (m_prev_data , 1 );
61+ bool new_sel = IS_SET_BIT (value , 0 );
62+ bool new_clr = IS_SET_BIT (value , 1 );
63+
64+ // Rising edge of CLR
65+ if (!old_clr && new_clr )
66+ {
67+ if (m_active )
68+ SendBit (new_sel );
69+ else
70+ {
71+ // Detect the 0xA8 pattern.
72+ m_shiftreg = (m_shiftreg >> 1 ) | (new_sel ? 0x80 : 0x00 );
73+
74+ if (m_shiftreg == 0xA8 )
75+ {
76+ m_state = MODE_A1 ;
77+ m_active = true;
78+ }
79+ }
80+ }
81+
82+ m_prev_data = value ;
83+ }
84+
85+ INLINE u8 MB128 ::Read ()
86+ {
87+ if (!m_connected )
88+ return 0 ;
89+
90+ if (!m_active )
91+ return 0 ;
92+
93+ return m_retval & 0x0F ;
94+ }
95+
4596#endif /* MB12_INLINE_H */
You can’t perform that action at this time.
0 commit comments