66 |
byte mem(word Addr) { |
byte mem(word Addr) { |
67 |
byte byte; |
byte byte; |
68 |
int count; |
int count; |
69 |
debugf(("mem(%04x)\n", Addr)); |
debugf(("mem(%04x)", Addr)); |
70 |
dSP; |
dSP; |
71 |
ENTER; |
ENTER; |
72 |
SAVETMPS; |
SAVETMPS; |
74 |
XPUSHs( sv_2mortal( newSViv( Addr ) ) ); |
XPUSHs( sv_2mortal( newSViv( Addr ) ) ); |
75 |
PUTBACK; |
PUTBACK; |
76 |
count = call_pv("M6502::read", G_ARRAY | G_EVAL ); |
count = call_pv("M6502::read", G_ARRAY | G_EVAL ); |
77 |
debugf(("got %d values\n", count)); |
debugf(("got %d values", count)); |
78 |
SPAGAIN; |
SPAGAIN; |
79 |
if (SvTrue(ERRSV)) { |
if (SvTrue(ERRSV)) { |
80 |
display_message("ERROR: %s", SvPV_nolen( ERRSV ) ); |
display_message("ERROR: %s", SvPV_nolen( ERRSV ) ); |
89 |
byte = SvIV(sv); |
byte = SvIV(sv); |
90 |
FREETMPS; |
FREETMPS; |
91 |
LEAVE; |
LEAVE; |
92 |
debugf(("mem(%04x) = %02x\n", Addr, byte)); |
debugf(("mem(%04x) = %02x", Addr, byte)); |
93 |
return byte; |
return byte; |
94 |
} |
} |
95 |
|
|
97 |
byte Value; |
byte Value; |
98 |
// Value = mem(Addr); |
// Value = mem(Addr); |
99 |
Value = 0x42; |
Value = 0x42; |
100 |
debugf(("Rd6502(%04x) = %02x\n", Addr, Value)); |
debugf(("Rd6502(%04x) = %02x", Addr, Value)); |
101 |
return Value; |
return Value; |
102 |
} |
} |
103 |
|
|
104 |
void Wr6502(register word Addr,register byte Value) { |
void Wr6502(register word Addr,register byte Value) { |
105 |
debugf(("Wr6502(%04x,%02x)\n", Addr, Value)); |
debugf(("Wr6502(%04x,%02x)", Addr, Value)); |
106 |
dSP; |
dSP; |
107 |
ENTER; |
ENTER; |
108 |
SAVETMPS; |
SAVETMPS; |
118 |
byte Op6502(register word Addr) { |
byte Op6502(register word Addr) { |
119 |
byte Op; |
byte Op; |
120 |
Op = mem(Addr); |
Op = mem(Addr); |
121 |
debugf(("Op6502(%04x,%02x) PC:%04x\n", Addr, Op, R->PC.W)); |
debugf(("Op6502(%04x,%02x) PC:%04x", Addr, Op, R->PC.W)); |
122 |
return Op; |
return Op; |
123 |
} |
} |
124 |
|
|
133 |
int hw_int = INT_NONE; |
int hw_int = INT_NONE; |
134 |
|
|
135 |
byte Loop6502(register M6502 *R) { |
byte Loop6502(register M6502 *R) { |
136 |
debugf(("Loop6502\n")); |
debugf(("Loop6502")); |
137 |
dump_R; |
dump_R; |
138 |
return hw_int; |
return hw_int; |
139 |
} |
} |
146 |
/** or 0 if the opcode was truly illegal. **/ |
/** or 0 if the opcode was truly illegal. **/ |
147 |
/************************************ TO BE WRITTEN BY USER **/ |
/************************************ TO BE WRITTEN BY USER **/ |
148 |
byte Patch6502(register byte Op,register M6502 *R) { |
byte Patch6502(register byte Op,register M6502 *R) { |
149 |
debugf(("Patch6502(%02x)\n", Op)); |
debugf(("Patch6502(%02x)", Op)); |
150 |
dump_R; |
dump_R; |
151 |
hw_int = INT_QUIT; |
hw_int = INT_QUIT; |
152 |
return 0; |
return 0; |