@@ -83,14 +83,48 @@ RTC.prototype.get_state = function()
8383{
8484 var state = [ ] ;
8585
86- state [ 0 ] = this . rtc ;
86+ state [ 0 ] = Number ( this . cpu . get_cmos_index ( this . rtc ) ) ;
87+ var cmos_data = [ ] ;
88+ for ( var i = 0 ; i < 128 ; i ++ ) {
89+ cmos_data [ i ] = this . cpu . get_cmos_data_byte ( this . rtc , i ) ;
90+ }
91+ state [ 1 ] = cmos_data ;
92+ state [ 2 ] = this . cpu . get_rtc_time ( this . rtc ) ;
93+ state [ 3 ] = this . cpu . get_last_update ( this . rtc ) ;
94+ state [ 4 ] = this . cpu . get_next_interrupt ( this . rtc ) ;
95+ state [ 5 ] = this . cpu . get_next_interrupt_alarm ( this . rtc ) ;
96+ state [ 6 ] = this . cpu . get_periodic_interrupt ( this . rtc ) ;
97+ state [ 7 ] = this . cpu . get_periodic_interrupt_time ( this . rtc ) ;
98+ state [ 8 ] = this . cpu . get_cmos_a ( this . rtc ) ;
99+ state [ 9 ] = this . cpu . get_cmos_b ( this . rtc ) ;
100+ state [ 10 ] = this . cpu . get_cmos_c ( this . rtc ) ;
101+ state [ 11 ] = this . cpu . get_nmi_disabled ( this . rtc ) ;
102+ state [ 12 ] = this . cpu . get_update_interrupt ( this . rtc ) ;
103+ state [ 13 ] = this . cpu . get_update_interrupt_time ( this . rtc ) ;
104+ state [ 14 ] = this . cpu . get_cmos_diag_status ( this . rtc ) ;
87105
88106 return state ;
89107} ;
90108
91109RTC . prototype . set_state = function ( state )
92110{
93- this . rtc = state [ 0 ] ;
111+ this . cpu . set_cmos_index ( this . rtc , state [ 0 ] ) ;
112+ for ( var i = 0 ; i < 128 ; i ++ ) {
113+ this . cpu . set_cmos_data_byte ( this . rtc , i , state [ 1 ] [ i ] ) ;
114+ }
115+ this . cpu . set_rtc_time ( this . rtc , state [ 2 ] ) ;
116+ this . cpu . set_last_update ( this . rtc , state [ 3 ] ) ;
117+ this . cpu . set_next_interrupt ( this . rtc , state [ 4 ] ) ;
118+ this . cpu . set_next_interrupt_alarm ( this . rtc , state [ 5 ] ) ;
119+ this . cpu . set_periodic_interrupt ( this . rtc , state [ 6 ] ) ;
120+ this . cpu . set_periodic_interrupt_time ( this . rtc , state [ 7 ] ) ;
121+ this . cpu . set_cmos_a ( this . rtc , state [ 8 ] ) ;
122+ this . cpu . set_cmos_b ( this . rtc , state [ 9 ] ) ;
123+ this . cpu . set_cmos_c ( this . rtc , state [ 10 ] ) ;
124+ this . cpu . set_nmi_disabled ( this . rtc , state [ 11 ] ) ;
125+ this . cpu . set_update_interrupt ( this . rtc , state [ 12 ] || false ) ;
126+ this . cpu . set_update_interrupt_time ( this . rtc , state [ 13 ] || 0 ) ;
127+ this . cpu . set_cmos_diag_status ( this . rtc , state [ 14 ] || 0 ) ;
94128} ;
95129
96130RTC . prototype . timer = function ( time , legacy_mode ) {
0 commit comments