/[VRac]/M6502/perl.c
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /M6502/perl.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 37 by dpavlin, Mon Jul 30 22:06:13 2007 UTC revision 38 by dpavlin, Mon Jul 30 23:28:25 2007 UTC
# Line 21  static M6502 *R; Line 21  static M6502 *R;
21  #define dump_R  #define dump_R
22  #endif  #endif
23    
24  void update_R(M6502 *R) {  void pull_R(M6502 *R) {
25          R->A = SvIV( get_sv("M6502::A", FALSE) );          R->A = SvIV( get_sv("M6502::A", FALSE) );
         printf("--%d", get_sv("M6502::A", FALSE) );  
26          R->P = SvIV( get_sv("M6502::P", FALSE) );          R->P = SvIV( get_sv("M6502::P", FALSE) );
27          R->X = atoi( SvPV_nolen( get_sv("M6502::X", FALSE) ) );          R->X = SvIV( get_sv("M6502::X", FALSE) );
28          R->Y = atoi( SvPV_nolen( get_sv("M6502::Y", FALSE) ) );          R->Y = SvIV( get_sv("M6502::Y", FALSE) );
29          R->S = atoi( SvPV_nolen( get_sv("M6502::S", FALSE) ) );          R->S = SvIV( get_sv("M6502::S", FALSE) );
30          R->PC.W = atoi( SvPV_nolen( get_sv("M6502::PC", FALSE) ) );          R->PC.W = SvIV( get_sv("M6502::PC", FALSE) );
31          R->IPeriod = atoi( SvPV_nolen( get_sv("M6502::IPeriod", FALSE) ) );          R->IPeriod = SvIV( get_sv("M6502::IPeriod", FALSE) );
32          // ICount IRequest IAutoReset TrapBadOps Trap Trace          // ICount IRequest IAutoReset TrapBadOps Trap Trace
33          printf("update_r finished\n");          printf("pull_R finished\n");
34          dump_R;          dump_R;
35  }  }
36    
37    void push_R(M6502 *R) {
38            dSP;
39            ENTER;
40            SAVETMPS;
41            PUSHMARK(SP);
42            XPUSHs( sv_2mortal( newSViv( R->A ) ) );
43            XPUSHs( sv_2mortal( newSViv( R->P ) ) );
44            XPUSHs( sv_2mortal( newSViv( R->X ) ) );
45            XPUSHs( sv_2mortal( newSViv( R->Y ) ) );
46            XPUSHs( sv_2mortal( newSViv( R->S ) ) );
47            XPUSHs( sv_2mortal( newSViv( R->PC.W ) ) );
48            PUTBACK;
49            call_pv("M6502::_push_R", G_DISCARD );
50            printf("push_R called\n");
51            dump_R;
52            FREETMPS;
53            LEAVE;
54    }
55    
56  /** Rd6502()/Wr6502/Op6502() *********************************/  /** Rd6502()/Wr6502/Op6502() *********************************/
57  /** These functions are called when access to RAM occurs.   **/  /** These functions are called when access to RAM occurs.   **/
58  /** They allow to control memory access. Op6502 is the same **/  /** They allow to control memory access. Op6502 is the same **/
# Line 153  int main(int argc, char **argv) { Line 171  int main(int argc, char **argv) {
171                  PUSHMARK(SP);                  PUSHMARK(SP);
172                  call_pv("Arch::init", G_DISCARD | G_NOARGS );                  call_pv("Arch::init", G_DISCARD | G_NOARGS );
173    
174                  update_R(R);                  pull_R(R);
175                  printf("run CPU\n");                  printf("run CPU\n");
176                  Run6502(R);                  dump_R;
177                    //Run6502(R);
178                    Exec6502(R, 10);
179                    dump_R;
180                    push_R(R);
181                  printf("end of CPU run\n");                  printf("end of CPU run\n");
182          }          }
183          free(R);          free(R);

Legend:
Removed from v.37  
changed lines
  Added in v.38

  ViewVC Help
Powered by ViewVC 1.1.26